drm/amdkfd: fix dma mapping leaking warning
authorPhilip Yang <Philip.Yang@amd.com>
Tue, 14 Sep 2021 20:33:40 +0000 (16:33 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 23 Sep 2021 20:00:16 +0000 (16:00 -0400)
commitf63251184a81039ebc805306505838c2a073e51a
treec000570c30acca30d7aa23a770c20c24d9628095
parent7beb26dcedaa977ece5be7c712a66b7b6c66fc2b
drm/amdkfd: fix dma mapping leaking warning

For xnack off, restore work dma unmap previous system memory page, and
dma map the updated system memory page to update GPU mapping, this is
not dma mapping leaking, remove the WARN_ONCE for dma mapping leaking.

prange->dma_addr store the VRAM page pfn after the range migrated to
VRAM, should not dma unmap VRAM page when updating GPU mapping or
remove prange. Add helper svm_is_valid_dma_mapping_addr to check VRAM
page and error cases.

Mask out SVM_RANGE_VRAM_DOMAIN flag in dma_addr before calling amdgpu vm
update to avoid BUG_ON(*addr & 0xFFFF00000000003FULL), and set it again
immediately after. This flag is used to know the type of page later to
dma unmapping system memory page.

Fixes: 1d5dbfe6c06a ("drm/amdkfd: classify and map mixed svm range pages in GPU")
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_svm.c