From: Mukul Joshi <[email protected]>

On GFX 12.1 remote (non-local / system) memory accesses should always
be mapped as MTYPE_UC.

Signed-off-by: Mukul Joshi <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c | 11 +++++------
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c   |  4 ++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
index 302ebf2f3ccd1..fd24d66290f55 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
@@ -638,20 +638,19 @@ static void gmc_v12_1_get_coherence_flags(struct 
amdgpu_device *adev,
                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;
+               /* Remote memory always uses MTYPE_UC on GFX 12.1. */
+               mtype_remote = MTYPE_UC;
                if (amdgpu_mtype_local == 0) {
-                       DRM_INFO_ONCE("Using MTYPE_RW for local memory and 
MTYPE_NC for remote memory\n");
+                       DRM_INFO_ONCE("Using MTYPE_RW for local 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;
                } else if (amdgpu_mtype_local == 2) {
                        DRM_INFO_ONCE("MTYPE_CC not supported, using %s for 
local memory\n", is_aid_a1 ? "MTYPE_RW" : "MTYPE_NC");
                } else {
-                       DRM_INFO_ONCE("Using %s for local memory and %s for 
remote memory\n",
-                                       is_aid_a1 ? "MTYPE_RW" : "MTYPE_NC",
-                                       is_aid_a1 ? "MTYPE_NC" : "MTYPE_UC");
+                       DRM_INFO_ONCE("Using %s for local memory and MTYPE_UC 
for remote memory\n",
+                                       is_aid_a1 ? "MTYPE_RW" : "MTYPE_NC");
                }
 
                is_local = (is_vram && adev == bo_adev);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index fb5eca38e6a93..64fb38400bd1a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1348,8 +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 = amdgpu_mtype_local == 0 ? AMDGPU_VM_MTYPE_NC :
-                               is_aid_a1 ? AMDGPU_VM_MTYPE_NC : 
AMDGPU_VM_MTYPE_UC;
+               /* Remote memory always uses MTYPE_UC on GFX 12.1. */
+               mtype_remote = AMDGPU_VM_MTYPE_UC;
                snoop = true;
 
                if (is_local) /* local HBM  */ {
-- 
2.55.0

Reply via email to