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;
                goto put_obj;
        }
 
-- 
2.55.0

Reply via email to