drm/amdgpu: Control NPA DMA-buf importing

NPA DMA-Bufs can only be imported on the same device as the
original BO. In source-identification mode NPA addresses are
importer-specific. Each GPU needs to import the UALink handle
by themselves. Sharing the NPA addresses between devices is
meaningless and potentially dangerous. Put controls to ensure
this is not violated.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Mukul Joshi 2025-11-12 14:00:01 -05:00 committed by Alex Deucher
parent 42cb7c53fa
commit 89496dcdca

View File

@ -558,6 +558,11 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
*/
drm_gem_object_get(obj);
return obj;
} else {
struct ttm_resource *mem = gem_to_amdgpu_bo(obj)->tbo.resource;
/* NPA DMA-buf can only be imported on the same device. */
if (mem && mem->mem_type == AMDGPU_PL_NPA)
return ERR_PTR(-EPERM);
}
}