Skip to contentSkip to conversation

PCI: pcie-xilinx-dma-pl: Fix off-by-one INTx IRQ handling

PATCH In review Stefan Roese 3 participants 6 messages Oct 21, 2025

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

PATCH v2 1/1 PCI: pcie-xilinx-dma-pl: Fix off-by-one INTx IRQ handling

While testing with NVMe drives connected to the Versal QDMA PL PCIe RP on our platform I noticed that with MSI disabled (e.g. via pci=nomsi) the NVMe interrupts are not delivered to the host CPU resulting in timeouts while probing.

Debugging has shown, that the hwirq numbers passed to this device driver (1...4, 1=INTA etc) need to get adjusted to match the numbers in the controller registers bits (0...3).

This patch now adds pci_irqd_intx_xlate to the INTx IRQ domain ops, handling this IRQ number translation correctly.

Cc Sean Anderson <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc Ravi Kumar Bandi <[email protected]>
Cc Thippeswamy Havalige <[email protected]>
Cc Michal Simek <[email protected]>
Cc Bjorn Helgaas <[email protected]>

---
v2:
- Use pci_irqd_intx_xlate to handle this IRQ number translation as suggested by Sean (thanks again)

 drivers/pci/controller/pcie-xilinx-dma-pl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/pcie-xilinx-dma-pl.c +1 -0
index 84888eda990b2..80095457ec531 100644
@@ -370,6 +370,7 @@ static int xilinx_pl_dma_pcie_intx_map(struct irq_domain *domain,
 /* INTx IRQ Domain operations */
 static const struct irq_domain_ops intx_domain_ops = {
 	.map = xilinx_pl_dma_pcie_intx_map,
+	.xlate = pci_irqd_intx_xlate,
 };
 
 static irqreturn_t xilinx_pl_dma_pcie_msi_handler_high(int irq, void *args)
Signature · 1 line
2.51.1
#1 lore raw
Quoted 11 lines · Stefan Roese

While testing with NVMe drives connected to the Versal QDMA PL PCIe RP on our platform I noticed that with MSI disabled (e.g. via pci=nomsi) the NVMe interrupts are not delivered to the host CPU resulting in timeouts while probing.

Debugging has shown, that the hwirq numbers passed to this device driver (1...4, 1=INTA etc) need to get adjusted to match the numbers in the controller registers bits (0...3).

This patch now adds pci_irqd_intx_xlate to the INTx IRQ domain ops, handling this IRQ number translation correctly.

s/pcie-xilinx-dma-pl:/xilinx-xdma:/ # in subject
s/has shown, that/has shown that/
s/This patch now adds/Add/
s/pci_irqd_intx_xlate/pci_irqd_intx_xlate()/

We'll do this when applying, no need to repost for this.

I wonder how many other drivers have this issue.
pci_irqd_intx_xlate() is used only by:

dwc/pci-dra7xx.c
pcie-altera.c
pcie-xilinx-nwl.c
pcie-xilinx.c
pcie-xilinx-dma-pl.c # this patch

Is there something different about these drivers that means they need it when all the others don't?

Quoted 30 lines
Cc Sean Anderson <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc Ravi Kumar Bandi <[email protected]>
Cc Thippeswamy Havalige <[email protected]>
Cc Michal Simek <[email protected]>
Cc Bjorn Helgaas <[email protected]>

---
v2:
- Use pci_irqd_intx_xlate to handle this IRQ number translation as suggested by Sean (thanks again)

 drivers/pci/controller/pcie-xilinx-dma-pl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/pcie-xilinx-dma-pl.c +1 -0
index 84888eda990b2..80095457ec531 100644
@@ -370,6 +370,7 @@ static int xilinx_pl_dma_pcie_intx_map(struct irq_domain *domain,
 /* INTx IRQ Domain operations */
 static const struct irq_domain_ops intx_domain_ops = {
 	.map = xilinx_pl_dma_pcie_intx_map,
+	.xlate = pci_irqd_intx_xlate,
 };
 
 static irqreturn_t xilinx_pl_dma_pcie_msi_handler_high(int irq, void *args)
Signature · 1 line
2.51.1
#2 lore raw

Hi Bjorn,

Quoted 13 lines · Bjorn Helgaas
Quoted 11 lines · Stefan Roese

While testing with NVMe drives connected to the Versal QDMA PL PCIe RP on our platform I noticed that with MSI disabled (e.g. via pci=nomsi) the NVMe interrupts are not delivered to the host CPU resulting in timeouts while probing.

Debugging has shown, that the hwirq numbers passed to this device driver (1...4, 1=INTA etc) need to get adjusted to match the numbers in the controller registers bits (0...3).

This patch now adds pci_irqd_intx_xlate to the INTx IRQ domain ops, handling this IRQ number translation correctly.

Quoted 6 lines

s/pcie-xilinx-dma-pl:/xilinx-xdma:/ # in subject
s/has shown, that/has shown that/
s/This patch now adds/Add/
s/pci_irqd_intx_xlate/pci_irqd_intx_xlate()/

We'll do this when applying, no need to repost for this.

Okay, thanks.

Quoted 11 lines

I wonder how many other drivers have this issue.
pci_irqd_intx_xlate() is used only by:

dwc/pci-dra7xx.c
pcie-altera.c
pcie-xilinx-nwl.c
pcie-xilinx.c
pcie-xilinx-dma-pl.c # this patch

Is there something different about these drivers that means they need it when all the others don't?

I can't really tell. I'm pretty sure that this driver also needs pci_irqd_intx_xlate():

pcie-xilinx-cpm.c

I can't test it right now though. Perhaps in a few weeks though.

My best guess is, that legacy PCI IRQs are very rarely (not at all?)
used and therefor tested these days. On our ZynqMP / Versal platforms this is currently sometimes used, as the RP does not support MSI-X (only MSI which is very unfortunate - and legacy of course). So it
might be that some other drivers are missing this intx_xlate as well.
Should be easy to test by booting with pci=nomsi.

Thanks,
Stefan

Quoted 30 lines
Quoted 30 lines
Cc Sean Anderson <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc Ravi Kumar Bandi <[email protected]>
Cc Thippeswamy Havalige <[email protected]>
Cc Michal Simek <[email protected]>
Cc Bjorn Helgaas <[email protected]>

---
v2:
- Use pci_irqd_intx_xlate to handle this IRQ number translation as suggested by Sean (thanks again)

  drivers/pci/controller/pcie-xilinx-dma-pl.c | 1 +
  1 file changed, 1 insertion(+)
drivers/pci/controller/pcie-xilinx-dma-pl.c +1 -0
index 84888eda990b2..80095457ec531 100644
@@ -370,6 +370,7 @@ static int xilinx_pl_dma_pcie_intx_map(struct irq_domain *domain,
  /* INTx IRQ Domain operations */
  static const struct irq_domain_ops intx_domain_ops = {
  	.map = xilinx_pl_dma_pcie_intx_map,
+	.xlate = pci_irqd_intx_xlate,
  };
 
  static irqreturn_t xilinx_pl_dma_pcie_msi_handler_high(int irq, void *args)
Signature · 1 line
2.51.1
#3 lore raw
Quoted 32 lines · Stefan Roese
Quoted 12 lines · Bjorn Helgaas
Quoted 11 lines · Stefan Roese

While testing with NVMe drives connected to the Versal QDMA PL PCIe RP on our platform I noticed that with MSI disabled (e.g. via pci=nomsi) the NVMe interrupts are not delivered to the host CPU resulting in timeouts while probing.

Debugging has shown, that the hwirq numbers passed to this device driver (1...4, 1=INTA etc) need to get adjusted to match the numbers in the controller registers bits (0...3).

This patch now adds pci_irqd_intx_xlate to the INTx IRQ domain ops, handling this IRQ number translation correctly.

...

Quoted 11 lines

I wonder how many other drivers have this issue.
pci_irqd_intx_xlate() is used only by:

dwc/pci-dra7xx.c
pcie-altera.c
pcie-xilinx-nwl.c
pcie-xilinx.c
pcie-xilinx-dma-pl.c # this patch

Is there something different about these drivers that means they need it when all the others don't?

I can't really tell. I'm pretty sure that this driver also needs pci_irqd_intx_xlate():

pcie-xilinx-cpm.c

Quoted 8 lines

I can't test it right now though. Perhaps in a few weeks though.

My best guess is, that legacy PCI IRQs are very rarely (not at all?) used and therefor tested these days. On our ZynqMP / Versal platforms this is currently sometimes used, as the RP does not support MSI-X (only MSI which is very unfortunate - and legacy of course). So it might be that some other drivers are missing this intx_xlate as well. Should be easy to test by booting with pci=nomsi.

I suspect many other drivers are also broken but not tested with INTx. I guess we should ask about testing when merging new drivers that claim to support INTx.

#4 lore raw
In reply to Bjorn Helgaas
Quoted 23 lines · Bjorn Helgaas
Quoted 11 lines · Stefan Roese

While testing with NVMe drives connected to the Versal QDMA PL PCIe RP on our platform I noticed that with MSI disabled (e.g. via pci=nomsi) the NVMe interrupts are not delivered to the host CPU resulting in timeouts while probing.

Debugging has shown, that the hwirq numbers passed to this device driver (1...4, 1=INTA etc) need to get adjusted to match the numbers in the controller registers bits (0...3).

This patch now adds pci_irqd_intx_xlate to the INTx IRQ domain ops, handling this IRQ number translation correctly.

s/pcie-xilinx-dma-pl:/xilinx-xdma:/ # in subject
s/has shown, that/has shown that/
s/This patch now adds/Add/
s/pci_irqd_intx_xlate/pci_irqd_intx_xlate()/

We'll do this when applying, no need to repost for this.

I wonder how many other drivers have this issue.
pci_irqd_intx_xlate() is used only by:

Quoted 8 lines

dwc/pci-dra7xx.c
pcie-altera.c
pcie-xilinx-nwl.c
pcie-xilinx.c
pcie-xilinx-dma-pl.c # this patch

Is there something different about these drivers that means they need it when all the others don't?

I think many PCI controllers just don't differentiate between legacy interrupts. e.g. I looked at NXP's LS1046 which is based on DWC and it does

#interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 7>;
interrupt-map = <0000 0 0 1 &gic GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,

		<0000 0 0 2 &gic GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
		<0000 0 0 3 &gic GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
		<0000 0 0 4 &gic GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;

which I believe maps all root port legacy interrupts to a single shared GIC interrupt. Which sort of defeats the purpose of swizzling, but most stuff uses MSI(-X) now so I guess they figured a status register wasn't worth the verification.

And yes, I don't think legacy interrupts are tested very much these days.

--Sean

Reviewed-by on v2 1/1
#5 lore raw
In reply to Stefan Roese
Quoted 32 lines · Stefan Roese

While testing with NVMe drives connected to the Versal QDMA PL PCIe RP on our platform I noticed that with MSI disabled (e.g. via pci=nomsi) the NVMe interrupts are not delivered to the host CPU resulting in timeouts while probing.

Debugging has shown, that the hwirq numbers passed to this device driver (1...4, 1=INTA etc) need to get adjusted to match the numbers in the controller registers bits (0...3).

This patch now adds pci_irqd_intx_xlate to the INTx IRQ domain ops, handling this IRQ number translation correctly.

Cc Sean Anderson <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc Ravi Kumar Bandi <[email protected]>
Cc Thippeswamy Havalige <[email protected]>
Cc Michal Simek <[email protected]>
Cc Bjorn Helgaas <[email protected]>

---
v2:
- Use pci_irqd_intx_xlate to handle this IRQ number translation as suggested by Sean (thanks again)

 drivers/pci/controller/pcie-xilinx-dma-pl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/pcie-xilinx-dma-pl.c +0 -0
index 84888eda990b2..80095457ec531 100644

drivers/pci/controller/pcie-xilinx-dma-pl.c static int xilinx_pl_dma_pcie_intx_map(struct irq_domain *domain, · line 376

Quoted 7 lines
drivers/pci/controller/pcie-xilinx-dma-pl.c +1 -0
@@ -370,6 +370,7 @@ static int xilinx_pl_dma_pcie_intx_map(struct irq_domain *domain,
 /* INTx IRQ Domain operations */
 static const struct irq_domain_ops intx_domain_ops = {
 	.map = xilinx_pl_dma_pcie_intx_map,
+	.xlate = pci_irqd_intx_xlate,
 };
 
 static irqreturn_t xilinx_pl_dma_pcie_msi_handler_high(int irq, void *args)