From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
Jesse.zhang <Jesse.zhang@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH v4 08/10] drm/amdgpu/mes: route NORMAL aggregated doorbell through global agdb_bo
Date: Fri, 1 May 2026 00:03:36 +0800 [thread overview]
Message-ID: <20260430161146.2851078-8-Jesse.Zhang@amd.com> (raw)
In-Reply-To: <20260430161146.2851078-1-Jesse.Zhang@amd.com>
From: "Jesse.zhang" <Jesse.zhang@amd.com>
SDMA UMQ submits cannot reliably wake the SDMA engine via the per-queue
doorbell because LSDMA programs the HQD-slot DOORBELL_OFFSET register
asynchronously after MES MAP_QUEUE — early rings hit a stale slot and
get silently dropped. Going through the MES aggregated doorbell works,
but today's slot lives inside the MES kernel doorbell page, which is
not user-mappable. This forces every SDMA UMQ submit through
amdgpu_userq_signal_ioctl just so the kernel can WDOORBELL32() the
agg slot — defeating the purpose of user mode queues.
Allocate the NORMAL-priority aggregated doorbell inside the global
adev->agdb_bo. MES is told via SET_HW_RESOURCES to monitor the new
location — code unchanged because it reads
mes->aggregated_doorbells[NORMAL] which now points into agdb_bo.
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 24 ++++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 9 +++++++++
2 files changed, 33 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
index bdf2561b5404..974dd7a3fc4f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
@@ -28,6 +28,7 @@
#include "amdgpu.h"
#include "soc15_common.h"
#include "amdgpu_mes_ctx.h"
+#include "amdgpu_doorbell.h"
#define AMDGPU_MES_MAX_NUM_OF_QUEUES_PER_PROCESS 1024
#define AMDGPU_ONE_DOORBELL_SIZE 8
@@ -57,6 +58,29 @@ static int amdgpu_mes_doorbell_init(struct amdgpu_device *adev)
set_bit(i, mes->doorbell_bitmap);
}
+ /*
+ * Relocate the NORMAL-priority aggregated doorbell into the global
+ * aggregated-doorbell BO so userspace SDMA UMQs can mmap it (via
+ * AMDGPU_GEM_GLOBAL_AGGREGATED_DOORBELL) and ring it directly,
+ * bypassing signal_ioctl. GFX/COMPUTE NORMAL queues are unaffected
+ * functionally — they don't actively ring the agg doorbell; the HW
+ * CP_UNMAPPED_DOORBELL intercept wakes MES for them. SDMA has no
+ * such intercept and needs an explicit wake path. Other priorities
+ * stay in the MES kernel doorbell page.
+ */
+ if (adev->agdb_bo) {
+ int r = amdgpu_bo_reserve(adev->agdb_bo, true);
+
+ if (r)
+ return r;
+ adev->sdma.agdb_offset = AMDGPU_NAVI10_DOORBELL_sDMA_ENGINE0 << 1;
+ adev->mes.aggregated_doorbells[AMDGPU_MES_PRIORITY_LEVEL_NORMAL] =
+ amdgpu_doorbell_index_on_bar(adev, adev->agdb_bo,
+ adev->sdma.agdb_offset,
+ sizeof(u32));
+ amdgpu_bo_unreserve(adev->agdb_bo);
+ }
+
return 0;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
index 2bf365609775..11cefb4c3a27 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
@@ -144,6 +144,15 @@ struct amdgpu_sdma {
struct list_head reset_callback_list;
bool no_user_submission;
bool disable_uq;
+ /*
+ * Dword offset within adev->agdb_bo for the SDMA UMQ aggregated
+ * doorbell. MES is told via SET_HW_RESOURCES to monitor this slot
+ * for NORMAL priority wakes. Userspace mmaps adev->agdb_bo (via
+ * AMDGPU_GEM_GLOBAL_AGGREGATED_DOORBELL) and writes WPTR here to
+ * wake SDMA UMQs without going through signal_ioctl. Reported via
+ * AMDGPU_INFO_DOORBELL with query_hw_ip.type = AMDGPU_HW_IP_DMA.
+ */
+ uint32_t agdb_offset;
void (*get_csa_info)(struct amdgpu_device *adev,
struct amdgpu_sdma_csa_info *csa_info);
};
--
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 ` [PATCH v4 06/10] drm/amdgpu: add AMDGPU_INFO_DOORBELL Jesse Zhang
2026-05-01 13:37 ` 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 ` Jesse Zhang [this message]
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-8-Jesse.Zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=Alexander.Deucher@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