From a8b1c724d28bc5ee295255fc514745d2af0dc5a9 Mon Sep 17 00:00:00 2001 From: Alex Sierra Date: Tue, 7 Jul 2026 13:34:47 -0500 Subject: [PATCH] drm/amd: force remote MTYPE_NC on GFX12.1 mtype_local=0 Work around this in both the amdgpu GMC and KFD SVM paths by explicitly selecting MTYPE_NC for remote memory when amdgpu_mtype_local is 0. Remove this once rev_id-based AID detection is reliable. Signed-off-by: Alex Sierra Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c index ecd17ee16019..0d89cae582a8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c @@ -617,8 +617,9 @@ static void gmc_v12_1_get_coherence_flags(struct amdgpu_device *adev, mtype_local = is_aid_a1 ? MTYPE_RW : MTYPE_NC; mtype_remote = is_aid_a1 ? MTYPE_NC : MTYPE_UC; if (amdgpu_mtype_local == 0) { - DRM_INFO_ONCE("Using MTYPE_RW for local memory\n"); + DRM_INFO_ONCE("Using MTYPE_RW for local memory and MTYPE_NC for remote memory\n"); mtype_local = MTYPE_RW; + mtype_remote = MTYPE_NC; } else if (amdgpu_mtype_local == 1) { DRM_INFO_ONCE("Using MTYPE_NC for local memory\n"); mtype_local = MTYPE_NC; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index fa4054d51f60..fb5eca38e6a9 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -1348,7 +1348,8 @@ svm_range_get_pte_flags(struct kfd_node *node, struct amdgpu_vm *vm, mtype_local = amdgpu_mtype_local == 0 ? AMDGPU_VM_MTYPE_RW : 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; + mtype_remote = amdgpu_mtype_local == 0 ? AMDGPU_VM_MTYPE_NC : + is_aid_a1 ? AMDGPU_VM_MTYPE_NC : AMDGPU_VM_MTYPE_UC; snoop = true; if (is_local) /* local HBM */ {