Revert "drm/amdgpu: TA unload messages are not actually sent to psp when amdgpu is...
authorjsg <jsg@openbsd.org>
Mon, 27 Mar 2023 04:05:13 +0000 (04:05 +0000)
committerjsg <jsg@openbsd.org>
Mon, 27 Mar 2023 04:05:13 +0000 (04:05 +0000)
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
sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c

index 0b80179..a089174 100644 (file)
@@ -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);
 
 }
 
index b3c1f4a..3a56d28 100644 (file)
@@ -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