From: sashiko-bot@kernel.org
To: "Alex Deucher" <alexander.deucher@amd.com>,
amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/5] drm/amdgpu: bring back the ring parameter for update_spm_vmid()
Date: Mon, 16 Nov 2026 17:26:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-217433@kernel.org> (raw)
In-Reply-To: <20261116165713.1945549-5-alexander.deucher@amd.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] drm/amdgpu: hardcoded XCC 0 in gfx_v9_4_3_xcc_rlc_resume()
skips XCCs 1..N-1
- [Medium] drm/amdgpu: gfx9 compute emit_frame_size exceeds max_dw in
amdgpu_ring_init()
- [Medium] drm/amdgpu: update_spm_vmid() skipped on SR-IOV VFs in
gfx_v8_0 and gfx_v9_4_3
--
commit 08b45306962b59cde3c232193cc26534f308aaa2
Author: Alex Deucher <alexander.deucher@amd.com>
drm/amdgpu: bring back the ring parameter for update_spm_vmid()
This commit restores the ring parameter to update_spm_vmid() so that GFX9,
GFX10, GFX11, and GFX12.0 emit the SPM VMID update on the ring during IB
scheduling while skipping MMIO updates when a ring is provided.
[ ... ]
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index df935827b002a..e818280139791 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -4084,7 +4084,8 @@ static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)
>
> /* init spm vmid with 0xf */
> if (adev->gfx.rlc.funcs->update_spm_vmid)
> - adev->gfx.rlc.funcs->update_spm_vmid(adev, 0, adev->vm_manager.spm_vmid);
> + adev->gfx.rlc.funcs->update_spm_vmid(adev, 0, NULL, adev->vm_manager.spm_vmid);
> +
> return 0;
> }
>
> @@ -5483,10 +5484,13 @@ static void gfx_v8_0_unset_safe_mode(struct amdgpu_device *adev, int xcc_id)
> }
>
> static void gfx_v8_0_update_spm_vmid(struct amdgpu_device *adev, int xcc_id,
> - unsigned int vmid)
> + struct amdgpu_ring *ring, unsigned vmid)
> {
> u32 data;
>
> + if (ring)
> + return;
> +
> amdgpu_gfx_off_ctrl(adev, false);
>
> if (amdgpu_sriov_is_pp_one_vf(adev))
[Severity: Medium]
Does returning early when ring is non-NULL leave mmRLC_SPM_VMID unprogrammed
on SR-IOV VFs in one-VF mode?
gfx_v8_0_rlc_resume() returns early when amdgpu_sriov_vf(adev) is true before
reaching the update_spm_vmid(adev, 0, NULL, ...) call:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:gfx_v8_0_rlc_resume() {
if (amdgpu_sriov_vf(adev)) {
gfx_v8_0_init_csb(adev);
return 0;
}
...
}
With amdgpu_ib_schedule() passing a non-NULL ring, gfx_v8_0_update_spm_vmid()
now returns before reaching the amdgpu_sriov_is_pp_one_vf(adev) branch, so
mmRLC_SPM_VMID is never programmed on SR-IOV VFs. The same issue affects
gfx_v9_4_3_update_spm_vmid(), because both gfx_v9_4_3_rlc_resume() and
gfx_v9_4_3_xcp_resume() skip calling gfx_v9_4_3_xcc_rlc_resume() when
amdgpu_sriov_vf(adev) is true.
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 2e2673a6dbbf5..be45c10b6f579 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
[ ... ]
> @@ -7663,6 +7675,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
> .get_wptr = gfx_v9_0_ring_get_wptr_compute,
> .set_wptr = gfx_v9_0_ring_set_wptr_compute,
> .emit_frame_size =
> + 5 + /* update_spm_vmid */
> 20 + /* gfx_v9_0_ring_emit_gds_switch */
> 7 + /* gfx_v9_0_ring_emit_hdp_flush */
> 5 + /* hdp invalidate */
[Severity: Medium]
Does adding 5 dwords here trigger WARN_ON(max_ibs_dw > max_dw) in
amdgpu_ring_init() for every GFX9 compute ring?
This increases gfx_v9_0_ring_funcs_compute.emit_frame_size from 145 to 150.
In amdgpu_ring_init(), max_ibs_dw is 150 + 125 * 7 = 1025, which rounds up to
1280 with align_mask (0xff), exceeding the max_dw of 1024 passed by
gfx_v9_0_compute_ring_init().
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> index 151336e6094f7..f28ffe8a5ac55 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> @@ -1586,7 +1586,7 @@ static int gfx_v9_4_3_xcc_rlc_resume(struct amdgpu_device *adev, int xcc_id)
>
> /* init spm vmid with 0xf */
> if (adev->gfx.rlc.funcs->update_spm_vmid)
> - adev->gfx.rlc.funcs->update_spm_vmid(adev, 0, adev->vm_manager.spm_vmid);
> + adev->gfx.rlc.funcs->update_spm_vmid(adev, 0, NULL, adev->vm_manager.spm_vmid);
>
> return 0;
> }
> @@ -1609,10 +1609,13 @@ static int gfx_v9_4_3_rlc_resume(struct amdgpu_device *adev)
> }
>
> static void gfx_v9_4_3_update_spm_vmid(struct amdgpu_device *adev,
> - int inst, unsigned int vmid)
> + int inst, struct amdgpu_ring *ring, unsigned int vmid)
> {
> u32 reg, pre_data, data;
>
> + if (ring)
> + return;
> +
> reg = SOC15_REG_OFFSET(GC, GET_INST(GC, inst), regRLC_SPM_MC_CNTL);
[Severity: High]
Should gfx_v9_4_3_xcc_rlc_resume() pass xcc_id instead of 0 to
update_spm_vmid()?
Previously, amdgpu_ib_schedule() called update_spm_vmid() with ring->xcc_id on
each IB submission, programming regRLC_SPM_MC_CNTL on all XCCs. Now that
gfx_v9_4_3_update_spm_vmid() returns early when ring is non-NULL,
gfx_v9_4_3_xcc_rlc_resume() is the only caller that programs the register, and
passing hardcoded 0 leaves XCCs 1..num_xcc-1 at their hardware reset value of
VMID 0 (the kernel VMID).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116165713.1945549-1-alexander.deucher@amd.com?part=5
next prev parent reply other threads:[~2026-11-16 17:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:57 [PATCH 1/5] Revert "drm/amdgpu: re-enable SPM updates in the the IB path" Alex Deucher
2026-11-16 16:57 ` [PATCH 2/5] Revert "drm/amdgpu: reemit RLC SPM register in ring reemit" Alex Deucher
2026-11-16 16:57 ` [PATCH 3/5] drm/amdgpu/gfx7,8: program the RLC SPM in RLC resume Alex Deucher
2026-11-16 16:57 ` [PATCH 4/5] drm/amdgpu/gfx9.4.3: " Alex Deucher
2026-11-16 17:20 ` sashiko-bot
2026-11-16 16:57 ` [PATCH 5/5] drm/amdgpu: bring back the ring parameter for update_spm_vmid() Alex Deucher
2026-11-16 17:26 ` sashiko-bot [this message]
2026-11-16 20:13 ` vitaly prosyak
2026-11-16 17:08 ` [PATCH 1/5] Revert "drm/amdgpu: re-enable SPM updates in the the IB path" sashiko-bot
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=sashiko-outbox-217433@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.