From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
"Wesley W . Terpstra" <wesley@sifive.com>,
Arnd Bergmann <arnd@arndb.de>,
linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH 1/3] PCI: add a callback to struct pci_host_bridge for adding a new device
Date: Thu, 2 Aug 2018 17:54:30 +0100 [thread overview]
Message-ID: <20180802165430.GA13725@red-moon> (raw)
In-Reply-To: <20180801151403.20660-2-hch@lst.de>
On Wed, Aug 01, 2018 at 05:14:01PM +0200, Christoph Hellwig wrote:
> There is currently no way for a PCIe bridge to impose constraints on
> devices added to it. For example, the Xilinx PCIe host bridge only
> supports 32-bit physical addresses (due to a limitation on the AXI
> port's address width). Thus, even devices that claim to support 64-bit
> DMA addresses must be restricted to 32-bit addresses when attached to
> this host controller.
>
> This patch adds a "add_dev" method to struct pci_host_bridge that
> allows the host driver to act upon acting adding devices.
>
> Based on an earlier patch from Wesley W. Terpstra <wesley@sifive.com>.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/pci/probe.c | 4 ++++
> include/linux/pci.h | 1 +
> 2 files changed, 5 insertions(+)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index ac876e32de4b..8736d78ffc66 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2290,6 +2290,7 @@ static void pci_set_msi_domain(struct pci_dev *dev)
>
> void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
> {
> + struct pci_host_bridge *host = pci_find_host_bridge(bus);
> int ret;
>
> pci_configure_device(dev);
> @@ -2331,6 +2332,9 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
> /* Set up MSI IRQ domain */
> pci_set_msi_domain(dev);
>
> + if (host->add_dev)
> + host->add_dev(dev);
Hi Christoph,
while at it, IMHO it would be good to match the current
pcibios_add_device() prototype (ie returning an int error value)
so that this change can pave the way to removing yet another
pcibios call.
Actually we could make pcibios_add_device() removal as part of this
series but you would have to patch all related host bridge drivers
initializations so I am happy for this patch to go standalone (I can
patch the rest of the code) - I leave it to Bjorn's decision.
Thanks,
Lorenzo
> +
> /* Notifier could use PCI capabilities */
> dev->match_driver = false;
> ret = device_add(&dev->dev);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index abd5d5e17aee..5eedae8e8f2b 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -485,6 +485,7 @@ struct pci_host_bridge {
> resource_size_t start,
> resource_size_t size,
> resource_size_t align);
> + void (*add_dev)(struct pci_dev *dev);
> unsigned long private[0] ____cacheline_aligned;
> };
>
> --
> 2.18.0
>
WARNING: multiple messages have this Message-ID (diff)
From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-riscv@lists.infradead.org
Subject: [PATCH 1/3] PCI: add a callback to struct pci_host_bridge for adding a new device
Date: Thu, 2 Aug 2018 17:54:30 +0100 [thread overview]
Message-ID: <20180802165430.GA13725@red-moon> (raw)
In-Reply-To: <20180801151403.20660-2-hch@lst.de>
On Wed, Aug 01, 2018 at 05:14:01PM +0200, Christoph Hellwig wrote:
> There is currently no way for a PCIe bridge to impose constraints on
> devices added to it. For example, the Xilinx PCIe host bridge only
> supports 32-bit physical addresses (due to a limitation on the AXI
> port's address width). Thus, even devices that claim to support 64-bit
> DMA addresses must be restricted to 32-bit addresses when attached to
> this host controller.
>
> This patch adds a "add_dev" method to struct pci_host_bridge that
> allows the host driver to act upon acting adding devices.
>
> Based on an earlier patch from Wesley W. Terpstra <wesley@sifive.com>.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/pci/probe.c | 4 ++++
> include/linux/pci.h | 1 +
> 2 files changed, 5 insertions(+)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index ac876e32de4b..8736d78ffc66 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2290,6 +2290,7 @@ static void pci_set_msi_domain(struct pci_dev *dev)
>
> void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
> {
> + struct pci_host_bridge *host = pci_find_host_bridge(bus);
> int ret;
>
> pci_configure_device(dev);
> @@ -2331,6 +2332,9 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
> /* Set up MSI IRQ domain */
> pci_set_msi_domain(dev);
>
> + if (host->add_dev)
> + host->add_dev(dev);
Hi Christoph,
while at it, IMHO it would be good to match the current
pcibios_add_device() prototype (ie returning an int error value)
so that this change can pave the way to removing yet another
pcibios call.
Actually we could make pcibios_add_device() removal as part of this
series but you would have to patch all related host bridge drivers
initializations so I am happy for this patch to go standalone (I can
patch the rest of the code) - I leave it to Bjorn's decision.
Thanks,
Lorenzo
> +
> /* Notifier could use PCI capabilities */
> dev->match_driver = false;
> ret = device_add(&dev->dev);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index abd5d5e17aee..5eedae8e8f2b 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -485,6 +485,7 @@ struct pci_host_bridge {
> resource_size_t start,
> resource_size_t size,
> resource_size_t align);
> + void (*add_dev)(struct pci_dev *dev);
> unsigned long private[0] ____cacheline_aligned;
> };
>
> --
> 2.18.0
>
next prev parent reply other threads:[~2018-08-02 18:46 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-01 15:14 add support for Xilinx PCIe root ports on RISC-V v2 Christoph Hellwig
2018-08-01 15:14 ` Christoph Hellwig
2018-08-01 15:14 ` [PATCH 1/3] PCI: add a callback to struct pci_host_bridge for adding a new device Christoph Hellwig
2018-08-01 15:14 ` Christoph Hellwig
2018-08-02 16:54 ` Lorenzo Pieralisi [this message]
2018-08-02 16:54 ` Lorenzo Pieralisi
2018-08-04 10:11 ` Christoph Hellwig
2018-08-04 10:11 ` Christoph Hellwig
2018-08-15 19:52 ` Bjorn Helgaas
2018-08-15 19:52 ` Bjorn Helgaas
2018-08-16 20:59 ` Bjorn Helgaas
2018-08-16 20:59 ` Bjorn Helgaas
2018-08-16 21:04 ` Arnd Bergmann
2018-08-16 21:04 ` Arnd Bergmann
2018-08-17 15:25 ` Lorenzo Pieralisi
2018-08-17 15:25 ` Lorenzo Pieralisi
2018-08-17 15:47 ` Arnd Bergmann
2018-08-17 15:47 ` Arnd Bergmann
2018-08-01 15:14 ` [PATCH 2/3] PCI/xilinx: Work-around for hardware DMA limit (32 bits) Christoph Hellwig
2018-08-01 15:14 ` Christoph Hellwig
2018-08-01 15:14 ` [PATCH 3/3] PCI/xilinx: Depend on OF instead of the ARCH Christoph Hellwig
2018-08-01 15:14 ` Christoph Hellwig
2018-08-02 16:56 ` Lorenzo Pieralisi
2018-08-02 16:56 ` Lorenzo Pieralisi
2018-08-04 10:12 ` Christoph Hellwig
2018-08-04 10:12 ` Christoph Hellwig
2018-08-01 23:02 ` add support for Xilinx PCIe root ports on RISC-V v2 Wesley Terpstra
2018-08-01 23:02 ` Wesley Terpstra
2018-08-02 7:14 ` Christoph Hellwig
2018-08-02 7:14 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2018-08-04 10:13 add support for Xilinx PCIe root ports on RISC-V v3 Christoph Hellwig
2018-08-04 10:14 ` [PATCH 1/3] PCI: add a callback to struct pci_host_bridge for adding a new device Christoph Hellwig
2018-08-04 10:14 ` Christoph Hellwig
2018-08-06 11:23 ` Lorenzo Pieralisi
2018-08-06 11:23 ` Lorenzo Pieralisi
2018-08-06 12:30 ` Christoph Hellwig
2018-08-06 12:30 ` Christoph Hellwig
2018-08-06 13:54 ` Arnd Bergmann
2018-08-06 13:54 ` Arnd Bergmann
2018-08-06 14:55 ` Lorenzo Pieralisi
2018-08-06 14:55 ` Lorenzo Pieralisi
2018-08-06 19:49 ` Arnd Bergmann
2018-08-06 19:49 ` Arnd Bergmann
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=20180802165430.GA13725@red-moon \
--to=lorenzo.pieralisi@arm.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=hch@lst.de \
--cc=linux-pci@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=wesley@sifive.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.