Commit 015ef618 authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie

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: default avatarBen Skeggs <bskeggs@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230918202149.4343-5-skeggsb@gmail.com
parent e8669270
/* SPDX-License-Identifier: MIT */ /* 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_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_VFN , struct nvkm_vfn , vfn)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PCI , struct nvkm_pci , pci) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PCI , struct nvkm_pci , pci)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios)
......
...@@ -11,6 +11,15 @@ struct nvkm_gsp { ...@@ -11,6 +11,15 @@ struct nvkm_gsp {
struct nvkm_falcon falcon; 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 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 **); int ga102_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
#endif #endif
...@@ -2408,7 +2408,7 @@ nv162_chipset = { ...@@ -2408,7 +2408,7 @@ nv162_chipset = {
.fb = { 0x00000001, tu102_fb_new }, .fb = { 0x00000001, tu102_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = { 0x00000001, gv100_gsp_new }, .gsp = { 0x00000001, tu102_gsp_new },
.i2c = { 0x00000001, gm200_i2c_new }, .i2c = { 0x00000001, gm200_i2c_new },
.imem = { 0x00000001, nv50_instmem_new }, .imem = { 0x00000001, nv50_instmem_new },
.ltc = { 0x00000001, gp102_ltc_new }, .ltc = { 0x00000001, gp102_ltc_new },
...@@ -2443,7 +2443,7 @@ nv164_chipset = { ...@@ -2443,7 +2443,7 @@ nv164_chipset = {
.fb = { 0x00000001, tu102_fb_new }, .fb = { 0x00000001, tu102_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = { 0x00000001, gv100_gsp_new }, .gsp = { 0x00000001, tu102_gsp_new },
.i2c = { 0x00000001, gm200_i2c_new }, .i2c = { 0x00000001, gm200_i2c_new },
.imem = { 0x00000001, nv50_instmem_new }, .imem = { 0x00000001, nv50_instmem_new },
.ltc = { 0x00000001, gp102_ltc_new }, .ltc = { 0x00000001, gp102_ltc_new },
...@@ -2478,7 +2478,7 @@ nv166_chipset = { ...@@ -2478,7 +2478,7 @@ nv166_chipset = {
.fb = { 0x00000001, tu102_fb_new }, .fb = { 0x00000001, tu102_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = { 0x00000001, gv100_gsp_new }, .gsp = { 0x00000001, tu102_gsp_new },
.i2c = { 0x00000001, gm200_i2c_new }, .i2c = { 0x00000001, gm200_i2c_new },
.imem = { 0x00000001, nv50_instmem_new }, .imem = { 0x00000001, nv50_instmem_new },
.ltc = { 0x00000001, gp102_ltc_new }, .ltc = { 0x00000001, gp102_ltc_new },
...@@ -2513,7 +2513,7 @@ nv167_chipset = { ...@@ -2513,7 +2513,7 @@ nv167_chipset = {
.fb = { 0x00000001, tu102_fb_new }, .fb = { 0x00000001, tu102_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = { 0x00000001, gv100_gsp_new }, .gsp = { 0x00000001, tu116_gsp_new },
.i2c = { 0x00000001, gm200_i2c_new }, .i2c = { 0x00000001, gm200_i2c_new },
.imem = { 0x00000001, nv50_instmem_new }, .imem = { 0x00000001, nv50_instmem_new },
.ltc = { 0x00000001, gp102_ltc_new }, .ltc = { 0x00000001, gp102_ltc_new },
...@@ -2548,7 +2548,7 @@ nv168_chipset = { ...@@ -2548,7 +2548,7 @@ nv168_chipset = {
.fb = { 0x00000001, tu102_fb_new }, .fb = { 0x00000001, tu102_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = { 0x00000001, gv100_gsp_new }, .gsp = { 0x00000001, tu116_gsp_new },
.i2c = { 0x00000001, gm200_i2c_new }, .i2c = { 0x00000001, gm200_i2c_new },
.imem = { 0x00000001, nv50_instmem_new }, .imem = { 0x00000001, nv50_instmem_new },
.ltc = { 0x00000001, gp102_ltc_new }, .ltc = { 0x00000001, gp102_ltc_new },
...@@ -2580,6 +2580,7 @@ nv170_chipset = { ...@@ -2580,6 +2580,7 @@ nv170_chipset = {
.fault = { 0x00000001, tu102_fault_new }, .fault = { 0x00000001, tu102_fault_new },
.fb = { 0x00000001, ga100_fb_new }, .fb = { 0x00000001, ga100_fb_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = { 0x00000001, ga100_gsp_new },
.i2c = { 0x00000001, gm200_i2c_new }, .i2c = { 0x00000001, gm200_i2c_new },
.imem = { 0x00000001, nv50_instmem_new }, .imem = { 0x00000001, nv50_instmem_new },
.mc = { 0x00000001, ga100_mc_new }, .mc = { 0x00000001, ga100_mc_new },
......
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
nvkm-y += nvkm/subdev/gsp/base.o nvkm-y += nvkm/subdev/gsp/base.o
nvkm-y += nvkm/subdev/gsp/gv100.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 nvkm-y += nvkm/subdev/gsp/ga102.o
...@@ -20,15 +20,48 @@ ...@@ -20,15 +20,48 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "priv.h" #include "priv.h"
#include <core/falcon.h>
#include <core/firmware.h> static int
#include <subdev/acr.h> nvkm_gsp_fini(struct nvkm_subdev *subdev, bool suspend)
#include <subdev/top.h> {
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 * static void *
nvkm_gsp_dtor(struct nvkm_subdev *subdev) nvkm_gsp_dtor(struct nvkm_subdev *subdev)
{ {
struct nvkm_gsp *gsp = nvkm_gsp(subdev); struct nvkm_gsp *gsp = nvkm_gsp(subdev);
if (gsp->func && gsp->func->dtor)
gsp->func->dtor(gsp);
nvkm_falcon_dtor(&gsp->falcon); nvkm_falcon_dtor(&gsp->falcon);
return gsp; return gsp;
} }
...@@ -36,6 +69,9 @@ nvkm_gsp_dtor(struct nvkm_subdev *subdev) ...@@ -36,6 +69,9 @@ nvkm_gsp_dtor(struct nvkm_subdev *subdev)
static const struct nvkm_subdev_func static const struct nvkm_subdev_func
nvkm_gsp = { nvkm_gsp = {
.dtor = nvkm_gsp_dtor, .dtor = nvkm_gsp_dtor,
.oneinit = nvkm_gsp_oneinit,
.init = nvkm_gsp_init,
.fini = nvkm_gsp_fini,
}; };
int int
...@@ -55,5 +91,6 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device, ...@@ -55,5 +91,6 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
gsp->func = fwif->func; 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);
} }
/*
* 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 = { ...@@ -39,15 +39,9 @@ ga102_gsp = {
.flcn = &ga102_gsp_flcn, .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 static struct nvkm_gsp_fwif
ga102_gsps[] = { ga102_gsps[] = {
{ -1, ga102_gsp_nofw, &ga102_gsp }, { -1, gv100_gsp_nofw, &ga102_gsp },
{} {}
}; };
......
...@@ -34,12 +34,12 @@ gv100_gsp_flcn = { ...@@ -34,12 +34,12 @@ gv100_gsp_flcn = {
.dmem_pio = &gm200_flcn_dmem_pio, .dmem_pio = &gm200_flcn_dmem_pio,
}; };
static const struct nvkm_gsp_func const struct nvkm_gsp_func
gv100_gsp = { gv100_gsp = {
.flcn = &gv100_gsp_flcn, .flcn = &gv100_gsp_flcn,
}; };
static int int
gv100_gsp_nofw(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif) gv100_gsp_nofw(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif)
{ {
return 0; return 0;
......
...@@ -4,16 +4,25 @@ ...@@ -4,16 +4,25 @@
#include <subdev/gsp.h> #include <subdev/gsp.h>
enum nvkm_acr_lsf_id; enum nvkm_acr_lsf_id;
struct nvkm_gsp_func {
const struct nvkm_falcon_func *flcn;
};
struct nvkm_gsp_fwif { struct nvkm_gsp_fwif {
int version; int version;
int (*load)(struct nvkm_gsp *, int ver, const struct nvkm_gsp_fwif *); int (*load)(struct nvkm_gsp *, int ver, const struct nvkm_gsp_fwif *);
const struct nvkm_gsp_func *func; 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, int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_gsp **); struct nvkm_gsp **);
extern const struct nvkm_gsp_func gv100_gsp;
#endif #endif
/*
* 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);
}
/*
* 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);
}
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