[PATCH 1/2] drm/amdgpu: rework gmc_v9_0_get_coherence_flags v2

Felix Kuehling felix.kuehling at amd.com
Mon Jul 14 20:22:46 UTC 2025


On 2025-07-09 08:51, Christian König wrote:
> Avoid using the mapping here.
>
> v2: use amdgpu_xgmi_same_hive() as suggested by Felix
>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Felix Kuehling <felix.kuehling at amd.com>


> ---
>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 8 ++++----
>   1 file changed, 4 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 380b7b81ac1f..71f134d54fe1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -1124,8 +1124,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);
> @@ -1135,7 +1135,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;
> @@ -1165,7 +1164,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_xgmi_same_hive(adev, bo_adev))
>   					snoop = true;
>   			}
>   		} else {
> @@ -1257,7 +1256,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