AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 4/4] drm/amdgpu/sdma7.1: program quantums
Date: Wed, 18 Mar 2026 10:10:12 -0400	[thread overview]
Message-ID: <20260318141012.583021-4-alexander.deucher@amd.com> (raw)
In-Reply-To: <20260318141012.583021-1-alexander.deucher@amd.com>

Set the quantums for queue switching on the instance.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c | 32 ++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
index f20e0fc3fc743..244f7df5ede19 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
@@ -478,6 +478,38 @@ static int sdma_v7_1_gfx_resume_instance(struct amdgpu_device *adev, int i, bool
 	rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_SDMA_QUEUE0_RB_CNTL, RB_PRIV, 1);
 	WREG32_SOC15_IP(GC, sdma_v7_1_get_reg_offset(adev, i, regSDMA0_SDMA_QUEUE0_RB_CNTL), rb_cntl);
 
+	/* handle queue priority and quantums */
+	temp = REG_SET_FIELD(0, SDMA0_SDMA_QUEUE0_SCHEDULE_CNTL, GLOBAL_ID, 2); /* 3-0, 3 is highest priority */
+	temp = REG_SET_FIELD(temp, SDMA0_SDMA_QUEUE0_SCHEDULE_CNTL, CONTEXT_QUANTUM,
+			     AMDGPU_SDMA_CONTEXT_QUANTUM); /*  value * 100us */
+	WREG32_SOC15_IP(GC, sdma_v7_1_get_reg_offset(adev, i, regSDMA0_SDMA_QUEUE0_SCHEDULE_CNTL), temp);
+
+	temp = REG_SET_FIELD(0, SDMA0_SDMA_GLOBAL_QUANTUM, GLOBAL_FOCUS_QUANTUM,
+			     AMDGPU_SDMA_FOCUS_QUANTUM); /*  value * 100us */
+	temp = REG_SET_FIELD(temp, SDMA0_SDMA_GLOBAL_QUANTUM, GLOBAL_NORMAL_QUANTUM,
+			     AMDGPU_SDMA_NORMAL_QUANTUM); /*  value * 100us */
+	WREG32_SOC15_IP(GC, sdma_v7_1_get_reg_offset(adev, i, regSDMA0_SDMA_GLOBAL_QUANTUM), temp);
+
+	temp = REG_SET_FIELD(0, SDMA0_SDMA_PROCESS_QUANTUM0, PROCESS0_QUANTUM,
+			     AMDGPU_SDMA_PROCESS_QUANTUM); /*  value * 100us */
+	temp = REG_SET_FIELD(temp, SDMA0_SDMA_PROCESS_QUANTUM0, PROCESS1_QUANTUM,
+			     AMDGPU_SDMA_PROCESS_QUANTUM); /*  value * 100us */
+	temp = REG_SET_FIELD(temp, SDMA0_SDMA_PROCESS_QUANTUM0, PROCESS2_QUANTUM,
+			     AMDGPU_SDMA_PROCESS_QUANTUM); /*  value * 100us */
+	temp = REG_SET_FIELD(temp, SDMA0_SDMA_PROCESS_QUANTUM0, PROCESS3_QUANTUM,
+			     AMDGPU_SDMA_PROCESS_QUANTUM); /*  value * 100us */
+	WREG32_SOC15_IP(GC, sdma_v7_1_get_reg_offset(adev, i, regSDMA0_SDMA_PROCESS_QUANTUM0), temp);
+
+	temp = REG_SET_FIELD(0, SDMA0_SDMA_PROCESS_QUANTUM1, PROCESS4_QUANTUM,
+			     AMDGPU_SDMA_PROCESS_QUANTUM); /*  value * 100us */
+	temp = REG_SET_FIELD(temp, SDMA0_SDMA_PROCESS_QUANTUM1, PROCESS5_QUANTUM,
+			     AMDGPU_SDMA_PROCESS_QUANTUM); /*  value * 100us */
+	temp = REG_SET_FIELD(temp, SDMA0_SDMA_PROCESS_QUANTUM1, PROCESS6_QUANTUM,
+			     AMDGPU_SDMA_PROCESS_QUANTUM); /*  value * 100us */
+	temp = REG_SET_FIELD(temp, SDMA0_SDMA_PROCESS_QUANTUM1, PROCESS7_QUANTUM,
+			     AMDGPU_SDMA_PROCESS_QUANTUM); /*  value * 100us */
+	WREG32_SOC15_IP(GC, sdma_v7_1_get_reg_offset(adev, i, regSDMA0_SDMA_PROCESS_QUANTUM1), temp);
+
 	/* Initialize the ring buffer's read and write pointers */
 	if (restore) {
 		WREG32_SOC15_IP(GC, sdma_v7_1_get_reg_offset(adev, i, regSDMA0_SDMA_QUEUE0_RB_RPTR), lower_32_bits(ring->wptr << 2));
-- 
2.53.0


      parent reply	other threads:[~2026-03-18 14:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 14:10 [PATCH 1/4] drm/amdgpu: add SDMA process quantum settings Alex Deucher
2026-03-18 14:10 ` [PATCH 2/4] drm/amdgpu/sdma6: program quantums Alex Deucher
2026-03-18 14:10 ` [PATCH 3/4] drm/amdgpu/sdma7: " Alex Deucher
2026-03-18 14:10 ` Alex Deucher [this message]

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=20260318141012.583021-4-alexander.deucher@amd.com \
    --to=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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