Commit f4032134 authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie

drm/nouveau/sec2/tu102-: prepare for GSP-RM

- add (initial) R535 implementation of SEC2, needed for boot
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230918202149.4343-30-skeggsb@gmail.com
parent 47c9136b
...@@ -4,3 +4,5 @@ nvkm-y += nvkm/engine/sec2/gp102.o ...@@ -4,3 +4,5 @@ nvkm-y += nvkm/engine/sec2/gp102.o
nvkm-y += nvkm/engine/sec2/gp108.o nvkm-y += nvkm/engine/sec2/gp108.o
nvkm-y += nvkm/engine/sec2/tu102.o nvkm-y += nvkm/engine/sec2/tu102.o
nvkm-y += nvkm/engine/sec2/ga102.o nvkm-y += nvkm/engine/sec2/ga102.o
nvkm-y += nvkm/engine/sec2/r535.o
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include "priv.h" #include "priv.h"
#include <subdev/acr.h> #include <subdev/acr.h>
#include <subdev/gsp.h>
#include <subdev/vfn.h> #include <subdev/vfn.h>
#include <nvfw/flcn.h> #include <nvfw/flcn.h>
...@@ -193,5 +194,10 @@ ga102_sec2_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, ...@@ -193,5 +194,10 @@ ga102_sec2_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
/* TOP info wasn't updated on Turing to reflect the PRI /* TOP info wasn't updated on Turing to reflect the PRI
* address change for some reason. We override it here. * address change for some reason. We override it here.
*/ */
return nvkm_sec2_new_(ga102_sec2_fwif, device, type, inst, 0x840000, psec2); const u32 addr = 0x840000;
if (nvkm_gsp_rm(device->gsp))
return r535_sec2_new(&ga102_sec2, device, type, inst, addr, psec2);
return nvkm_sec2_new_(ga102_sec2_fwif, device, type, inst, addr, psec2);
} }
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include <engine/sec2.h> #include <engine/sec2.h>
struct nvkm_acr_lsfw; struct nvkm_acr_lsfw;
int r535_sec2_new(const struct nvkm_sec2_func *,
struct nvkm_device *, enum nvkm_subdev_type, int, u32 addr, struct nvkm_sec2 **);
struct nvkm_sec2_func { struct nvkm_sec2_func {
const struct nvkm_falcon_func *flcn; const struct nvkm_falcon_func *flcn;
u8 unit_unload; u8 unit_unload;
......
/*
* Copyright 2023 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "priv.h"
static void *
r535_sec2_dtor(struct nvkm_engine *engine)
{
struct nvkm_sec2 *sec2 = nvkm_sec2(engine);
nvkm_falcon_dtor(&sec2->falcon);
return sec2;
}
static const struct nvkm_engine_func
r535_sec2 = {
.dtor = r535_sec2_dtor,
};
int
r535_sec2_new(const struct nvkm_sec2_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, u32 addr, struct nvkm_sec2 **psec2)
{
struct nvkm_sec2 *sec2;
int ret;
if (!(sec2 = *psec2 = kzalloc(sizeof(*sec2), GFP_KERNEL)))
return -ENOMEM;
ret = nvkm_engine_ctor(&r535_sec2, device, type, inst, true, &sec2->engine);
if (ret)
return ret;
return nvkm_falcon_ctor(func->flcn, &sec2->engine.subdev, sec2->engine.subdev.name,
addr, &sec2->falcon);
}
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include "priv.h" #include "priv.h"
#include <subdev/acr.h> #include <subdev/acr.h>
#include <subdev/gsp.h>
#include <nvfw/sec2.h> #include <nvfw/sec2.h>
...@@ -82,5 +83,10 @@ tu102_sec2_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, ...@@ -82,5 +83,10 @@ tu102_sec2_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
/* TOP info wasn't updated on Turing to reflect the PRI /* TOP info wasn't updated on Turing to reflect the PRI
* address change for some reason. We override it here. * address change for some reason. We override it here.
*/ */
return nvkm_sec2_new_(tu102_sec2_fwif, device, type, inst, 0x840000, psec2); const u32 addr = 0x840000;
if (nvkm_gsp_rm(device->gsp))
return r535_sec2_new(&tu102_sec2, device, type, inst, addr, psec2);
return nvkm_sec2_new_(tu102_sec2_fwif, device, type, inst, addr, psec2);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment