mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 14:19:16 +00:00
drm/amd: Add concept of running prepare_suspend() sequence for IP blocks
[ Upstream commitcb11ca3233
] If any IP blocks allocate memory during their hw_fini() sequence this can cause the suspend to fail under memory pressure. Introduce a new phase that IP blocks can use to allocate memory before suspend starts so that it can potentially be evicted into swap instead. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Stable-dep-of:ca299b4512
("drm/amd: Flush GFXOFF requests in prepare stage") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8b5f720486
commit
da67a1139f
2 changed files with 12 additions and 1 deletions
|
@ -4107,7 +4107,7 @@ static int amdgpu_device_evict_resources(struct amdgpu_device *adev)
|
||||||
int amdgpu_device_prepare(struct drm_device *dev)
|
int amdgpu_device_prepare(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = drm_to_adev(dev);
|
struct amdgpu_device *adev = drm_to_adev(dev);
|
||||||
int r;
|
int i, r;
|
||||||
|
|
||||||
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
|
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4117,6 +4117,16 @@ int amdgpu_device_prepare(struct drm_device *dev)
|
||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
for (i = 0; i < adev->num_ip_blocks; i++) {
|
||||||
|
if (!adev->ip_blocks[i].status.valid)
|
||||||
|
continue;
|
||||||
|
if (!adev->ip_blocks[i].version->funcs->prepare_suspend)
|
||||||
|
continue;
|
||||||
|
r = adev->ip_blocks[i].version->funcs->prepare_suspend((void *)adev);
|
||||||
|
if (r)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,6 +295,7 @@ struct amd_ip_funcs {
|
||||||
int (*hw_init)(void *handle);
|
int (*hw_init)(void *handle);
|
||||||
int (*hw_fini)(void *handle);
|
int (*hw_fini)(void *handle);
|
||||||
void (*late_fini)(void *handle);
|
void (*late_fini)(void *handle);
|
||||||
|
int (*prepare_suspend)(void *handle);
|
||||||
int (*suspend)(void *handle);
|
int (*suspend)(void *handle);
|
||||||
int (*resume)(void *handle);
|
int (*resume)(void *handle);
|
||||||
bool (*is_idle)(void *handle);
|
bool (*is_idle)(void *handle);
|
||||||
|
|
Loading…
Reference in a new issue