From: Lang Yu <lang.yu@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Mukul Joshi <mukul.joshi@amd.com>,
"David Belanger" <david.belanger@amd.com>,
Lang Yu <lang.yu@amd.com>
Subject: [PATCH 1/4] drm/amdgpu: Add a helper macro to align mqd size
Date: Mon, 26 Jan 2026 18:25:11 +0800 [thread overview]
Message-ID: <20260126102514.273891-1-lang.yu@amd.com> (raw)
MES FW uses addr(mqd_addr + sizeof(struct mqd) + 3*sizeof(uint32_t))
as fence address and writes a 32 bit fence value to this address.
Driver needs to allocate some extra memory(at least 4 DWs) in addition to
sizeof(struct mqd) as mqd memory.
For gfx11/12, sizeof(struct mqd) < PAGE_SIZE, allocate mqd memory with
PAGE_SIZE aligned works. For gfx12.1, sizeof(struct mqd) == PAGE_SIZE,
it doesn't work.
KFD mqd manager hardcodes mqd size to PAGE_SIZE/MQD_SIZE.
Let's use AMDGPU_MQD_SIZE_ALIGN to avoid hardcoding in differnet place
and across different IP version. It is used in two place.
1. mqd memory alloction
2. mqd stride initialization
Signed-off-by: Lang Yu <lang.yu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 9c11535c44c6..41f32ed39113 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1239,6 +1239,11 @@ struct amdgpu_device {
struct amdgpu_kfd_dev kfd;
};
+/*
+ * MES will use memory beyond struct MQD size, 5 DWs currently
+ */
+#define AMDGPU_MQD_SIZE_ALIGN(mqd_size) ALIGN(((mqd_size) + 20), PAGE_SIZE)
+
static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
uint8_t ip, uint8_t inst)
{
--
2.34.1
next reply other threads:[~2026-01-26 10:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 10:25 Lang Yu [this message]
2026-01-26 10:25 ` [PATCH 2/4] drm/amdgpu: Use AMDGPU_MQD_SIZE_ALIGN in KGD Lang Yu
2026-01-26 10:25 ` [PATCH 3/4] drm/amdkfd: Adjust parameter of allocate_mqd Lang Yu
2026-01-26 10:25 ` [PATCH 4/4] drm/amdkfd: Use AMDGPU_MQD_SIZE_ALIGN in gfx11+ kfd mqd manager Lang Yu
2026-01-27 15:16 ` Belanger, David
2026-01-27 16:22 ` Joshi, Mukul
2026-01-28 0:45 ` Yu, Lang
2026-01-27 16:26 ` [PATCH 1/4] drm/amdgpu: Add a helper macro to align mqd size Joshi, Mukul
2026-01-28 0:41 ` Yu, Lang
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=20260126102514.273891-1-lang.yu@amd.com \
--to=lang.yu@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=david.belanger@amd.com \
--cc=mukul.joshi@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