Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1242814 > unrolled thread
| Started by | David Daney <ddaney.cavm@gmail.com> |
|---|---|
| First post | 2015-10-09 00:20 +0200 |
| Last post | 2015-10-15 22:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v5 3/4] PCI/MSI: Add helper function pci_msi_domain_get_msi_rid(). David Daney <ddaney.cavm@gmail.com> - 2015-10-09 00:20 +0200
Re: [PATCH v5 3/4] PCI/MSI: Add helper function pci_msi_domain_get_msi_rid(). Bjorn Helgaas <helgaas@kernel.org> - 2015-10-15 22:10 +0200
| From | David Daney <ddaney.cavm@gmail.com> |
|---|---|
| Date | 2015-10-09 00:20 +0200 |
| Subject | [PATCH v5 3/4] PCI/MSI: Add helper function pci_msi_domain_get_msi_rid(). |
| Message-ID | <qhrHA-8et-11@gated-at.bofh.it> |
From: David Daney <david.daney@cavium.com>
Add pci_msi_domain_get_msi_rid() to return the MSI requester id (RID).
Initially needed by gic-v3 based systems. It will be used by follow on
patch to drivers/irqchip/irq-gic-v3-its-pci-msi.c
Initially supports mapping the RID via OF device tree. In the future,
this could be extended to use ACPI _IORT tables as well.
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: David Daney <david.daney@cavium.com>
---
drivers/pci/msi.c | 30 ++++++++++++++++++++++++++++++
include/linux/msi.h | 1 +
2 files changed, 31 insertions(+)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d449714..81a2798 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,33 @@ struct irq_domain *pci_msi_create_default_irq_domain(struct device_node *node,
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)
+{
+ u32 rid = 0;
+
+ pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid);
+
+ if (domain->of_node)
+ rid = of_msi_map_rid(&pdev->dev, domain->of_node, rid);
+
+ return rid;
+}
#endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */
diff --git a/include/linux/msi.h b/include/linux/msi.h
index ad939d0..56e3b76 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -293,6 +293,7 @@ irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev,
struct msi_desc *desc);
int pci_msi_domain_check_cap(struct irq_domain *domain,
struct msi_domain_info *info, struct device *dev);
+u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev);
#endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */
#endif /* LINUX_MSI_H */
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2015-10-15 22:10 +0200 |
| Subject | Re: [PATCH v5 3/4] PCI/MSI: Add helper function pci_msi_domain_get_msi_rid(). |
| Message-ID | <qjX0B-8R-5@gated-at.bofh.it> |
| In reply to | #1242814 |
On Thu, Oct 08, 2015 at 03:10:49PM -0700, David Daney wrote:
> From: David Daney <david.daney@cavium.com>
>
> Add pci_msi_domain_get_msi_rid() to return the MSI requester id (RID).
> Initially needed by gic-v3 based systems. It will be used by follow on
> patch to drivers/irqchip/irq-gic-v3-its-pci-msi.c
>
> Initially supports mapping the RID via OF device tree. In the future,
> this could be extended to use ACPI _IORT tables as well.
>
> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: David Daney <david.daney@cavium.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
I assume Thomas will take these (or at least, somebody other than me).
> ---
> drivers/pci/msi.c | 30 ++++++++++++++++++++++++++++++
> include/linux/msi.h | 1 +
> 2 files changed, 31 insertions(+)
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index d449714..81a2798 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,33 @@ struct irq_domain *pci_msi_create_default_irq_domain(struct device_node *node,
>
> 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)
> +{
> + u32 rid = 0;
> +
> + pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid);
> +
> + if (domain->of_node)
> + rid = of_msi_map_rid(&pdev->dev, domain->of_node, rid);
> +
> + return rid;
> +}
> #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index ad939d0..56e3b76 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -293,6 +293,7 @@ irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev,
> struct msi_desc *desc);
> int pci_msi_domain_check_cap(struct irq_domain *domain,
> struct msi_domain_info *info, struct device *dev);
> +u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev);
> #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */
>
> #endif /* LINUX_MSI_H */
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web