drm/nouveau/gsp: switch to instanced constructor
authorBen Skeggs <bskeggs@redhat.com>
Fri, 4 Dec 2020 01:23:38 +0000 (11:23 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 11 Feb 2021 01:49:53 +0000 (11:49 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
drivers/gpu/drm/nouveau/include/nvkm/core/layout.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/priv.h

index 42ce75d..4b7f75a 100644 (file)
@@ -60,7 +60,6 @@ struct nvkm_device {
                struct notifier_block nb;
        } acpi;
 
-       struct nvkm_gsp *gsp;
        struct nvkm_i2c *i2c;
        struct nvkm_subdev *ibus;
        struct nvkm_iccsense *iccsense;
@@ -138,7 +137,6 @@ struct nvkm_device_chip {
 #include <core/layout.h>
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
-       int (*gsp     )(struct nvkm_device *, int idx, struct nvkm_gsp **);
        int (*i2c     )(struct nvkm_device *, int idx, struct nvkm_i2c **);
        int (*ibus    )(struct nvkm_device *, int idx, struct nvkm_subdev **);
        int (*iccsense)(struct nvkm_device *, int idx, struct nvkm_iccsense **);
index 13c8d37..a307c98 100644 (file)
@@ -9,3 +9,4 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR     , struct nvkm_bar     ,      bar)
 NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FAULT   , struct nvkm_fault   ,    fault)
 NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ACR     , struct nvkm_acr     ,      acr)
 NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK     , struct nvkm_clk     ,      clk)
+NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP     , struct nvkm_gsp     ,      gsp)
index 06db676..cf42a59 100644 (file)
@@ -9,5 +9,5 @@ struct nvkm_gsp {
        struct nvkm_falcon falcon;
 };
 
-int gv100_gsp_new(struct nvkm_device *, int, struct nvkm_gsp **);
+int gv100_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
 #endif
index b83dd00..17156b1 100644 (file)
@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
 #include <core/layout.h>
 #undef NVKM_LAYOUT_ONCE
 #undef NVKM_LAYOUT_INST
-       [NVKM_SUBDEV_GSP     ] = "gsp",
        [NVKM_SUBDEV_I2C     ] = "i2c",
        [NVKM_SUBDEV_IBUS    ] = "priv",
        [NVKM_SUBDEV_ICCSENSE] = "iccsense",
index 86dd135..8f043d7 100644 (file)
@@ -2427,7 +2427,7 @@ nv140_chipset = {
        .fb       = { 0x00000001, gv100_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
-       .gsp = gv100_gsp_new,
+       .gsp      = { 0x00000001, gv100_gsp_new },
        .i2c = gm200_i2c_new,
        .ibus = gm200_ibus_new,
        .imem = nv50_instmem_new,
@@ -2471,7 +2471,7 @@ nv162_chipset = {
        .fb       = { 0x00000001, gv100_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
-       .gsp = gv100_gsp_new,
+       .gsp      = { 0x00000001, gv100_gsp_new },
        .i2c = gm200_i2c_new,
        .ibus = gm200_ibus_new,
        .imem = nv50_instmem_new,
@@ -2509,7 +2509,7 @@ nv164_chipset = {
        .fb       = { 0x00000001, gv100_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
-       .gsp = gv100_gsp_new,
+       .gsp      = { 0x00000001, gv100_gsp_new },
        .i2c = gm200_i2c_new,
        .ibus = gm200_ibus_new,
        .imem = nv50_instmem_new,
@@ -2548,7 +2548,7 @@ nv166_chipset = {
        .fb       = { 0x00000001, gv100_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
-       .gsp = gv100_gsp_new,
+       .gsp      = { 0x00000001, gv100_gsp_new },
        .i2c = gm200_i2c_new,
        .ibus = gm200_ibus_new,
        .imem = nv50_instmem_new,
@@ -2588,7 +2588,7 @@ nv167_chipset = {
        .fb       = { 0x00000001, gv100_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
-       .gsp = gv100_gsp_new,
+       .gsp      = { 0x00000001, gv100_gsp_new },
        .i2c = gm200_i2c_new,
        .ibus = gm200_ibus_new,
        .imem = nv50_instmem_new,
@@ -2626,7 +2626,7 @@ nv168_chipset = {
        .fb       = { 0x00000001, gv100_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
-       .gsp = gv100_gsp_new,
+       .gsp      = { 0x00000001, gv100_gsp_new },
        .i2c = gm200_i2c_new,
        .ibus = gm200_ibus_new,
        .imem = nv50_instmem_new,
@@ -3248,7 +3248,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 #include <core/layout.h>
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
-               _(NVKM_SUBDEV_GSP     ,      gsp);
                _(NVKM_SUBDEV_I2C     ,      i2c);
                _(NVKM_SUBDEV_IBUS    ,     ibus);
                _(NVKM_SUBDEV_ICCSENSE, iccsense);
index 7bfcca9..2257488 100644 (file)
@@ -40,14 +40,14 @@ nvkm_gsp = {
 
 int
 nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
-             int index, struct nvkm_gsp **pgsp)
+             enum nvkm_subdev_type type, int inst, struct nvkm_gsp **pgsp)
 {
        struct nvkm_gsp *gsp;
 
        if (!(gsp = *pgsp = kzalloc(sizeof(*gsp), GFP_KERNEL)))
                return -ENOMEM;
 
-       nvkm_subdev_ctor(&nvkm_gsp, device, index, &gsp->subdev);
+       nvkm_subdev_ctor(&nvkm_gsp, device, type, inst, &gsp->subdev);
 
        fwif = nvkm_firmware_load(&gsp->subdev, fwif, "Gsp", gsp);
        if (IS_ERR(fwif))
index 2114f9b..2ac7fc9 100644 (file)
@@ -49,7 +49,8 @@ gv100_gsp[] = {
 };
 
 int
-gv100_gsp_new(struct nvkm_device *device, int index, struct nvkm_gsp **pgsp)
+gv100_gsp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+             struct nvkm_gsp **pgsp)
 {
-       return nvkm_gsp_new_(gv100_gsp, device, index, pgsp);
+       return nvkm_gsp_new_(gv100_gsp, device, type, inst, pgsp);
 }
index 92820fb..19381dd 100644 (file)
@@ -10,6 +10,6 @@ struct nvkm_gsp_fwif {
        const struct nvkm_falcon_func *flcn;
 };
 
-int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, int,
+int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
                  struct nvkm_gsp **);
 #endif