summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
diff options
context:
space:
mode:
authorRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>2022-03-03 18:56:05 +0300
committerAlex Deucher <alexander.deucher@amd.com>2023-06-09 16:43:13 +0300
commitef75a6ef37235e211bbdb17c25e5f79c55df1750 (patch)
treed96f32a69c527499ef2886c6cc4c0d244eabe8fb /drivers/gpu/drm/amd/amdkfd/kfd_svm.c
parenta8027fcd08f9127d38edeb59600ecb76c56a121a (diff)
downloadlinux-ef75a6ef37235e211bbdb17c25e5f79c55df1750.tar.xz
drm/amdkfd: Update coherence settings for svm ranges
Recently introduced commit "drm/amdgpu: Set cache coherency for GC 9.4.3" did not update the settings applicable for svm ranges. Add the coherence settings for svm ranges for GFX IP 9.4.3. Reviewed-by: Amber Lin <amber.lin@amd.com> Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_svm.c')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_svm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 96ccff79902c..4b4f3bf8b823 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1159,6 +1159,7 @@ svm_range_get_pte_flags(struct amdgpu_device *adev, struct svm_range *prange,
uint64_t pte_flags;
bool snoop = (domain != SVM_RANGE_VRAM_DOMAIN);
bool coherent = flags & KFD_IOCTL_SVM_FLAG_COHERENT;
+ bool uncached = flags & KFD_IOCTL_SVM_FLAG_UNCACHED;
if (domain == SVM_RANGE_VRAM_DOMAIN)
bo_adev = amdgpu_ttm_adev(prange->svm_bo->bo->tbo.bdev);
@@ -1198,6 +1199,22 @@ svm_range_get_pte_flags(struct amdgpu_device *adev, struct svm_range *prange,
AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
}
break;
+ case IP_VERSION(9, 4, 3):
+ //TODO: Need more work for handling multiple memory partitions
+ //e.g. NPS4. Current approch is only applicable without memory
+ //partitions.
+ snoop = true;
+ if (uncached)
+ mapping_flags |= AMDGPU_VM_MTYPE_UC;
+ /* local HBM region close to partition*/
+ else if (bo_adev == adev)
+ mapping_flags |= AMDGPU_VM_MTYPE_RW;
+ /* local HBM region far from partition or remote XGMI GPU or
+ * system memory
+ */
+ else
+ mapping_flags |= AMDGPU_VM_MTYPE_NC;
+ break;
default:
mapping_flags |= coherent ?
AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;