]> git.baikalelectronics.ru Git - kernel.git/commit
of/irq: Allow matching of an interrupt-map local to an interrupt controller
authorMarc Zyngier <maz@kernel.org>
Wed, 29 Sep 2021 16:38:35 +0000 (17:38 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 4 Nov 2021 19:14:57 +0000 (14:14 -0500)
commit4bdb5cf1f76d68b1e1d332744cced60b7a1d31f6
treeb757a2cd70a0f0b12e6bf4ce665bc162a307c90e
parentf10e379781ca5aacd9b158c451304456ae62b7dd
of/irq: Allow matching of an interrupt-map local to an interrupt controller

of_irq_parse_raw() has a baked assumption that if a node has an
interrupt-controller property, it cannot possibly also have an
interrupt-map property (the latter being ignored).

This seems to be an odd behaviour, and there is no reason why we should
avoid supporting this use case. This is specially useful when a PCI root
port acts as an interrupt controller for PCI endpoints, such as this:

  pcie0: pcie@690000000 {
      [...]
      port00: pci@0,0 {
  device_type = "pci";
  [...]
  #address-cells = <3>;

  interrupt-controller;
  #interrupt-cells = <1>;

  interrupt-map-mask = <0 0 0 7>;
  interrupt-map = <0 0 0 1 &port00 0 0 0 0>,
  <0 0 0 2 &port00 0 0 0 1>,
  <0 0 0 3 &port00 0 0 0 2>,
  <0 0 0 4 &port00 0 0 0 3>;
      };
  };

Handle it by detecting that we have an interrupt-map early in the parsing,
and special case the situation where the phandle in the interrupt map
refers to the current node (which is the interesting case here).

Link: https://lore.kernel.org/r/20210929163847.2807812-3-maz@kernel.org
Tested-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rob Herring <robh@kernel.org>
drivers/of/irq.c