drm/nouveau/fault: switch to instanced constructor
authorBen Skeggs <bskeggs@redhat.com>
Fri, 4 Dec 2020 01:07:41 +0000 (11:07 +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>
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/fault.h
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/gp100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/gp10b.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/gv100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/fault/tu102.c

index 01e653f16edc37c183db1e0106906b325cac311a..0b5c85218c71d9e2a46d4804acfa047e11e3853e 100644 (file)
@@ -60,7 +60,6 @@ struct nvkm_device {
                struct notifier_block nb;
        } acpi;
 
-       struct nvkm_fault *fault;
        struct nvkm_fb *fb;
        struct nvkm_fuse *fuse;
        struct nvkm_gpio *gpio;
@@ -142,7 +141,6 @@ struct nvkm_device_chip {
 #include <core/layout.h>
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
-       int (*fault   )(struct nvkm_device *, int idx, struct nvkm_fault **);
        int (*fb      )(struct nvkm_device *, int idx, struct nvkm_fb **);
        int (*fuse    )(struct nvkm_device *, int idx, struct nvkm_fuse **);
        int (*gpio    )(struct nvkm_device *, int idx, struct nvkm_gpio **);
index 47cb81c6e129c66ac2df8c081e9778e8a936d6bc..9f5fad93eaccf88abffa614d0fd828a944510558 100644 (file)
@@ -3,5 +3,6 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS   , struct nvkm_bios    ,     bios)
 NVKM_LAYOUT_ONCE(NVKM_SUBDEV_DEVINIT , struct nvkm_devinit ,  devinit)
 NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS     , struct nvkm_bus     ,      bus)
 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)
index a513c16ab10569a595eb573e60ee9687aac26b65..581458ad38e064b6e9ffaf9fe40d7c7e40305ae2 100644 (file)
@@ -30,8 +30,8 @@ struct nvkm_fault_data {
        u8 reason;
 };
 
-int gp100_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
-int gp10b_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
-int gv100_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
-int tu102_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
+int gp100_fault_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
+int gp10b_fault_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
+int gv100_fault_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
+int tu102_fault_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
 #endif
index 2aa0dc6c32d3ac59606e170e949d76dace611522..56b61a266f1f8419a58fdf3a8c675d283c0b1734 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_FAULT   ] = "fault",
        [NVKM_SUBDEV_FB      ] = "fb",
        [NVKM_SUBDEV_FUSE    ] = "fuse",
        [NVKM_SUBDEV_GPIO    ] = "gpio",
index d334bcc6d5bbec5012cc7493a80b19ced8cda1dc..123a01f2683076af6ca2fc0478b865b906102e1b 100644 (file)
@@ -2172,7 +2172,7 @@ nv130_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, gm200_devinit_new },
-       .fault = gp100_fault_new,
+       .fault    = { 0x00000001, gp100_fault_new },
        .fb = gp100_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2212,7 +2212,7 @@ nv132_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, gm200_devinit_new },
-       .fault = gp100_fault_new,
+       .fault    = { 0x00000001, gp100_fault_new },
        .fb = gp102_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2250,7 +2250,7 @@ nv134_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, gm200_devinit_new },
-       .fault = gp100_fault_new,
+       .fault    = { 0x00000001, gp100_fault_new },
        .fb = gp102_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2288,7 +2288,7 @@ nv136_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, gm200_devinit_new },
-       .fault = gp100_fault_new,
+       .fault    = { 0x00000001, gp100_fault_new },
        .fb = gp102_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2325,7 +2325,7 @@ nv137_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, gm200_devinit_new },
-       .fault = gp100_fault_new,
+       .fault    = { 0x00000001, gp100_fault_new },
        .fb = gp102_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2363,7 +2363,7 @@ nv138_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, gm200_devinit_new },
-       .fault = gp100_fault_new,
+       .fault    = { 0x00000001, gp100_fault_new },
        .fb = gp102_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2397,7 +2397,7 @@ nv13b_chipset = {
        .acr      = { 0x00000001, gp10b_acr_new },
        .bar      = { 0x00000001, gm20b_bar_new },
        .bus      = { 0x00000001, gf100_bus_new },
-       .fault = gp10b_fault_new,
+       .fault    = { 0x00000001, gp10b_fault_new },
        .fb = gp10b_fb_new,
        .fuse = gm107_fuse_new,
        .ibus = gp10b_ibus_new,
@@ -2423,7 +2423,7 @@ nv140_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, gv100_devinit_new },
-       .fault = gv100_fault_new,
+       .fault    = { 0x00000001, gv100_fault_new },
        .fb = gv100_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2467,7 +2467,7 @@ nv162_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
-       .fault = tu102_fault_new,
+       .fault    = { 0x00000001, tu102_fault_new },
        .fb = gv100_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2505,7 +2505,7 @@ nv164_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
-       .fault = tu102_fault_new,
+       .fault    = { 0x00000001, tu102_fault_new },
        .fb = gv100_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2544,7 +2544,7 @@ nv166_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
-       .fault = tu102_fault_new,
+       .fault    = { 0x00000001, tu102_fault_new },
        .fb = gv100_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2584,7 +2584,7 @@ nv167_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
-       .fault = tu102_fault_new,
+       .fault    = { 0x00000001, tu102_fault_new },
        .fb = gv100_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
@@ -2622,7 +2622,7 @@ nv168_chipset = {
        .bios     = { 0x00000001, nvkm_bios_new },
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
-       .fault = tu102_fault_new,
+       .fault    = { 0x00000001, tu102_fault_new },
        .fb = gv100_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_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_FAULT   ,    fault);
                _(NVKM_SUBDEV_FB      ,       fb);
                _(NVKM_SUBDEV_FUSE    ,     fuse);
                _(NVKM_SUBDEV_GPIO    ,     gpio);
index f6dca97140d6bdf877c97e5348bcec3f48ccf5c4..fd54fa504efa04a50de2cd1fced419f1e6aad9e6 100644 (file)
@@ -170,12 +170,12 @@ nvkm_fault = {
 
 int
 nvkm_fault_new_(const struct nvkm_fault_func *func, struct nvkm_device *device,
-               int index, struct nvkm_fault **pfault)
+               enum nvkm_subdev_type type, int inst, struct nvkm_fault **pfault)
 {
        struct nvkm_fault *fault;
        if (!(fault = *pfault = kzalloc(sizeof(*fault), GFP_KERNEL)))
                return -ENOMEM;
-       nvkm_subdev_ctor(&nvkm_fault, device, index, &fault->subdev);
+       nvkm_subdev_ctor(&nvkm_fault, device, type, inst, &fault->subdev);
        fault->func = func;
        fault->user.ctor = nvkm_ufault_new;
        fault->user.base = func->user.base;
index f6b189cc43301f05b6220651f558830e2196a4bc..20e271744a7aec86703d3178374a2244b6cece38 100644 (file)
@@ -82,8 +82,8 @@ gp100_fault = {
 };
 
 int
-gp100_fault_new(struct nvkm_device *device, int index,
+gp100_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
                struct nvkm_fault **pfault)
 {
-       return nvkm_fault_new_(&gp100_fault, device, index, pfault);
+       return nvkm_fault_new_(&gp100_fault, device, type, inst, pfault);
 }
index 9e66d1f7654d4a7ad9843676ff21983e1b1771c9..89e0bc96fb92dd5ec5f871a78c453adca8c600d5 100644 (file)
@@ -46,8 +46,8 @@ gp10b_fault = {
 };
 
 int
-gp10b_fault_new(struct nvkm_device *device, int index,
+gp10b_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
                struct nvkm_fault **pfault)
 {
-       return nvkm_fault_new_(&gp10b_fault, device, index, pfault);
+       return nvkm_fault_new_(&gp10b_fault, device, type, inst, pfault);
 }
index 2707be4ffabc37773fd01838eaa3481bfdbde597..cd9d2ade5ac7a5c5174ecfc0ce5995055ada4917 100644 (file)
@@ -228,8 +228,8 @@ gv100_fault = {
 };
 
 int
-gv100_fault_new(struct nvkm_device *device, int index,
+gv100_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
                struct nvkm_fault **pfault)
 {
-       return nvkm_fault_new_(&gv100_fault, device, index, pfault);
+       return nvkm_fault_new_(&gv100_fault, device, type, inst, pfault);
 }
index f6f1dd7eee1ff5dd394c4b3f5efdc1ce3cb039c8..36681c347fb597a631a1909200d63e148f38ea70 100644 (file)
@@ -18,8 +18,8 @@ struct nvkm_fault_buffer {
        u64 addr;
 };
 
-int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *,
-                   int index, struct nvkm_fault **);
+int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *, enum nvkm_subdev_type,
+                   int inst, struct nvkm_fault **);
 
 struct nvkm_fault_func {
        int (*oneinit)(struct nvkm_fault *);
index f080051b0c65fe434911a41b2443a9a7df213b3d..437cf323ee2fed7b9db8346e26aebff703fc23b7 100644 (file)
@@ -181,8 +181,8 @@ tu102_fault = {
 };
 
 int
-tu102_fault_new(struct nvkm_device *device, int index,
+tu102_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
                struct nvkm_fault **pfault)
 {
-       return nvkm_fault_new_(&tu102_fault, device, index, pfault);
+       return nvkm_fault_new_(&tu102_fault, device, type, inst, pfault);
 }