drm/amdkfd: avoid conflicting address mappings
authorAlex Sierra <alex.sierra@amd.com>
Mon, 7 Jun 2021 18:14:50 +0000 (13:14 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 13 Oct 2021 18:14:34 +0000 (14:14 -0400)
commit71cbfeb38141928f65dd84db61df01e36119cceb
treef39e4319a2b4d51f37691dd366488bca046054fa
parent369b7d04baf3334d3473b2bb0b210a4e51d7bb67
drm/amdkfd: avoid conflicting address mappings

[Why]
Avoid conflict with address ranges mapped by SVM
mechanism that try to be allocated again through
ioctl_alloc in the same process. And viceversa.

[How]
For ioctl_alloc_memory_of_gpu allocations
Check if the address range passed into ioctl memory
alloc does not exist already in the kfd_process
svms->objects interval tree.

For SVM allocations
Look for the address range into the interval tree VA from
the VM inside of each pdds used in a kfd_process.

Signed-off-by: Alex Sierra <alex.sierra@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_chardev.c
drivers/gpu/drm/amd/amdkfd/kfd_svm.c