GFX12 MES uses low 32 bits of status return for success (1 or 0)
and high bits for debug information if low bits are 0.

GFX11 MES doesn't do this so checking full 64-bit status return
for 1 or 0 is still valid.

v2: user lower_32_bits to check status and write some inline comments to
explain the status pointer value.

Signed-off-by: Jonathan Kim <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
index aff06f06aeee..e3149196143e 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
@@ -228,7 +228,12 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct 
amdgpu_mes *mes,
                        pipe, x_pkt->header.opcode);
 
        r = amdgpu_fence_wait_polling(ring, seq, timeout);
-       if (r < 1 || !*status_ptr) {
+
+       /*
+        * status_ptr[31:0] == 0 (fail) or status_ptr[63:0] == 1 (success).
+        * If status_ptr[31:0] == 0 then status_ptr[63:32] will have debug 
error information.
+        */
+       if (r < 1 || !(lower_32_bits(*status_ptr))) {
 
                if (misc_op_str)
                        dev_err(adev->dev, "MES(%d) failed to respond to msg=%s 
(%s)\n",
-- 
2.34.1

Reply via email to