From: Graham Sider <[email protected]>

Revert temporary dGPU VRAM MTYPE setting and align with expected
coherency protocol.

Signed-off-by: Graham Sider <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 15 +++++----------
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c  |  8 ++------
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 5c9a0f3d5581..7564c6b237eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1220,17 +1220,12 @@ static void gmc_v9_0_get_coherence_flags(struct 
amdgpu_device *adev,
                        mtype = MTYPE_RW;
                } else {
                        /* dGPU */
-                       /*
-                       if ((mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) &&
-                           bo_adev == adev)
-                               mapping_flags |= AMDGPU_VM_MTYPE_RW;
+                       if (is_vram && bo_adev == adev)
+                               mtype = MTYPE_RW;
+                       else if (is_vram)
+                               mtype = MTYPE_NC;
                        else
-                       */
-                       /* Temporarily comment out above lines and use MTYPE_NC
-                        * on both VRAM and system memory access until
-                        * MTYPE_RW can properly work on VRAM access
-                        */
-                       mtype = MTYPE_NC;
+                               mtype = MTYPE_UC;
                }
 
                break;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index efd2bffbb892..89c0f3b333d3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1195,13 +1195,9 @@ svm_range_get_pte_flags(struct kfd_node *node,
                if (uncached) {
                        mapping_flags |= AMDGPU_VM_MTYPE_UC;
                } else if (domain == SVM_RANGE_VRAM_DOMAIN) {
-                       /* local HBM region close to partition with a workaround
-                        * for Endpoint systems.
-                        */
+                       /* local HBM region close to partition */
                        if (bo_node == node)
-                               mapping_flags |=
-                                       (node->adev->flags & AMD_IS_APU) ?
-                                       AMDGPU_VM_MTYPE_RW : AMDGPU_VM_MTYPE_NC;
+                               mapping_flags |= AMDGPU_VM_MTYPE_RW;
                        /* local HBM region far from partition or remote XGMI 
GPU */
                        else if (svm_nodes_in_same_hive(bo_node, node))
                                mapping_flags |= AMDGPU_VM_MTYPE_NC;
-- 
2.39.2

Reply via email to