diff options
| author | Mukul Joshi <mukul.joshi@amd.com> | 2025-11-12 14:00:01 -0500 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2026-09-02 15:29:25 -0400 |
| commit | 89496dcdca7873eb7457bdaeb1c142aee1914d2f (patch) | |
| tree | 3988c9c027660f19abc6fdb91c8de7e37851dfa8 | |
| parent | 42cb7c53fa2894a8592fa75fef34cf404a9f0945 (diff) | |
| download | linux-next-89496dcdca7873eb7457bdaeb1c142aee1914d2f.tar.gz linux-next-89496dcdca7873eb7457bdaeb1c142aee1914d2f.zip | |
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>
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c index b33c300e26e2..b4fbd8a407f1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c @@ -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); } } |
