From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
"David (Ming Qiang) Wu" <David.Wu3@amd.com>,
Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH v4 06/10] drm/amdgpu: add AMDGPU_INFO_DOORBELL
Date: Fri, 1 May 2026 00:03:34 +0800 [thread overview]
Message-ID: <20260430161146.2851078-6-Jesse.Zhang@amd.com> (raw)
In-Reply-To: <20260430161146.2851078-1-Jesse.Zhang@amd.com>
From: "David (Ming Qiang) Wu" <David.Wu3@amd.com>
Use it to get the doorbell range and aggregated doorbell enablement
and offset. This patch only supports VCN for now.
V2 - drop VPE and use vcn.agdb_offset saved in
umsch_mm_agdb_index_init() (suggested by Alex)
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_kms.c | 18 ++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 +
include/uapi/drm/amdgpu_drm.h | 13 +++++++++++++
3 files changed, 32 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index d88e4994c8c1..a3beeff800bf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1425,6 +1425,24 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
return -EINVAL;
}
}
+ case AMDGPU_INFO_DOORBELL: {
+ struct drm_amdgpu_info_doorbell doorbell_info = {};
+ /* note: may need to check asic_type */
+ switch (info->query_hw_ip.type) {
+ case AMDGPU_HW_IP_VCN_ENC:
+ if (adev->agdb_bo) {
+ doorbell_info.agdb_enable = 1;
+ doorbell_info.agdb_offset = adev->vcn.agdb_offset;
+ }
+ doorbell_info.index_start = adev->doorbell_index.vcn.vcn_ring0_1 << 1;
+ doorbell_info.index_end = (adev->doorbell_index.vcn.vcn_ring6_7 << 1) + 1;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return copy_to_user(out, &doorbell_info,
+ min((size_t)size, sizeof(doorbell_info))) ? -EFAULT : 0;
+ }
default:
DRM_DEBUG_KMS("Invalid request %d\n", info->query);
return -EINVAL;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
index 82624b44e661..f07920594295 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
@@ -368,6 +368,7 @@ struct amdgpu_vcn {
struct mutex workload_profile_mutex;
u32 reg_count;
const struct amdgpu_hwip_reg_entry *reg_list;
+ uint32_t agdb_offset;
};
struct amdgpu_fw_shared_rb_ptrs_struct {
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index 062ae4741fd6..3ffdd2f8c418 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -1276,6 +1276,8 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {
#define AMDGPU_INFO_GPUVM_FAULT 0x23
/* query FW object size and alignment */
#define AMDGPU_INFO_UQ_FW_AREAS 0x24
+/* query doorbell info */
+#define AMDGPU_INFO_DOORBELL 0x25
#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
@@ -1677,6 +1679,17 @@ struct drm_amdgpu_info_uq_metadata {
#define AMDGPU_FAMILY_GC_11_5_4 154 /* GC 11.5.4 */
#define AMDGPU_FAMILY_GC_12_0_0 152 /* GC 12.0.0 */
+/* for AMDGPU_INFO_DOORBELL query */
+struct drm_amdgpu_info_doorbell {
+ __u32 index_start;
+ /* could be equal to index_start */
+ __u32 index_end;
+ /* aggregated doorbell, 0 for disable */
+ __u32 agdb_enable;
+ /* if agdb_enable, it is a value in [index_start, index_end] */
+ __u32 agdb_offset;
+};
+
#if defined(__cplusplus)
}
#endif
--
2.49.0
next prev parent reply other threads:[~2026-04-30 16:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 16:03 [PATCH v4 01/10] drm/amdgpu/mes: add NOTIFY_WORK_ON_UNMAPPED_QUEUE op + ADD_QUEUE fields Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 02/10] drm/amdgpu/mes11: plumb unmap_flag_addr + NOTIFY_WORK_ON_UNMAPPED_QUEUE Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 03/10] drm/amdgpu/mes12: plumb is_user_mode_submission, unmap_flag_addr, NOTIFY Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 04/10] drm/amdgpu/mes_userqueue: mark SDMA UMQs as user-mode submission Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 05/10] amdgpu: add global aggregated doorbell bo Jesse Zhang
2026-04-30 16:03 ` Jesse Zhang [this message]
2026-05-01 13:37 ` [PATCH v4 06/10] drm/amdgpu: add AMDGPU_INFO_DOORBELL Alex Deucher
2026-04-30 16:03 ` [PATCH v4 07/10] drm/amdgpu: Add AMDGPU_GEM_OP_OPEN_GLOBAL Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 08/10] drm/amdgpu/mes: route NORMAL aggregated doorbell through global agdb_bo Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 09/10] drm/amdgpu/userq: report SDMA UMQ doorbell info via AMDGPU_INFO_DOORBELL Jesse Zhang
2026-05-01 13:35 ` Alex Deucher
2026-04-30 16:03 ` [PATCH v4 10/10] drm/amdgpu/userq_fence: NOTIFY MES on SDMA UMQ submit Jesse Zhang
2026-05-01 13:30 ` Alex Deucher
2026-05-04 9:01 ` Christian König
2026-05-06 6:08 ` Zhang, Jesse(Jie)
2026-05-06 7:21 ` Christian König
2026-05-01 13:26 ` [PATCH v4 01/10] drm/amdgpu/mes: add NOTIFY_WORK_ON_UNMAPPED_QUEUE op + ADD_QUEUE fields Alex Deucher
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=20260430161146.2851078-6-Jesse.Zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=David.Wu3@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@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