Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx> --- drivers/gpu/drm/nouveau/include/nvkm/core/device.h | 1 + drivers/gpu/drm/nouveau/nouveau_drm.c | 5 ----- drivers/gpu/drm/nouveau/nvkm/device/base.c | 6 ++++++ drivers/gpu/drm/nouveau/nvkm/device/pci.c | 11 +++++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h index 3c11d3068ced..d8596fe0adea 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h @@ -89,6 +89,7 @@ struct nvkm_device_func { struct nvkm_device_tegra *(*tegra)(struct nvkm_device *); void *(*dtor)(struct nvkm_device *); int (*preinit)(struct nvkm_device *); + int (*oneinit)(struct nvkm_device *); int (*init)(struct nvkm_device *); void (*fini)(struct nvkm_device *, bool suspend); int (*irq)(struct nvkm_device *); diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 3f1f93fa7029..be31e8ea4fee 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -804,11 +804,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev, device = pci_get_drvdata(pdev); - /* Remove conflicting drivers (vesafb, efifb etc). */ - ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, &driver_pci); - if (ret) - return ret; - pci_set_master(pdev); if (nouveau_atomic) diff --git a/drivers/gpu/drm/nouveau/nvkm/device/base.c b/drivers/gpu/drm/nouveau/nvkm/device/base.c index 1b76c2a60799..4f8298bf71ee 100644 --- a/drivers/gpu/drm/nouveau/nvkm/device/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/device/base.c @@ -2954,6 +2954,12 @@ nvkm_device_oneinit(struct nvkm_device *device) #undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_ONCE + if (device->func->oneinit) { + ret = device->func->oneinit(device); + if (ret) + goto done; + } + ret = nvkm_intr_install(device); done: if (ret) { diff --git a/drivers/gpu/drm/nouveau/nvkm/device/pci.c b/drivers/gpu/drm/nouveau/nvkm/device/pci.c index 21ca094df54f..7d0ddc968246 100644 --- a/drivers/gpu/drm/nouveau/nvkm/device/pci.c +++ b/drivers/gpu/drm/nouveau/nvkm/device/pci.c @@ -26,6 +26,7 @@ #include "acpi.h" #include "priv.h" +#include <linux/aperture.h> #include <linux/vga_switcheroo.h> struct nvkm_device_pci_device { @@ -1608,6 +1609,15 @@ nvkm_device_pci_preinit(struct nvkm_device *device) return 0; } +static int +nvkm_device_pci_oneinit(struct nvkm_device *device) +{ + struct nvkm_device_pci *pdev = nvkm_device_pci(device); + + /* Remove conflicting drivers (vesafb, efifb etc). */ + return aperture_remove_conflicting_pci_devices(pdev->pdev, "nvkm"); +} + static void * nvkm_device_pci_dtor(struct nvkm_device *device) { @@ -1621,6 +1631,7 @@ nvkm_device_pci_func = { .pci = nvkm_device_pci, .dtor = nvkm_device_pci_dtor, .preinit = nvkm_device_pci_preinit, + .oneinit = nvkm_device_pci_oneinit, .fini = nvkm_device_pci_fini, .irq = nvkm_device_pci_irq, .resource_addr = nvkm_device_pci_resource_addr, -- 2.44.0