Skip to content

Commit

Permalink
Revert "drm/amdgpu: TA unload messages are not actually sent to psp w…
Browse files Browse the repository at this point in the history
…hen amdgpu is uninstalled"

This reverts commit fac5347.
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>
  • Loading branch information
vprosyak authored and lyndonli committed Apr 19, 2023
1 parent 166c089 commit 0b579de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -4072,7 +4072,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);

}

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2282,6 +2282,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);
Expand Down Expand Up @@ -2321,8 +2323,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
Expand Down

0 comments on commit 0b579de

Please sign in to comment.