From: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Date: Fri, 20 Jul 2018 11:42:24 -0400
Subject: drm/amdgpu: Fix warning in dma_fence_is_later on resume from S3.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: 7766484b4a18373ac557ce6ea442ef28517c8224
Patch-mainline: v4.19-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166
Problem:
amdgpu_ttm_set_buffer_funcs_status destroys adev->mman.entity on suspend
without releasing adev->mman.bdev.man[TTM_PL_VRAM].move fence
so on resume the new drm_sched_entity.fence_context causes
the warning against the old fence context which is different.
Fix:
When destroying sched_entity in amdgpu_ttm_set_buffer_funcs_status
release man->move and set the pointer to NULL.
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1928,6 +1928,8 @@ void amdgpu_ttm_set_buffer_funcs_status(
} else {
drm_sched_entity_destroy(adev->mman.entity.sched,
&adev->mman.entity);
+ dma_fence_put(man->move);
+ man->move = NULL;
}
/* this just adjusts TTM size idea, which sets lpfn to the correct value */