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
1159 uint64_t pte_flags;1159 uint64_t pte_flags;
1160 bool snoop = (domain != SVM_RANGE_VRAM_DOMAIN);1160 bool snoop = (domain != SVM_RANGE_VRAM_DOMAIN);
1161 bool coherent = flags & KFD_IOCTL_SVM_FLAG_COHERENT;1161 bool coherent = flags & KFD_IOCTL_SVM_FLAG_COHERENT;
1162 bool uncached = flags & KFD_IOCTL_SVM_FLAG_UNCACHED;
1162 1163
1163 if (domain == SVM_RANGE_VRAM_DOMAIN)1164 if (domain == SVM_RANGE_VRAM_DOMAIN)
1164 bo_adev = amdgpu_ttm_adev(prange->svm_bo->bo->tbo.bdev);1165 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
1198 AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;1199 AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
1199 }1200 }
1200 break;1201 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;
1201 default:1218 default:
1202 mapping_flags |= coherent ?1219 mapping_flags |= coherent ?
1203 AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;1220 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
623#define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY 0x00000020623#define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY 0x00000020
624/* Keep GPU memory mapping always valid as if XNACK is disable */624/* Keep GPU memory mapping always valid as if XNACK is disable */
625#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED 0x00000040625#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED 0x00000040
626/* Uncached access to memory */
627#define KFD_IOCTL_SVM_FLAG_UNCACHED 0x00000080
626 628
627/**629/**
628 * kfd_ioctl_svm_op - SVM ioctl operations630 * 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