Skip to contentSkip to conversation

drm/amdgpu: track queue privilege in amdgpu_mqd_prop

PATCH In review Alex Deucher 4 participants 9 messages Jul 11, 2025 – Jul 17, 2025

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/3 drm/amdgpu: track queue privilege in amdgpu_mqd_prop

Used to track the privilege level of the queue.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h      | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index a1737556a77eb..51be12bc7c8b7 100644
@@ -883,6 +883,7 @@ struct amdgpu_mqd_prop {
 	uint64_t csa_addr;
 	uint64_t fence_address;
 	bool tmz_queue;
+	bool priv_queue;
 };
 
 struct amdgpu_mqd {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -0
index 426834806fbf2..08615a20ab4d3 100644
@@ -682,6 +682,8 @@ static void amdgpu_ring_to_mqd_prop(struct amdgpu_ring *ring,
 	prop->eop_gpu_addr = ring->eop_gpu_addr;
 	prop->use_doorbell = ring->use_doorbell;
 	prop->doorbell_index = ring->doorbell_index;
+	/* kernel queues are privileged */
+	prop->priv_queue = true;
 
 	/* map_queues packet doesn't need activate the queue,
 	 * so only kiq need set this field.
Signature · 1 line
2.50.0
author maintainer
#1 lore raw

PATCH 2/3 drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

Set the MQD as appropriate for the queue priv state.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +6 -2
index 37dcec2d07841..b9ba8b22a1073 100644
@@ -4124,6 +4124,8 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,
 #endif
 	if (prop->tmz_queue)
 		tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, TMZ_MATCH, 1);
+	if (!prop->priv_queue)
+		tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_NON_PRIV, 1);
 	mqd->cp_gfx_hqd_cntl = tmp;
 
 	/* set up cp_doorbell_control */
@@ -4276,8 +4278,10 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m,
 	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1);
 	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH,
 			    prop->allow_tunneling);
-	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
-	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+	if (prop->priv_queue) {
+		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
+		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+	}
 	if (prop->tmz_queue)
 		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TMZ, 1);
 	mqd->cp_hqd_pq_control = tmp;
Signature · 1 line
2.50.0
#2 lore raw

Re: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

Quoted 22 lines · Alex Deucher

Set the MQD as appropriate for the queue priv state.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -0
index 37dcec2d07841..b9ba8b22a1073 100644
@@ -4124,6 +4124,8 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,
 #endif
 	if (prop->tmz_queue)
 		tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, TMZ_MATCH, 1);
+	if (!prop->priv_queue)
+		tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_NON_PRIV, 1);
 	mqd->cp_gfx_hqd_cntl = tmp;
 
 	/* set up cp_doorbell_control */

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, · line 4284

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +4 -2
@@ -4276,8 +4278,10 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m,
 	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1);
 	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH,
 			    prop->allow_tunneling);
-	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
-	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+	if (prop->priv_queue) {
+		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
+		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+	}

As per above logic, only kernel mode queues are supposed to be privileged. If so, would suggest renaming the flag to kernel_q

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
 	if (prop->tmz_queue)
 		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TMZ, 1);
 	mqd->cp_hqd_pq_control = tmp;
#3 lore raw

RE: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

[Public]

Regards,
Prike

Quoted 46 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, July 16, 2025 12:18 PM
To: Deucher, Alexander <[email protected]>; amd- [email protected]
Cc: Koenig, Christian <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

Quoted 14 lines · Alex Deucher

Set the MQD as appropriate for the queue priv state.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
index 37dcec2d07841..b9ba8b22a1073 100644
@@ -4124,6 +4124,8 @@ static int gfx_v11_0_gfx_mqd_init(struct
Quoted 3 lines

amdgpu_device *adev, void *m, #endif
if (prop->tmz_queue)
tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, TMZ_MATCH,

1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -0
+   if (!prop->priv_queue)
+           tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL,

RB_NON_PRIV, 1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct

Quoted 4 lines
    mqd->cp_gfx_hqd_cntl = tmp;

    /* set up cp_doorbell_control */
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
@@ -4276,8 +4278,10 @@ static int gfx_v11_0_compute_mqd_init(struct

amdgpu_device *adev, void *m,

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct · line 4278

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
    tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

UNORD_DISPATCH, 1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct · line 4279

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
    tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

TUNNEL_DISPATCH,

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -2
                        prop->allow_tunneling);
-   tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
-   tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+   if (prop->priv_queue) {
+           tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,
Quoted 7 lines

PRIV_STATE, 1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct · line 4283

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -0
+           tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

KMD_QUEUE, 1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, · line 4284

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -0
+   }

As per above logic, only kernel mode queues are supposed to be privileged. If so, would suggest renaming the flag to kernel_q

According to the CP guys, the privileged bit can be applied both the user queue and kernel queue. So, we may don't bound the privileged queue to the kernel queue. Meanwhile, the KMD_QUEUE bit may only set for the kernel queue only enabled case.

Quoted 6 lines

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
    if (prop->tmz_queue)
            tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TMZ, 1);
    mqd->cp_hqd_pq_control = tmp;
#4 lore raw

Re: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

Quoted 53 lines · Prike

[Public]

Regards,
Prike

Quoted 47 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, July 16, 2025 12:18 PM
To: Deucher, Alexander <[email protected]>; amd- [email protected]
Cc: Koenig, Christian <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

Quoted 14 lines · Alex Deucher

Set the MQD as appropriate for the queue priv state.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
index 37dcec2d07841..b9ba8b22a1073 100644
@@ -4124,6 +4124,8 @@ static int gfx_v11_0_gfx_mqd_init(struct
Quoted 3 lines

amdgpu_device *adev, void *m, #endif
if (prop->tmz_queue)
tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, TMZ_MATCH,

1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -0
+   if (!prop->priv_queue)
+           tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL,

RB_NON_PRIV, 1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct

Quoted 4 lines
    mqd->cp_gfx_hqd_cntl = tmp;

    /* set up cp_doorbell_control */
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
@@ -4276,8 +4278,10 @@ static int gfx_v11_0_compute_mqd_init(struct

amdgpu_device *adev, void *m,

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct · line 4278

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
    tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

UNORD_DISPATCH, 1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct · line 4279

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
    tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

TUNNEL_DISPATCH,

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -2
                        prop->allow_tunneling);
-   tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
-   tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+   if (prop->priv_queue) {
+           tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

PRIV_STATE, 1);

Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct · line 4283

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -0
+           tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

KMD_QUEUE, 1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, · line 4284

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -0
+   }

As per above logic, only kernel mode queues are supposed to be privileged. If so, would suggest renaming the flag to kernel_q

According to the CP guys, the privileged bit can be applied both the user queue and kernel queue. So, we may don't bound the privileged queue to the kernel queue. Meanwhile, the KMD_QUEUE bit may only set for the kernel queue only enabled case.

I think we want PRIV_STATE for only kernel queues. Why would you want it for user queues?

Alex

Quoted 8 lines
Quoted 7 lines

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
    if (prop->tmz_queue)
            tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TMZ, 1);
    mqd->cp_hqd_pq_control = tmp;
#5 lore raw

RE: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

[Public]

Regards,
Prike

Quoted 72 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, July 16, 2025 11:20 PM
To: Liang, Prike <[email protected]>
Cc: Lazar, Lijo <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

Quoted 52 lines · Prike

[Public]

Regards,
Prike

Quoted 46 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, July 16, 2025 12:18 PM
To: Deucher, Alexander <[email protected]>; amd- [email protected]
Cc: Koenig, Christian <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

Quoted 14 lines · Alex Deucher

Set the MQD as appropriate for the queue priv state.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
index 37dcec2d07841..b9ba8b22a1073 100644
@@ -4124,6 +4124,8 @@ static int gfx_v11_0_gfx_mqd_init(struct
Quoted 3 lines

amdgpu_device *adev, void *m, #endif
if (prop->tmz_queue)
tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, TMZ_MATCH,

1);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -0
+   if (!prop->priv_queue)
+           tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL,

RB_NON_PRIV, 1);

Quoted 4 lines
    mqd->cp_gfx_hqd_cntl = tmp;

    /* set up cp_doorbell_control */ @@ -4276,8 +4278,10 @@ static

int gfx_v11_0_compute_mqd_init(struct

amdgpu_device *adev, void *m,

Quoted 1 line

tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

UNORD_DISPATCH, 1);

Quoted 1 line

tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

TUNNEL_DISPATCH,

Quoted 3 lines
                        prop->allow_tunneling);
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -2
-   tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
-   tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE,

1);

Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -0
+   if (prop->priv_queue) {
+           tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

PRIV_STATE, 1);

Quoted 1 line

+ tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL,

KMD_QUEUE, 1);

Quoted 1 line

+ }

As per above logic, only kernel mode queues are supposed to be privileged. If so, would suggest renaming the flag to kernel_q

Quoted 7 lines
Quoted 1 line

According to the CP guys, the privileged bit can be applied both the user queue

and kernel queue. So, we may don't bound the privileged queue to the kernel queue.

Quoted 1 line

Meanwhile, the KMD_QUEUE bit may only set for the kernel queue only enabled

case.

I think we want PRIV_STATE for only kernel queues. Why would you want it for user queues?

If the user queue only limits to be none privileged, then that will limit the user queue some kind of scheduling capability. Also, it seems this register bit may not be allowed to touch here if we want to avoid the wrong privileges setting on the user queue. I will check those questions with HW team later.

Quoted 10 lines

Alex

Quoted 8 lines
Quoted 7 lines

Thanks,
Lijo

Quoted 3 lines
    if (prop->tmz_queue)
            tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TMZ, 1);
    mqd->cp_hqd_pq_control = tmp;
#6 lore raw

Re: [PATCH 2/3] drm/amdgpu/gfx11: set MQD as appriopriate for queue priv

In reply to Lazar, Lijo
Quoted 24 lines · Lijo
Quoted 20 lines · Alex Deucher

Set the MQD as appropriate for the queue priv state.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -0
index 37dcec2d07841..b9ba8b22a1073 100644
@@ -4124,6 +4124,8 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,
 #endif
      if (prop->tmz_queue)
              tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, TMZ_MATCH, 1);
+     if (!prop->priv_queue)
+             tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_NON_PRIV, 1);
      mqd->cp_gfx_hqd_cntl = tmp;
 
Quoted 14 lines

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, · line 4284

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +4 -2
      /* set up cp_doorbell_control */
@@ -4276,8 +4278,10 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m,
      tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1);
      tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH,
                          prop->allow_tunneling);
-     tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
-     tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+     if (prop->priv_queue) {
+             tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
+             tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+     }

As per above logic, only kernel mode queues are supposed to be privileged. If so, would suggest renaming the flag to kernel_q

I'll respin with the rename.

Alex

Quoted 8 lines

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
      if (prop->tmz_queue)
              tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TMZ, 1);
      mqd->cp_hqd_pq_control = tmp;
author maintainer
#7 lore raw

PATCH 3/3 drm/amdgpu/gfx12: set MQD as appriopriate for queue priv

In reply to Alex Deucher

Set the MQD as appropriate for the queue priv state.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6 -2
index e4fc42470cf3e..c4dc6bfb0f6f1 100644
@@ -3016,6 +3016,8 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,
 #endif
 	if (prop->tmz_queue)
 		tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, TMZ_MATCH, 1);
+	if (!prop->priv_queue)
+		tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_NON_PRIV, 1);
 	mqd->cp_gfx_hqd_cntl = tmp;
 
 	/* set up cp_doorbell_control */
@@ -3165,8 +3167,10 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m,
 			    (order_base_2(AMDGPU_GPU_PAGE_SIZE / 4) - 1));
 	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1);
 	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH, 0);
-	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
-	tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+	if (prop->priv_queue) {
+		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
+		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+	}
 	if (prop->tmz_queue)
 		tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TMZ, 1);
 	mqd->cp_hqd_pq_control = tmp;
Signature · 1 line
2.50.0
#8 lore raw

Re: [PATCH 3/3] drm/amdgpu/gfx12: set MQD as appriopriate for queue priv

ping on this series.

Quoted 38 lines · Alex Deucher

Set the MQD as appropriate for the queue priv state.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6 -3
index e4fc42470cf3e..c4dc6bfb0f6f1 100644
@@ -3016,6 +3016,8 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,
 #endif
        if (prop->tmz_queue)
                tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, TMZ_MATCH, 1);
+       if (!prop->priv_queue)
+               tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_NON_PRIV, 1);
        mqd->cp_gfx_hqd_cntl = tmp;
 
        /* set up cp_doorbell_control */
@@ -3165,8 +3167,10 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m,
                            (order_base_2(AMDGPU_GPU_PAGE_SIZE / 4) - 1));
        tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1);
        tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH, 0);
-       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
-       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+       if (prop->priv_queue) {
+               tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
+               tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);
+       }
        if (prop->tmz_queue)
                tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TMZ, 1);
        mqd->cp_hqd_pq_control = tmp;
--

2.50.0