From: Hawking Zhang <Hawking.Zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>, Likun Gao <Likun.Gao@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Subject: [PATCH 06/13] drm/amdgpu: Support doorbell range programming through smn
Date: Sat, 5 Sep 2026 18:05:31 +0800 [thread overview]
Message-ID: <20260905100538.12877-7-Hawking.Zhang@amd.com> (raw)
In-Reply-To: <20260905100538.12877-1-Hawking.Zhang@amd.com>
Some NBIO generations expose doorbell control register
instances through global SMN addresses. Extend the common
doorbell entry description and programming helper to
select this access path
The IP-specific mapping records the target register
instance while callers remain responsible for invoking
their doorbell callback for each required instance.
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c | 24 ++++++++++++++++--------
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h | 9 +++++++++
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
index 70b63fd3656f..55049a8635bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
@@ -221,18 +221,26 @@ void amdgpu_nbio_program_doorbell_entry(
if (WARN_ON_ONCE(!entry->ctrl_reg))
return;
- /* A NULL CTRL disables and clears the entry. */
- if (!ctrl) {
- WREG32_SOC15_IP(NBIO, entry->ctrl_reg, 0);
- if (entry->ctrl1_reg)
- WREG32_SOC15_IP(NBIO, entry->ctrl1_reg, 0);
+ if (entry->use_ext) {
+ /* CTRL1 programming is not needed when use_ext is set. */
+ if (WARN_ON_ONCE(entry->ctrl1_reg || ctrl1))
+ return;
+
+ WREG32_PCIE_EXT(
+ (adev->reg_offset[NBIO_HWIP][entry->reg_inst]
+ [entry->ctrl_reg_base_idx] + entry->ctrl_reg) * 4 +
+ amdgpu_reg_get_smn_base64(
+ adev, NBIO_HWIP, entry->reg_inst),
+ ctrl ? *ctrl : 0);
return;
}
if (WARN_ON_ONCE(ctrl1 && !entry->ctrl1_reg))
return;
- WREG32_SOC15_IP(NBIO, entry->ctrl_reg, *ctrl);
- if (ctrl1)
- WREG32_SOC15_IP(NBIO, entry->ctrl1_reg, *ctrl1);
+ /* A NULL CTRL disables and clears the entry. */
+ WREG32_SOC15_IP(NBIO, entry->ctrl_reg, ctrl ? *ctrl : 0);
+ if (entry->ctrl1_reg && (!ctrl || ctrl1))
+ WREG32_SOC15_IP(NBIO, entry->ctrl1_reg,
+ ctrl ? *ctrl1 : 0);
}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
index 2ac392934169..18418a331517 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
@@ -114,6 +114,15 @@ struct amdgpu_nbio_doorbell_entry {
u32 port;
u32 ctrl_reg;
u32 ctrl1_reg;
+ /*
+ * Some NBIO generations expose each register instance through a global
+ * SMN address. The caller invokes the doorbell callback for each required
+ * instance across the die; reg_inst identifies the instance represented
+ * by this entry. Extended entries only support a CTRL register.
+ */
+ bool use_ext;
+ u32 reg_inst;
+ u32 ctrl_reg_base_idx;
};
struct amdgpu_nbio_doorbell_entries {
--
2.17.1
next prev parent reply other threads:[~2026-09-05 10:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 10:05 [PATCH 00/13] drm/amdgpu: Simplify nbio doorbell range programming Hawking Zhang
2026-09-05 10:05 ` [PATCH 01/13] drm/amdgpu: Add common NBIO doorbell entry helpers Hawking Zhang
2026-09-05 10:05 ` [PATCH 02/13] drm/amdgpu: Add nbio v6_3_2 doorbell layout Hawking Zhang
2026-09-05 10:05 ` [PATCH 03/13] drm/amdgpu: Use common doorbell helpers in nbio v6_3_2 Hawking Zhang
2026-09-05 10:05 ` [PATCH 04/13] drm/amdgpu: Add nbio v4_3 doorbell layout Hawking Zhang
2026-09-05 10:05 ` [PATCH 05/13] drm/amdgpu: Use common doorbell helpers in nbio v4_3 Hawking Zhang
2026-09-05 10:05 ` Hawking Zhang [this message]
2026-09-05 10:05 ` [PATCH 07/13] drm/amdgpu: Use common doorbell helpers in nbio v7_9 Hawking Zhang
2026-09-05 10:05 ` [PATCH 08/13] drm/amdgpu: Use common doorbell helpers in nbio v7_11_5 Hawking Zhang
2026-09-05 10:05 ` [PATCH 09/13] drm/amdgpu: Add nbif v4_10_0 ip headers Hawking Zhang
2026-09-05 10:05 ` [PATCH 10/13] drm/amdgpu: Add nbio v7_11_4 support Hawking Zhang
2026-09-05 10:05 ` [PATCH 11/13] drm/amdgpu: Drop nbio v7_11_x support from nbif v6_3_1 Hawking Zhang
2026-09-05 10:05 ` [PATCH 12/13] drm/amdgpu: Use common doorbell helpers in nbio v7_11_4 Hawking Zhang
2026-09-05 10:05 ` [PATCH 13/13] drm/amdgpu: Use common doorbell helpers in nbif v6_3_1 Hawking Zhang
2026-09-07 3:56 ` Gao, Likun
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=20260905100538.12877-7-Hawking.Zhang@amd.com \
--to=hawking.zhang@amd.com \
--cc=Likun.Gao@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