drm/nouveau/acr: switch to instanced constructor
authorBen Skeggs <bskeggs@redhat.com>
Tue, 1 Dec 2020 22:35:30 +0000 (08:35 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 11 Feb 2021 01:49:52 +0000 (11:49 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
13 files changed:
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/acr.h
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/acr/gm200.c
drivers/gpu/drm/nouveau/nvkm/subdev/acr/gm20b.c
drivers/gpu/drm/nouveau/nvkm/subdev/acr/gp102.c
drivers/gpu/drm/nouveau/nvkm/subdev/acr/gp108.c
drivers/gpu/drm/nouveau/nvkm/subdev/acr/gp10b.c
drivers/gpu/drm/nouveau/nvkm/subdev/acr/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/acr/tu102.c

index 66743f2e329ccdc97da5e293d390cde29d30281c..862cbde2054be9cd101fe99dc273d090d147df21 100644 (file)
@@ -60,7 +60,6 @@ struct nvkm_device {
                struct notifier_block nb;
        } acpi;
 
-       struct nvkm_acr *acr;
        struct nvkm_bar *bar;
        struct nvkm_bios *bios;
        struct nvkm_bus *bus;
@@ -148,7 +147,6 @@ struct nvkm_device_chip {
 #include <core/layout.h>
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
-       int (*acr     )(struct nvkm_device *, int idx, struct nvkm_acr **);
        int (*bar     )(struct nvkm_device *, int idx, struct nvkm_bar **);
        int (*bios    )(struct nvkm_device *, int idx, struct nvkm_bios **);
        int (*bus     )(struct nvkm_device *, int idx, struct nvkm_bus **);
index 7812f35680597a62352fbdebd34e76d5c28ea6bb..9afc17d760a22f251d7a893b27e228b164c58b0f 100644 (file)
@@ -1 +1,2 @@
 /* SPDX-License-Identifier: MIT */
+NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ACR     , struct nvkm_acr     ,      acr)
index 836d8b93282296718f120df97ef2a60070db1d5e..c0b254f7f0b5b4b828cc23340f00da465c7f46b3 100644 (file)
@@ -59,12 +59,12 @@ struct nvkm_acr {
 bool nvkm_acr_managed_falcon(struct nvkm_device *, enum nvkm_acr_lsf_id);
 int nvkm_acr_bootstrap_falcons(struct nvkm_device *, unsigned long mask);
 
-int gm200_acr_new(struct nvkm_device *, int, struct nvkm_acr **);
-int gm20b_acr_new(struct nvkm_device *, int, struct nvkm_acr **);
-int gp102_acr_new(struct nvkm_device *, int, struct nvkm_acr **);
-int gp108_acr_new(struct nvkm_device *, int, struct nvkm_acr **);
-int gp10b_acr_new(struct nvkm_device *, int, struct nvkm_acr **);
-int tu102_acr_new(struct nvkm_device *, int, struct nvkm_acr **);
+int gm200_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **);
+int gm20b_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **);
+int gp102_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **);
+int gp108_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **);
+int gp10b_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **);
+int tu102_acr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_acr **);
 
 struct nvkm_acr_lsfw {
        const struct nvkm_acr_lsf_func *func;
index acfa3ba5880da5141ad5d8fa5812302484521c90..a6fd9683e6771f0b863cd0b0bf3e6da532724482 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_ACR     ] = "acr",
        [NVKM_SUBDEV_BAR     ] = "bar",
        [NVKM_SUBDEV_VBIOS   ] = "bios",
        [NVKM_SUBDEV_BUS     ] = "bus",
index de9f1d35601246c756cc6a10249e11f2c8aea106..7457785564735bebc77280a40c8804de4afea7b8 100644 (file)
@@ -2029,7 +2029,7 @@ nv118_chipset = {
 static const struct nvkm_device_chip
 nv120_chipset = {
        .name = "GM200",
-       .acr = gm200_acr_new,
+       .acr      = { 0x00000001, gm200_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2067,7 +2067,7 @@ nv120_chipset = {
 static const struct nvkm_device_chip
 nv124_chipset = {
        .name = "GM204",
-       .acr = gm200_acr_new,
+       .acr      = { 0x00000001, gm200_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2105,7 +2105,7 @@ nv124_chipset = {
 static const struct nvkm_device_chip
 nv126_chipset = {
        .name = "GM206",
-       .acr = gm200_acr_new,
+       .acr      = { 0x00000001, gm200_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2142,7 +2142,7 @@ nv126_chipset = {
 static const struct nvkm_device_chip
 nv12b_chipset = {
        .name = "GM20B",
-       .acr = gm20b_acr_new,
+       .acr      = { 0x00000001, gm20b_acr_new },
        .bar = gm20b_bar_new,
        .bus = gf100_bus_new,
        .clk = gm20b_clk_new,
@@ -2167,7 +2167,7 @@ nv12b_chipset = {
 static const struct nvkm_device_chip
 nv130_chipset = {
        .name = "GP100",
-       .acr = gm200_acr_new,
+       .acr      = { 0x00000001, gm200_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2207,7 +2207,7 @@ nv130_chipset = {
 static const struct nvkm_device_chip
 nv132_chipset = {
        .name = "GP102",
-       .acr = gp102_acr_new,
+       .acr      = { 0x00000001, gp102_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2245,7 +2245,7 @@ nv132_chipset = {
 static const struct nvkm_device_chip
 nv134_chipset = {
        .name = "GP104",
-       .acr = gp102_acr_new,
+       .acr      = { 0x00000001, gp102_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2283,7 +2283,7 @@ nv134_chipset = {
 static const struct nvkm_device_chip
 nv136_chipset = {
        .name = "GP106",
-       .acr = gp102_acr_new,
+       .acr      = { 0x00000001, gp102_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2320,7 +2320,7 @@ nv136_chipset = {
 static const struct nvkm_device_chip
 nv137_chipset = {
        .name = "GP107",
-       .acr = gp102_acr_new,
+       .acr      = { 0x00000001, gp102_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2358,7 +2358,7 @@ nv137_chipset = {
 static const struct nvkm_device_chip
 nv138_chipset = {
        .name = "GP108",
-       .acr = gp108_acr_new,
+       .acr      = { 0x00000001, gp108_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2394,7 +2394,7 @@ nv138_chipset = {
 static const struct nvkm_device_chip
 nv13b_chipset = {
        .name = "GP10B",
-       .acr = gp10b_acr_new,
+       .acr      = { 0x00000001, gp10b_acr_new },
        .bar = gm20b_bar_new,
        .bus = gf100_bus_new,
        .fault = gp10b_fault_new,
@@ -2418,7 +2418,7 @@ nv13b_chipset = {
 static const struct nvkm_device_chip
 nv140_chipset = {
        .name = "GV100",
-       .acr = gp108_acr_new,
+       .acr      = { 0x00000001, gp108_acr_new },
        .bar = gm107_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2462,7 +2462,7 @@ nv140_chipset = {
 static const struct nvkm_device_chip
 nv162_chipset = {
        .name = "TU102",
-       .acr = tu102_acr_new,
+       .acr      = { 0x00000001, tu102_acr_new },
        .bar = tu102_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2500,7 +2500,7 @@ nv162_chipset = {
 static const struct nvkm_device_chip
 nv164_chipset = {
        .name = "TU104",
-       .acr = tu102_acr_new,
+       .acr      = { 0x00000001, tu102_acr_new },
        .bar = tu102_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2539,7 +2539,7 @@ nv164_chipset = {
 static const struct nvkm_device_chip
 nv166_chipset = {
        .name = "TU106",
-       .acr = tu102_acr_new,
+       .acr      = { 0x00000001, tu102_acr_new },
        .bar = tu102_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2579,7 +2579,7 @@ nv166_chipset = {
 static const struct nvkm_device_chip
 nv167_chipset = {
        .name = "TU117",
-       .acr = tu102_acr_new,
+       .acr      = { 0x00000001, tu102_acr_new },
        .bar = tu102_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
@@ -2617,7 +2617,7 @@ nv167_chipset = {
 static const struct nvkm_device_chip
 nv168_chipset = {
        .name = "TU116",
-       .acr = tu102_acr_new,
+       .acr      = { 0x00000001, tu102_acr_new },
        .bar = tu102_bar_new,
        .bios = nvkm_bios_new,
        .bus = gf100_bus_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_ACR     ,      acr);
                _(NVKM_SUBDEV_BAR     ,      bar);
                _(NVKM_SUBDEV_VBIOS   ,     bios);
                _(NVKM_SUBDEV_BUS     ,      bus);
index c962df9910dd46a71658a23ce7cb6b586392ed12..af6cac696d434c8ac3785427940c477e97408b1a 100644 (file)
@@ -410,14 +410,14 @@ nvkm_acr_ctor_wpr(struct nvkm_acr *acr, int ver)
 
 int
 nvkm_acr_new_(const struct nvkm_acr_fwif *fwif, struct nvkm_device *device,
-             int index, struct nvkm_acr **pacr)
+             enum nvkm_subdev_type type, int inst, struct nvkm_acr **pacr)
 {
        struct nvkm_acr *acr;
        long wprfw;
 
        if (!(acr = *pacr = kzalloc(sizeof(*acr), GFP_KERNEL)))
                return -ENOMEM;
-       nvkm_subdev_ctor(&nvkm_acr, device, index, &acr->subdev);
+       nvkm_subdev_ctor(&nvkm_acr, device, type, inst, &acr->subdev);
        INIT_LIST_HEAD(&acr->hsfw);
        INIT_LIST_HEAD(&acr->lsfw);
        INIT_LIST_HEAD(&acr->hsf);
index cd41b2e6cc8795feca6152c8188028be96163d22..8bff384a0bb7c8411281082ae80663216fe8355c 100644 (file)
@@ -478,7 +478,8 @@ gm200_acr_fwif[] = {
 };
 
 int
-gm200_acr_new(struct nvkm_device *device, int index, struct nvkm_acr **pacr)
+gm200_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+             struct nvkm_acr **pacr)
 {
-       return nvkm_acr_new_(gm200_acr_fwif, device, index, pacr);
+       return nvkm_acr_new_(gm200_acr_fwif, device, type, inst, pacr);
 }
index b1ecc58152ccab978ceb027f24d8399ace1c2b5c..54e996f2f630b22217675fd2437089f84ea96db7 100644 (file)
@@ -129,7 +129,8 @@ gm20b_acr_fwif[] = {
 };
 
 int
-gm20b_acr_new(struct nvkm_device *device, int index, struct nvkm_acr **pacr)
+gm20b_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+             struct nvkm_acr **pacr)
 {
-       return nvkm_acr_new_(gm20b_acr_fwif, device, index, pacr);
+       return nvkm_acr_new_(gm20b_acr_fwif, device, type, inst, pacr);
 }
index 80eb9d8dbc8037f5de38aaf0f25027298cef1ad1..fb9132a39bb1a5be122cf23fcb074a901ee9a435 100644 (file)
@@ -276,7 +276,8 @@ gp102_acr_fwif[] = {
 };
 
 int
-gp102_acr_new(struct nvkm_device *device, int index, struct nvkm_acr **pacr)
+gp102_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+             struct nvkm_acr **pacr)
 {
-       return nvkm_acr_new_(gp102_acr_fwif, device, index, pacr);
+       return nvkm_acr_new_(gp102_acr_fwif, device, type, inst, pacr);
 }
index 67a7c141004bd30a2b820731a4633da1a8b2e47f..373d638a21777e1a5d20db13fd0a3551e0e6eb94 100644 (file)
@@ -106,7 +106,8 @@ gp108_acr_fwif[] = {
 };
 
 int
-gp108_acr_new(struct nvkm_device *device, int index, struct nvkm_acr **pacr)
+gp108_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+             struct nvkm_acr **pacr)
 {
-       return nvkm_acr_new_(gp108_acr_fwif, device, index, pacr);
+       return nvkm_acr_new_(gp108_acr_fwif, device, type, inst, pacr);
 }
index 8249f0d2d81d7737281d125e058cc7b94dc56716..f03ba028867b6691899a4d329f9fa29f67d21d42 100644 (file)
@@ -52,7 +52,8 @@ gp10b_acr_fwif[] = {
 };
 
 int
-gp10b_acr_new(struct nvkm_device *device, int index, struct nvkm_acr **pacr)
+gp10b_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+             struct nvkm_acr **pacr)
 {
-       return nvkm_acr_new_(gp10b_acr_fwif, device, index, pacr);
+       return nvkm_acr_new_(gp10b_acr_fwif, device, type, inst, pacr);
 }
index d71af17a169a40e6837bffb56de71b93dbd27828..c30b841c9d352f5b1b1655979d47029cbc51922e 100644 (file)
@@ -135,8 +135,8 @@ int gp102_acr_load_load(struct nvkm_acr *, struct nvkm_acr_hsfw *);
 extern const struct nvkm_acr_hsf_func gp108_acr_unload_0;
 void gp108_acr_hsfw_bld(struct nvkm_acr *, struct nvkm_acr_hsf *);
 
-int nvkm_acr_new_(const struct nvkm_acr_fwif *, struct nvkm_device *, int,
-                 struct nvkm_acr **);
+int nvkm_acr_new_(const struct nvkm_acr_fwif *, struct nvkm_device *, enum nvkm_subdev_type,
+                 int inst, struct nvkm_acr **);
 int nvkm_acr_hsf_boot(struct nvkm_acr *, const char *name);
 
 struct nvkm_acr_lsf {
index c4981bce9a2b6a735de8e36c1d314fc416c1f5b7..05a87e77525f61e4c0fb3bc271ad0169f4e0edf0 100644 (file)
@@ -224,7 +224,8 @@ tu102_acr_fwif[] = {
 };
 
 int
-tu102_acr_new(struct nvkm_device *device, int index, struct nvkm_acr **pacr)
+tu102_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+             struct nvkm_acr **pacr)
 {
-       return nvkm_acr_new_(tu102_acr_fwif, device, index, pacr);
+       return nvkm_acr_new_(tu102_acr_fwif, device, type, inst, pacr);
 }