Skip to contentSkip to conversation

pci: dwc: Clear MSI interrupt status after it is handled

PATCH In review Faiz Abbas 3 participants 3 messages Aug 10, 2017 – Aug 22, 2017 PCI

lore
Share & tools
lore

Faiz Abbas

author
#0 lore raw

PATCH 1/1 pci: dwc: Clear MSI interrupt status after it is handled

If the interrupt status is cleared before it is handled, it is possible that another interrupt will trigger while servicing the previous one. This is causing timeouts in some wireless lan cards which use pcie. Therefore, clear MSI interrupt status after it gets serviced instead of before calling generic_handler.

---
 drivers/pci/dwc/pcie-designware-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/dwc/pcie-designware-host.c +1 -1
index 28ed32b..78b2584 100644
@@ -71,9 +71,9 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
 		while ((pos = find_next_bit((unsigned long *) &val, 32,
 					    pos)) != 32) {
 			irq = irq_find_mapping(pp->irq_domain, i * 32 + pos);
+			generic_handle_irq(irq);
 			dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12,
 					    4, 1 << pos);
-			generic_handle_irq(irq);
 			pos++;
 		}
 	}
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw

Hello,

Às 12:24 PM de 8/10/2017, Faiz Abbas escreveu:

Quoted 17 lines

If the interrupt status is cleared before it is handled, it is possible that another interrupt will trigger while servicing the previous one. This is causing timeouts in some wireless lan cards which use pcie. Therefore, clear MSI interrupt status after it gets serviced instead of before calling generic_handler.

---
 drivers/pci/dwc/pcie-designware-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/dwc/pcie-designware-host.c +0 -0
index 28ed32b..78b2584 100644

drivers/pci/dwc/pcie-designware-host.c irqreturn_t dw_handle_msi_irq(struct pcie_port *pp) · line 79

Quoted 10 lines
drivers/pci/dwc/pcie-designware-host.c +1 -1
@@ -71,9 +71,9 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
 		while ((pos = find_next_bit((unsigned long *) &val, 32,
 					    pos)) != 32) {
 			irq = irq_find_mapping(pp->irq_domain, i * 32 + pos);
+			generic_handle_irq(irq);
 			dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12,
 					    4, 1 << pos);
-			generic_handle_irq(irq);
 			pos++;
 		}
 	}

It makes sense.

#2 lore raw
In reply to Faiz Abbas
Quoted 7 lines · Faiz Abbas

If the interrupt status is cleared before it is handled, it is possible that another interrupt will trigger while servicing the previous one. This is causing timeouts in some wireless lan cards which use pcie. Therefore, clear MSI interrupt status after it gets serviced instead of before calling generic_handler.

Applied with Joao's ack to pci/host-designware for v4.14, thanks!

Quoted 22 lines
---
 drivers/pci/dwc/pcie-designware-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/dwc/pcie-designware-host.c +1 -1
index 28ed32b..78b2584 100644
@@ -71,9 +71,9 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
 		while ((pos = find_next_bit((unsigned long *) &val, 32,
 					    pos)) != 32) {
 			irq = irq_find_mapping(pp->irq_domain, i * 32 + pos);
+			generic_handle_irq(irq);
 			dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12,
 					    4, 1 << pos);
-			generic_handle_irq(irq);
 			pos++;
 		}
 	}
Signature · 1 line
2.7.4