Message ID | 20210913182550.264165-4-maz@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | PCI: Add support for Apple M1 | expand |
On Mon, Sep 13, 2021 at 1:26 PM Marc Zyngier <maz@kernel.org> wrote: > > Just as we now allow an interrupt map to be parsed when part > of an interrupt controller, there is no reason to ignore an > interrupt map that would be part of a pci device node such as > a root port since we already allow interrupt specifiers. > > This allows the device itself to use the interrupt map for > for its own purpose. > > Signed-off-by: Marc Zyngier <maz@kernel.org> > --- > drivers/pci/of.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/of.c b/drivers/pci/of.c > index d84381ce82b5..443cebb0622e 100644 > --- a/drivers/pci/of.c > +++ b/drivers/pci/of.c > @@ -423,7 +423,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, > */ > static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) > { > - struct device_node *dn, *ppnode; > + struct device_node *dn, *ppnode = NULL; > struct pci_dev *ppdev; > __be32 laddr[3]; > u8 pin; > @@ -452,8 +452,14 @@ static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args * > if (pin == 0) > return -ENODEV; > > + /* Local interrupt-map in the device node? Use it! */ > + if (dn && of_get_property(dn, "interrupt-map", NULL)) { No need to check 'dn' is not NULL. Otherwise, Reviewed-by: Rob Herring <robh@kernel.org> > + pin = pci_swizzle_interrupt_pin(pdev, pin); > + ppnode = dn; > + } > + > /* Now we walk up the PCI tree */ > - for (;;) { > + while (!ppnode) { > /* Get the pci_dev of our parent */ > ppdev = pdev->bus->self; > > -- > 2.30.2 >
On Mon, Sep 13, 2021 at 07:25:43PM +0100, Marc Zyngier wrote: > Just as we now allow an interrupt map to be parsed when part > of an interrupt controller, there is no reason to ignore an > interrupt map that would be part of a pci device node such as > a root port since we already allow interrupt specifiers. > > This allows the device itself to use the interrupt map for > for its own purpose. > > Signed-off-by: Marc Zyngier <maz@kernel.org> Acked-by: Bjorn Helgaas <bhelgaas@google.com> I assume Lorenzo would merge this along with the rest of the series. If I were applying I would silently wrap to 75 characters, s/pci/PCI/ in subject and above, and maybe incorporate a version of the subject line in the commit log so it says what the patch does. > --- > drivers/pci/of.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/of.c b/drivers/pci/of.c > index d84381ce82b5..443cebb0622e 100644 > --- a/drivers/pci/of.c > +++ b/drivers/pci/of.c > @@ -423,7 +423,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, > */ > static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) > { > - struct device_node *dn, *ppnode; > + struct device_node *dn, *ppnode = NULL; > struct pci_dev *ppdev; > __be32 laddr[3]; > u8 pin; > @@ -452,8 +452,14 @@ static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args * > if (pin == 0) > return -ENODEV; > > + /* Local interrupt-map in the device node? Use it! */ > + if (dn && of_get_property(dn, "interrupt-map", NULL)) { > + pin = pci_swizzle_interrupt_pin(pdev, pin); > + ppnode = dn; > + } > + > /* Now we walk up the PCI tree */ > - for (;;) { > + while (!ppnode) { > /* Get the pci_dev of our parent */ > ppdev = pdev->bus->self; > > -- > 2.30.2 >
diff --git a/drivers/pci/of.c b/drivers/pci/of.c index d84381ce82b5..443cebb0622e 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -423,7 +423,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, */ static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) { - struct device_node *dn, *ppnode; + struct device_node *dn, *ppnode = NULL; struct pci_dev *ppdev; __be32 laddr[3]; u8 pin; @@ -452,8 +452,14 @@ static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args * if (pin == 0) return -ENODEV; + /* Local interrupt-map in the device node? Use it! */ + if (dn && of_get_property(dn, "interrupt-map", NULL)) { + pin = pci_swizzle_interrupt_pin(pdev, pin); + ppnode = dn; + } + /* Now we walk up the PCI tree */ - for (;;) { + while (!ppnode) { /* Get the pci_dev of our parent */ ppdev = pdev->bus->self;
Just as we now allow an interrupt map to be parsed when part of an interrupt controller, there is no reason to ignore an interrupt map that would be part of a pci device node such as a root port since we already allow interrupt specifiers. This allows the device itself to use the interrupt map for for its own purpose. Signed-off-by: Marc Zyngier <maz@kernel.org> --- drivers/pci/of.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)