summaryrefslogtreecommitdiff
path: root/drivers/irqchip/irq-gic-v3-its-pci-msi.c
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2015-07-28 14:46:21 +0100
committerThomas Gleixner <tglx@linutronix.de>2015-07-30 00:14:38 +0200
commit54456db9a23753b87ce4d49adabe7da853bf13a2 (patch)
tree8e1f2f45675150931d870bc746b79df28a9dfd53 /drivers/irqchip/irq-gic-v3-its-pci-msi.c
parent841514ab41ced765158d71d818b1d564ebe9436d (diff)
irqchip/gicv3-its: Make the PCI/MSI code standalone
We can now lookup the base ITS domain, making it possible to initialize the PCI/MSI code independently from the main ITS subsystem. This allows us to remove all the previously add hooks. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Cc: <linux-arm-kernel@lists.infradead.org> Cc: Yijing Wang <wangyijing@huawei.com> Cc: Ma Jun <majun258@huawei.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Duc Dang <dhdang@apm.com> Cc: Hanjun Guo <hanjun.guo@linaro.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Jiang Liu <jiang.liu@linux.intel.com> Cc: Jason Cooper <jason@lakedaemon.net> Link: http://lkml.kernel.org/r/1438091186-10244-15-git-send-email-marc.zyngier@arm.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/irqchip/irq-gic-v3-its-pci-msi.c')
-rw-r--r--drivers/irqchip/irq-gic-v3-its-pci-msi.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index 76147219da7f..cf351c637464 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -20,8 +20,6 @@
#include <linux/of_irq.h>
#include <linux/of_pci.h>
-#include <linux/irqchip/arm-gic-v3.h>
-
static void its_mask_msi_irq(struct irq_data *d)
{
pci_msi_mask_irq(d);
@@ -74,17 +72,24 @@ static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
{
struct pci_dev *pdev;
struct its_pci_alias dev_alias;
+ struct msi_domain_info *msi_info;
if (!dev_is_pci(dev))
return -EINVAL;
+ msi_info = msi_get_domain_info(domain->parent);
+
pdev = to_pci_dev(dev);
dev_alias.pdev = pdev;
dev_alias.count = nvec;
pci_for_each_dma_alias(pdev, its_get_pci_alias, &dev_alias);
- return its_msi_prepare(domain, dev_alias.dev_id, dev_alias.count, info);
+ /* ITS specific DeviceID, as the core ITS ignores dev. */
+ info->scratchpad[0].ul = dev_alias.dev_id;
+
+ return msi_info->ops->msi_prepare(domain->parent,
+ dev, dev_alias.count, info);
}
static struct msi_domain_ops its_pci_msi_ops = {
@@ -98,8 +103,38 @@ static struct msi_domain_info its_pci_msi_domain_info = {
.chip = &its_msi_irq_chip,
};
-struct irq_domain *its_pci_msi_alloc_domain(struct device_node *np,
- struct irq_domain *parent)
+static struct of_device_id its_device_id[] = {
+ { .compatible = "arm,gic-v3-its", },
+ {},
+};
+
+static int __init its_pci_msi_init(void)
{
- return pci_msi_create_irq_domain(np, &its_pci_msi_domain_info, parent);
+ struct device_node *np;
+ struct irq_domain *parent;
+
+ for (np = of_find_matching_node(NULL, its_device_id); np;
+ np = of_find_matching_node(np, its_device_id)) {
+ if (!of_property_read_bool(np, "msi-controller"))
+ continue;
+
+ parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS);
+ if (!parent || !msi_get_domain_info(parent)) {
+ pr_err("%s: unable to locate ITS domain\n",
+ np->full_name);
+ continue;
+ }
+
+ if (!pci_msi_create_irq_domain(np, &its_pci_msi_domain_info,
+ parent)) {
+ pr_err("%s: unable to create PCI domain\n",
+ np->full_name);
+ continue;
+ }
+
+ pr_info("PCI/MSI: %s domain created\n", np->full_name);
+ }
+
+ return 0;
}
+early_initcall(its_pci_msi_init);