History

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.

Rajneesh Bhardwaj committed 4 years ago

Commit ef75a6e1 parent a8027fc2 files · +19 −0Browse files

Unified · Split

2 files
  1. drivers/gpu/drm/amd/amdkfd/kfd_svm.c +17 −0
  2. include/uapi/linux/kfd_ioctl.h +2 −0
drivers/gpu/drm/amd/amdkfd/kfd_svm.c+17−0
@@ -1159,6 +1159,7 @@ svm_range_get_pte_flags(struct amdgpu_device *adev, struct svm_range *prange, · 1158 unmodified lines
11591159 uint64_t pte_flags;
11601160 bool snoop = (domain != SVM_RANGE_VRAM_DOMAIN);
11611161 bool coherent = flags & KFD_IOCTL_SVM_FLAG_COHERENT;
1162+ bool uncached = flags & KFD_IOCTL_SVM_FLAG_UNCACHED;
11621163
11631164 if (domain == SVM_RANGE_VRAM_DOMAIN)
11641165 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, · 33 unmodified lines
11981199 AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
11991200 }
12001201 break;
1202+ case IP_VERSION(9, 4, 3):
1203+ //TODO: Need more work for handling multiple memory partitions
1204+ //e.g. NPS4. Current approch is only applicable without memory
1205+ //partitions.
1206+ snoop = true;
1207+ if (uncached)
1208+ mapping_flags |= AMDGPU_VM_MTYPE_UC;
1209+ /* local HBM region close to partition*/
1210+ else if (bo_adev == adev)
1211+ mapping_flags |= AMDGPU_VM_MTYPE_RW;
1212+ /* local HBM region far from partition or remote XGMI GPU or
1213+ * system memory
1214+ */
1215+ else
1216+ mapping_flags |= AMDGPU_VM_MTYPE_NC;
1217+ break;
12011218 default:
12021219 mapping_flags |= coherent ?
12031220 AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
include/uapi/linux/kfd_ioctl.h+2−0
@@ -623,6 +623,8 @@ enum kfd_mmio_remap { · 622 unmodified lines
623623 #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY 0x00000020
624624 /* Keep GPU memory mapping always valid as if XNACK is disable */
625625 #define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED 0x00000040
626+/* Uncached access to memory */
627+#define KFD_IOCTL_SVM_FLAG_UNCACHED 0x00000080
626628
627629 /**
628630 * kfd_ioctl_svm_op - SVM ioctl operations

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t