drm/amd: Move evict resources suspend step to prepare()
Subsystems (2)
PATCH 1/1 drm/amd: Move evict resources suspend step to prepare()
If the system is under high memory pressure, the resources may need to be evicted into swap instead. If the storage backing for swap is offlined during the suspend() step then such a call may fail.
So instead move this step into prepare(), while leaving all other steps that put the GPU into a low power state in suspend().
Signed-off-by Mario Limonciello <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +------ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++++-- 3 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1285,6 +1285,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define MIN (X ,Y ) ((X) < (Y) ? (X) : (Y))/* Common functions */ +int amdgpu_device_evict_resources (struct amdgpu_device *adev);bool amdgpu_device_has_job_running (struct amdgpu_device *adev);bool amdgpu_device_should_recover_gpu (struct amdgpu_device *adev); int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -6
@@ -4085,7 +4085,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)* at suspend time. * */ -static int amdgpu_device_evict_resources (struct amdgpu_device *adev) +int amdgpu_device_evict_resources (struct amdgpu_device *adev) {int ret;
@@ -4122,11 +4122,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) adev->in_suspend = true; -/* Evict the majority of BOs before grabbing the full access */ - r =amdgpu_device_evict_resources (adev); -if (r) -return r; -if (amdgpu_sriov_vf (adev)) {amdgpu_virt_fini_data_exchange (adev); r =amdgpu_virt_request_full_gpu (adev, false);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +9 -2
@@ -2380,12 +2380,14 @@ static int amdgpu_pmops_prepare(struct device *dev) {struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); +int r;/* Return a positive number here so * DPM_FLAG_SMART_SUSPEND works properly */ -if (amdgpu_device_supports_boco (drm_dev)) -return pm_runtime_suspended (dev); +if (amdgpu_device_supports_boco (drm_dev) && +pm_runtime_suspended (dev)) +return 1 ;/* if we will not support s3 or s2i for the device * then skip suspend
@@ -2394,6 +2396,11 @@ static int amdgpu_pmops_prepare(struct device *dev) !amdgpu_acpi_is_s3_active(adev))return 1 ; +/* Evict the majority of BOs before grabbing the full access */ + r =amdgpu_device_evict_resources (adev); +if (r) +return r; +return 0 ; }
Signature · 1 line
2.34.1