Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd: update mtype flags for gfx 9.5.0

Update mtype flags to meet gfx 9.5.0 requirements for remote GPU
memory and system memory.

Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Harish Kasiviswanathan <harish.kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Alex Sierra and committed by
Alex Deucher
dad0c705 1f91cc4d

+16 -8
+4 -4
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 1209 1209 if (uncached) { 1210 1210 mtype = MTYPE_UC; 1211 1211 } else if (ext_coherent) { 1212 - if (adev->rev_id) 1212 + if (gc_ip_version == IP_VERSION(9, 5, 0) || adev->rev_id) 1213 1213 mtype = is_local ? MTYPE_CC : MTYPE_UC; 1214 1214 else 1215 1215 mtype = MTYPE_UC; ··· 1219 1219 /* dGPU */ 1220 1220 if (is_local) 1221 1221 mtype = mtype_local; 1222 - else if (is_vram) 1223 - mtype = MTYPE_NC; 1224 - else 1222 + else if (gc_ip_version < IP_VERSION(9, 5, 0) && !is_vram) 1225 1223 mtype = MTYPE_UC; 1224 + else 1225 + mtype = MTYPE_NC; 1226 1226 } 1227 1227 1228 1228 break;
+12 -4
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
··· 1244 1244 case IP_VERSION(9, 4, 4): 1245 1245 case IP_VERSION(9, 5, 0): 1246 1246 if (ext_coherent) 1247 - mtype_local = node->adev->rev_id ? AMDGPU_VM_MTYPE_CC : AMDGPU_VM_MTYPE_UC; 1247 + mtype_local = (gc_ip_version < IP_VERSION(9, 5, 0) && !node->adev->rev_id) ? 1248 + AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_CC; 1248 1249 else 1249 1250 mtype_local = amdgpu_mtype_local == 1 ? AMDGPU_VM_MTYPE_NC : 1250 1251 amdgpu_mtype_local == 2 ? AMDGPU_VM_MTYPE_CC : AMDGPU_VM_MTYPE_RW; ··· 1260 1259 */ 1261 1260 else if (svm_nodes_in_same_hive(bo_node, node) && !ext_coherent) 1262 1261 mapping_flags |= AMDGPU_VM_MTYPE_NC; 1263 - /* PCIe P2P or extended system scope coherence */ 1264 - else 1262 + /* PCIe P2P on GPUs pre-9.5.0 */ 1263 + else if (gc_ip_version < IP_VERSION(9, 5, 0) && 1264 + !svm_nodes_in_same_hive(bo_node, node)) 1265 1265 mapping_flags |= AMDGPU_VM_MTYPE_UC; 1266 + /* Other remote memory */ 1267 + else 1268 + mapping_flags |= ext_coherent ? AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC; 1266 1269 /* system memory accessed by the APU */ 1267 1270 } else if (node->adev->flags & AMD_IS_APU) { 1268 1271 /* On NUMA systems, locality is determined per-page ··· 1278 1273 mapping_flags |= ext_coherent ? AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC; 1279 1274 /* system memory accessed by the dGPU */ 1280 1275 } else { 1281 - mapping_flags |= AMDGPU_VM_MTYPE_UC; 1276 + if (gc_ip_version < IP_VERSION(9, 5, 0)) 1277 + mapping_flags |= AMDGPU_VM_MTYPE_UC; 1278 + else 1279 + mapping_flags |= AMDGPU_VM_MTYPE_NC; 1282 1280 } 1283 1281 break; 1284 1282 case IP_VERSION(12, 0, 0):