[PATCH 1/3] drm/amdgpu: rework gmc_v9_0_get_coherence_flags

Christian König christian.koenig at amd.com
Wed Jun 25 12:47:49 UTC 2025


Primarily @Felix gentle ping. This is a prerequisite to Davids work.

Regards,
Christian.

On 06.06.25 14:57, Christian König wrote:
> Avoid using the mapping here.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index e691cc61ef6e..cad014c3bbf7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -30,6 +30,7 @@
>  #include "gmc_v9_0.h"
>  #include "amdgpu_atomfirmware.h"
>  #include "amdgpu_gem.h"
> +#include "amdgpu_dma_buf.h"
>  
>  #include "gc/gc_9_0_sh_mask.h"
>  #include "dce/dce_12_0_offset.h"
> @@ -1131,8 +1132,8 @@ static void gmc_v9_0_get_vm_pde(struct amdgpu_device *adev, int level,
>  }
>  
>  static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev,
> +					 struct amdgpu_vm *vm,
>  					 struct amdgpu_bo *bo,
> -					 struct amdgpu_bo_va_mapping *mapping,
>  					 uint64_t *flags)
>  {
>  	struct amdgpu_device *bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);
> @@ -1142,7 +1143,6 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev,
>  				     AMDGPU_GEM_CREATE_EXT_COHERENT);
>  	bool ext_coherent = bo->flags & AMDGPU_GEM_CREATE_EXT_COHERENT;
>  	bool uncached = bo->flags & AMDGPU_GEM_CREATE_UNCACHED;
> -	struct amdgpu_vm *vm = mapping->bo_va->base.vm;
>  	unsigned int mtype_local, mtype;
>  	uint32_t gc_ip_version = amdgpu_ip_version(adev, GC_HWIP, 0);
>  	bool snoop = false;
> @@ -1172,7 +1172,7 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev,
>  					mtype = MTYPE_UC;
>  				else
>  					mtype = MTYPE_NC;
> -				if (mapping->bo_va->is_xgmi)
> +				if (amdgpu_dmabuf_is_xgmi_accessible(adev, bo))
>  					snoop = true;
>  			}
>  		} else {
> @@ -1264,7 +1264,8 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev,
>  	}
>  
>  	if ((*flags & AMDGPU_PTE_VALID) && bo)
> -		gmc_v9_0_get_coherence_flags(adev, bo, mapping, flags);
> +		gmc_v9_0_get_coherence_flags(adev, mapping->bo_va->base.vm, bo,
> +					     flags);
>  }
>  
>  static void gmc_v9_0_override_vm_pte_flags(struct amdgpu_device *adev,



More information about the amd-gfx mailing list