[PATCH RFC DNM 06/15] thunderbolt: nhi: Clear ring interrupts when not using MSI-X
From: Konrad Dybcio
Date: Tue Nov 24 2026 - 15:02:55 EST
Commit 468c49f44759 ("thunderbolt: Disable interrupt auto clear for
rings") made the hardware stop clearing the ring interrupt status on
read for all routers except Intel ones, and added an explicit write to
REG_RING_INT_CLEAR to the MSI-X handler. The single-interrupt handler
was not updated though, so for such routers the status bits are never
cleared and the interrupt keeps firing.
Write back the bits that were found set in each notify register to
REG_RING_INT_CLEAR, before handling the rings that they belong to.
Fixes: 468c49f44759 ("thunderbolt: Disable interrupt auto clear for rings")
Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
---
drivers/thunderbolt/nhi.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index f54ab2189cf424d04a9ec48576efe78283a83138..e48521482c021c7f5f73349ce16519d6088d3250 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -1036,13 +1036,20 @@ void nhi_interrupt_work(struct work_struct *work)
/*
* Starting at REG_RING_NOTIFY_BASE there are three status bitfields
* (TX, RX, RX overflow). We iterate over the bits and read a new
- * dwords as required. The registers are cleared on read.
+ * dwords as required. The registers are cleared on read, unless
+ * auto-clear is disabled, in which case the bits that were set have
+ * to be written back to REG_RING_INT_CLEAR.
*/
for (bit = 0; bit < 3 * nhi->hop_count; bit++) {
- if (bit % 32 == 0)
+ if (bit % 32 == 0) {
value = ioread32(nhi->iobase
+ REG_RING_NOTIFY_BASE
+ 4 * (bit / 32));
+ if (!(nhi->quirks & QUIRK_AUTO_CLEAR_INT))
+ iowrite32(value, nhi->iobase
+ + REG_RING_INT_CLEAR
+ + 4 * (bit / 32));
+ }
if (++hop == nhi->hop_count) {
hop = 0;
type++;
--
2.55.0