drm/amdkfd: Adjust parameter of allocate_mqd
authorLang Yu <lang.yu@amd.com>
Mon, 26 Jan 2026 08:57:01 +0000 (16:57 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 29 Jan 2026 17:26:58 +0000 (12:26 -0500)
Make allocate_mqd consistent with other callbacks.
Prepare for next patch to use mqd_manager->mqd_size.

Signed-off-by: Lang Yu <lang.yu@amd.com>
Reviewed-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c

index b542de9..8048516 100644 (file)
@@ -676,7 +676,7 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,
 
        /* Temporarily release dqm lock to avoid a circular lock dependency */
        dqm_unlock(dqm);
-       q->mqd_mem_obj = mqd_mgr->allocate_mqd(mqd_mgr->dev, &q->properties);
+       q->mqd_mem_obj = mqd_mgr->allocate_mqd(mqd_mgr, &q->properties);
        dqm_lock(dqm);
 
        if (!q->mqd_mem_obj) {
@@ -2002,7 +2002,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
                dqm->asic_ops.init_sdma_vm(dqm, q, qpd);
        q->properties.tba_addr = qpd->tba_addr;
        q->properties.tma_addr = qpd->tma_addr;
-       q->mqd_mem_obj = mqd_mgr->allocate_mqd(mqd_mgr->dev, &q->properties);
+       q->mqd_mem_obj = mqd_mgr->allocate_mqd(mqd_mgr, &q->properties);
        if (!q->mqd_mem_obj) {
                retval = -ENOMEM;
                goto out_deallocate_doorbell;
index 961a4b8..d987ff7 100644 (file)
@@ -130,7 +130,7 @@ static bool kq_initialize(struct kernel_queue *kq, struct kfd_node *dev,
 
        kq->queue->device = dev;
 
-       kq->queue->mqd_mem_obj = kq->mqd_mgr->allocate_mqd(kq->mqd_mgr->dev,
+       kq->queue->mqd_mem_obj = kq->mqd_mgr->allocate_mqd(kq->mqd_mgr,
                                        &kq->queue->properties);
        if (!kq->queue->mqd_mem_obj)
                goto err_allocate_mqd;
index f78b249..ceb6566 100644 (file)
@@ -46,9 +46,10 @@ int pipe_priority_map[] = {
        KFD_PIPE_PRIORITY_CS_HIGH
 };
 
-struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev, struct queue_properties *q)
+struct kfd_mem_obj *allocate_hiq_mqd(struct mqd_manager *mm, struct queue_properties *q)
 {
        struct kfd_mem_obj *mqd_mem_obj;
+       struct kfd_node *dev = mm->dev;
 
        mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
        if (!mqd_mem_obj)
@@ -61,10 +62,11 @@ struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev, struct queue_properti
        return mqd_mem_obj;
 }
 
-struct kfd_mem_obj *allocate_sdma_mqd(struct kfd_node *dev,
+struct kfd_mem_obj *allocate_sdma_mqd(struct mqd_manager *mm,
                                        struct queue_properties *q)
 {
        struct kfd_mem_obj *mqd_mem_obj;
+       struct kfd_node *dev = mm->dev;
        uint64_t offset;
 
        mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
index 17cc1f2..2429d27 100644 (file)
@@ -68,7 +68,7 @@
  */
 extern int pipe_priority_map[];
 struct mqd_manager {
-       struct kfd_mem_obj*     (*allocate_mqd)(struct kfd_node *kfd,
+       struct kfd_mem_obj*     (*allocate_mqd)(struct mqd_manager *mm,
                struct queue_properties *q);
 
        void    (*init_mqd)(struct mqd_manager *mm, void **mqd,
@@ -153,10 +153,10 @@ struct mqd_user_context_save_area_header {
        uint32_t wave_state_size;
 };
 
-struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev,
+struct kfd_mem_obj *allocate_hiq_mqd(struct mqd_manager *mm,
                                struct queue_properties *q);
 
-struct kfd_mem_obj *allocate_sdma_mqd(struct kfd_node *dev,
+struct kfd_mem_obj *allocate_sdma_mqd(struct mqd_manager *mm,
                                        struct queue_properties *q);
 void free_mqd_hiq_sdma(struct mqd_manager *mm, void *mqd,
                                struct kfd_mem_obj *mqd_mem_obj);
index 05f3ac2..90ac3a3 100644 (file)
@@ -73,9 +73,10 @@ static void set_priority(struct cik_mqd *m, struct queue_properties *q)
        m->cp_hqd_queue_priority = q->priority;
 }
 
-static struct kfd_mem_obj *allocate_mqd(struct kfd_node *kfd,
+static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm,
                                        struct queue_properties *q)
 {
+       struct kfd_node *kfd = mm->dev;
        struct kfd_mem_obj *mqd_mem_obj;
 
        if (kfd_gtt_sa_allocate(kfd, sizeof(struct cik_mqd),
index 1695dd7..97055f8 100644 (file)
@@ -73,9 +73,10 @@ static void set_priority(struct v10_compute_mqd *m, struct queue_properties *q)
        m->cp_hqd_queue_priority = q->priority;
 }
 
-static struct kfd_mem_obj *allocate_mqd(struct kfd_node *kfd,
+static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm,
                struct queue_properties *q)
 {
+       struct kfd_node *kfd = mm->dev;
        struct kfd_mem_obj *mqd_mem_obj;
 
        if (kfd_gtt_sa_allocate(kfd, sizeof(struct v10_compute_mqd),
index 3c0ae28..5c44d09 100644 (file)
@@ -99,9 +99,10 @@ static void set_priority(struct v11_compute_mqd *m, struct queue_properties *q)
        m->cp_hqd_queue_priority = q->priority;
 }
 
-static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,
+static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm,
                struct queue_properties *q)
 {
+       struct kfd_node *node = mm->dev;
        struct kfd_mem_obj *mqd_mem_obj;
        int size;
 
index 729df66..b7ac2de 100644 (file)
@@ -80,9 +80,10 @@ static void set_priority(struct v12_compute_mqd *m, struct queue_properties *q)
        m->cp_hqd_queue_priority = q->priority;
 }
 
-static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,
+static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm,
                struct queue_properties *q)
 {
+       struct kfd_node *node = mm->dev;
        struct kfd_mem_obj *mqd_mem_obj;
 
        /*
index 5582163..0b0d802 100644 (file)
@@ -145,9 +145,10 @@ static void set_priority(struct v12_1_compute_mqd *m, struct queue_properties *q
        m->cp_hqd_queue_priority = q->priority;
 }
 
-static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,
+static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm,
                struct queue_properties *q)
 {
+       struct kfd_node *node = mm->dev;
        struct kfd_mem_obj *mqd_mem_obj;
        unsigned int size;
 
index d867dcc..dcf4bbf 100644 (file)
@@ -120,10 +120,11 @@ static bool mqd_on_vram(struct amdgpu_device *adev)
        }
 }
 
-static struct kfd_mem_obj *allocate_mqd(struct kfd_node *node,
+static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm,
                struct queue_properties *q)
 {
        int retval;
+       struct kfd_node *node = mm->dev;
        struct kfd_mem_obj *mqd_mem_obj = NULL;
 
        /* For V9 only, due to a HW bug, the control stack of a user mode
index c1fafc5..09483f0 100644 (file)
@@ -76,9 +76,10 @@ static void set_priority(struct vi_mqd *m, struct queue_properties *q)
        m->cp_hqd_queue_priority = q->priority;
 }
 
-static struct kfd_mem_obj *allocate_mqd(struct kfd_node *kfd,
+static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm,
                                        struct queue_properties *q)
 {
+       struct kfd_node *kfd = mm->dev;
        struct kfd_mem_obj *mqd_mem_obj;
 
        if (kfd_gtt_sa_allocate(kfd, sizeof(struct vi_mqd),