drm/amdgpu: Inherit coherence flags on dmabuf import
Subsystems (2)
PATCH 1/1 drm/amdgpu: Inherit coherence flags on dmabuf import
When importing dmabufs from other amdgpu devices, inherit the coherence flags from the exported BO. This ensures correct MTYPEs in the GPU PTEs for multi-GPU mappings of shared BOs.
Fixes 763fbebb20e1 ("drm/amdgpu: Set MTYPE in PTE based on BO flags")
Tested-by Gang Ba <[email protected]>
Signed-off-by Felix Kuehling <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +3 -1
@@ -328,7 +328,9 @@ amdgpu_dma_buf_create_obj(struct drm_device *dev, struct dma_buf *dma_buf)if (dma_buf->ops == &amdgpu_dmabuf_ops) {struct amdgpu_bo *other =gem_to_amdgpu_bo (dma_buf->priv); - flags |= other->flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ; + flags |= other->flags & (AMDGPU_GEM_CREATE_CPU_GTT_USWC | +AMDGPU_GEM_CREATE_COHERENT | +AMDGPU_GEM_CREATE_UNCACHED ); } ret = amdgpu_gem_object_create(adev, dma_buf->size, PAGE_SIZE,
Signature · 1 line
2.32.0
Am 04.11.22 um 16:40 schrieb Felix Kuehling:
Quoted 7 lines
When importing dmabufs from other amdgpu devices, inherit the coherence flags from the exported BO. This ensures correct MTYPEs in the GPU PTEs for multi-GPU mappings of shared BOs.
Fixes 763fbebb20e1 ("drm/amdgpu: Set MTYPE in PTE based on BO flags")Tested-by Gang Ba <[email protected]>Signed-off-by Felix Kuehling <[email protected]>
Acked-by Christian König <[email protected]>
Quoted 19 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +3
-1@@ -328,7 +328,9 @@ amdgpu_dma_buf_create_obj(struct drm_device *dev, struct dma_buf *dma_buf)if (dma_buf->ops == &amdgpu_dmabuf_ops) {struct amdgpu_bo *other =gem_to_amdgpu_bo (dma_buf->priv); - flags |= other->flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ; + flags |= other->flags & (AMDGPU_GEM_CREATE_CPU_GTT_USWC | +AMDGPU_GEM_CREATE_COHERENT | +AMDGPU_GEM_CREATE_UNCACHED ); } ret = amdgpu_gem_object_create(adev, dma_buf->size, PAGE_SIZE,