Commit 628e1ace authored by Sreekant Somasekharan's avatar Sreekant Somasekharan Committed by Alex Deucher

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 <joseph.greathouse@amd.com>
Cc: David Belanger <david.belanger@amd.com>
Signed-off-by: default avatarRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: default avatarSreekant Somasekharan <sreekant.somasekharan@amd.com>
Reviewed-by: default avatarHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a8a4615b
......@@ -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)
......
......@@ -1249,6 +1249,15 @@ svm_range_get_pte_flags(struct kfd_node *node,
mapping_flags |= AMDGPU_VM_MTYPE_UC;
}
break;
case IP_VERSION(12, 0, 0):
if (domain == SVM_RANGE_VRAM_DOMAIN) {
if (bo_node != node)
mapping_flags |= AMDGPU_VM_MTYPE_NC;
} else {
mapping_flags |= coherent ?
AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
}
break;
default:
mapping_flags |= coherent ?
AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment