]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
accel/amdxdna: Fix race where send ring appears full due to delayed head update
authorLizhi Hou <lizhi.hou@amd.com>
Thu, 11 Dec 2025 04:51:25 +0000 (20:51 -0800)
committerLizhi Hou <lizhi.hou@amd.com>
Fri, 12 Dec 2025 17:49:10 +0000 (09:49 -0800)
commit343f5683cfa443000904c88ce2e23656375fc51c
tree2b1798ac4810e3ff783619c630ad20d11e7d12eb
parent470cb09a2936d3c1ff8aeff46e3c14dcc4314e9b
accel/amdxdna: Fix race where send ring appears full due to delayed head update

The firmware sends a response and interrupts the driver before advancing
the mailbox send ring head pointer. As a result, the driver may observe
the response and attempt to send a new request before the firmware has
updated the head pointer. In this window, the send ring still appears
full, causing the driver to incorrectly fail the send operation.

This race can be triggered more easily in a multithreaded environment,
leading to unexpected and spurious "send ring full" failures.

To address this, poll the send ring head pointer for up to 100us before
returning a full-ring condition. This allows the firmware time to update
the head pointer.

Fixes: b87f920b9344 ("accel/amdxdna: Support hardware mailbox")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20251211045125.1724604-1-lizhi.hou@amd.com
drivers/accel/amdxdna/amdxdna_mailbox.c