[PATCH] drm/amdgpu: Inherit coherence flags on dmabuf import

Christian König christian.koenig at amd.com
Fri Nov 4 16:04:20 UTC 2022


Am 04.11.22 um 16:40 schrieb Felix Kuehling:
> 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 <Gang.Ba at amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>

Acked-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> index 7bd8e33b14be..271e30e34d93 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> @@ -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,



More information about the amd-gfx mailing list