From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
Prike Liang <prike.liang@amd.com>,
Sunil Khatri <sunil.khatri@amd.com>,
"Jesse Zhang" <Jesse.Zhang@amd.com>
Subject: [PATCH 3/3] drm/amdgpu: program the SH_MEM registers of the SPM VMID
Date: Thu, 29 Oct 2026 15:03:26 +0800 [thread overview]
Message-ID: <20261029070403.22012-3-Jesse.Zhang@amd.com> (raw)
In-Reply-To: <20261029070403.22012-1-Jesse.Zhang@amd.com>
Commit 02232367be23 ("drm/amdgpu: add spm_vmid and exclude it from the
MES, KFD and kq pools") took the SPM VMID out of the kernel queue and the
user queue VMID masks, and since commit 8a9263fc8812 ("drm/amdgpu: use
dedicated SPM VMID from the reserved path") the kernel queue jobs of a VM
with a reserved VMID run on it. The gfx constants_init() only programs
SH_MEM_CONFIG and SH_MEM_BASES for VMID 0 and the kernel queue mask
though, and init_compute_vmid() for the user queue mask, so the SPM VMID
keeps the reset defaults: no unaligned access mode and no apertures.
On navi48 VMID 15 has SH_MEM_CONFIG 0xc000 and SH_MEM_BASES 0 while the
other graphics VMIDs have 0xc00c and 0x20001000. A shader storing a dword
to an address with a byte offset of 1 writes it there in a normal
process, but at the dword aligned address in one which reserved a VMID,
e.g. for profiling with SPM:
$ umr -i 0 -sb 0 0 0 15 -r '*.*.regSH_MEM_CONFIG'
gfx1201.regSH_MEM_CONFIG => 0x0000c000
$ amd_pmc --run-subtest reserved-vmid-unaligned-store
unaligned store: 0x0000000000002a00 normally, 0x000000000000002a with a reserved VMID
Include the SPM VMID in for_each_vmid_and_zero() for the GFXHUB so the
constants_init() of all gfx generations program it like the other
kernel queue VMIDs.
Fixes: 8a9263fc8812 ("drm/amdgpu: use dedicated SPM VMID from the reserved path")
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h
index c134000eecfd..6d0f302c1344 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h
@@ -45,14 +45,17 @@
* Equivalent to OR-ing BIT(0) into id_mgr[hub].vmid_mask and walking
* the result with for_each_set_bit(). Used by the gfx_v*_constants_init()
* paths which must always touch VMID 0 (system) in addition to the regular
- * VMIDs owned by the hub.
+ * VMIDs owned by the hub. On the GFXHUB this includes the SPM VMID, which is
+ * kept out of the pool but runs the kernel queue jobs of the VM reserving it.
*
* Relies on AMDGPU_NUM_VMID (16) fitting in a single unsigned long, i.e.
* vmid_mask[] being a 1-element bitmap.
*/
#define for_each_vmid_and_zero(vmid, adev, hub) \
for (unsigned long __vmid_mask = \
- (adev)->vm_manager.id_mgr[(hub)].vmid_mask[0] | BIT(0); \
+ (adev)->vm_manager.id_mgr[(hub)].vmid_mask[0] | BIT(0) | \
+ ((hub) == AMDGPU_GFXHUB(0) && (adev)->vm_manager.spm_vmid ? \
+ BIT((adev)->vm_manager.spm_vmid) : 0); \
__vmid_mask; __vmid_mask = 0) \
for_each_set_bit((vmid), &__vmid_mask, AMDGPU_NUM_VMID)
--
2.50.1
next prev parent reply other threads:[~2026-10-29 7:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 7:03 [PATCH 1/3] drm/amdgpu: program the SPM VMID for jobs on the reserved VMID again Jesse Zhang
2026-10-29 7:03 ` [PATCH 2/3] drm/amdgpu/gfx12: disallow GFXOFF while updating the SPM VMID Jesse Zhang
2026-10-29 13:37 ` Alex Deucher
2026-10-29 7:03 ` Jesse Zhang [this message]
2026-10-29 13:40 ` [PATCH 3/3] drm/amdgpu: program the SH_MEM registers of " Alex Deucher
2026-10-29 7:17 ` [PATCH 1/3] drm/amdgpu: program the SPM VMID for jobs on the reserved VMID again Lazar, Lijo
2026-10-29 15:04 ` Christian König
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=20261029070403.22012-3-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 \
--cc=prike.liang@amd.com \
--cc=sunil.khatri@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.