Skip to content

Commit faefba9

Browse files
committed
drm/amdgpu: just suspend the hw on pci shutdown
We can't just reuse pci_remove as there may be userspace still doing things. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98638 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97980 Reviewed-by: Christian König <christian.koenig@amd.com> Reported-and-tested-by: Mike Lothian <mike@fireburn.co.uk> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent ab7cd8d commit faefba9

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,6 +2472,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
24722472
struct drm_file *file_priv);
24732473
void amdgpu_driver_preclose_kms(struct drm_device *dev,
24742474
struct drm_file *file_priv);
2475+
int amdgpu_suspend(struct amdgpu_device *adev);
24752476
int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon);
24762477
int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon);
24772478
u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ static int amdgpu_fini(struct amdgpu_device *adev)
14931493
return 0;
14941494
}
14951495

1496-
static int amdgpu_suspend(struct amdgpu_device *adev)
1496+
int amdgpu_suspend(struct amdgpu_device *adev)
14971497
{
14981498
int i, r;
14991499

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,12 +479,15 @@ amdgpu_pci_remove(struct pci_dev *pdev)
479479
static void
480480
amdgpu_pci_shutdown(struct pci_dev *pdev)
481481
{
482+
struct drm_device *dev = pci_get_drvdata(pdev);
483+
struct amdgpu_device *adev = dev->dev_private;
484+
482485
/* if we are running in a VM, make sure the device
483486
* torn down properly on reboot/shutdown.
484487
* unfortunately we can't detect certain
485488
* hypervisors so just do this all the time.
486489
*/
487-
amdgpu_pci_remove(pdev);
490+
amdgpu_suspend(adev);
488491
}
489492

490493
static int amdgpu_pmops_suspend(struct device *dev)

0 commit comments

Comments
 (0)