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;
} 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:
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;
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: