From: Bjorn Helgaas <bhelgaas@google.com>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: linux-pci@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
Thierry Reding <thierry.reding@avionic-design.de>,
linux-arm-kernel@lists.infradead.org,
Jason Cooper <jason@lakedaemon.net>,
Gregory Clement <gregory.clement@free-electrons.com>,
Andrew Lunn <andrew@lunn.ch>,
Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
Lior Amsalem <alior@marvell.com>,
Maen Suleiman <maen@marvell.com>
Subject: Re: [PATCH v2 2/8] PCI: Add registry of MSI chips
Date: Tue, 18 Jun 2013 16:48:44 -0600 [thread overview]
Message-ID: <20130618224844.GC16134@google.com> (raw)
In-Reply-To: <1370536888-8871-3-git-send-email-thomas.petazzoni@free-electrons.com>
On Thu, Jun 06, 2013 at 06:41:22PM +0200, Thomas Petazzoni wrote:
> This commit adds a very basic registry of msi_chip structures, so that
> an IRQ controller driver can register an msi_chip, and a PCIe host
> controller can find it, based on a 'struct device_node'.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> drivers/pci/msi.c | 25 +++++++++++++++++++++++++
> include/linux/msi.h | 11 +++++++++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 4dafac6..0f177ee 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -20,6 +20,7 @@
> #include <linux/errno.h>
> #include <linux/io.h>
> #include <linux/slab.h>
> +#include <linux/of.h>
>
> #include "pci.h"
>
> @@ -70,6 +71,30 @@ int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
> # define HAVE_DEFAULT_MSI_SETUP_IRQS
> #endif
>
> +#ifdef CONFIG_OF
> +static LIST_HEAD(msi_chip_list);
> +static DEFINE_MUTEX(msi_chip_mutex);
> +
> +void msi_chip_add(struct msi_chip *chip)
> +{
> + mutex_lock(&msi_chip_mutex);
> + list_add(&chip->link, &msi_chip_list);
> + mutex_unlock(&msi_chip_mutex);
> +}
> +
> +struct msi_chip *msi_chip_find_by_of_node(struct device_node *of_node)
> +{
> + struct msi_chip *c;
> + list_for_each_entry(c, &msi_chip_list, link) {
> + if (c->of_node == of_node &&
> + of_property_read_bool(c->of_node, "msi-controller"))
> + return c;
> + }
> +
> + return NULL;
> +}
> +#endif
I don't really understand why the msi_chip_list lives here, since
nothing in drivers/pci/msi.c uses it. Seems like maybe something
that could be in the OF code somewhere?
> +
> #ifdef HAVE_DEFAULT_MSI_SETUP_IRQS
> int default_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> {
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index 4633529..a1a6084 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -61,6 +61,8 @@ int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
> struct msi_chip {
> struct module *owner;
> struct device *dev;
> + struct device_node *of_node;
> + struct list_head link;
>
> int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev,
> struct msi_desc *desc);
> @@ -69,4 +71,13 @@ struct msi_chip {
> int nvec, int type);
> };
>
> +#if defined(CONFIG_PCI_MSI) && defined(CONFIG_OF)
> +void msi_chip_add(struct msi_chip *chip);
> +struct msi_chip *msi_chip_find_by_of_node(struct device_node *of_node);
> +#else
> +static inline void msi_chip_add(struct msi_chip *chip) {}
> +static inline struct msi_chip *
> +msi_chip_find_by_of_node(struct device_node *of_node) { return NULL; }
> +#endif
> +
> #endif /* LINUX_MSI_H */
> --
> 1.8.1.2
>
WARNING: multiple messages have this Message-ID (diff)
From: bhelgaas@google.com (Bjorn Helgaas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/8] PCI: Add registry of MSI chips
Date: Tue, 18 Jun 2013 16:48:44 -0600 [thread overview]
Message-ID: <20130618224844.GC16134@google.com> (raw)
In-Reply-To: <1370536888-8871-3-git-send-email-thomas.petazzoni@free-electrons.com>
On Thu, Jun 06, 2013 at 06:41:22PM +0200, Thomas Petazzoni wrote:
> This commit adds a very basic registry of msi_chip structures, so that
> an IRQ controller driver can register an msi_chip, and a PCIe host
> controller can find it, based on a 'struct device_node'.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> drivers/pci/msi.c | 25 +++++++++++++++++++++++++
> include/linux/msi.h | 11 +++++++++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 4dafac6..0f177ee 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -20,6 +20,7 @@
> #include <linux/errno.h>
> #include <linux/io.h>
> #include <linux/slab.h>
> +#include <linux/of.h>
>
> #include "pci.h"
>
> @@ -70,6 +71,30 @@ int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
> # define HAVE_DEFAULT_MSI_SETUP_IRQS
> #endif
>
> +#ifdef CONFIG_OF
> +static LIST_HEAD(msi_chip_list);
> +static DEFINE_MUTEX(msi_chip_mutex);
> +
> +void msi_chip_add(struct msi_chip *chip)
> +{
> + mutex_lock(&msi_chip_mutex);
> + list_add(&chip->link, &msi_chip_list);
> + mutex_unlock(&msi_chip_mutex);
> +}
> +
> +struct msi_chip *msi_chip_find_by_of_node(struct device_node *of_node)
> +{
> + struct msi_chip *c;
> + list_for_each_entry(c, &msi_chip_list, link) {
> + if (c->of_node == of_node &&
> + of_property_read_bool(c->of_node, "msi-controller"))
> + return c;
> + }
> +
> + return NULL;
> +}
> +#endif
I don't really understand why the msi_chip_list lives here, since
nothing in drivers/pci/msi.c uses it. Seems like maybe something
that could be in the OF code somewhere?
> +
> #ifdef HAVE_DEFAULT_MSI_SETUP_IRQS
> int default_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> {
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index 4633529..a1a6084 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -61,6 +61,8 @@ int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
> struct msi_chip {
> struct module *owner;
> struct device *dev;
> + struct device_node *of_node;
> + struct list_head link;
>
> int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev,
> struct msi_desc *desc);
> @@ -69,4 +71,13 @@ struct msi_chip {
> int nvec, int type);
> };
>
> +#if defined(CONFIG_PCI_MSI) && defined(CONFIG_OF)
> +void msi_chip_add(struct msi_chip *chip);
> +struct msi_chip *msi_chip_find_by_of_node(struct device_node *of_node);
> +#else
> +static inline void msi_chip_add(struct msi_chip *chip) {}
> +static inline struct msi_chip *
> +msi_chip_find_by_of_node(struct device_node *of_node) { return NULL; }
> +#endif
> +
> #endif /* LINUX_MSI_H */
> --
> 1.8.1.2
>
next prev parent reply other threads:[~2013-06-18 22:48 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 16:41 [PATCH v2 0/8] MSI support for Marvell EBU PCIe driver Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-06 16:41 ` [PATCH v2 1/8] PCI: Introduce new MSI chip infrastructure Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-18 22:46 ` Bjorn Helgaas
2013-06-18 22:46 ` Bjorn Helgaas
2013-06-19 11:42 ` Thomas Petazzoni
2013-06-19 11:42 ` Thomas Petazzoni
2013-06-06 16:41 ` [PATCH v2 2/8] PCI: Add registry of MSI chips Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-12 10:33 ` Thierry Reding
2013-06-12 10:33 ` Thierry Reding
2013-06-18 22:48 ` Bjorn Helgaas [this message]
2013-06-18 22:48 ` Bjorn Helgaas
2013-06-19 11:42 ` Thomas Petazzoni
2013-06-19 11:42 ` Thomas Petazzoni
2013-06-06 16:41 ` [PATCH v2 3/8] irqchip: armada-370-xp: properly request resources Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-06 16:41 ` [PATCH v2 4/8] irqchip: armada-370-xp: implement MSI support Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-11 13:37 ` Grant Likely
2013-06-11 13:37 ` Grant Likely
2013-06-18 8:42 ` Thomas Petazzoni
2013-06-18 8:42 ` Thomas Petazzoni
2013-06-18 10:15 ` Grant Likely
2013-06-18 10:15 ` Grant Likely
2013-06-18 10:36 ` Thomas Petazzoni
2013-06-18 10:36 ` Thomas Petazzoni
2013-06-12 10:42 ` Thierry Reding
2013-06-12 10:42 ` Thierry Reding
2013-06-18 8:43 ` Thomas Petazzoni
2013-06-18 8:43 ` Thomas Petazzoni
2013-06-18 11:26 ` Thierry Reding
2013-06-18 11:26 ` Thierry Reding
2013-06-18 12:11 ` Thomas Petazzoni
2013-06-18 12:11 ` Thomas Petazzoni
2013-06-06 16:41 ` [PATCH v2 5/8] arm: mvebu: the MPIC now provides MSI controller features Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-06 16:41 ` [PATCH v2 6/8] pci: mvebu: add support for MSI Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-18 22:57 ` Bjorn Helgaas
2013-06-18 22:57 ` Bjorn Helgaas
2013-06-06 16:41 ` [PATCH v2 7/8] arm: mvebu: indicate that this platform supports MSI Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-06 16:41 ` [PATCH v2 8/8] arm: mvebu: link PCIe controllers to the MSI controller Thomas Petazzoni
2013-06-06 16:41 ` Thomas Petazzoni
2013-06-06 17:17 ` [PATCH v2 0/8] MSI support for Marvell EBU PCIe driver Jason Cooper
2013-06-06 17:17 ` Jason Cooper
2013-06-07 8:14 ` Thomas Petazzoni
2013-06-07 8:14 ` Thomas Petazzoni
2013-06-07 14:47 ` Jason Cooper
2013-06-07 14:47 ` Jason Cooper
2013-06-06 18:51 ` Jason Cooper
2013-06-06 18:51 ` Jason Cooper
2013-06-07 8:23 ` Thomas Petazzoni
2013-06-07 8:23 ` Thomas Petazzoni
2013-06-07 15:08 ` Jason Cooper
2013-06-07 15:08 ` Jason Cooper
2013-06-07 17:00 ` Thomas Petazzoni
2013-06-07 17:00 ` Thomas Petazzoni
2013-06-18 8:56 ` Thomas Petazzoni
2013-06-18 8:56 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130618224844.GC16134@google.com \
--to=bhelgaas@google.com \
--cc=alior@marvell.com \
--cc=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=ezequiel.garcia@free-electrons.com \
--cc=gregory.clement@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=maen@marvell.com \
--cc=thierry.reding@avionic-design.de \
--cc=thomas.petazzoni@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.