[PATCH] iommu/riscv: Stop polling when CQCSR reports an error

Jörg Rödel joro at 8bytes.org
Tue Mar 17 05:56:37 PDT 2026


On Fri, Feb 27, 2026 at 07:26:40PM +0800, fangyu.yu at linux.alibaba.com wrote:
> From: Fangyu Yu <fangyu.yu at linux.alibaba.com>
> 
> 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 at linux.alibaba.com>
> ---
>  drivers/iommu/riscv/iommu.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.



More information about the linux-riscv mailing list