From 628e1ace23796d74a34d85833a60dd0d20ecbdb7 Mon Sep 17 00:00:00 2001 From: Sreekant Somasekharan Date: Tue, 26 Mar 2024 16:19:28 -0400 Subject: [PATCH 0187/1625] drm/amdkfd: mark GFX12 system and peer GPU memory mappings as MTYPE_NC Due to a HW bug, the system memory mappings and peer GPU mappings on GFX12 need to be marked as MTYPE_NC. Cc: Joe Greathouse Cc: David Belanger Signed-off-by: Rajneesh Bhardwaj Signed-off-by: Sreekant Somasekharan Reviewed-by: Harish Kasiviswanathan Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c index c24f5bd3e09c..3e6676fdc187 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c @@ -497,6 +497,10 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev, uint64_t *flags) { struct amdgpu_bo *bo = mapping->bo_va->base.bo; + struct amdgpu_device *bo_adev = amdgpu_ttm_adev(bo->tbo.bdev); + bool coherent = bo->flags & AMDGPU_GEM_CREATE_COHERENT; + bool is_system = bo->tbo.resource->mem_type == TTM_PL_SYSTEM; + *flags &= ~AMDGPU_PTE_EXECUTABLE; *flags |= mapping->flags & AMDGPU_PTE_EXECUTABLE; @@ -515,6 +519,11 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev, AMDGPU_GEM_CREATE_UNCACHED)) *flags = (*flags & ~AMDGPU_PTE_MTYPE_GFX12_MASK) | AMDGPU_PTE_MTYPE_GFX12(MTYPE_UC); + + /* WA for HW bug */ + if ((bo && is_system) || ((bo_adev != adev) && coherent)) + *flags |= AMDGPU_PTE_MTYPE_GFX12(MTYPE_NC); + } static unsigned gmc_v12_0_get_vbios_fb_size(struct amdgpu_device *adev) -- 2.52.0