drm/amdgpu: just suspend the hw on pci shutdown
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 6 Dec 2016 15:38:29 +0000 (10:38 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 7 Dec 2016 16:17:21 +0000 (11:17 -0500)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index 496f72b134eb07777f623f62d10eda6743565fa1..05c2850c04b00f01bfcda21182fdaa15f3c0edb1 100644 (file)
@@ -2472,6 +2472,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
                                 struct drm_file *file_priv);
 void amdgpu_driver_preclose_kms(struct drm_device *dev,
                                struct drm_file *file_priv);
+int amdgpu_suspend(struct amdgpu_device *adev);
 int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon);
 int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon);
 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
index 3161d77bf29989f5a6edb6d817973630e2b996b4..e41d4baebf86ea39b7e604071d72b0ca29ded612 100644 (file)
@@ -1493,7 +1493,7 @@ static int amdgpu_fini(struct amdgpu_device *adev)
        return 0;
 }
 
-static int amdgpu_suspend(struct amdgpu_device *adev)
+int amdgpu_suspend(struct amdgpu_device *adev)
 {
        int i, r;
 
index 02ff0747197c13e91ee378696a0fc46fe2b193f0..e0890deccb2fe31d4deb78deac640d53d8f34a45 100644 (file)
@@ -479,12 +479,15 @@ amdgpu_pci_remove(struct pci_dev *pdev)
 static void
 amdgpu_pci_shutdown(struct pci_dev *pdev)
 {
+       struct drm_device *dev = pci_get_drvdata(pdev);
+       struct amdgpu_device *adev = dev->dev_private;
+
        /* if we are running in a VM, make sure the device
         * torn down properly on reboot/shutdown.
         * unfortunately we can't detect certain
         * hypervisors so just do this all the time.
         */
-       amdgpu_pci_remove(pdev);
+       amdgpu_suspend(adev);
 }
 
 static int amdgpu_pmops_suspend(struct device *dev)