From e63de9fbfd49315bc016da5726b74cc2db259719 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 27 Mar 2023 04:05:13 +0000 Subject: [PATCH] Revert "drm/amdgpu: TA unload messages are not actually sent to psp when amdgpu is uninstalled" From Vitaly Prosyak 804bdc5fe05dbbcca6d998bf84c3dbafdcf3534d in linux-6.1.y/6.1.16 39934d3ed5725c5e3570ed1b67f612f1ea60ce03 in mainline linux --- sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c | 3 ++- sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c index 0b80179123f..a0891745c0e 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c @@ -4111,7 +4111,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) amdgpu_gart_dummy_page_fini(adev); - amdgpu_device_unmap_mmio(adev); + if (drm_dev_is_unplugged(adev_to_drm(adev))) + amdgpu_device_unmap_mmio(adev); } diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c index b3c1f4a0a82..3a56d2851c2 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c @@ -2230,6 +2230,8 @@ amdgpu_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); struct amdgpu_device *adev = drm_to_adev(dev); + drm_dev_unplug(dev); + if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) { pm_runtime_get_sync(dev->dev); pm_runtime_forbid(dev->dev); @@ -2269,8 +2271,6 @@ amdgpu_pci_remove(struct pci_dev *pdev) amdgpu_driver_unload_kms(dev); - drm_dev_unplug(dev); - /* * Flush any in flight DMA operations from device. * Clear the Bus Master Enable bit and then wait on the PCIe Device -- 2.20.1