Skip to content

Commit 9397204

Browse files
fxkamdalexdeucher
authored andcommitted
drm/amdgpu: Fail DMABUF map of XGMI-accessible memory
If peer memory is XGMI-accessible, we should never access it through PCIe P2P DMA mappings. PCIe P2P is slower, has different coherence behaviour, limited or no support for atomics, or may not work at all. Fail with a warning if DMABUF mappings of such memory are attempted. Signed-off-by: Felix Kuehling <felix.kuehling@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit dbe4c63)
1 parent be593d9 commit 9397204

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ static struct sg_table *amdgpu_dma_buf_map(struct dma_buf_attachment *attach,
199199
break;
200200

201201
case TTM_PL_VRAM:
202+
/* XGMI-accessible memory should never be DMA-mapped */
203+
if (WARN_ON(amdgpu_dmabuf_is_xgmi_accessible(
204+
dma_buf_attach_adev(attach), bo)))
205+
return ERR_PTR(-EINVAL);
206+
202207
r = amdgpu_vram_mgr_alloc_sgt(adev, bo->tbo.resource, 0,
203208
bo->tbo.base.size, attach->dev,
204209
dir, &sgt);

0 commit comments

Comments
 (0)