drm/amdkfd: Move gfx9 MQD to HBM
Subsystems (3)
v2 cover drm/amdkfd: Move gfx9 MQD to HBM
To reduce multiple queues switch latency, move user queues MQD to HBM, and map on GART with mtype RW.
v2: patch 4 GART mapping use MC address, vram_base_offset + physical address
Philip Yang (4):
drm/amdkfd: Bind gfx9 MQD in GART with mtype RW drm/amdkfd: Add domain parameter to alloc kernel BO drm/amdkfd: Move gfx9 MQD to VRAM domain drm/amdkfd: Map VRAM MQD on GART
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 115 +++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 + drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 +- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 1 + .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 9 ++ .../amd/amdkfd/kfd_process_queue_manager.c | 2 + 12 files changed, 124 insertions(+), 24 deletions(-)
Signature · 1 line
2.50.1
PATCH v2 1/4 drm/amdkfd: Bind gfx9 MQD in GART with mtype RW
For gfx9, bind MQD in GART with mtype RW to enable caching, to reduce queue switch latency.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 + 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -0
@@ -841,6 +841,8 @@ static void amdgpu_ttm_gart_bind_gfx9_mqd(struct amdgpu_device *adev,int i;uint64_t ctrl_flags =AMDGPU_PTE_MTYPE_VG10 (flags,AMDGPU_MTYPE_NC ); + flags =AMDGPU_PTE_MTYPE_VG10 (flags,AMDGPU_MTYPE_RW ); + pages_per_xcc = total_pages;do_div (pages_per_xcc, num_xcc);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 -0
@@ -101,6 +101,7 @@ struct amdgpu_bo_vm; AMDGPU_PTE_MTYPE_VG10_SHIFT(mtype))#define AMDGPU_MTYPE_NC 0 +#define AMDGPU_MTYPE_RW 1#define AMDGPU_MTYPE_CC 2#define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \
Signature · 1 line
2.50.1
Kuehling, Felix
maintainerRe: [PATCH v2 1/4] drm/amdkfd: Bind gfx9 MQD in GART with mtype RW
Quoted 27 lines · Philip Yang
For gfx9, bind MQD in GART with mtype RW to enable caching, to reduce queue switch latency.
Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 + 2 files changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2
-0@@ -841,6 +841,8 @@ static void amdgpu_ttm_gart_bind_gfx9_mqd(struct amdgpu_device *adev,int i;uint64_t ctrl_flags =AMDGPU_PTE_MTYPE_VG10 (flags,AMDGPU_MTYPE_NC ); + flags =AMDGPU_PTE_MTYPE_VG10 (flags,AMDGPU_MTYPE_RW ); + pages_per_xcc = total_pages;do_div (pages_per_xcc, num_xcc);drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h struct amdgpu_bo_vm; · line 104
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1
-0@@ -101,6 +101,7 @@ struct amdgpu_bo_vm; AMDGPU_PTE_MTYPE_VG10_SHIFT(mtype))#define AMDGPU_MTYPE_NC 0 +#define AMDGPU_MTYPE_RW 1
This is probably not the right place to define this. MTYPE_RW is not universally available on all our GPUs. Not even on all GFX9 GPUs. This MTYPE definition needs to be in an ASIC-specific header file, and probably already exists somewhere.
Also, we can't use MTYPE_RW on GPUs that don't support it. I believe it was added in MI300.
Regards,
Felix
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0
-0#define AMDGPU_MTYPE_CC 2#define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \
Re: [PATCH v2 1/4] drm/amdkfd: Bind gfx9 MQD in GART with mtype RW
Quoted 33 lines · Felix
Quoted 26 lines · Philip Yang
For gfx9, bind MQD in GART with mtype RW to enable caching, to reduce queue switch latency.
Signed-off-by Philip Yang <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c| 2 ++
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +2 files changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-0@@ -841,6 +841,8 @@ static void amdgpu_ttm_gart_bind_gfx9_mqd(structamdgpu_device *adev, int i; uint64_t ctrl_flags = AMDGPU_PTE_MTYPE_VG10(flags, AMDGPU_MTYPE_NC); + flags = AMDGPU_PTE_MTYPE_VG10(flags, AMDGPU_MTYPE_RW); + pages_per_xcc = total_pages; do_div(pages_per_xcc, num_xcc);diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.hindex139642eacdd0..4dd15767a722100644drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h struct amdgpu_bo_vm; · line 103
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1
-0@@ -101,6 +101,7 @@ struct amdgpu_bo_vm; AMDGPU_PTE_MTYPE_VG10_SHIFT(mtype)) #define AMDGPU_MTYPE_NC 0 +#define AMDGPU_MTYPE_RW 1This is probably not the right place to define this.
MTYPE_RWis not universally available on all our GPUs. Not even on all GFX9 GPUs. This MTYPE definition needs to be in an ASIC-specific header file, and probably already exists somewhere.
Quoted 1 line
Also, we can't use
MTYPE_RWon GPUs that don't support it. I believe it was added in MI300.
Thanks, this is available for gfxv >= 9.4.1, will drop this patch and setup mtype before calling amdgpu_ttm_gart_bind.
Philip
Quoted 7 lines
Regards,
FelixQuoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0
-0#define AMDGPU_MTYPE_CC 2 #define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \
PATCH v2 2/4 drm/amdkfd: Add domain parameter to alloc kernel BO
In reply to Philip YangTo allocate kernel BO from VRAM domain for MQD in the following patch. No functional change because kernel BO allocate are all from GTT domain so far.
amdgpu_amdkfd_alloc_gtt_mem has many duplicate code as function amdgpu_bo_create_kernel, with one extra flag MQD_GFX9 to bind MQD and control stack in GART with different mtype, the duplicate code could be removed in future.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 ++ 7 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +3 -3
@@ -317,7 +317,7 @@ void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev) }int amdgpu_amdkfd_alloc_gtt_mem (struct amdgpu_device *adev,size_t size, -void **mem_obj,uint64_t *gpu_addr, +u32 domain,void **mem_obj,uint64_t *gpu_addr,void **cpu_ptr,bool cp_mqd_gfx9) {struct amdgpu_bo *bo =NULL ;
@@ -328,7 +328,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,memset (&bp,0 ,sizeof (bp)); bp.size = size; bp.byte_align =PAGE_SIZE ; - bp.domain =AMDGPU_GEM_DOMAIN_GTT ; + bp.domain = domain; bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC ; bp.type = ttm_bo_type_kernel; bp.resv =NULL ;
@@ -351,7 +351,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, goto allocate_mem_reserve_bo_failed; } - r =amdgpu_bo_pin (bo,AMDGPU_GEM_DOMAIN_GTT ); + r =amdgpu_bo_pin (bo, domain);if (r) {dev_err (adev->dev,"(%d) failed to pin bo for amdkfd\n" , r); goto allocate_mem_pin_bo_failed;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -1
@@ -237,7 +237,7 @@ int amdgpu_amdkfd_bo_validate_and_fence(struct amdgpu_bo *bo,#endif /* Shared API */ int amdgpu_amdkfd_alloc_gtt_mem (struct amdgpu_device *adev,size_t size, -void **mem_obj,uint64_t *gpu_addr, +u32 domain,void **mem_obj,uint64_t *gpu_addr,void **cpu_ptr,bool mqd_gfx9);void amdgpu_amdkfd_free_gtt_mem (struct amdgpu_device *adev,void **mem_obj); int amdgpu_amdkfd_alloc_gws(struct amdgpu_device *adev, size_t size,
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1 -0
@@ -359,6 +359,7 @@ int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd, bool sq_trap_en)if (!pdd->proc_ctx_cpu_ptr) { r = amdgpu_amdkfd_alloc_gtt_mem(adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr, &pdd->proc_ctx_cpu_ptr,
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -1
@@ -787,7 +787,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, size +=512 *1024 ;if (amdgpu_amdkfd_alloc_gtt_mem ( - kfd->adev, size, &kfd->gtt_mem, + kfd->adev, size,AMDGPU_GEM_DOMAIN_GTT , + &kfd->gtt_mem, &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr, false)) {dev_err (kfd_device,"Could not allocate %d bytes\n" , size);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -0
@@ -2906,6 +2906,7 @@ static int allocate_hiq_sdma_mqd(struct device_queue_manager *dqm) NUM_XCC(dqm->dev->xcc_mask)); retval =amdgpu_amdkfd_alloc_gtt_mem (dev->adev, size, +AMDGPU_GEM_DOMAIN_GTT , &(mem_obj->gtt_mem), &(mem_obj->gpu_addr), (void *)&(mem_obj->cpu_ptr), false);
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1 -0
@@ -139,6 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node, (ALIGN (q->ctl_stack_size,PAGE_SIZE ) +ALIGN (sizeof (struct v9_mqd ),PAGE_SIZE )) *NUM_XCC (node->xcc_mask), +AMDGPU_GEM_DOMAIN_GTT , &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr), (void *)&(mqd_mem_obj->cpu_ptr), true);
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +2 -0
@@ -266,6 +266,7 @@ static int init_user_queue(struct process_queue_manager *pqm,if (dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_GANG_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &(*q)->gang_ctx_bo, &(*q)->gang_ctx_gpu_addr, &(*q)->gang_ctx_cpu_ptr,
@@ -369,6 +370,7 @@ int pqm_create_queue(struct process_queue_manager *pqm,if (!pdd->proc_ctx_cpu_ptr && dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr, &pdd->proc_ctx_cpu_ptr,
Signature · 1 line
2.50.1
RE: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BO
[Public]
I know that it makes the change more complicated, but should we be renaming the function since we're no longer guaranteeing a GTT memory allocation in the alloc_gtt_mem function?
Kent
Quoted 160 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Philip Yang
Sent: Monday, December 1, 2025 9:29 AM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Yat Sin, David <[email protected]>; Yang, Philip <[email protected]>
Subject: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BOTo allocate kernel BO from VRAM domain for MQD in the following patch. No functional change because kernel BO allocate are all from GTT domain so far.
amdgpu_amdkfd_alloc_gtt_memhas many duplicate code as functionamdgpu_bo_create_kernel, with one extra flagMQD_GFX9to bind MQD and control stack in GART with different mtype, the duplicate code could be removed in future.Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 ++ 7 files changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1@@ -317,7 +317,7 @@ void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev) }int amdgpu_amdkfd_alloc_gtt_mem (struct amdgpu_device *adev,size_t size, -void **mem_obj,uint64_t *gpu_addr, +u32 domain,void **mem_obj,uint64_t *gpu_addr,void **cpu_ptr,bool cp_mqd_gfx9) {struct amdgpu_bo *bo = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1@@ -328,7 +328,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,memset (&bp,0 ,sizeof (bp)); bp.size = size; bp.byte_align =PAGE_SIZE ; - bp.domain =AMDGPU_GEM_DOMAIN_GTT ; + bp.domain = domain; bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC ; bp.type = ttm_bo_type_kernel;bp.resv = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1@@ -351,7 +351,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, goto allocate_mem_reserve_bo_failed; } - r =amdgpu_bo_pin (bo,AMDGPU_GEM_DOMAIN_GTT ); + r =amdgpu_bo_pin (bo, domain);if (r) {dev_err (adev->dev,"(%d) failed to pin bo for amdkfd\n" , r);goto allocate_mem_pin_bo_failed;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1
-1@@ -237,7 +237,7 @@ int amdgpu_amdkfd_bo_validate_and_fence(structamdgpu_bo *bo, #endif /* Shared API */ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, -void **mem_obj,uint64_t *gpu_addr, +u32 domain,void **mem_obj,uint64_t *gpu_addr,void **cpu_ptr,bool mqd_gfx9);void amdgpu_amdkfd_free_gtt_mem (struct amdgpu_device *adev,void **mem_obj);int amdgpu_amdkfd_alloc_gws(struct
amdgpu_device*adev,size_tsize,drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-0@@ -359,6 +359,7 @@ int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd, bool sq_trap_en)if (!pdd->proc_ctx_cpu_ptr) { r = amdgpu_amdkfd_alloc_gtt_mem(adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr,&pdd->proc_ctx_cpu_ptr,drivers/gpu/drm/amd/amdkfd/kfd_device.c +2
-1@@ -787,7 +787,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, size +=512 *1024 ;if (amdgpu_amdkfd_alloc_gtt_mem ( - kfd->adev, size, &kfd->gtt_mem, + kfd->adev, size,AMDGPU_GEM_DOMAIN_GTT , + &kfd->gtt_mem, &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr, false)) {dev_err (kfd_device,"Could not allocate %d bytes\n" , size);drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-0@@ -2906,6 +2906,7 @@ static int allocate_hiq_sdma_mqd(struct device_queue_manager *dqm) NUM_XCC(dqm->dev->xcc_mask)); retval =amdgpu_amdkfd_alloc_gtt_mem (dev->adev, size, +AMDGPU_GEM_DOMAIN_GTT , &(mem_obj->gtt_mem), &(mem_obj->gpu_addr), (void *)&(mem_obj->cpu_ptr), false);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1
-0@@ -139,6 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node, (ALIGN (q->ctl_stack_size,PAGE_SIZE ) +ALIGN (sizeof (struct v9_mqd ),PAGE_SIZE )) *NUM_XCC (node->xcc_mask), +AMDGPU_GEM_DOMAIN_GTT , &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr),(void *)&(mqd_mem_obj->cpu_ptr), true);drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1
-0@@ -266,6 +266,7 @@ static int init_user_queue(struct process_queue_manager *pqm, if (dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_GANG_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &(*q)->gang_ctx_bo, &(*q)->gang_ctx_gpu_addr,&(*q)->gang_ctx_cpu_ptr,drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1
-0@@ -369,6 +370,7 @@ int pqm_create_queue(struct process_queue_manager *pqm, if (!pdd->proc_ctx_cpu_ptr && dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr,&pdd->proc_ctx_cpu_ptr,--
2.50.1
Re: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BO
Quoted 3 lines · Kent
[Public]
I know that it makes the change more complicated, but should we be renaming the function since we're no longer guaranteeing a GTT memory allocation in the
alloc_gtt_memfunction?
yes, you are right, I have the patch to s/alloc_gtt_mem/alloc_kernel_mem/g, s/free_gtt_mem/free_kernel_mem/g, and found it is too much changes, not related to the purpose of this patch series, so I dropped that patch. We can cleanup this in the followup patch, probably remove the alloc/free_gtt_mem functions and use amdgpu_bo_create_kernel instead.
Regards,
Philip
Quoted 163 lines
Kent
Quoted 160 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Philip Yang
Sent: Monday, December 1, 2025 9:29 AM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Yat Sin, David <[email protected]>; Yang, Philip <[email protected]>
Subject: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BOTo allocate kernel BO from VRAM domain for MQD in the following patch. No functional change because kernel BO allocate are all from GTT domain so far.
amdgpu_amdkfd_alloc_gtt_memhas many duplicate code as functionamdgpu_bo_create_kernel, with one extra flagMQD_GFX9to bind MQD and control stack in GART with different mtype, the duplicate code could be removed in future.Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 ++ 7 files changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1@@ -317,7 +317,7 @@ void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev) }int amdgpu_amdkfd_alloc_gtt_mem (struct amdgpu_device *adev,size_t size, -void **mem_obj,uint64_t *gpu_addr, +u32 domain,void **mem_obj,uint64_t *gpu_addr,void **cpu_ptr,bool cp_mqd_gfx9) {struct amdgpu_bo *bo = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1@@ -328,7 +328,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,memset (&bp,0 ,sizeof (bp)); bp.size = size; bp.byte_align =PAGE_SIZE ; - bp.domain =AMDGPU_GEM_DOMAIN_GTT ; + bp.domain = domain; bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC ; bp.type = ttm_bo_type_kernel;bp.resv = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1@@ -351,7 +351,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, goto allocate_mem_reserve_bo_failed; } - r =amdgpu_bo_pin (bo,AMDGPU_GEM_DOMAIN_GTT ); + r =amdgpu_bo_pin (bo, domain);if (r) {dev_err (adev->dev,"(%d) failed to pin bo for amdkfd\n" , r);goto allocate_mem_pin_bo_failed;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1
-1@@ -237,7 +237,7 @@ int amdgpu_amdkfd_bo_validate_and_fence(structamdgpu_bo *bo, #endif /* Shared API */ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, -void **mem_obj,uint64_t *gpu_addr, +u32 domain,void **mem_obj,uint64_t *gpu_addr,void **cpu_ptr,bool mqd_gfx9);void amdgpu_amdkfd_free_gtt_mem (struct amdgpu_device *adev,void **mem_obj);int amdgpu_amdkfd_alloc_gws(struct
amdgpu_device*adev,size_tsize,drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-0@@ -359,6 +359,7 @@ int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd, bool sq_trap_en)if (!pdd->proc_ctx_cpu_ptr) { r = amdgpu_amdkfd_alloc_gtt_mem(adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr,&pdd->proc_ctx_cpu_ptr,drivers/gpu/drm/amd/amdkfd/kfd_device.c +2
-1@@ -787,7 +787,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, size +=512 *1024 ;if (amdgpu_amdkfd_alloc_gtt_mem ( - kfd->adev, size, &kfd->gtt_mem, + kfd->adev, size,AMDGPU_GEM_DOMAIN_GTT , + &kfd->gtt_mem, &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr, false)) {dev_err (kfd_device,"Could not allocate %d bytes\n" , size);drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-0@@ -2906,6 +2906,7 @@ static int allocate_hiq_sdma_mqd(struct device_queue_manager *dqm) NUM_XCC(dqm->dev->xcc_mask)); retval =amdgpu_amdkfd_alloc_gtt_mem (dev->adev, size, +AMDGPU_GEM_DOMAIN_GTT , &(mem_obj->gtt_mem), &(mem_obj->gpu_addr), (void *)&(mem_obj->cpu_ptr), false);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1
-0@@ -139,6 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node, (ALIGN (q->ctl_stack_size,PAGE_SIZE ) +ALIGN (sizeof (struct v9_mqd ),PAGE_SIZE )) *NUM_XCC (node->xcc_mask), +AMDGPU_GEM_DOMAIN_GTT , &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr),(void *)&(mqd_mem_obj->cpu_ptr), true);drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1
-0@@ -266,6 +266,7 @@ static int init_user_queue(struct process_queue_manager *pqm, if (dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_GANG_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &(*q)->gang_ctx_bo, &(*q)->gang_ctx_gpu_addr,&(*q)->gang_ctx_cpu_ptr,drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1
-0@@ -369,6 +370,7 @@ int pqm_create_queue(struct process_queue_manager *pqm, if (!pdd->proc_ctx_cpu_ptr && dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr,&pdd->proc_ctx_cpu_ptr,--
2.50.1
Russell, Kent
Reviewed-byRE: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BO
[AMD Official Use Only - AMD Internal Distribution Only]
Makes sense. This one can be
Quoted 194 lines
-----Original Message-----
From: Yang, Philip <[email protected]>
Sent: Monday, December 1, 2025 3:31 PM
To: Russell, Kent <[email protected]>; Yang, Philip <[email protected]>; [email protected]
Cc: Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Yat Sin, David <[email protected]>
Subject: Re: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BOQuoted 3 lines · Kent
[Public]
I know that it makes the change more complicated, but should we be renaming the
function since we're no longer guaranteeing a GTT memory allocation in the
alloc_gtt_memfunction?
yes, you are right, I have the patch to s/alloc_gtt_mem/alloc_kernel_mem/g, s/free_gtt_mem/free_kernel_mem/g, and found it is too much changes, not related to the purpose of this patch series, so I dropped that patch. We can cleanup this in the followup patch, probably remove the alloc/free_gtt_mem functions and useamdgpu_bo_create_kernelinstead.Regards,
PhilipQuoted 5 lines
Kent
Quoted 2 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of PhilipYang
Quoted 35 lines
Quoted 35 lines
Sent: Monday, December 1, 2025 9:29 AM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Yat Sin, David <[email protected]>; Yang, Philip <[email protected]>
Subject: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BOTo allocate kernel BO from VRAM domain for MQD in the following patch. No functional change because kernel BO allocate are all from GTT domain so far.
amdgpu_amdkfd_alloc_gtt_memhas many duplicate code as functionamdgpu_bo_create_kernel, with one extra flagMQD_GFX9to bind MQD and control stack in GART with different mtype, the duplicate code could be removed in future.Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 ++ 7 files changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0
-0@@ -317,7 +317,7 @@ void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev) }Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_alloc_gtt_mem(struct
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1int amdgpu_amdkfd_alloc_gtt_mem (struct amdgpu_device *adev,size_t size, -void **mem_obj,uint64_t *gpu_addr, +u32 domain,void **mem_obj,uint64_t *gpu_addr,void **cpu_ptr,bool cp_mqd_gfx9) {struct amdgpu_bo *bo = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0
-0@@ -328,7 +328,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct
amdgpu_deviceQuoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_alloc_gtt_mem(struct
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1*adev, size_t size,memset (&bp,0 ,sizeof (bp)); bp.size = size; bp.byte_align =PAGE_SIZE ; - bp.domain =AMDGPU_GEM_DOMAIN_GTT ; + bp.domain = domain; bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC ; bp.type = ttm_bo_type_kernel;bp.resv = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0
-0@@ -351,7 +351,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct
amdgpu_deviceQuoted 15 lines
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1*adev, size_t size, goto allocate_mem_reserve_bo_failed; } - r =amdgpu_bo_pin (bo,AMDGPU_GEM_DOMAIN_GTT ); + r =amdgpu_bo_pin (bo, domain);if (r) {dev_err (adev->dev,"(%d) failed to pin bo for amdkfd\n" , r);goto allocate_mem_pin_bo_failed;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +0
-0@@ -237,7 +237,7 @@ int amdgpu_amdkfd_bo_validate_and_fence(structQuoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h int amdgpu_amdkfd_bo_validate_and_fence(struct amdgpu_bo *bo,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1
-1amdgpu_bo *bo, #endif /* Shared API */ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, -void **mem_obj,uint64_t *gpu_addr, +u32 domain,void **mem_obj,uint64_t *gpu_addr,void **cpu_ptr,bool mqd_gfx9); void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void**mem_obj);
Quoted 56 lines
Quoted 56 lines
int amdgpu_amdkfd_alloc_gws(struct
amdgpu_device*adev,size_tsize,drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-0@@ -359,6 +359,7 @@ int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd, bool sq_trap_en)if (!pdd->proc_ctx_cpu_ptr) { r = amdgpu_amdkfd_alloc_gtt_mem(adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr,&pdd->proc_ctx_cpu_ptr,drivers/gpu/drm/amd/amdkfd/kfd_device.c +2
-1@@ -787,7 +787,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, size +=512 *1024 ;if (amdgpu_amdkfd_alloc_gtt_mem ( - kfd->adev, size, &kfd->gtt_mem, + kfd->adev, size,AMDGPU_GEM_DOMAIN_GTT , + &kfd->gtt_mem, &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr, false)) {dev_err (kfd_device,"Could not allocate %d bytes\n" , size);drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-0@@ -2906,6 +2906,7 @@ static int allocate_hiq_sdma_mqd(struct device_queue_manager *dqm) NUM_XCC(dqm->dev->xcc_mask)); retval =amdgpu_amdkfd_alloc_gtt_mem (dev->adev, size, +AMDGPU_GEM_DOMAIN_GTT , &(mem_obj->gtt_mem), &(mem_obj->gpu_addr), (void *)&(mem_obj->cpu_ptr), false);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1
-0@@ -139,6 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node, (ALIGN (q->ctl_stack_size,PAGE_SIZE ) +ALIGN (sizeof (struct v9_mqd ),PAGE_SIZE )) *NUM_XCC (node->xcc_mask), +AMDGPU_GEM_DOMAIN_GTT , &(mqd_mem_obj->gtt_mem),Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c static int init_user_queue(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0&(mqd_mem_obj->gpu_addr),(void *)&(mqd_mem_obj->cpu_ptr), true);drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +0
-0@@ -266,6 +266,7 @@ static int init_user_queue(struct
process_queue_managerQuoted 19 lines
Quoted 19 lines
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1
-0*pqm, if (dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_GANG_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &(*q)->gang_ctx_bo, &(*q)->gang_ctx_gpu_addr,&(*q)->gang_ctx_cpu_ptr,drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1
-0@@ -369,6 +370,7 @@ int pqm_create_queue(struct process_queue_manager *pqm, if (!pdd->proc_ctx_cpu_ptr && dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr,&pdd->proc_ctx_cpu_ptr,--
2.50.1
Kuehling, Felix
maintainerRe: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BO
In reply to Philip YangQuoted 7 lines · Philip Yang
Quoted 3 lines · Kent
[Public]
I know that it makes the change more complicated, but should we be renaming the function since we're no longer guaranteeing a GTT memory allocation in the
alloc_gtt_memfunction?yes, you are right, I have the patch to s/alloc_gtt_mem/alloc_kernel_mem/g, s/free_gtt_mem/free_kernel_mem/g, and found it is too much changes,
I see amdgpu_amdkfd_alloc_gtt_mem being called in 7 places in KFD. I don't think that's too much churn. You need to change all those places anyway to add a new parameter, so you might as well change the function name while you're there.
Regards,
Felix
Quoted 174 lines
not related to the purpose of this patch series, so I dropped that patch. We can cleanup this in the followup patch, probably remove the alloc/free_gtt_mem functions and use
amdgpu_bo_create_kernelinstead.Regards,
PhilipQuoted 169 lines
Kent
Quoted 166 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Philip Yang
Sent: Monday, December 1, 2025 9:29 AM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Yat Sin, David <[email protected]>; Yang, Philip <[email protected]>
Subject: [PATCH v2 2/4] drm/amdkfd: Add domain parameter to alloc kernel BOTo allocate kernel BO from VRAM domain for MQD in the following patch. No functional change because kernel BO allocate are all from GTT domain so far.
amdgpu_amdkfd_alloc_gtt_memhas many duplicate code as functionamdgpu_bo_create_kernel, with one extra flagMQD_GFX9to bind MQD and control stack in GART with different mtype, the duplicate code could be removed in future.Signed-off-by Philip Yang <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 1 +drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c| 2 ++7 files changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1@@ -317,7 +317,7 @@ void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev) } int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, - void **mem_obj, uint64_t *gpu_addr, + u32 domain, void **mem_obj, uint64_t *gpu_addr, void **cpu_ptr, bool cp_mqd_gfx9){
structamdgpu_bo*bo = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0
-0@@ -328,7 +328,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct
amdgpu_device
*adev,size_tsize,
memset(&bp, 0, sizeof(bp));
bp.size = size;
bp.byte_align =PAGE_SIZE;
- bp.domain =AMDGPU_GEM_DOMAIN_GTT;
+ bp.domain = domain;
bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC;
bp.type =ttm_bo_type_kernel;
bp.resv = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0
-0@@ -351,7 +351,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct
amdgpu_device
*adev,size_tsize,
gotoallocate_mem_reserve_bo_failed; }- r =
amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
+ r =amdgpu_bo_pin(bo, domain);
if (r) {
dev_err(adev->dev, "(%d) failed to pin bo for amdkfd\n", r); gotoallocate_mem_pin_bo_failed;drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1
-1@@ -237,7 +237,7 @@ int amdgpu_amdkfd_bo_validate_and_fence(structamdgpu_bo *bo, #endif /* Shared API */ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, - void **mem_obj, uint64_t *gpu_addr, + u32 domain, void **mem_obj, uint64_t *gpu_addr, void **cpu_ptr, bool mqd_gfx9);void
amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void **mem_obj); int amdgpu_amdkfd_alloc_gws(structamdgpu_device*adev,size_tsize,drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-0@@ -359,6 +359,7 @@ int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd, bool sq_trap_en) if (!pdd->proc_ctx_cpu_ptr) { r = amdgpu_amdkfd_alloc_gtt_mem(adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr,
&pdd->proc_ctx_cpu_ptr,drivers/gpu/drm/amd/amdkfd/kfd_device.c +0
-0@@ -787,7 +787,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, size += 512 * 1024;if (amdgpu_amdkfd_alloc_gtt_mem(
-kfd->adev, size,&kfd->gtt_mem,
+kfd->adev, size,AMDGPU_GEM_DOMAIN_GTT, +&kfd->gtt_mem,
&kfd->gtt_start_gpu_addr,&kfd->gtt_start_cpu_ptr, false)) {
dev_err(kfd_device, "Could not allocate %d bytes\n", size);drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-0@@ -2906,6 +2906,7 @@ static int allocate_hiq_sdma_mqd(struct device_queue_manager *dqm) NUM_XCC(dqm->dev->xcc_mask)); retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, size, + AMDGPU_GEM_DOMAIN_GTT, &(mem_obj->gtt_mem), &(mem_obj->gpu_addr), (void *)&(mem_obj->cpu_ptr), false);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0@@ -139,6 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct
kfd_node
*node,
(ALIGN(q->ctl_stack_size, PAGE_SIZE)+ALIGN(sizeof(struct v9_mqd), PAGE_SIZE)) *NUM_XCC(node->xcc_mask),
+AMDGPU_GEM_DOMAIN_GTT, &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr),
(void *)&(mqd_mem_obj->cpu_ptr), true);drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +0
-0@@ -266,6 +266,7 @@ static int init_user_queue(struct
process_queue_manager
*pqm,
if (dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev,AMDGPU_MES_GANG_CTX_SIZE,
+AMDGPU_GEM_DOMAIN_GTT,
&(*q)->gang_ctx_bo,
&(*q)->gang_ctx_gpu_addr,
&(*q)->gang_ctx_cpu_ptr,drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1
-0@@ -369,6 +370,7 @@ int pqm_create_queue(struct process_queue_manager *pqm, if (!pdd->proc_ctx_cpu_ptr && dev->kfd->shared_resources.enable_mes) { retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, AMDGPU_MES_PROC_CTX_SIZE, + AMDGPU_GEM_DOMAIN_GTT, &pdd->proc_ctx_bo, &pdd->proc_ctx_gpu_addr,
&pdd->proc_ctx_cpu_ptr,Signature · 1 line
2.50.1
PATCH v2 3/4 drm/amdkfd: Move gfx9 MQD to VRAM domain
In reply to Philip YangTo reduce queue switch latency further, move MQD to VRAM domain, add AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS flag to allocate contiguous pages using one buddy block.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -1
@@ -329,7 +329,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, bp.size = size; bp.byte_align =PAGE_SIZE ; bp.domain = domain; - bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC ; + bp.flags =AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | +AMDGPU_GEM_CREATE_CPU_GTT_USWC ; bp.type = ttm_bo_type_kernel; bp.resv =NULL ; bp.bo_ptr_size =sizeof (struct amdgpu_bo );
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1 -1
@@ -139,7 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node, (ALIGN (q->ctl_stack_size,PAGE_SIZE ) +ALIGN (sizeof (struct v9_mqd ),PAGE_SIZE )) *NUM_XCC (node->xcc_mask), -AMDGPU_GEM_DOMAIN_GTT , +AMDGPU_GEM_DOMAIN_VRAM , &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr), (void *)&(mqd_mem_obj->cpu_ptr), true);
Signature · 1 line
2.50.1
Kuehling, Felix
maintainerRe: [PATCH v2 3/4] drm/amdkfd: Move gfx9 MQD to VRAM domain
Quoted 3 lines · Philip Yang
To reduce queue switch latency further, move MQD to VRAM domain, add
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSflag to allocate contiguous pages using one buddy block.
Why does it need to be contiguous? In the next patch you're mapping it in the GART anyway.
Regards,
Felix
Quoted 34 lines
Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-1@@ -329,7 +329,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, bp.size = size; bp.byte_align =PAGE_SIZE ; bp.domain = domain; - bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC ; + bp.flags =AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | +AMDGPU_GEM_CREATE_CPU_GTT_USWC ; bp.type = ttm_bo_type_kernel; bp.resv =NULL ; bp.bo_ptr_size =sizeof (struct amdgpu_bo );drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1
-1@@ -139,7 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node, (ALIGN (q->ctl_stack_size,PAGE_SIZE ) +ALIGN (sizeof (struct v9_mqd ),PAGE_SIZE )) *NUM_XCC (node->xcc_mask), -AMDGPU_GEM_DOMAIN_GTT , +AMDGPU_GEM_DOMAIN_VRAM , &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr), (void *)&(mqd_mem_obj->cpu_ptr), true);
Re: [PATCH v2 3/4] drm/amdkfd: Move gfx9 MQD to VRAM domain
Quoted 6 lines · Felix
Quoted 3 lines · Philip Yang
To reduce queue switch latency further, move MQD to VRAM domain, add
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSflag to allocate contiguous pages using one buddy block.Why does it need to be contiguous? In the next patch you're mapping it in the GART anyway.
Because MQD and control stack uses different mtype, for multiple XCCs, it is complicated to update mapping using resource cursor with multiple buddy blocks which depends on size alignment. Yes, with GART mapping, we don't need contiguous pages, will remove this in next version.
Regards,
Philip
Quoted 41 lines
Regards,
FelixQuoted 36 lines
Signed-off-by Philip Yang <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++-drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c| 2 +-2 files changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-1@@ -329,7 +329,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, bp.size = size; bp.byte_align = PAGE_SIZE; bp.domain = domain; - bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC; + bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | + AMDGPU_GEM_CREATE_CPU_GTT_USWC; bp.type = ttm_bo_type_kernel; bp.resv = NULL;bp.bo_ptr_size =
sizeof(struct amdgpu_bo);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0@@ -139,7 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,(
ALIGN(q->ctl_stack_size, PAGE_SIZE)+ALIGN(sizeof(struct v9_mqd), PAGE_SIZE)) *NUM_XCC(node->xcc_mask),
-AMDGPU_GEM_DOMAIN_GTT,
+AMDGPU_GEM_DOMAIN_VRAM, &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr),
(void *)&(mqd_mem_obj->cpu_ptr), true);
Re: [PATCH v2 3/4] drm/amdkfd: Move gfx9 MQD to VRAM domain
In reply to Kuehling, FelixQuoted 6 lines · Felix
Quoted 3 lines · Philip Yang
To reduce queue switch latency further, move MQD to VRAM domain, add
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSflag to allocate contiguous pages using one buddy block.Why does it need to be contiguous? In the next patch you're mapping it in the GART anyway.
Without AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS flag, amdgpu_bo_gpu_offset trigger this warning
WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_VRAM && !(bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS));
This makes senses because we pass the FB aperture address to CP, this should be contiguous pages.
Regards,
Philip
Quoted 41 lines
Regards,
FelixQuoted 36 lines
Signed-off-by Philip Yang <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++-drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c| 2 +-2 files changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-1@@ -329,7 +329,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, bp.size = size; bp.byte_align = PAGE_SIZE; bp.domain = domain; - bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC; + bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | + AMDGPU_GEM_CREATE_CPU_GTT_USWC; bp.type = ttm_bo_type_kernel; bp.resv = NULL;bp.bo_ptr_size =
sizeof(struct amdgpu_bo);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0@@ -139,7 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,(
ALIGN(q->ctl_stack_size, PAGE_SIZE)+ALIGN(sizeof(struct v9_mqd), PAGE_SIZE)) *NUM_XCC(node->xcc_mask),
-AMDGPU_GEM_DOMAIN_GTT,
+AMDGPU_GEM_DOMAIN_VRAM, &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr),
(void *)&(mqd_mem_obj->cpu_ptr), true);
Felix Kuehling
maintainerRe: [PATCH v2 3/4] drm/amdkfd: Move gfx9 MQD to VRAM domain
Quoted 8 lines · Philip Yang
Quoted 5 lines · Felix
Quoted 3 lines · Philip Yang
To reduce queue switch latency further, move MQD to VRAM domain, add
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSflag to allocate contiguous pages using one buddy block.
Quoted 7 lines
Quoted 1 line
Why does it need to be contiguous? In the next patch you're mapping it in the GART anyway.
Without
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSflag,amdgpu_bo_gpu_offsettrigger this warning
WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_VRAM && !(bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS));This makes senses because we pass the FB aperture address to CP, this should be contiguous pages.
That's right, if you query the VRAM offset of the BO, you're assuming that it's contiguous. If you're mapping it in the GART, you wouldn't use that VRAM offset, you'd use the GART address instead. Since you don't want to use the mapping of the BO in the FB aperture (because that gives you the wrong MTYPE), you should not need to use amdgpu_bo_gpu_offset at all.
Regards,
Felix
Quoted 45 lines
Regards,
PhilipQuoted 41 lines
Regards,
FelixQuoted 36 lines
Signed-off-by Philip Yang <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++-drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c| 2 +-2 files changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-1@@ -329,7 +329,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, bp.size = size; bp.byte_align = PAGE_SIZE; bp.domain = domain; - bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC; + bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | + AMDGPU_GEM_CREATE_CPU_GTT_USWC; bp.type = ttm_bo_type_kernel; bp.resv = NULL;bp.bo_ptr_size =
sizeof(struct amdgpu_bo);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0@@ -139,7 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,(
ALIGN(q->ctl_stack_size, PAGE_SIZE)+ALIGN(sizeof(struct v9_mqd), PAGE_SIZE)) *NUM_XCC(node->xcc_mask),
-AMDGPU_GEM_DOMAIN_GTT,
+AMDGPU_GEM_DOMAIN_VRAM, &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr),
(void *)&(mqd_mem_obj->cpu_ptr), true);
Re: [PATCH v2 3/4] drm/amdkfd: Move gfx9 MQD to VRAM domain
Quoted 10 lines · Felix Kuehling
Quoted 9 lines · Philip Yang
Quoted 6 lines · Felix
Quoted 3 lines · Philip Yang
To reduce queue switch latency further, move MQD to VRAM domain, add
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSflag to allocate contiguous pages using one buddy block.Why does it need to be contiguous? In the next patch you're mapping it in the GART anyway.
Quoted 8 lines
Quoted 6 lines
Without
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSflag,amdgpu_bo_gpu_offsettrigger this warning
WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_VRAM && !(bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS));This makes senses because we pass the FB aperture address to CP, this should be contiguous pages.
That's right, if you query the VRAM offset of the BO, you're assuming that it's contiguous. If you're mapping it in the GART, you wouldn't use that VRAM offset, you'd use the GART address instead. Since you don't want to use the mapping of the BO in the FB aperture (because that gives you the wrong MTYPE), you should not need to use
amdgpu_bo_gpu_offsetat all.
With this patch, MQD move to VRAM and pass amdgpu_bo_gpu_offset to CP, this works with FB aperture mtype, so need contiguous flag.
The next patch with GART mapping, yes, we can remove contiguous flag. Because MQD size is small, pinned, use contiguous allocation is also simpler to update GART mapping.
Regards,
Philip
Quoted 50 lines
Regards,
FelixQuoted 45 lines
Regards,
PhilipQuoted 41 lines
Regards,
FelixQuoted 36 lines
Signed-off-by Philip Yang <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++-drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c| 2 +-2 files changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-1@@ -329,7 +329,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, bp.size = size; bp.byte_align = PAGE_SIZE; bp.domain = domain; - bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC; + bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | + AMDGPU_GEM_CREATE_CPU_GTT_USWC; bp.type = ttm_bo_type_kernel; bp.resv = NULL;bp.bo_ptr_size =
sizeof(struct amdgpu_bo);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0@@ -139,7 +139,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,(
ALIGN(q->ctl_stack_size, PAGE_SIZE)+ALIGN(sizeof(struct v9_mqd), PAGE_SIZE)) *NUM_XCC(node->xcc_mask),
-AMDGPU_GEM_DOMAIN_GTT,
+AMDGPU_GEM_DOMAIN_VRAM, &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr),
(void *)&(mqd_mem_obj->cpu_ptr), true);
PATCH v2 4/4 drm/amdkfd: Map VRAM MQD on GART
In reply to Philip YangMQD BO on VRAM access via FB aperture is mtype UC uncaching, map to GART as mtype RW caching, to reduce queue switch latency.
TTM bo only has one resource, add GART resource to amdgpu_bo in order to support dynamic GART resource and VRAM BO resource.
Update amdgpu_ttm_gart_bind_gfx9_mqd to map MQD in system or VRAM.
Add helper amdgpu_ttm_alloc_gart_for_vram_bo to alloc GART entries resource for MQD bo->gart_res and bind to GART mapping.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 113 +++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 + .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 8 ++ 5 files changed, 108 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
@@ -1297,6 +1297,9 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo) abo =ttm_to_amdgpu_bo (bo); +if (abo->gart_res) +ttm_resource_free (bo, &abo->gart_res); +WARN_ON (abo->vm_bo);if (abo->kfd_bo)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1 -0
@@ -106,6 +106,7 @@ struct amdgpu_bo {struct ttm_place placements[AMDGPU_BO_MAX_PLACEMENTS ];struct ttm_placement placement;struct ttm_buffer_object tbo; +struct ttm_resource *gart_res;struct ttm_bo_kmap_obj kmap;u64 flags;/* per VM structure for page tables and with virtual addresses */
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +95 -18
146 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1 -0
@@ -179,6 +179,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, u64 k_job_id);int amdgpu_ttm_alloc_gart (struct ttm_buffer_object *bo); +int amdgpu_ttm_alloc_gart_vram_bo (struct amdgpu_bo *abo,u64 *gpu_addr);void amdgpu_ttm_recover_gart (struct ttm_buffer_object *tbo);uint64_t amdgpu_ttm_domain_start (struct amdgpu_device *adev,uint32_t type);
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +8 -0
@@ -148,6 +148,14 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,kfree (mqd_mem_obj);return NULL ; } + + retval =amdgpu_ttm_alloc_gart_vram_bo (mqd_mem_obj->gtt_mem, + &(mqd_mem_obj->gpu_addr)); +if (retval) { +amdgpu_amdkfd_free_gtt_mem (node->adev, &(mqd_mem_obj->gtt_mem)); +kfree (mqd_mem_obj); +return NULL ; + } }else { retval =kfd_gtt_sa_allocate (node,sizeof (struct v9_mqd ), &mqd_mem_obj);
Signature · 1 line
2.50.1
Christian König
maintainerRe: [PATCH v2 4/4] drm/amdkfd: Map VRAM MQD on GART
Quoted 10 lines · Philip Yang
MQD BO on VRAM access via FB aperture is mtype UC uncaching, map to GART as mtype RW caching, to reduce queue switch latency.
TTM bo only has one resource, add GART resource to
amdgpu_boin order to support dynamic GART resource and VRAM BO resource.Update
amdgpu_ttm_gart_bind_gfx9_mqdto map MQD in system or VRAM.Add helper
amdgpu_ttm_alloc_gart_for_vram_boto alloc GART entries resource for MQDbo->gart_resand bind to GART mapping.
Clear NAK to that approach! That would completely confuse TTM.
We need to talk about that on the weekly meeting first.
Regards,
Christian.
Quoted 221 lines
Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 113 +++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 + .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 8 ++ 5 files changed, 108 insertions(+), 18 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-0@@ -1297,6 +1297,9 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo) abo =ttm_to_amdgpu_bo (bo); +if (abo->gart_res) +ttm_resource_free (bo, &abo->gart_res); +WARN_ON (abo->vm_bo);if (abo->kfd_bo)drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1
-0@@ -106,6 +106,7 @@ struct amdgpu_bo {struct ttm_place placements[AMDGPU_BO_MAX_PLACEMENTS ];struct ttm_placement placement;struct ttm_buffer_object tbo; +struct ttm_resource *gart_res;struct ttm_bo_kmap_obj kmap;u64 flags;/* per VM structure for page tables and with virtual addresses */ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +95
-18@@ -832,14 +832,27 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_device *bdev,* Ctrl stack and modify their memory type to NC. */ static void amdgpu_ttm_gart_bind_gfx9_mqd (struct amdgpu_device *adev, -struct ttm_tt *ttm,uint64_t flags) +struct ttm_buffer_object *tbo, +uint64_t flags) { +struct amdgpu_bo *abo =ttm_to_amdgpu_bo (tbo); +struct ttm_tt *ttm = tbo->ttm;struct amdgpu_ttm_tt *gtt = (void *)ttm; -uint64_t total_pages = ttm->num_pages; +uint64_t total_pages;int num_xcc =max (1U , adev->gfx.num_xcc_per_xcp);uint64_t page_idx, pages_per_xcc; -int i;uint64_t ctrl_flags =AMDGPU_PTE_MTYPE_VG10 (flags,AMDGPU_MTYPE_NC ); +int i; + +if (!ttm && !abo->gart_res) +return ; + +if (ttm) { + total_pages = ttm->num_pages; + }else { +WARN_ON_ONCE (abo->gart_res->size != tbo->resource->size); + total_pages = (abo->gart_res->size) >>PAGE_SHIFT ; + } flags =AMDGPU_PTE_MTYPE_VG10 (flags,AMDGPU_MTYPE_RW );@@ -847,19 +860,33 @@ static void amdgpu_ttm_gart_bind_gfx9_mqd(struct amdgpu_device *adev,do_div (pages_per_xcc, num_xcc);for (i =0 , page_idx =0 ; i < num_xcc; i++, page_idx += pages_per_xcc) { -/* MQD page: use default flags */ -amdgpu_gart_bind (adev, - gtt->offset + (page_idx <<PAGE_SHIFT ), -1 , >t->ttm.dma_address[page_idx], flags); -/* -* Ctrl pages - modify the memory type to NC (ctrl_flags) from -* the second page of the BO onward. -*/ -amdgpu_gart_bind (adev, - gtt->offset + ((page_idx +1 ) <<PAGE_SHIFT ), - pages_per_xcc -1 , - >t->ttm.dma_address[page_idx +1 ], - ctrl_flags); +if (ttm) { +/* MQD page: use default flags */ +amdgpu_gart_bind (adev, + gtt->offset + (page_idx <<PAGE_SHIFT ), +1 , >t->ttm.dma_address[page_idx], flags); +/* +* Ctrl pages - modify the memory type to NC (ctrl_flags) from +* the second page of the BO onward. +*/ +amdgpu_gart_bind (adev, + gtt->offset + ((page_idx +1 ) <<PAGE_SHIFT ), + pages_per_xcc -1 , + >t->ttm.dma_address[page_idx +1 ], + ctrl_flags); + }else { +u64 pa = (tbo->resource->start + page_idx) <<PAGE_SHIFT ; +u64 start_page = abo->gart_res->start + page_idx; + + pa += adev->vm_manager.vram_base_offset; +amdgpu_gart_map_vram_range (adev, pa, start_page,1 , + flags,NULL ); + +amdgpu_gart_map_vram_range (adev, pa +PAGE_SIZE , + start_page +1 , + pages_per_xcc -1 , + ctrl_flags,NULL ); + } } }@@ -875,12 +902,14 @@ static void amdgpu_ttm_gart_bind(struct amdgpu_device *adev, flags |=AMDGPU_PTE_TMZ ;if (abo->flags &AMDGPU_GEM_CREATE_CP_MQD_GFX9 ) { -amdgpu_ttm_gart_bind_gfx9_mqd (adev, ttm, flags); +amdgpu_ttm_gart_bind_gfx9_mqd (adev, tbo, flags); }else {amdgpu_gart_bind (adev, gtt->offset, ttm->num_pages, gtt->ttm.dma_address, flags); } - gtt->bound = true; + +if (ttm) + gtt->bound = true; }/* @@ -1000,6 +1029,54 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo)return 0 ; } +int amdgpu_ttm_alloc_gart_vram_bo (struct amdgpu_bo *abo, +u64 *gpu_addr) +{ +struct ttm_buffer_object *bo = &abo->tbo; +struct amdgpu_device *adev =amdgpu_ttm_adev (bo->bdev); +struct ttm_operation_ctx ctx = { false, false }; +struct ttm_placement placement; +struct ttm_place placements; +struct ttm_resource *res; +uint64_t flags; +int r; + +/* Only for valid VRAM bo resource */ +if (bo->resource->start ==AMDGPU_BO_INVALID_OFFSET ) +return 0 ; + + r =amdgpu_bo_reserve (abo, false); +if (unlikely (r)) +return r; + +/* allocate GART space */ + placement.num_placement =1 ; + placement.placement = &placements; + placements.fpfn =0 ; + placements.lpfn = adev->gmc.gart_size >>PAGE_SHIFT ; + placements.mem_type =TTM_PL_TT ; + placements.flags = bo->resource->placement; + + r =ttm_bo_mem_space (bo, &placement, &res, &ctx); +if (unlikely (r)) + goto out_unreserve; + +/* compute PTE flags for this buffer object */ + flags =amdgpu_ttm_tt_pte_flags (adev,NULL , bo->resource); + +/* Bind VRAM pages */ + abo->gart_res = res; + +amdgpu_ttm_gart_bind (adev, bo, flags); +amdgpu_gart_invalidate_tlb (adev); + + *gpu_addr = res->start <<PAGE_SHIFT ; + +out_unreserve: +amdgpu_bo_unreserve (abo); +return r; +} +/* * amdgpu_ttm_recover_gart - Rebind GTT pages * drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1
-0@@ -179,6 +179,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, u64 k_job_id);int amdgpu_ttm_alloc_gart (struct ttm_buffer_object *bo); +int amdgpu_ttm_alloc_gart_vram_bo (struct amdgpu_bo *abo,u64 *gpu_addr);void amdgpu_ttm_recover_gart (struct ttm_buffer_object *tbo);uint64_t amdgpu_ttm_domain_start (struct amdgpu_device *adev,uint32_t type);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +8
-0@@ -148,6 +148,14 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,kfree (mqd_mem_obj);return NULL ; } + + retval =amdgpu_ttm_alloc_gart_vram_bo (mqd_mem_obj->gtt_mem, + &(mqd_mem_obj->gpu_addr)); +if (retval) { +amdgpu_amdkfd_free_gtt_mem (node->adev, &(mqd_mem_obj->gtt_mem)); +kfree (mqd_mem_obj); +return NULL ; + } }else { retval =kfd_gtt_sa_allocate (node,sizeof (struct v9_mqd ), &mqd_mem_obj);
Re: [PATCH v2 4/4] drm/amdkfd: Map VRAM MQD on GART
Quoted 7 lines · Christian König
Quoted 6 lines · Philip Yang
MQD BO on VRAM access via FB aperture is mtype UC uncaching, map to GART as mtype RW caching, to reduce queue switch latency.
TTM bo only has one resource, add GART resource to
amdgpu_boin order to support dynamic GART resource and VRAM BO resource.
Quoted 7 lines
Quoted 4 lines
Update
amdgpu_ttm_gart_bind_gfx9_mqdto map MQD in system or VRAM.Add helper
amdgpu_ttm_alloc_gart_for_vram_boto alloc GART entries resource for MQDbo->gart_resand bind to GART mapping.Clear NAK to that approach! That would completely confuse TTM.
We need to talk about that on the weekly meeting first.
I think that is becausettm_bo_mem_space also add GART resource into ttm bo, which already hold VRAM resource. Felix suggest to alloc gart space via drm_mm and store in mqd structure, not in amdgpu_bo. I will implement it in next version and we can discuss details in the meeting.
Regards,
Philip
Quoted 224 lines
Regards,
Christian.Quoted 220 lines
Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 113 +++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 + .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 8 ++ 5 files changed, 108 insertions(+), 18 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-0@@ -1297,6 +1297,9 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo) abo =ttm_to_amdgpu_bo (bo); +if (abo->gart_res) +ttm_resource_free (bo, &abo->gart_res); +WARN_ON (abo->vm_bo);if (abo->kfd_bo)drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1
-0@@ -106,6 +106,7 @@ struct amdgpu_bo {struct ttm_place placements[AMDGPU_BO_MAX_PLACEMENTS ];struct ttm_placement placement;struct ttm_buffer_object tbo; +struct ttm_resource *gart_res;struct ttm_bo_kmap_obj kmap;u64 flags;/* per VM structure for page tables and with virtual addresses */ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +95
-18@@ -832,14 +832,27 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_device *bdev,* Ctrl stack and modify their memory type to NC. */ static void amdgpu_ttm_gart_bind_gfx9_mqd (struct amdgpu_device *adev, -struct ttm_tt *ttm,uint64_t flags) +struct ttm_buffer_object *tbo, +uint64_t flags) { +struct amdgpu_bo *abo =ttm_to_amdgpu_bo (tbo); +struct ttm_tt *ttm = tbo->ttm;struct amdgpu_ttm_tt *gtt = (void *)ttm; -uint64_t total_pages = ttm->num_pages; +uint64_t total_pages;int num_xcc =max (1U , adev->gfx.num_xcc_per_xcp);uint64_t page_idx, pages_per_xcc; -int i;uint64_t ctrl_flags =AMDGPU_PTE_MTYPE_VG10 (flags,AMDGPU_MTYPE_NC ); +int i; + +if (!ttm && !abo->gart_res) +return ; + +if (ttm) { + total_pages = ttm->num_pages; + }else { +WARN_ON_ONCE (abo->gart_res->size != tbo->resource->size); + total_pages = (abo->gart_res->size) >>PAGE_SHIFT ; + } flags =AMDGPU_PTE_MTYPE_VG10 (flags,AMDGPU_MTYPE_RW );@@ -847,19 +860,33 @@ static void amdgpu_ttm_gart_bind_gfx9_mqd(struct amdgpu_device *adev,do_div (pages_per_xcc, num_xcc);for (i =0 , page_idx =0 ; i < num_xcc; i++, page_idx += pages_per_xcc) { -/* MQD page: use default flags */ -amdgpu_gart_bind (adev, - gtt->offset + (page_idx <<PAGE_SHIFT ), -1 , >t->ttm.dma_address[page_idx], flags); -/* -* Ctrl pages - modify the memory type to NC (ctrl_flags) from -* the second page of the BO onward. -*/ -amdgpu_gart_bind (adev, - gtt->offset + ((page_idx +1 ) <<PAGE_SHIFT ), - pages_per_xcc -1 , - >t->ttm.dma_address[page_idx +1 ], - ctrl_flags); +if (ttm) { +/* MQD page: use default flags */ +amdgpu_gart_bind (adev, + gtt->offset + (page_idx <<PAGE_SHIFT ), +1 , >t->ttm.dma_address[page_idx], flags); +/* +* Ctrl pages - modify the memory type to NC (ctrl_flags) from +* the second page of the BO onward. +*/ +amdgpu_gart_bind (adev, + gtt->offset + ((page_idx +1 ) <<PAGE_SHIFT ), + pages_per_xcc -1 , + >t->ttm.dma_address[page_idx +1 ], + ctrl_flags); + }else { +u64 pa = (tbo->resource->start + page_idx) <<PAGE_SHIFT ; +u64 start_page = abo->gart_res->start + page_idx; + + pa += adev->vm_manager.vram_base_offset; +amdgpu_gart_map_vram_range (adev, pa, start_page,1 , + flags,NULL ); + +amdgpu_gart_map_vram_range (adev, pa +PAGE_SIZE , + start_page +1 , + pages_per_xcc -1 , + ctrl_flags,NULL ); + } } }@@ -875,12 +902,14 @@ static void amdgpu_ttm_gart_bind(struct amdgpu_device *adev, flags |=AMDGPU_PTE_TMZ ;if (abo->flags &AMDGPU_GEM_CREATE_CP_MQD_GFX9 ) { -amdgpu_ttm_gart_bind_gfx9_mqd (adev, ttm, flags); +amdgpu_ttm_gart_bind_gfx9_mqd (adev, tbo, flags); }else {amdgpu_gart_bind (adev, gtt->offset, ttm->num_pages, gtt->ttm.dma_address, flags); } - gtt->bound = true; + +if (ttm) + gtt->bound = true; }/* @@ -1000,6 +1029,54 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo)return 0 ; } +int amdgpu_ttm_alloc_gart_vram_bo (struct amdgpu_bo *abo, +u64 *gpu_addr) +{ +struct ttm_buffer_object *bo = &abo->tbo; +struct amdgpu_device *adev =amdgpu_ttm_adev (bo->bdev); +struct ttm_operation_ctx ctx = { false, false }; +struct ttm_placement placement; +struct ttm_place placements; +struct ttm_resource *res; +uint64_t flags; +int r; + +/* Only for valid VRAM bo resource */ +if (bo->resource->start ==AMDGPU_BO_INVALID_OFFSET ) +return 0 ; + + r =amdgpu_bo_reserve (abo, false); +if (unlikely (r)) +return r; + +/* allocate GART space */ + placement.num_placement =1 ; + placement.placement = &placements; + placements.fpfn =0 ; + placements.lpfn = adev->gmc.gart_size >>PAGE_SHIFT ; + placements.mem_type =TTM_PL_TT ; + placements.flags = bo->resource->placement; + + r =ttm_bo_mem_space (bo, &placement, &res, &ctx); +if (unlikely (r)) + goto out_unreserve; + +/* compute PTE flags for this buffer object */ + flags =amdgpu_ttm_tt_pte_flags (adev,NULL , bo->resource); + +/* Bind VRAM pages */ + abo->gart_res = res; + +amdgpu_ttm_gart_bind (adev, bo, flags); +amdgpu_gart_invalidate_tlb (adev); + + *gpu_addr = res->start <<PAGE_SHIFT ; + +out_unreserve: +amdgpu_bo_unreserve (abo); +return r; +} +/* * amdgpu_ttm_recover_gart - Rebind GTT pages * drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1
-0@@ -179,6 +179,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, u64 k_job_id);int amdgpu_ttm_alloc_gart (struct ttm_buffer_object *bo); +int amdgpu_ttm_alloc_gart_vram_bo (struct amdgpu_bo *abo,u64 *gpu_addr);void amdgpu_ttm_recover_gart (struct ttm_buffer_object *tbo);uint64_t amdgpu_ttm_domain_start (struct amdgpu_device *adev,uint32_t type);drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +8
-0@@ -148,6 +148,14 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,kfree (mqd_mem_obj);return NULL ; } + + retval =amdgpu_ttm_alloc_gart_vram_bo (mqd_mem_obj->gtt_mem, + &(mqd_mem_obj->gpu_addr)); +if (retval) { +amdgpu_amdkfd_free_gtt_mem (node->adev, &(mqd_mem_obj->gtt_mem)); +kfree (mqd_mem_obj); +return NULL ; + } }else { retval =kfd_gtt_sa_allocate (node,sizeof (struct v9_mqd ), &mqd_mem_obj);
Christian König
maintainerRe: [PATCH v2 4/4] drm/amdkfd: Map VRAM MQD on GART
Quoted 10 lines · Philip Yang
Quoted 9 lines · Christian König
Quoted 8 lines · Philip Yang
MQD BO on VRAM access via FB aperture is mtype UC uncaching, map to GART as mtype RW caching, to reduce queue switch latency.
TTM bo only has one resource, add GART resource to
amdgpu_boin order to support dynamic GART resource and VRAM BO resource.Update
amdgpu_ttm_gart_bind_gfx9_mqdto map MQD in system or VRAM.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Add helper
amdgpu_ttm_alloc_gart_for_vram_boto alloc GART entries resource for MQDbo->gart_resand bind to GART mapping.Clear NAK to that approach! That would completely confuse TTM.
We need to talk about that on the weekly meeting first.
I think that is
becausettm_bo_mem_spacealso add GART resource into ttm bo, which already hold VRAM resource. Felix suggest to alloc gart space viadrm_mmand store in mqd structure, not inamdgpu_bo. I will implement it in next version and we can discuss details in the meeting.
Yes, that sounds like a good approach to me.
We could implement GART as separate TTM domain and then have the ability to map anything to it, but that is a much wider change.
Probably good to do that in the long term, but also tricky to get right.
Regards,
Christian.
Quoted 216 lines
Regards,
PhilipQuoted 212 lines
Regards,
Christian.Quoted 208 lines
Signed-off-by Philip Yang <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 113 +++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 + .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 8 ++5 files changed, 108 insertions(+), 18 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-0@@ -1297,6 +1297,9 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo) abo = ttm_to_amdgpu_bo(bo); + if (abo->gart_res) + ttm_resource_free(bo, &abo->gart_res); + WARN_ON(abo->vm_bo); if (abo->kfd_bo)drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1
-0@@ -106,6 +106,7 @@ struct amdgpu_bo { struct ttm_place placements[AMDGPU_BO_MAX_PLACEMENTS]; struct ttm_placement placement; struct ttm_buffer_object tbo; + struct ttm_resource *gart_res; struct ttm_bo_kmap_obj kmap; u64 flags; /* per VM structure for page tables and with virtual addresses */drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +16
-3@@ -832,14 +832,27 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_device *bdev,* Ctrl stack and modify their memory type to NC. */ static void amdgpu_ttm_gart_bind_gfx9_mqd(struct amdgpu_device *adev, - struct ttm_tt *ttm, uint64_t flags) + struct ttm_buffer_object *tbo, + uint64_t flags) { + struct amdgpu_bo *abo = ttm_to_amdgpu_bo(tbo); + struct ttm_tt *ttm = tbo->ttm; struct amdgpu_ttm_tt *gtt = (void *)ttm; - uint64_t total_pages = ttm->num_pages; + uint64_t total_pages; int num_xcc = max(1U, adev->gfx.num_xcc_per_xcp); uint64_t page_idx, pages_per_xcc; - int i; uint64_t ctrl_flags = AMDGPU_PTE_MTYPE_VG10(flags, AMDGPU_MTYPE_NC); + int i; + + if (!ttm && !abo->gart_res) + return; + + if (ttm) { + total_pages = ttm->num_pages; + } else { + WARN_ON_ONCE(abo->gart_res->size != tbo->resource->size); + total_pages = (abo->gart_res->size) >> PAGE_SHIFT; + } flags = AMDGPU_PTE_MTYPE_VG10(flags, AMDGPU_MTYPE_RW); @@ -847,19 +860,33 @@ static void amdgpu_ttm_gart_bind_gfx9_mqd(struct amdgpu_device *adev, do_div(pages_per_xcc, num_xcc);for (i = 0,
page_idx= 0; i <num_xcc; i++,page_idx+=pages_per_xcc) { - /* MQD page: use default flags */
- amdgpu_gart_bind(adev,
-gtt->offset+ (page_idx<<PAGE_SHIFT),
- 1, >t->ttm.dma_address[page_idx], flags);
- /*
- * Ctrl pages - modify the memory type to NC (ctrl_flags) from - * the second page of the BO onward.
- */
- amdgpu_gart_bind(adev,
-gtt->offset+ ((page_idx+ 1) <<PAGE_SHIFT),
-pages_per_xcc- 1,
- >t->ttm.dma_address[page_idx + 1],
-ctrl_flags);
+ if (ttm) {
+ /* MQD page: use default flags */
+ amdgpu_gart_bind(adev,
+gtt->offset+ (page_idx<<PAGE_SHIFT),
+ 1, >t->ttm.dma_address[page_idx], flags);
+ /*
+ * Ctrl pages - modify the memory type to NC (ctrl_flags) from + * the second page of the BO onward.
+ */
+ amdgpu_gart_bind(adev,
+gtt->offset+ ((page_idx+ 1) <<PAGE_SHIFT), +pages_per_xcc- 1,
+ >t->ttm.dma_address[page_idx + 1],
+ctrl_flags);
+ } else {
+ u64 pa = (tbo->resource->start+page_idx) <<PAGE_SHIFT; + u64start_page=abo->gart_res->start+page_idx;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +10
-0+ + pa += adev->vm_manager.vram_base_offset; + amdgpu_gart_map_vram_range(adev, pa, start_page, 1, + flags, NULL); + + amdgpu_gart_map_vram_range(adev, pa + PAGE_SIZE, + start_page + 1, + pages_per_xcc - 1, + ctrl_flags, NULL); + }}
}
@@ -875,12 +902,14 @@ static void amdgpu_ttm_gart_bind(structamdgpu_device*adev, flags |=AMDGPU_PTE_TMZ;
if (abo->flags&AMDGPU_GEM_CREATE_CP_MQD_GFX9) {
-amdgpu_ttm_gart_bind_gfx9_mqd(adev, ttm, flags);
+amdgpu_ttm_gart_bind_gfx9_mqd(adev, tbo, flags);
} else {
amdgpu_gart_bind(adev, gtt->offset, ttm->num_pages, gtt->ttm.dma_address, flags);
}
-gtt->bound= true;
+
+ if (ttm)
+gtt->bound= true;
}
/*drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +47
-0@@ -1000,6 +1029,54 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo) return 0; } +int amdgpu_ttm_alloc_gart_vram_bo(struct amdgpu_bo *abo, + u64 *gpu_addr) +{ + struct ttm_buffer_object *bo = &abo->tbo; + struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); + struct ttm_operation_ctx ctx = { false, false }; + struct ttm_placement placement; + struct ttm_place placements; + struct ttm_resource *res; + uint64_t flags; + int r; + + /* Only for valid VRAM bo resource */ + if (bo->resource->start == AMDGPU_BO_INVALID_OFFSET) + return 0; + + r = amdgpu_bo_reserve(abo, false); + if (unlikely(r)) + return r; + + /* allocate GART space */ + placement.num_placement = 1; + placement.placement = &placements; + placements.fpfn = 0; + placements.lpfn = adev->gmc.gart_size >> PAGE_SHIFT; + placements.mem_type = TTM_PL_TT; + placements.flags = bo->resource->placement; + + r = ttm_bo_mem_space(bo, &placement, &res, &ctx); + if (unlikely(r)) + goto out_unreserve; + + /* compute PTE flags for this buffer object */ + flags = amdgpu_ttm_tt_pte_flags(adev, NULL, bo->resource); + + /* Bind VRAM pages */ + abo->gart_res = res; + + amdgpu_ttm_gart_bind(adev, bo, flags); + amdgpu_gart_invalidate_tlb(adev); + + *gpu_addr = res->start << PAGE_SHIFT; + +out_unreserve: + amdgpu_bo_unreserve(abo); + return r; +} + /** amdgpu_ttm_recover_gart - Rebind GTT pages * drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1
-0@@ -179,6 +179,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, u64 k_job_id); int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo); +int amdgpu_ttm_alloc_gart_vram_bo (struct amdgpu_bo *abo,u64 *gpu_addr); void amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo); uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type);diff --git
a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.cb/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.cindexc6945c842267..d96de02c6bb9100644drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +8
-0@@ -148,6 +148,14 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node, kfree(mqd_mem_obj); return NULL; } + + retval = amdgpu_ttm_alloc_gart_vram_bo(mqd_mem_obj->gtt_mem, + &(mqd_mem_obj->gpu_addr)); + if (retval) { + amdgpu_amdkfd_free_gtt_mem(node->adev, &(mqd_mem_obj->gtt_mem)); + kfree(mqd_mem_obj); + return NULL; + } } else { retval = kfd_gtt_sa_allocate(node, sizeof(struct v9_mqd), &mqd_mem_obj);
ping...
Quoted 25 lines · Philip Yang
To reduce multiple queues switch latency, move user queues MQD to HBM, and map on GART with mtype RW.
v2: patch 4 GART mapping use MC address,
vram_base_offset+ physical addressPhilip Yang (4):
drm/amdkfd: Bind gfx9 MQD in GART with mtype RW drm/amdkfd: Add domain parameter to alloc kernel BO drm/amdkfd: Move gfx9 MQD to VRAM domain drm/amdkfd: Map VRAM MQD on GARTdrivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 115 +++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 + drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 +- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 1 + .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 9 ++ .../amd/amdkfd/kfd_process_queue_manager.c | 2 + 12 files changed, 124 insertions(+), 24 deletions(-)