diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-10-16 14:22:15 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-10-16 14:22:15 +0200 |
commit | 3b93baf56dafa2d27e4fc227990dcd3ffeb10510 (patch) | |
tree | bf5cbab9a60df9291dcc92592f21a1c52cc593ee /drivers/pci/msi.c | |
parent | a71225e204f5ba8b41e7bb100ca37c074861d5b1 (diff) | |
parent | 54fa97eeb9e22b47d68b67ee00987afa7fbc2178 (diff) |
Merge tag 'msi-map-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/core
Support for msi-map, and msi-parent update from Marc Zyngier:
- New map-map property to describe the remapping of requester-ids,
and the routing of MSIs to controllers
- New hooks to make MSI domains per-device if required
- Extension of msi-parent to provide sideband information
- Extensive documentation for both msi-map and msi-parent
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r-- | drivers/pci/msi.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index ddd59fe786f8..4cd6f3abcecf 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -20,6 +20,7 @@ #include <linux/io.h> #include <linux/slab.h> #include <linux/irqdomain.h> +#include <linux/of_irq.h> #include "pci.h" @@ -1327,4 +1328,52 @@ struct irq_domain *pci_msi_create_default_irq_domain(struct fwnode_handle *fwnod return domain; } + +static int get_msi_id_cb(struct pci_dev *pdev, u16 alias, void *data) +{ + u32 *pa = data; + + *pa = alias; + return 0; +} +/** + * pci_msi_domain_get_msi_rid - Get the MSI requester id (RID) + * @domain: The interrupt domain + * @pdev: The PCI device. + * + * The RID for a device is formed from the alias, with a firmware + * supplied mapping applied + * + * Returns: The RID. + */ +u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev) +{ + struct device_node *of_node; + u32 rid = 0; + + pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); + + of_node = irq_domain_get_of_node(domain); + if (of_node) + rid = of_msi_map_rid(&pdev->dev, of_node, rid); + + return rid; +} + +/** + * pci_msi_get_device_domain - Get the MSI domain for a given PCI device + * @pdev: The PCI device + * + * Use the firmware data to find a device-specific MSI domain + * (i.e. not one that is ste as a default). + * + * Returns: The coresponding MSI domain or NULL if none has been found. + */ +struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev) +{ + u32 rid = 0; + + pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); + return of_msi_map_get_device_domain(&pdev->dev, rid); +} #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */ |