drm/amdgpu: amdgpu_ttm_gart_bind set gtt bound flag
authorPhilip Yang <Philip.Yang@amd.com>
Mon, 11 Mar 2024 22:07:34 +0000 (18:07 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 20 Mar 2024 17:12:57 +0000 (13:12 -0400)
Otherwise after the GTT bo is released, the GTT and gart space is freed
but amdgpu_ttm_backend_unbind will not clear the gart page table entry
and leave valid mapping entry pointing to the stale system page. Then
if GPU access the gart address mistakely, it will read undefined value
instead page fault, harder to debug and reproduce the real issue.

Cc: stable@vger.kernel.org
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index 8722beb..fc418e6 100644 (file)
@@ -864,6 +864,7 @@ static void amdgpu_ttm_gart_bind(struct amdgpu_device *adev,
                amdgpu_gart_bind(adev, gtt->offset, ttm->num_pages,
                                 gtt->ttm.dma_address, flags);
        }
+       gtt->bound = true;
 }
 
 /*