Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1240740 > unrolled thread

[PATCH v2 7/8] PCI: Add per-device MSI domain hook

Started byMarc Zyngier <marc.zyngier@arm.com>
First post2015-10-06 19:10 +0200
Last post2015-10-15 22:20 +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.


Contents

  [PATCH v2 7/8] PCI: Add per-device MSI domain hook Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:10 +0200
    Re: [PATCH v2 7/8] PCI: Add per-device MSI domain hook Bjorn Helgaas <helgaas@kernel.org> - 2015-10-15 22:20 +0200

#1240740 — [PATCH v2 7/8] PCI: Add per-device MSI domain hook

FromMarc Zyngier <marc.zyngier@arm.com>
Date2015-10-06 19:10 +0200
Subject[PATCH v2 7/8] PCI: Add per-device MSI domain hook
Message-ID<qgDUv-3Yw-23@gated-at.bofh.it>
So far, we have considered that the MSI domain for a device was
either set via the architecture-dependent pcibios implementation
or inherited from the host bridge.

As we're about to break that assumption, add pci_dev_msi_domain
which is the equivalent of pci_host_bridge_msi_domain, but for
a single device.

Other than moving things around a bit, this patch on its own
has no effect.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/pci/probe.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8361d27..7c333f8 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1622,15 +1622,40 @@ static void pci_init_capabilities(struct pci_dev *dev)
 	pci_enable_acs(dev);
 }
 
+/*
+ * This is the equivalent of pci_host_bridge_msi_domain that acts on
+ * devices. Firmware interfaces that can select the MSI domain on a
+ * per-device basis should be called from here.
+ */
+static struct irq_domain *pci_dev_msi_domain(struct pci_dev *dev)
+{
+	struct irq_domain *d;
+
+	/*
+	 * If a domain has been set through the pcibios_add_device
+	 * callback, then this is the one (platform code knows best).
+	 */
+	d = dev_get_msi_domain(&dev->dev);
+	if (d)
+		return d;
+
+	return NULL;
+}
+
 static void pci_set_msi_domain(struct pci_dev *dev)
 {
+	struct irq_domain *d;
+
 	/*
-	 * If no domain has been set through the pcibios_add_device
-	 * callback, inherit the default from the bus device.
+	 * If the platform or firmware interfaces cannot supply a
+	 * device-specific MSI domain, then inherit the default domain
+	 * from the host bridge itself.
 	 */
-	if (!dev_get_msi_domain(&dev->dev))
-		dev_set_msi_domain(&dev->dev,
-				   dev_get_msi_domain(&dev->bus->dev));
+	d = pci_dev_msi_domain(dev);
+	if (!d)
+		d = dev_get_msi_domain(&dev->bus->dev);
+
+	dev_set_msi_domain(&dev->dev, d);
 }
 
 void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
-- 
2.1.4

--
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]


#1248144

FromBjorn Helgaas <helgaas@kernel.org>
Date2015-10-15 22:20 +0200
Message-ID<qjXai-pN-35@gated-at.bofh.it>
In reply to#1240740
On Tue, Oct 06, 2015 at 06:04:02PM +0100, Marc Zyngier wrote:
> So far, we have considered that the MSI domain for a device was
> either set via the architecture-dependent pcibios implementation
> or inherited from the host bridge.
> 
> As we're about to break that assumption, add pci_dev_msi_domain
> which is the equivalent of pci_host_bridge_msi_domain, but for
> a single device.
> 
> Other than moving things around a bit, this patch on its own
> has no effect.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/pci/probe.c | 35 ++++++++++++++++++++++++++++++-----
>  1 file changed, 30 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 8361d27..7c333f8 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1622,15 +1622,40 @@ static void pci_init_capabilities(struct pci_dev *dev)
>  	pci_enable_acs(dev);
>  }
>  
> +/*
> + * This is the equivalent of pci_host_bridge_msi_domain that acts on
> + * devices. Firmware interfaces that can select the MSI domain on a
> + * per-device basis should be called from here.
> + */
> +static struct irq_domain *pci_dev_msi_domain(struct pci_dev *dev)
> +{
> +	struct irq_domain *d;
> +
> +	/*
> +	 * If a domain has been set through the pcibios_add_device
> +	 * callback, then this is the one (platform code knows best).
> +	 */
> +	d = dev_get_msi_domain(&dev->dev);
> +	if (d)
> +		return d;
> +
> +	return NULL;
> +}
> +
>  static void pci_set_msi_domain(struct pci_dev *dev)
>  {
> +	struct irq_domain *d;
> +
>  	/*
> -	 * If no domain has been set through the pcibios_add_device
> -	 * callback, inherit the default from the bus device.
> +	 * If the platform or firmware interfaces cannot supply a
> +	 * device-specific MSI domain, then inherit the default domain
> +	 * from the host bridge itself.
>  	 */
> -	if (!dev_get_msi_domain(&dev->dev))
> -		dev_set_msi_domain(&dev->dev,
> -				   dev_get_msi_domain(&dev->bus->dev));
> +	d = pci_dev_msi_domain(dev);
> +	if (!d)
> +		d = dev_get_msi_domain(&dev->bus->dev);
> +
> +	dev_set_msi_domain(&dev->dev, d);
>  }
>  
>  void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
> -- 
> 2.1.4
> 
> --
> 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