[PATCH] drm/amdgpu: fix identifying prefix and postfix SET_Q_MODE packet
ZhenGuo Yin
zhenguo.yin at amd.com
Mon Nov 4 09:18:00 UTC 2024
[Why]
In legacy mode(no MCBP support) shadow_va of prefix SET_Q_MODE
packet is set to 0, matching the value used in the postfix
SET_Q_MODE packet. A prefix SET_Q_MODE packet will be skipped
unexpectedly when mixed running jobs with shadowing on and off.
[How]
Both shadow_va and vmid should be set to 0 in postfix SET_Q_MODE
packet. Combined these two conditions together to identify the
prefix and postfix SET_Q_MODE packet.
Fixes: 8bc75586ea01 ("drm/amdgpu: workaround to avoid SET_Q_MODE packets v2")
Signed-off-by: ZhenGuo Yin <zhenguo.yin at amd.com>
---
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 5aff8f72de9c..01b9dfe5b307 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -5862,6 +5862,7 @@ static void gfx_v11_0_ring_emit_gfx_shadow(struct amdgpu_ring *ring,
{
struct amdgpu_device *adev = ring->adev;
unsigned int offs, end;
+ bool is_postfix = !shadow_va && !vmid;
if (!adev->gfx.cp_gfx_shadow || !ring->ring_obj)
return;
@@ -5886,7 +5887,7 @@ static void gfx_v11_0_ring_emit_gfx_shadow(struct amdgpu_ring *ring,
* the postfix SET_Q_MODE packet. This is changed below with a
* WRITE_DATA command when the postfix executed.
*/
- amdgpu_ring_write(ring, shadow_va ? 1 : 0);
+ amdgpu_ring_write(ring, is_postfix ? 0 : 1);
amdgpu_ring_write(ring, 0);
if (ring->set_q_mode_offs) {
@@ -5901,7 +5902,7 @@ static void gfx_v11_0_ring_emit_gfx_shadow(struct amdgpu_ring *ring,
* When the postfix SET_Q_MODE packet executes we need to make sure that the
* next prefix SET_Q_MODE packet executes as well.
*/
- if (!shadow_va) {
+ if (is_postfix) {
uint64_t addr;
addr = amdgpu_bo_gpu_offset(ring->ring_obj);
@@ -5928,7 +5929,7 @@ static void gfx_v11_0_ring_emit_gfx_shadow(struct amdgpu_ring *ring,
if (ring->set_q_mode_offs)
amdgpu_ring_patch_cond_exec(ring, end);
- if (shadow_va) {
+ if (!is_postfix) {
uint64_t token = shadow_va ^ csa_va ^ gds_va ^ vmid;
/*
--
2.35.1
More information about the amd-gfx
mailing list