]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommu/riscv: Stop polling when CQCSR reports an error
authorFangyu Yu <fangyu.yu@linux.alibaba.com>
Fri, 27 Feb 2026 11:26:40 +0000 (19:26 +0800)
committerJoerg Roedel <joerg.roedel@amd.com>
Tue, 17 Mar 2026 12:56:21 +0000 (13:56 +0100)
commitb2e5684558edf3e9bbe18d0e0043854994eab1be
treeb06847815caeba72803f18a90f4e89e73a7257f6
parent7217cee35aadbb07e12673bcf1dcf729e1b2f6c9
iommu/riscv: Stop polling when CQCSR reports an error

The cmdq wait loop busy-polls the consumer index until it advances
or the software timeout expires. If the IOMMU has already signaled
a command queue failure in CQCSR, continuing to poll for progress is
pointless.

Make riscv_iommu_queue_wait() also terminate the poll when any of these
CQCSR error bits are observed.

This helps the caller return earlier in failure cases and avoids
spinning until the full timeout interval when the hardware has already
reported an error. On single-core systems in particular, the current
busy-wait can delay servicing the command-timeout interrupt until the
software timeout expires (90s by default).

Fixes: 856c0cfe5c5f ("iommu/riscv: Command and fault queue support")
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/riscv/iommu.c