From: "David (Ming Qiang) Wu" <David.Wu3@amd.com>
To: <amd-gfx@lists.freedesktop.org>, <Christian.Koenig@amd.com>,
<alexander.deucher@amd.com>
Cc: <leo.liu@amd.com>, <Boyuan.Zhang@amd.com>, <David.Wu3@amd.com>,
"Saleemkhan Jamadar" <saleemkhan.jamadar@amd.com>
Subject: [PATCH 06/14] drm/amdgpu/vcn: changes when kernel queue is disabled
Date: Tue, 10 Feb 2026 16:47:21 -0500 [thread overview]
Message-ID: <20260210214729.80964-7-David.Wu3@amd.com> (raw)
In-Reply-To: <20260210214729.80964-1-David.Wu3@amd.com>
From: Saleemkhan Jamadar <saleemkhan.jamadar@amd.com>
v4 - don't call ring test and touch the ring structure
when it is not initialized (Christian)
add kernel message to note kernel queues are not
supported with user queues (Alex)
v3 - don't call amdgpu_ring_init() when kernel queue
is disabled (David)
v2 - Add flag to enable/disable userq and kernelq (Alex)
Disable ring buffer address update to the RB register for user queues.
RB register update is handled by UMSCH.
vcn 4_0_5 cannot support both user queue and kernel
queue at same time, so disable kernel queue when
user queue is enabled. (David)
Signed-off-by: Saleemkhan Jamadar <saleemkhan.jamadar@amd.com>
Signed-off-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 ++
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 51 ++++++++++++++++++-------
2 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
index 82624b44e661..bea95307fd42 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
@@ -368,6 +368,9 @@ struct amdgpu_vcn {
struct mutex workload_profile_mutex;
u32 reg_count;
const struct amdgpu_hwip_reg_entry *reg_list;
+
+ bool disable_uq;
+ bool disable_kq;
};
struct amdgpu_fw_shared_rb_ptrs_struct {
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
index 1f6a22983c0d..d2744cd4c865 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
@@ -115,6 +115,24 @@ static int vcn_v4_0_5_early_init(struct amdgpu_ip_block *ip_block)
struct amdgpu_device *adev = ip_block->adev;
int i, r;
+ switch (amdgpu_user_queue) {
+ case -1:
+ case 0:
+ default:
+ adev->vcn.disable_kq = false;
+ adev->vcn.disable_uq = true;
+ break;
+ case 1:
+ adev->vcn.disable_kq = true; /* does not support if userq is enabled */
+ adev->vcn.disable_uq = false;
+ dev_info_once(adev->dev, "Kernel queues are not supported with user queues.\n");
+ break;
+ case 2:
+ adev->vcn.disable_kq = true;
+ adev->vcn.disable_uq = false;
+ break;
+ }
+
if (amdgpu_ip_version(adev, UVD_HWIP, 0) == IP_VERSION(4, 0, 6))
adev->vcn.per_inst_fw = true;
@@ -187,13 +205,14 @@ static int vcn_v4_0_5_sw_init(struct amdgpu_ip_block *ip_block)
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) +
2 + 8 * i;
ring->vm_hub = AMDGPU_MMHUB0(0);
- sprintf(ring->name, "vcn_unified_%d", i);
-
- r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[i].irq, 0,
- AMDGPU_RING_PRIO_0, &adev->vcn.inst[i].sched_score);
- if (r)
- return r;
+ if (!adev->vcn.disable_kq) {
+ sprintf(ring->name, "vcn_unified_%d", i);
+ r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[i].irq, 0,
+ AMDGPU_RING_PRIO_0, &adev->vcn.inst[i].sched_score);
+ if (r)
+ return r;
+ }
fw_shared = adev->vcn.inst[i].fw_shared.cpu_addr;
fw_shared->present_flag_0 = cpu_to_le32(AMDGPU_FW_SHARED_FLAG_0_UNIFIED_QUEUE);
fw_shared->sq.is_enabled = 1;
@@ -300,6 +319,8 @@ static int vcn_v4_0_5_hw_init(struct amdgpu_ip_block *ip_block)
adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
((adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 8 * i), i);
+ if (adev->vcn.disable_kq)
+ continue;
r = amdgpu_ring_test_helper(ring);
if (r)
return r;
@@ -1005,10 +1026,11 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_vcn_inst *vinst,
}
ring = &adev->vcn.inst[inst_idx].ring_enc[0];
-
- WREG32_SOC15(VCN, inst_idx, regUVD_RB_BASE_LO, ring->gpu_addr);
- WREG32_SOC15(VCN, inst_idx, regUVD_RB_BASE_HI, upper_32_bits(ring->gpu_addr));
- WREG32_SOC15(VCN, inst_idx, regUVD_RB_SIZE, ring->ring_size / 4);
+ if (!adev->vcn.disable_kq) {
+ WREG32_SOC15(VCN, inst_idx, regUVD_RB_BASE_LO, ring->gpu_addr);
+ WREG32_SOC15(VCN, inst_idx, regUVD_RB_BASE_HI, upper_32_bits(ring->gpu_addr));
+ WREG32_SOC15(VCN, inst_idx, regUVD_RB_SIZE, ring->ring_size / 4);
+ }
tmp = RREG32_SOC15(VCN, inst_idx, regVCN_RB_ENABLE);
tmp &= ~(VCN_RB_ENABLE__RB1_EN_MASK);
@@ -1195,10 +1217,11 @@ static int vcn_v4_0_5_start(struct amdgpu_vcn_inst *vinst)
WREG32_SOC15(VCN, i, regVCN_RB1_DB_CTRL,
ring->doorbell_index << VCN_RB1_DB_CTRL__OFFSET__SHIFT |
VCN_RB1_DB_CTRL__EN_MASK);
-
- WREG32_SOC15(VCN, i, regUVD_RB_BASE_LO, ring->gpu_addr);
- WREG32_SOC15(VCN, i, regUVD_RB_BASE_HI, upper_32_bits(ring->gpu_addr));
- WREG32_SOC15(VCN, i, regUVD_RB_SIZE, ring->ring_size / 4);
+ if (!adev->vcn.disable_kq) {
+ WREG32_SOC15(VCN, i, regUVD_RB_BASE_LO, ring->gpu_addr);
+ WREG32_SOC15(VCN, i, regUVD_RB_BASE_HI, upper_32_bits(ring->gpu_addr));
+ WREG32_SOC15(VCN, i, regUVD_RB_SIZE, ring->ring_size / 4);
+ }
tmp = RREG32_SOC15(VCN, i, regVCN_RB_ENABLE);
tmp &= ~(VCN_RB_ENABLE__RB1_EN_MASK);
--
2.43.0
next prev parent reply other threads:[~2026-02-10 21:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 21:47 [PATCH 00/14] user queue support for VCN 4.0.5 David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 01/14] amdgpu: add global aggregated doorbell bo David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 02/14] drm/amdgpu: add AMDGPU_GEM_GLOBAL_AGGREGATED_DOORBELL David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 03/14] drm/amdgpu/userq: add doorbell size for VCN and VPE David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 04/14] amdgpu/umsch: Update UMSCH interface and mqd structure David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 05/14] drm/amdgpu: use amdgpu_user_queue instead of amdgpu_umsch_mm David (Ming Qiang) Wu
2026-02-10 21:47 ` David (Ming Qiang) Wu [this message]
2026-02-10 21:47 ` [PATCH 07/14] amdgpu/umsch: Add VCN IP init to umsch driver David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 08/14] drm/amdgpu/userq: change mes_userq_create_wptr_mapping() to be common David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 09/14] drm/amdgpu/userq: rework on amdgpu_userq_create_wptr_mapping David (Ming Qiang) Wu
2026-04-24 13:37 ` Alex Deucher
2026-04-27 8:44 ` Zhang, Jesse(Jie)
2026-02-10 21:47 ` [PATCH 10/14] drm/amdgpu/umsch: user queue support for vcn David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 11/14] drm/amdgpu: add AMDGPU_INFO_DOORBELL David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 12/14] drm/amdgpu/vcn: handle interrupt received from fw David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 13/14] drm/amdgpu/umsch: userq suspend and resume context David (Ming Qiang) Wu
2026-02-10 21:47 ` [PATCH 14/14] drm/amdgpu/vcn: handle the suspend context interrupt David (Ming Qiang) Wu
2026-02-18 15:37 ` [PATCH 00/14] user queue support for VCN 4.0.5 Saleemkhan
2026-02-18 18:13 ` Wu, David
2026-02-18 23:59 ` Saleemkhan
2026-02-19 18:00 ` David Wu
2026-04-17 15:22 ` Wu, David
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260210214729.80964-7-David.Wu3@amd.com \
--to=david.wu3@amd.com \
--cc=Boyuan.Zhang@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=leo.liu@amd.com \
--cc=saleemkhan.jamadar@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox