arm/pci: update interrupt-map only for legacy interrupts
PATCH 1/1 arm/pci: update interrupt-map only for legacy interrupts
The interrupt pin cell in "interrupt-map" property is defined only for legacy interrupts with a valid range in [1-4] corrspoding to INTA#..INTD#. And the PCI endpoint devices that support advance interrupt mechanism like MSI or MSI-X should not have an entry with value 0 in "interrupt-map". This patch takes care of this problem by avoiding redundant entries.
--- arm/pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arm/pci.c +10 -0
@@ -80,6 +80,16 @@ void pci__generate_fdt_nodes(void *fdt)u8 irq = pci_hdr->irq_line;u32 irq_flags = pci_hdr->irq_type; +/* +* Avoid adding entries in "interrupt-map" for devices that +* will be using advance interrupt mechanisms like MSI or +* MSI-X instead of legacy interrupt pins INTA#..INTD# +*/ +if (pin ==0 ) { + dev_hdr =device__next_dev (dev_hdr); +continue ; + } + *entry = (struct of_interrupt_map_entry ) { .pci_irq_mask = { .pci_addr = {
Signature · 1 line
2.25.1
Hi Sathyam,
Quoted 21 lines · Sathyam Panda
The interrupt pin cell in "interrupt-map" property is defined only for legacy interrupts with a valid range in [1-4] corrspoding to INTA#..INTD#. And the PCI endpoint devices that support advance interrupt mechanism like MSI or MSI-X should not have an entry with value 0 in "interrupt-map". This patch takes care of this problem by avoiding redundant entries.
Signed-off-by Sathyam Panda <[email protected]>Reviewed-by Vivek Kumar Gautam <[email protected]>--- arm/pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)arm/pci.c +0
-0@@ -80,6 +80,16 @@ void pci__generate_fdt_nodes(void *fdt)u8 irq = pci_hdr->irq_line;u32 irq_flags = pci_hdr->irq_type;
arm/pci.c void pci__generate_fdt_nodes(void *fdt) · line 91
Quoted 10 lines
arm/pci.c +9
-0+/* +* Avoid adding entries in "interrupt-map" for devices that +* will be using advance interrupt mechanisms like MSI or +* MSI-X instead of legacy interrupt pins INTA#..INTD# +*/ +if (pin ==0 ) { + dev_hdr =device__next_dev (dev_hdr); +continue ; + }
I found this in "Open Firmware Recommended Practive: Interrupt Mapping" [1] (referenced by Documentation/devicetree/bindings/pci/pci.txt in the Linux source tree), in the PCI bus examples section (page 8):
"The PCI binding defines an "interrupts" property to consist of one cell, which encodes wheth- er the PCI device’s interrupt is connected to the PCI connector’s INTA#...INTD# pins, with values 1...4, respectively (assuming that the device is on a plug-in PCI card)".
The patch makes sense to me, if the interrupt pin is not present a the device, don't describe it in the DTB:
[1] https://www.devicetree.org/open-firmware/practice/imap/imap0_9d.pdf
Thanks,
Alex
Quoted 7 lines
arm/pci.c +1
-0+ *entry = (struct of_interrupt_map_entry ) { .pci_irq_mask = { .pci_addr = {Signature · 1 line
2.25.1
Will Deacon
AppliedQuoted 9 lines · Sathyam Panda
The interrupt pin cell in "interrupt-map" property is defined only for legacy interrupts with a valid range in [1-4] corrspoding to INTA#..INTD#. And the PCI endpoint devices that support advance interrupt mechanism like MSI or MSI-X should not have an entry with value 0 in "interrupt-map". This patch takes care of this problem by avoiding redundant entries.
[...]
Applied to kvmtool (master), thanks!
[1/1] arm/pci: update interrupt-map only for legacy interrupts
https://git.kernel.org/will/kvmtool/c/7a60af05c183
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev