]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
accel/amdxdna: Return errors for failed debug BO commands
authorLizhi Hou <lizhi.hou@amd.com>
Fri, 29 May 2026 16:21:22 +0000 (09:21 -0700)
committerLizhi Hou <lizhi.hou@amd.com>
Wed, 3 Jun 2026 18:47:12 +0000 (11:47 -0700)
The config and sync debug BO commands currently may report success even
when the operation fails.

Capture the firmware return status and propagate the corresponding error
to userspace.

Fixes: 7ea046838021 ("accel/amdxdna: Support firmware debug buffer")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260529162122.1976376-1-lizhi.hou@amd.com
drivers/accel/amdxdna/aie2_ctx.c

index 2ad343728782b1693a0aff738b70adccf92224fe..da89b3701f5b6e9bc2ed57c536358b38842b8500 100644 (file)
@@ -305,17 +305,13 @@ aie2_sched_drvcmd_resp_handler(void *handle, void __iomem *data, size_t size)
        struct amdxdna_sched_job *job = handle;
        int ret = 0;
 
-       if (unlikely(!data))
-               goto out;
-
-       if (unlikely(size != sizeof(u32))) {
+       if (unlikely(!data || size != sizeof(u32))) {
+               job->drv_cmd->result = U32_MAX;
                ret = -EINVAL;
-               goto out;
+       } else {
+               job->drv_cmd->result = readl(data);
        }
 
-       job->drv_cmd->result = readl(data);
-
-out:
        aie2_sched_notify(job);
        return ret;
 }
@@ -940,6 +936,7 @@ static int aie2_hwctx_cfg_debug_bo(struct amdxdna_hwctx *hwctx, u32 bo_hdl,
        aie2_cmd_wait(hwctx, seq);
        if (cmd.result) {
                XDNA_ERR(xdna, "Response failure 0x%x", cmd.result);
+               ret = -EINVAL;
                goto put_obj;
        }