Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 dbe4c63689bc6b5fd3ab72650ea4b6a667e96a68)

authored by

Felix Kuehling and committed by
Alex Deucher
9397204f be593d9d

+5
+5
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
··· 199 199 break; 200 200 201 201 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 + 202 207 r = amdgpu_vram_mgr_alloc_sgt(adev, bo->tbo.resource, 0, 203 208 bo->tbo.base.size, attach->dev, 204 209 dir, &sgt);