Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: of_property: Add interrupt-controller property in PCI device nodes

PCI devices and bridges DT nodes created during the PCI scan are created
with the interrupt-map property set to handle interrupts.

In order to set this interrupt-map property at a specific level, a
phandle to the parent interrupt controller is needed. On systems that
are not fully described by a device-tree, the parent interrupt
controller may be unavailable (i.e. not described by the device-tree).

As mentioned in the [1], avoiding the use of the interrupt-map property
and considering a PCI device as an interrupt controller itself avoid the
use of a parent interrupt phandle.

In that case, the PCI device itself as an interrupt controller is
responsible for routing the interrupts described in the device-tree
world (DT overlay) to the PCI interrupts.

Add the 'interrupt-controller' property in the PCI device DT node.

[1]: https://lore.kernel.org/lkml/CAL_Jsq+je7+9ATR=B6jXHjEJHjn24vQFs4Tvi9=vhDeK9n42Aw@mail.gmail.com/

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20240527161450.326615-18-herve.codina@bootlin.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

authored by

Herve Codina and committed by
Rob Herring (Arm)
dc12273f 1e436839

+24
+24
drivers/pci/of_property.c
··· 183 183 return of_changeset_add_prop_u32(ocs, np, "interrupts", (u32)pin); 184 184 } 185 185 186 + static int of_pci_prop_intr_ctrl(struct pci_dev *pdev, struct of_changeset *ocs, 187 + struct device_node *np) 188 + { 189 + int ret; 190 + u8 pin; 191 + 192 + ret = pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin); 193 + if (ret != 0) 194 + return ret; 195 + 196 + if (!pin) 197 + return 0; 198 + 199 + ret = of_changeset_add_prop_u32(ocs, np, "#interrupt-cells", 1); 200 + if (ret) 201 + return ret; 202 + 203 + return of_changeset_add_prop_bool(ocs, np, "interrupt-controller"); 204 + } 205 + 186 206 static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs, 187 207 struct device_node *np) 188 208 { ··· 354 334 return ret; 355 335 356 336 ret = of_pci_prop_intr_map(pdev, ocs, np); 337 + if (ret) 338 + return ret; 339 + } else { 340 + ret = of_pci_prop_intr_ctrl(pdev, ocs, np); 357 341 if (ret) 358 342 return ret; 359 343 }