On 8/17/26 16:07, Taimuraz Kaitmazov wrote:
amdxdna_drm_sync_bo_ioctl() calls amdxdna_hwctx_sync_debug_bo() for every
FROM_DEVICE sync, which answers -EINVAL when the BO has no assigned hwctx.
Only a BO attached with ATTACH_DEBUG_BO ever gets one, so an ordinary
read-back sync reports failure after its flush has already run.

There is no debug buffer to sync in that case, so answer success.

Signed-off-by: Taimuraz Kaitmazov <[email protected]>
---
  drivers/accel/amdxdna/amdxdna_ctx.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c 
b/drivers/accel/amdxdna/amdxdna_ctx.c
index 855da8c79a1c..c0d0aa53c596 100644
--- a/drivers/accel/amdxdna/amdxdna_ctx.c
+++ b/drivers/accel/amdxdna/amdxdna_ctx.c
@@ -416,7 +416,8 @@ int amdxdna_hwctx_sync_debug_bo(struct amdxdna_client 
*client, u32 debug_bo_hdl)
        guard(mutex)(&xdna->dev_lock);
        hwctx = xa_load(&client->hwctx_xa, abo->assigned_hwctx);
        if (!hwctx) {
-               ret = -EINVAL;
+               /* Not attached as a debug BO, so there is nothing to sync. */
+               ret = 0;

It should check assigned_hwctx before entering this function:

   if (abo->assigned_hwctx != AMDXDNA_INVALID_CTX_HANDLE && args->direction == SYNC_DIRECT_FROM_DEVICE)

       ret = amdxdna_hwctx_sync_debug_bo(client, args->handle);


Thanks,

Lizhi

                goto put_obj;
        }

Reply via email to