]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "drm/amdgpu: TA unload messages are not actually sent to psp when amdgpu is...
authorVitaly Prosyak <vitaly.prosyak@amd.com>
Fri, 20 Jan 2023 18:19:50 +0000 (13:19 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:59 +0000 (09:33 +0100)
[ Upstream commit b9a3a4fccc9d7945d196c154fd35302fca383c83 ]

This reverts commit c15966c1aa2f22f6ad3ee895210df712f2246d5f.
The following change: move the drm_dev_unplug call after
amdgpu_driver_unload_kms in amdgpu_pci_remove. The reason is
the following: amdgpu_pci_remove calls drm_dev_unregister
and it should be called first to ensure userspace can't access the
device instance anymore. If we call drm_dev_unplug after
amdgpu_driver_unload_kms then we observe IGT PCI software unplug
test failure (kernel hung) for all ASICs. This is how this
regression was found.

After this revert, the following commands do work not, but it would
be fixed in the next commit:
 - sudo modprobe -r amdgpu
 - sudo modprobe amdgpu

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index a21b3f66fd708621ace1c722de1c765d922daa9e..824b0b356b3ce9963f48c36c738eb1ab46c2fb86 100644 (file)
@@ -4012,7 +4012,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 2e5d78b6635c4aac1212e6e75bf42dad2ad267cd..dfbeef2c4a9e2ab0e93890c2d2561ecb74fdf795 100644 (file)
@@ -2226,6 +2226,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);
@@ -2265,8 +2267,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