Skip to contentSkip to conversation

PCI: mediatek: Clear interrupt status before dispatching handler

PATCH Applied Jianjun Wang 2 participants 2 messages Dec 11, 2023 – Jan 8, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 PCI: mediatek: Clear interrupt status before dispatching handler

From: qizhong cheng <[email protected]>

We found a failure when used iperf tool for wifi performance testing, there are some MSIs received while clearing the interrupt status, these MSIs cannot be serviced.

The interrupt status can be cleared even the MSI status still remaining, as an edge-triggered interrupts, its interrupt status should be cleared before dispatching to the handler of device.

Fixes 43e6409db64d ("PCI: mediatek: Add MSI support for MT2712 and MT7622")

---
v4:
- Found that this patch has not been merged, resending it as v4.

v3:
- Add Fix tag.

v2:
- Update the subject line.
- Improve the commit log and code comments.

---
 drivers/pci/controller/pcie-mediatek.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/controller/pcie-mediatek.c +7 -2
index 66a8f73296fc..3fb7f08de061 100644
@@ -617,12 +617,17 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
 		if (status & MSI_STATUS){
 			unsigned long imsi_status;
 
+			/*
+			 * The interrupt status can be cleared even the MSI
+			 * status still remaining, hence as an edge-triggered
+			 * interrupts, its interrupt status should be cleared
+			 * before dispatching handler.
+			 */
+			writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
 			while ((imsi_status = readl(port->base + PCIE_IMSI_STATUS))) {
 				for_each_set_bit(bit, &imsi_status, MTK_MSI_IRQS_NUM)
 					generic_handle_domain_irq(port->inner_domain, bit);
 			}
-			/* Clear MSI interrupt status */
-			writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
 		}
 	}
 
Signature · 1 line
2.18.0
#1 lore raw

Hello,

Quoted 7 lines

We found a failure when used iperf tool for wifi performance testing, there are some MSIs received while clearing the interrupt status, these MSIs cannot be serviced.

The interrupt status can be cleared even the MSI status still remaining, as an edge-triggered interrupts, its interrupt status should be cleared before dispatching to the handler of device.

Applied to controller/mediatek, thank you!

[1/1] PCI: mediatek: Clear interrupt status before dispatching handler

      https://git.kernel.org/pci/pci/c/4fea201e110e

	Krzysztof