Use KFD_IOC_ALLOC_MEM_FLAGS_COHERENT for fine-grained memory

Use KFD_IOC_ALLOC_MEM_FLAGS_COHERENT when allocating fine-grained
memory and doorbell BOs so that they will be mapped with MTYPE_UC
on GFX9 hardware.

Change-Id: I51adf45b13105f479e6bcdaf54955b467920ee9a
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
This commit is contained in:
Felix Kuehling
2016-11-15 14:37:31 -05:00
parent e5dd2f88c6
commit 8cb89b6926
+6 -3
View File
@@ -1023,7 +1023,8 @@ void *fmm_allocate_doorbell(uint32_t gpu_id, uint64_t MemorySizeInBytes,
/* Use fine-grained aperture */
aperture = &svm.dgpu_alt_aperture;
ioc_flags = KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL;
ioc_flags = KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL |
KFD_IOC_ALLOC_MEM_FLAGS_COHERENT;
mem = __fmm_allocate_device(gpu_id, MemorySizeInBytes,
aperture, 0, NULL,
@@ -1109,10 +1110,12 @@ static void* fmm_allocate_host_gpu(uint32_t node_id, uint64_t MemorySizeInBytes,
size = MemorySizeInBytes;
ioc_flags = 0;
if (flags.ui32.CoarseGrain)
if (flags.ui32.CoarseGrain) {
aperture = &svm.dgpu_aperture;
else
} else {
aperture = &svm.dgpu_alt_aperture; /* coherent */
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_COHERENT;
}
if (flags.ui32.AQLQueueMemory) {
size = MemorySizeInBytes * 2;
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_DGPU_AQL_QUEUE_MEM;