drm/nouveau/gsp: prepare for GSP-RM
- move TOP after GSP, so we can disable TOP if GSP is in use - provide plumbing to support falcon-only and GSP-RM paths - provide a method for subdevs to detect GSP-RM paths - split tu102/tu116/ga100 paths from gv100, which can't support GSP-RM Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230918202149.4343-5-skeggsb@gmail.com
This commit is contained in:
parent
e866927013
commit
015ef6187f
@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TOP , struct nvkm_top , top)
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp)
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TOP , struct nvkm_top , top)
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VFN , struct nvkm_vfn , vfn)
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PCI , struct nvkm_pci , pci)
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios)
|
||||
|
@ -11,6 +11,15 @@ struct nvkm_gsp {
|
||||
struct nvkm_falcon falcon;
|
||||
};
|
||||
|
||||
static inline bool
|
||||
nvkm_gsp_rm(struct nvkm_gsp *gsp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int gv100_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
|
||||
int tu102_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
|
||||
int tu116_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
|
||||
int ga100_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
|
||||
int ga102_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
|
||||
#endif
|
||||
|
@ -2408,7 +2408,7 @@ nv162_chipset = {
|
||||
.fb = { 0x00000001, tu102_fb_new },
|
||||
.fuse = { 0x00000001, gm107_fuse_new },
|
||||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.gsp = { 0x00000001, gv100_gsp_new },
|
||||
.gsp = { 0x00000001, tu102_gsp_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.imem = { 0x00000001, nv50_instmem_new },
|
||||
.ltc = { 0x00000001, gp102_ltc_new },
|
||||
@ -2443,7 +2443,7 @@ nv164_chipset = {
|
||||
.fb = { 0x00000001, tu102_fb_new },
|
||||
.fuse = { 0x00000001, gm107_fuse_new },
|
||||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.gsp = { 0x00000001, gv100_gsp_new },
|
||||
.gsp = { 0x00000001, tu102_gsp_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.imem = { 0x00000001, nv50_instmem_new },
|
||||
.ltc = { 0x00000001, gp102_ltc_new },
|
||||
@ -2478,7 +2478,7 @@ nv166_chipset = {
|
||||
.fb = { 0x00000001, tu102_fb_new },
|
||||
.fuse = { 0x00000001, gm107_fuse_new },
|
||||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.gsp = { 0x00000001, gv100_gsp_new },
|
||||
.gsp = { 0x00000001, tu102_gsp_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.imem = { 0x00000001, nv50_instmem_new },
|
||||
.ltc = { 0x00000001, gp102_ltc_new },
|
||||
@ -2513,7 +2513,7 @@ nv167_chipset = {
|
||||
.fb = { 0x00000001, tu102_fb_new },
|
||||
.fuse = { 0x00000001, gm107_fuse_new },
|
||||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.gsp = { 0x00000001, gv100_gsp_new },
|
||||
.gsp = { 0x00000001, tu116_gsp_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.imem = { 0x00000001, nv50_instmem_new },
|
||||
.ltc = { 0x00000001, gp102_ltc_new },
|
||||
@ -2548,7 +2548,7 @@ nv168_chipset = {
|
||||
.fb = { 0x00000001, tu102_fb_new },
|
||||
.fuse = { 0x00000001, gm107_fuse_new },
|
||||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.gsp = { 0x00000001, gv100_gsp_new },
|
||||
.gsp = { 0x00000001, tu116_gsp_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.imem = { 0x00000001, nv50_instmem_new },
|
||||
.ltc = { 0x00000001, gp102_ltc_new },
|
||||
@ -2580,6 +2580,7 @@ nv170_chipset = {
|
||||
.fault = { 0x00000001, tu102_fault_new },
|
||||
.fb = { 0x00000001, ga100_fb_new },
|
||||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.gsp = { 0x00000001, ga100_gsp_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.imem = { 0x00000001, nv50_instmem_new },
|
||||
.mc = { 0x00000001, ga100_mc_new },
|
||||
|
@ -1,4 +1,7 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
nvkm-y += nvkm/subdev/gsp/base.o
|
||||
nvkm-y += nvkm/subdev/gsp/gv100.o
|
||||
nvkm-y += nvkm/subdev/gsp/tu102.o
|
||||
nvkm-y += nvkm/subdev/gsp/tu116.o
|
||||
nvkm-y += nvkm/subdev/gsp/ga100.o
|
||||
nvkm-y += nvkm/subdev/gsp/ga102.o
|
||||
|
@ -20,15 +20,48 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "priv.h"
|
||||
#include <core/falcon.h>
|
||||
#include <core/firmware.h>
|
||||
#include <subdev/acr.h>
|
||||
#include <subdev/top.h>
|
||||
|
||||
static int
|
||||
nvkm_gsp_fini(struct nvkm_subdev *subdev, bool suspend)
|
||||
{
|
||||
struct nvkm_gsp *gsp = nvkm_gsp(subdev);
|
||||
|
||||
if (!gsp->func->fini)
|
||||
return 0;
|
||||
|
||||
return gsp->func->fini(gsp, suspend);
|
||||
}
|
||||
|
||||
static int
|
||||
nvkm_gsp_init(struct nvkm_subdev *subdev)
|
||||
{
|
||||
struct nvkm_gsp *gsp = nvkm_gsp(subdev);
|
||||
|
||||
if (!gsp->func->init)
|
||||
return 0;
|
||||
|
||||
return gsp->func->init(gsp);
|
||||
}
|
||||
|
||||
static int
|
||||
nvkm_gsp_oneinit(struct nvkm_subdev *subdev)
|
||||
{
|
||||
struct nvkm_gsp *gsp = nvkm_gsp(subdev);
|
||||
|
||||
if (!gsp->func->oneinit)
|
||||
return 0;
|
||||
|
||||
return gsp->func->oneinit(gsp);
|
||||
}
|
||||
|
||||
static void *
|
||||
nvkm_gsp_dtor(struct nvkm_subdev *subdev)
|
||||
{
|
||||
struct nvkm_gsp *gsp = nvkm_gsp(subdev);
|
||||
|
||||
if (gsp->func && gsp->func->dtor)
|
||||
gsp->func->dtor(gsp);
|
||||
|
||||
nvkm_falcon_dtor(&gsp->falcon);
|
||||
return gsp;
|
||||
}
|
||||
@ -36,6 +69,9 @@ nvkm_gsp_dtor(struct nvkm_subdev *subdev)
|
||||
static const struct nvkm_subdev_func
|
||||
nvkm_gsp = {
|
||||
.dtor = nvkm_gsp_dtor,
|
||||
.oneinit = nvkm_gsp_oneinit,
|
||||
.init = nvkm_gsp_init,
|
||||
.fini = nvkm_gsp_fini,
|
||||
};
|
||||
|
||||
int
|
||||
@ -55,5 +91,6 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
|
||||
|
||||
gsp->func = fwif->func;
|
||||
|
||||
return nvkm_falcon_ctor(gsp->func->flcn, &gsp->subdev, gsp->subdev.name, 0, &gsp->falcon);
|
||||
return nvkm_falcon_ctor(gsp->func->flcn, &gsp->subdev, gsp->subdev.name, 0x110000,
|
||||
&gsp->falcon);
|
||||
}
|
||||
|
35
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c
Normal file
35
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2022 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 struct nvkm_gsp_fwif
|
||||
ga100_gsps[] = {
|
||||
{ -1, gv100_gsp_nofw, &gv100_gsp },
|
||||
{}
|
||||
};
|
||||
|
||||
int
|
||||
ga100_gsp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
|
||||
struct nvkm_gsp **pgsp)
|
||||
{
|
||||
return nvkm_gsp_new_(ga100_gsps, device, type, inst, pgsp);
|
||||
}
|
@ -39,15 +39,9 @@ ga102_gsp = {
|
||||
.flcn = &ga102_gsp_flcn,
|
||||
};
|
||||
|
||||
static int
|
||||
ga102_gsp_nofw(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct nvkm_gsp_fwif
|
||||
ga102_gsps[] = {
|
||||
{ -1, ga102_gsp_nofw, &ga102_gsp },
|
||||
{ -1, gv100_gsp_nofw, &ga102_gsp },
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -34,12 +34,12 @@ gv100_gsp_flcn = {
|
||||
.dmem_pio = &gm200_flcn_dmem_pio,
|
||||
};
|
||||
|
||||
static const struct nvkm_gsp_func
|
||||
const struct nvkm_gsp_func
|
||||
gv100_gsp = {
|
||||
.flcn = &gv100_gsp_flcn,
|
||||
};
|
||||
|
||||
static int
|
||||
int
|
||||
gv100_gsp_nofw(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif)
|
||||
{
|
||||
return 0;
|
||||
|
@ -4,16 +4,25 @@
|
||||
#include <subdev/gsp.h>
|
||||
enum nvkm_acr_lsf_id;
|
||||
|
||||
struct nvkm_gsp_func {
|
||||
const struct nvkm_falcon_func *flcn;
|
||||
};
|
||||
|
||||
struct nvkm_gsp_fwif {
|
||||
int version;
|
||||
int (*load)(struct nvkm_gsp *, int ver, const struct nvkm_gsp_fwif *);
|
||||
const struct nvkm_gsp_func *func;
|
||||
};
|
||||
|
||||
int gv100_gsp_nofw(struct nvkm_gsp *, int, const struct nvkm_gsp_fwif *);
|
||||
|
||||
struct nvkm_gsp_func {
|
||||
const struct nvkm_falcon_func *flcn;
|
||||
|
||||
void (*dtor)(struct nvkm_gsp *);
|
||||
int (*oneinit)(struct nvkm_gsp *);
|
||||
int (*init)(struct nvkm_gsp *);
|
||||
int (*fini)(struct nvkm_gsp *, bool suspend);
|
||||
};
|
||||
|
||||
int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
|
||||
struct nvkm_gsp **);
|
||||
|
||||
extern const struct nvkm_gsp_func gv100_gsp;
|
||||
#endif
|
||||
|
35
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c
Normal file
35
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2022 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 struct nvkm_gsp_fwif
|
||||
tu102_gsps[] = {
|
||||
{ -1, gv100_gsp_nofw, &gv100_gsp },
|
||||
{}
|
||||
};
|
||||
|
||||
int
|
||||
tu102_gsp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
|
||||
struct nvkm_gsp **pgsp)
|
||||
{
|
||||
return nvkm_gsp_new_(tu102_gsps, device, type, inst, pgsp);
|
||||
}
|
35
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c
Normal file
35
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2022 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 struct nvkm_gsp_fwif
|
||||
tu116_gsps[] = {
|
||||
{ -1, gv100_gsp_nofw, &gv100_gsp },
|
||||
{}
|
||||
};
|
||||
|
||||
int
|
||||
tu116_gsp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
|
||||
struct nvkm_gsp **pgsp)
|
||||
{
|
||||
return nvkm_gsp_new_(tu116_gsps, device, type, inst, pgsp);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user