drm/amdgpu: Update MTYPE for GFX12.1

Update MTYPE for GFX12.1 for AID A0 and A1

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Philip.Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Harish Kasiviswanathan 2026-01-29 14:17:22 -05:00 committed by Alex Deucher
parent e040301393
commit f6e9582a7f
2 changed files with 22 additions and 19 deletions

View File

@ -524,13 +524,16 @@ static void gmc_v12_1_get_coherence_flags(struct amdgpu_device *adev,
bool ext_coherent = bo->flags & AMDGPU_GEM_CREATE_EXT_COHERENT;
uint32_t gc_ip_version = amdgpu_ip_version(adev, GC_HWIP, 0);
bool uncached = bo->flags & AMDGPU_GEM_CREATE_UNCACHED;
unsigned int mtype, mtype_local;
unsigned int mtype, mtype_local, mtype_remote;
bool snoop = false;
bool is_local = false;
switch (gc_ip_version) {
case IP_VERSION(12, 1, 0):
mtype_local = MTYPE_RW;
bool is_aid_a1 = (adev->rev_id & 0x10);
mtype_local = is_aid_a1 ? MTYPE_RW : MTYPE_NC;
mtype_remote = is_aid_a1 ? MTYPE_NC : MTYPE_UC;
if (amdgpu_mtype_local == 1) {
DRM_INFO_ONCE("Using MTYPE_NC for local memory\n");
mtype_local = MTYPE_NC;
@ -547,10 +550,7 @@ static void gmc_v12_1_get_coherence_flags(struct amdgpu_device *adev,
} else if (ext_coherent) {
mtype = is_local ? mtype_local : MTYPE_UC;
} else {
if (is_local)
mtype = mtype_local;
else
mtype = MTYPE_NC;
mtype = is_local ? mtype_local : mtype_remote;
}
break;
default:

View File

@ -1219,7 +1219,7 @@ svm_range_get_pte_flags(struct kfd_node *node, struct amdgpu_vm *vm,
bool snoop = (domain != SVM_RANGE_VRAM_DOMAIN);
bool coherent = flags & (KFD_IOCTL_SVM_FLAG_COHERENT | KFD_IOCTL_SVM_FLAG_EXT_COHERENT);
bool ext_coherent = flags & KFD_IOCTL_SVM_FLAG_EXT_COHERENT;
unsigned int mtype_local;
unsigned int mtype_local, mtype_remote;
if (domain == SVM_RANGE_VRAM_DOMAIN)
bo_node = prange->svm_bo->node;
@ -1307,20 +1307,23 @@ svm_range_get_pte_flags(struct kfd_node *node, struct amdgpu_vm *vm,
mapping_flags |= AMDGPU_VM_MTYPE_NC;
break;
case IP_VERSION(12, 1, 0):
bool is_aid_a1 = (node->adev->rev_id & 0x10);
bool is_local = (domain == SVM_RANGE_VRAM_DOMAIN) &&
(bo_node->adev == node->adev);
mtype_local = amdgpu_mtype_local == 1 ? AMDGPU_VM_MTYPE_NC :
is_aid_a1 ?
AMDGPU_VM_MTYPE_RW : AMDGPU_VM_MTYPE_NC;
mtype_remote = is_aid_a1 ? AMDGPU_VM_MTYPE_NC : AMDGPU_VM_MTYPE_UC;
snoop = true;
if (domain == SVM_RANGE_VRAM_DOMAIN) {
mtype_local = amdgpu_mtype_local == 1 ? AMDGPU_VM_MTYPE_NC :
AMDGPU_VM_MTYPE_RW;
/* local HBM */
if (bo_node->adev == node->adev)
mapping_flags |= mtype_local;
/* Remote GPU memory */
else
mapping_flags |= ext_coherent ? AMDGPU_VM_MTYPE_UC :
AMDGPU_VM_MTYPE_NC;
/* system memory accessed by the dGPU */
if (is_local) /* local HBM */ {
mapping_flags |= mtype_local;
} else if (ext_coherent) {
mapping_flags |= AMDGPU_VM_MTYPE_UC;
} else {
mapping_flags |= ext_coherent ? AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
/* system memory or remote VRAM */
mapping_flags |= mtype_remote;
}
break;
default: