Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+6 -2
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 2472 2472 struct drm_file *file_priv); 2473 2473 void amdgpu_driver_preclose_kms(struct drm_device *dev, 2474 2474 struct drm_file *file_priv); 2475 + int amdgpu_suspend(struct amdgpu_device *adev); 2475 2476 int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon); 2476 2477 int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon); 2477 2478 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1493 1493 return 0; 1494 1494 } 1495 1495 1496 - static int amdgpu_suspend(struct amdgpu_device *adev) 1496 + int amdgpu_suspend(struct amdgpu_device *adev) 1497 1497 { 1498 1498 int i, r; 1499 1499
+4 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 479 479 static void 480 480 amdgpu_pci_shutdown(struct pci_dev *pdev) 481 481 { 482 + struct drm_device *dev = pci_get_drvdata(pdev); 483 + struct amdgpu_device *adev = dev->dev_private; 484 + 482 485 /* if we are running in a VM, make sure the device 483 486 * torn down properly on reboot/shutdown. 484 487 * unfortunately we can't detect certain 485 488 * hypervisors so just do this all the time. 486 489 */ 487 - amdgpu_pci_remove(pdev); 490 + amdgpu_suspend(adev); 488 491 } 489 492 490 493 static int amdgpu_pmops_suspend(struct device *dev)