mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-23 08:55:56 -04:00
drm/amdgpu: unify BO evicting method in amdgpu_ttm
Unify BO evicting functionality for possible memory types in amdgpu_ttm.c. Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -3885,6 +3885,25 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_device_evict_resources - evict device resources
|
||||
* @adev: amdgpu device object
|
||||
*
|
||||
* Evicts all ttm device resources(vram BOs, gart table) from the lru list
|
||||
* of the vram memory type. Mainly used for evicting device resources
|
||||
* at suspend time.
|
||||
*
|
||||
*/
|
||||
static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
|
||||
{
|
||||
/* No need to evict vram on APUs for suspend to ram */
|
||||
if (adev->in_s3 && (adev->flags & AMD_IS_APU))
|
||||
return;
|
||||
|
||||
if (amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM))
|
||||
DRM_WARN("evicting device resources failed\n");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Suspend & resume.
|
||||
@@ -3925,17 +3944,16 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
|
||||
if (!adev->in_s0ix)
|
||||
amdgpu_amdkfd_suspend(adev, adev->in_runpm);
|
||||
|
||||
/* evict vram memory */
|
||||
amdgpu_bo_evict_vram(adev);
|
||||
/* First evict vram memory */
|
||||
amdgpu_device_evict_resources(adev);
|
||||
|
||||
amdgpu_fence_driver_hw_fini(adev);
|
||||
|
||||
amdgpu_device_ip_suspend_phase2(adev);
|
||||
/* evict remaining vram memory
|
||||
* This second call to evict vram is to evict the gart page table
|
||||
* using the CPU.
|
||||
/* This second call to evict device resources is to evict
|
||||
* the gart page table using the CPU.
|
||||
*/
|
||||
amdgpu_bo_evict_vram(adev);
|
||||
amdgpu_device_evict_resources(adev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user