Skip to content

Commit 4e11c29

Browse files
mtk20626bjorn-helgaas
authored andcommitted
PCI: mediatek: Clear interrupt status before dispatching handler
We found a failure when using the iperf tool during WiFi performance testing, where some MSIs were received while clearing the interrupt status, and these MSIs cannot be serviced. The interrupt status can be cleared even if the MSI status remains pending. As such, given the edge-triggered interrupt type, its status should be cleared before being dispatched to the handler of the underling device. [kwilczynski: commit log, code comment wording] Link: https://lore.kernel.org/linux-pci/20231211094923.31967-1-jianjun.wang@mediatek.com Fixes: 43e6409 ("PCI: mediatek: Add MSI support for MT2712 and MT7622") Signed-off-by: qizhong cheng <qizhong.cheng@mediatek.com> Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> [bhelgaas: rewrap comment] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: <stable@vger.kernel.org>
1 parent b85ea95 commit 4e11c29

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/pci/controller/pcie-mediatek.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,12 +617,18 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
617617
if (status & MSI_STATUS){
618618
unsigned long imsi_status;
619619

620+
/*
621+
* The interrupt status can be cleared even if the
622+
* MSI status remains pending. As such, given the
623+
* edge-triggered interrupt type, its status should
624+
* be cleared before being dispatched to the
625+
* handler of the underlying device.
626+
*/
627+
writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
620628
while ((imsi_status = readl(port->base + PCIE_IMSI_STATUS))) {
621629
for_each_set_bit(bit, &imsi_status, MTK_MSI_IRQS_NUM)
622630
generic_handle_domain_irq(port->inner_domain, bit);
623631
}
624-
/* Clear MSI interrupt status */
625-
writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
626632
}
627633
}
628634

0 commit comments

Comments
 (0)