diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2020-12-04 12:36:38 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2021-02-11 11:49:54 +1000 |
commit | 0a7bff10aed6231a0a5ad9cfc19eab51d4ce1d0a (patch) | |
tree | 8b214a13c553219a690dd160dcacc84b8385b865 /drivers/gpu | |
parent | 353108a49fc8464a6ce23ff3724662910ace7687 (diff) |
drm/nouveau/mxm: switch to instanced constructor
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/core/device.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/core/layout.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/subdev/mxm.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/subdev.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 71 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/mxm/nv50.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/mxm/priv.h | 2 |
8 files changed, 44 insertions, 45 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h index 2cd619e258ef..48d832c6f64f 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h @@ -60,7 +60,6 @@ struct nvkm_device { struct notifier_block nb; } acpi; - struct nvkm_subdev *mxm; struct nvkm_pci *pci; struct nvkm_pmu *pmu; struct nvkm_therm *therm; @@ -130,7 +129,6 @@ struct nvkm_device_chip { #include <core/layout.h> #undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_ONCE - int (*mxm )(struct nvkm_device *, int idx, struct nvkm_subdev **); int (*pci )(struct nvkm_device *, int idx, struct nvkm_pci **); int (*pmu )(struct nvkm_device *, int idx, struct nvkm_pmu **); int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **); diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/layout.h b/drivers/gpu/drm/nouveau/include/nvkm/core/layout.h index 199bd8efd08f..782ec223756f 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/layout.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/layout.h @@ -5,6 +5,7 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_IBUS , struct nvkm_subdev , ibus) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GPIO , struct nvkm_gpio , gpio) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_I2C , struct nvkm_i2c , i2c) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FUSE , struct nvkm_fuse , fuse) +NVKM_LAYOUT_ONCE(NVKM_SUBDEV_MXM , struct nvkm_subdev , mxm) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_MC , struct nvkm_mc , mc) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_INSTMEM , struct nvkm_instmem , imem) diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mxm.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mxm.h index 78df1e9def05..7d4132a17d0f 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mxm.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mxm.h @@ -3,5 +3,5 @@ #define __NVKM_MXM_H__ #include <core/subdev.h> -int nv50_mxm_new(struct nvkm_device *, int, struct nvkm_subdev **); +int nv50_mxm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_subdev **); #endif diff --git a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c index 3f1fa104de67..c6f198eb624c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c @@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = { #include <core/layout.h> #undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_INST - [NVKM_SUBDEV_MXM ] = "mxm", [NVKM_SUBDEV_PCI ] = "pci", [NVKM_SUBDEV_PMU ] = "pmu", [NVKM_SUBDEV_THERM ] = "therm", diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c index a531b1a7cb44..8c127bd0780e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c @@ -822,7 +822,7 @@ nv50_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, nv50_mc_new }, .mmu = { 0x00000001, nv50_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = nv46_pci_new, .therm = nv50_therm_new, .timer = nv41_timer_new, @@ -929,7 +929,7 @@ nv84_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g84_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g84_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -961,7 +961,7 @@ nv86_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g84_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g84_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -993,7 +993,7 @@ nv92_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g84_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g92_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -1025,7 +1025,7 @@ nv94_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g84_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -1057,7 +1057,7 @@ nv96_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g84_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -1089,7 +1089,7 @@ nv98_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g98_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -1121,7 +1121,7 @@ nva0_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g84_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -1153,7 +1153,7 @@ nva3_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, gt215_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .pmu = gt215_pmu_new, .therm = gt215_therm_new, @@ -1187,7 +1187,7 @@ nva5_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, gt215_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .pmu = gt215_pmu_new, .therm = gt215_therm_new, @@ -1220,7 +1220,7 @@ nva8_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, gt215_mc_new }, .mmu = { 0x00000001, g84_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .pmu = gt215_pmu_new, .therm = gt215_therm_new, @@ -1253,7 +1253,7 @@ nvaa_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g98_mc_new }, .mmu = { 0x00000001, mcp77_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -1285,7 +1285,7 @@ nvac_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, g98_mc_new }, .mmu = { 0x00000001, mcp77_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .therm = g84_therm_new, .timer = nv41_timer_new, @@ -1317,7 +1317,7 @@ nvaf_chipset = { .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, gt215_mc_new }, .mmu = { 0x00000001, mcp77_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = g94_pci_new, .pmu = gt215_pmu_new, .therm = gt215_therm_new, @@ -1353,7 +1353,7 @@ nvc0_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf100_pci_new, .pmu = gf100_pmu_new, .therm = gt215_therm_new, @@ -1390,7 +1390,7 @@ nvc1_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf106_pci_new, .pmu = gf100_pmu_new, .therm = gt215_therm_new, @@ -1426,7 +1426,7 @@ nvc3_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf106_pci_new, .pmu = gf100_pmu_new, .therm = gt215_therm_new, @@ -1462,7 +1462,7 @@ nvc4_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf100_pci_new, .pmu = gf100_pmu_new, .therm = gt215_therm_new, @@ -1499,7 +1499,7 @@ nvc8_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf100_pci_new, .pmu = gf100_pmu_new, .therm = gt215_therm_new, @@ -1536,7 +1536,7 @@ nvce_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf100_pci_new, .pmu = gf100_pmu_new, .therm = gt215_therm_new, @@ -1573,7 +1573,7 @@ nvcf_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf106_pci_new, .pmu = gf100_pmu_new, .therm = gt215_therm_new, @@ -1609,7 +1609,7 @@ nvd7_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf106_pci_new, .therm = gf119_therm_new, .timer = nv41_timer_new, @@ -1644,7 +1644,7 @@ nvd9_chipset = { .ltc = { 0x00000001, gf100_ltc_new }, .mc = { 0x00000001, gf100_mc_new }, .mmu = { 0x00000001, gf100_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gf106_pci_new, .pmu = gf119_pmu_new, .therm = gf119_therm_new, @@ -1680,7 +1680,7 @@ nve4_chipset = { .ltc = { 0x00000001, gk104_ltc_new }, .mc = { 0x00000001, gk104_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gk104_pmu_new, .therm = gk104_therm_new, @@ -1719,7 +1719,7 @@ nve6_chipset = { .ltc = { 0x00000001, gk104_ltc_new }, .mc = { 0x00000001, gk104_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gk104_pmu_new, .therm = gk104_therm_new, @@ -1758,7 +1758,7 @@ nve7_chipset = { .ltc = { 0x00000001, gk104_ltc_new }, .mc = { 0x00000001, gk104_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gk104_pmu_new, .therm = gk104_therm_new, @@ -1822,7 +1822,7 @@ nvf0_chipset = { .ltc = { 0x00000001, gk104_ltc_new }, .mc = { 0x00000001, gk104_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gk110_pmu_new, .therm = gk104_therm_new, @@ -1860,7 +1860,7 @@ nvf1_chipset = { .ltc = { 0x00000001, gk104_ltc_new }, .mc = { 0x00000001, gk104_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gk110_pmu_new, .therm = gk104_therm_new, @@ -1898,7 +1898,7 @@ nv106_chipset = { .ltc = { 0x00000001, gk104_ltc_new }, .mc = { 0x00000001, gk20a_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gk208_pmu_new, .therm = gk104_therm_new, @@ -1936,7 +1936,7 @@ nv108_chipset = { .ltc = { 0x00000001, gk104_ltc_new }, .mc = { 0x00000001, gk20a_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gk208_pmu_new, .therm = gk104_therm_new, @@ -1974,7 +1974,7 @@ nv117_chipset = { .ltc = { 0x00000001, gm107_ltc_new }, .mc = { 0x00000001, gk20a_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gm107_pmu_new, .therm = gm107_therm_new, @@ -2010,7 +2010,7 @@ nv118_chipset = { .ltc = { 0x00000001, gm107_ltc_new }, .mc = { 0x00000001, gk20a_mc_new }, .mmu = { 0x00000001, gk104_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gm107_pmu_new, .therm = gm107_therm_new, @@ -2044,7 +2044,7 @@ nv120_chipset = { .ltc = { 0x00000001, gm200_ltc_new }, .mc = { 0x00000001, gk20a_mc_new }, .mmu = { 0x00000001, gm200_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gm200_pmu_new, .therm = gm200_therm_new, @@ -2082,7 +2082,7 @@ nv124_chipset = { .ltc = { 0x00000001, gm200_ltc_new }, .mc = { 0x00000001, gk20a_mc_new }, .mmu = { 0x00000001, gm200_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gm200_pmu_new, .therm = gm200_therm_new, @@ -2120,7 +2120,7 @@ nv126_chipset = { .ltc = { 0x00000001, gm200_ltc_new }, .mc = { 0x00000001, gk20a_mc_new }, .mmu = { 0x00000001, gm200_mmu_new }, - .mxm = nv50_mxm_new, + .mxm = { 0x00000001, nv50_mxm_new }, .pci = gk104_pci_new, .pmu = gm200_pmu_new, .therm = gm200_therm_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_MXM , mxm); _(NVKM_SUBDEV_PCI , pci); _(NVKM_SUBDEV_PMU , pmu); _(NVKM_SUBDEV_THERM , therm); diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c index f44682d62f75..c1acfe642da3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c @@ -230,7 +230,8 @@ nvkm_mxm = { }; int -nvkm_mxm_new_(struct nvkm_device *device, int index, struct nvkm_mxm **pmxm) +nvkm_mxm_new_(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, + struct nvkm_mxm **pmxm) { struct nvkm_bios *bios = device->bios; struct nvkm_mxm *mxm; @@ -240,7 +241,7 @@ nvkm_mxm_new_(struct nvkm_device *device, int index, struct nvkm_mxm **pmxm) if (!(mxm = *pmxm = kzalloc(sizeof(*mxm), GFP_KERNEL))) return -ENOMEM; - nvkm_subdev_ctor(&nvkm_mxm, device, index, &mxm->subdev); + nvkm_subdev_ctor(&nvkm_mxm, device, type, inst, &mxm->subdev); data = mxm_table(bios, &ver, &len); if (!data || !(ver = nvbios_rd08(bios, data))) { diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/nv50.c index 70e2c414bb7b..f3167904dcb0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/nv50.c @@ -201,12 +201,13 @@ mxm_dcb_sanitise(struct nvkm_mxm *mxm) } int -nv50_mxm_new(struct nvkm_device *device, int index, struct nvkm_subdev **pmxm) +nv50_mxm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, + struct nvkm_subdev **pmxm) { struct nvkm_mxm *mxm; int ret; - ret = nvkm_mxm_new_(device, index, &mxm); + ret = nvkm_mxm_new_(device, type, inst, &mxm); if (mxm) *pmxm = &mxm->subdev; if (ret) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/priv.h index fc8f69e6fc64..fcacb6c6a7f7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/priv.h @@ -12,5 +12,5 @@ struct nvkm_mxm { u8 *mxms; }; -int nvkm_mxm_new_(struct nvkm_device *, int index, struct nvkm_mxm **); +int nvkm_mxm_new_(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_mxm **); #endif |