From: Christian König Date: Wed, 16 Nov 2022 14:45:36 +0000 (+0100) Subject: drm/amdgpu: WARN when freeing kernel memory during suspend X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4d2ccd96ac25846749fc58691f5142a966e65b3a;p=linux.git drm/amdgpu: WARN when freeing kernel memory during suspend When buffers are freed during suspend there is no guarantee that they can be re-allocated during resume. The PSP subsystem seems to be quite buggy regarding this, so add a WARN_ON() to point out those bugs. Signed-off-by: Christian König Reviewed-by: Alex Deucher Tested-by: Guilherme G. Piccoli Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 2df55cc7e07f6..3393c1a6a0ff1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -422,6 +422,8 @@ void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr, if (*bo == NULL) return; + WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend); + if (likely(amdgpu_bo_reserve(*bo, true) == 0)) { if (cpu_addr) amdgpu_bo_kunmap(*bo);