From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-arm-kernel@lists.infradead.org,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH 2/3] PCI: ARM: add support for virtual PCI host controller
Date: Wed, 12 Feb 2014 22:15:26 +0100 [thread overview]
Message-ID: <20140212221526.60fd7f8b@skate> (raw)
In-Reply-To: <20140212194313.GA17248@obsidianresearch.com>
Dear Jason Gunthorpe,
On Wed, 12 Feb 2014 12:43:13 -0700, Jason Gunthorpe wrote:
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index 2394e97..7fd54e9 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -876,14 +876,14 @@ static void __init mvebu_mbus_get_pcie_resources(struct device_node *np,
> ret = of_property_read_u32_array(np, "pcie-mem-aperture", reg, ARRAY_SIZE(reg));
> if (!ret) {
> mem->start = reg[0];
> - mem->end = mem->start + reg[1];
> + mem->end = mem->start + reg[1] - 1;
> mem->flags = IORESOURCE_MEM;
> }
>
> ret = of_property_read_u32_array(np, "pcie-io-aperture", reg, ARRAY_SIZE(reg));
> if (!ret) {
> io->start = reg[0];
> - io->end = io->start + reg[1];
> + io->end = io->start + reg[1] - 1;
> io->flags = IORESOURCE_IO;
> }
> }
This certainly looks good.
> Fixes the wrong length (e0000000-f0000000 should be e0000000-efffffff)
>
> And this fixes the <BAD>:
>
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index ef8691a..fbb89cb 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -109,7 +109,9 @@ struct mvebu_pcie {
> struct mvebu_pcie_port *ports;
> struct msi_chip *msi;
> struct resource io;
> + char io_name[30];
> struct resource realio;
> + char mem_name[30];
> struct resource mem;
> struct resource busn;
> int nports;
> @@ -681,10 +683,29 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
> {
> struct mvebu_pcie *pcie = sys_to_pcie(sys);
> int i;
> + int domain = 0;
>
> +#ifdef CONFIG_PCI_DOMAINS
> + domain = sys->domain;
> +#endif
> +
> + snprintf(pcie->mem_name, sizeof(pcie->mem_name), "PCI MEM %04x", domain);
> + pcie->mem.name = pcie->mem_name;
> +
> + snprintf(pcie->io_name, sizeof(pcie->io_name), "PCI I/O %04x", domain);
> + pcie->realio.name = pcie->io_name;
I honestly don't know what PCI domains are, but this change looks
fairly harmless to me. I would however use kasprintf() instead maybe. I
can submit patches for those two changes if you want.
> Still missing release_region..
To match which request_region?
> > Since the mvebu_pcie_setup() function seems very generic at this,
> > we should probably try to factor out that code into a common
> > helper, at least for arm64, but ideally shared with arm32
> > as well.
>
> Yah, especially since people are not getting it completely right..
>
> But some of the trouble here is a lack of a generic pci host driver
> structure, eg I have to pull the domain number out of the ARM32
> specific structure ..
There is indeed a good deal of duplication of PCI related code in the
different architectures. The PCI_DOMAINS Kconfig option is for example
replicated in multiple architectures.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] PCI: ARM: add support for virtual PCI host controller
Date: Wed, 12 Feb 2014 22:15:26 +0100 [thread overview]
Message-ID: <20140212221526.60fd7f8b@skate> (raw)
In-Reply-To: <20140212194313.GA17248@obsidianresearch.com>
Dear Jason Gunthorpe,
On Wed, 12 Feb 2014 12:43:13 -0700, Jason Gunthorpe wrote:
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index 2394e97..7fd54e9 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -876,14 +876,14 @@ static void __init mvebu_mbus_get_pcie_resources(struct device_node *np,
> ret = of_property_read_u32_array(np, "pcie-mem-aperture", reg, ARRAY_SIZE(reg));
> if (!ret) {
> mem->start = reg[0];
> - mem->end = mem->start + reg[1];
> + mem->end = mem->start + reg[1] - 1;
> mem->flags = IORESOURCE_MEM;
> }
>
> ret = of_property_read_u32_array(np, "pcie-io-aperture", reg, ARRAY_SIZE(reg));
> if (!ret) {
> io->start = reg[0];
> - io->end = io->start + reg[1];
> + io->end = io->start + reg[1] - 1;
> io->flags = IORESOURCE_IO;
> }
> }
This certainly looks good.
> Fixes the wrong length (e0000000-f0000000 should be e0000000-efffffff)
>
> And this fixes the <BAD>:
>
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index ef8691a..fbb89cb 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -109,7 +109,9 @@ struct mvebu_pcie {
> struct mvebu_pcie_port *ports;
> struct msi_chip *msi;
> struct resource io;
> + char io_name[30];
> struct resource realio;
> + char mem_name[30];
> struct resource mem;
> struct resource busn;
> int nports;
> @@ -681,10 +683,29 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
> {
> struct mvebu_pcie *pcie = sys_to_pcie(sys);
> int i;
> + int domain = 0;
>
> +#ifdef CONFIG_PCI_DOMAINS
> + domain = sys->domain;
> +#endif
> +
> + snprintf(pcie->mem_name, sizeof(pcie->mem_name), "PCI MEM %04x", domain);
> + pcie->mem.name = pcie->mem_name;
> +
> + snprintf(pcie->io_name, sizeof(pcie->io_name), "PCI I/O %04x", domain);
> + pcie->realio.name = pcie->io_name;
I honestly don't know what PCI domains are, but this change looks
fairly harmless to me. I would however use kasprintf() instead maybe. I
can submit patches for those two changes if you want.
> Still missing release_region..
To match which request_region?
> > Since the mvebu_pcie_setup() function seems very generic at this,
> > we should probably try to factor out that code into a common
> > helper, at least for arm64, but ideally shared with arm32
> > as well.
>
> Yah, especially since people are not getting it completely right..
>
> But some of the trouble here is a lack of a generic pci host driver
> structure, eg I have to pull the domain number out of the ARM32
> specific structure ..
There is indeed a good deal of duplication of PCI related code in the
different architectures. The PCI_DOMAINS Kconfig option is for example
replicated in multiple architectures.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-02-12 21:15 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 16:53 [PATCH 0/3] ARM: PCI: implement virtual PCI host controller Will Deacon
2014-02-04 16:53 ` Will Deacon
2014-02-04 16:53 ` [PATCH 1/3] ARM: bios32: use pci_enable_resource to enable PCI resources Will Deacon
2014-02-04 16:53 ` Will Deacon
2014-02-12 1:06 ` Bjorn Helgaas
2014-02-12 1:06 ` Bjorn Helgaas
2014-02-12 16:18 ` Will Deacon
2014-02-12 16:18 ` Will Deacon
2014-02-04 16:53 ` [PATCH 2/3] PCI: ARM: add support for virtual PCI host controller Will Deacon
2014-02-04 16:53 ` Will Deacon
2014-02-04 19:13 ` Arnd Bergmann
2014-02-04 19:13 ` Arnd Bergmann
2014-02-05 19:09 ` Will Deacon
2014-02-05 19:09 ` Will Deacon
2014-02-05 19:27 ` Jason Gunthorpe
2014-02-05 19:27 ` Jason Gunthorpe
2014-02-05 19:41 ` Peter Maydell
2014-02-05 19:41 ` Peter Maydell
2014-02-05 20:26 ` Arnd Bergmann
2014-02-05 20:26 ` Arnd Bergmann
2014-02-05 20:53 ` Jason Gunthorpe
2014-02-05 20:53 ` Jason Gunthorpe
2014-02-06 8:28 ` Arnd Bergmann
2014-02-06 8:28 ` Arnd Bergmann
2014-02-06 20:31 ` Russell King - ARM Linux
2014-02-06 20:31 ` Russell King - ARM Linux
2014-02-09 20:18 ` Arnd Bergmann
2014-02-09 20:18 ` Arnd Bergmann
2014-02-09 20:34 ` Russell King - ARM Linux
2014-02-09 20:34 ` Russell King - ARM Linux
2014-02-11 19:15 ` Arnd Bergmann
2014-02-11 19:15 ` Arnd Bergmann
2014-02-07 11:46 ` Will Deacon
2014-02-07 11:46 ` Will Deacon
2014-02-07 17:54 ` Jason Gunthorpe
2014-02-07 17:54 ` Jason Gunthorpe
2014-02-12 18:10 ` Will Deacon
2014-02-12 18:10 ` Will Deacon
2014-02-12 18:19 ` Jason Gunthorpe
2014-02-12 18:19 ` Jason Gunthorpe
2014-02-12 18:21 ` Will Deacon
2014-02-12 18:21 ` Will Deacon
2014-02-09 20:30 ` Arnd Bergmann
2014-02-09 20:30 ` Arnd Bergmann
2014-02-10 17:34 ` Jason Gunthorpe
2014-02-10 17:34 ` Jason Gunthorpe
2014-02-11 10:42 ` Arnd Bergmann
2014-02-11 10:42 ` Arnd Bergmann
2014-02-12 19:43 ` Jason Gunthorpe
2014-02-12 19:43 ` Jason Gunthorpe
2014-02-12 20:07 ` Arnd Bergmann
2014-02-12 20:07 ` Arnd Bergmann
2014-02-12 20:33 ` Bjorn Helgaas
2014-02-12 20:33 ` Bjorn Helgaas
2014-02-12 21:15 ` Thomas Petazzoni [this message]
2014-02-12 21:15 ` Thomas Petazzoni
2014-02-12 22:24 ` Jason Gunthorpe
2014-02-12 22:24 ` Jason Gunthorpe
2014-02-12 19:49 ` Will Deacon
2014-02-12 19:49 ` Will Deacon
2014-02-06 8:54 ` Anup Patel
2014-02-06 8:54 ` Anup Patel
2014-02-06 10:26 ` Arnd Bergmann
2014-02-06 10:26 ` Arnd Bergmann
2014-02-06 10:52 ` Anup Patel
2014-02-06 10:52 ` Anup Patel
2014-02-06 10:54 ` Liviu Dudau
2014-02-06 10:54 ` Liviu Dudau
2014-02-06 11:00 ` Will Deacon
2014-02-06 11:00 ` Will Deacon
2014-02-06 11:28 ` Arnd Bergmann
2014-02-06 11:28 ` Arnd Bergmann
2014-02-04 16:53 ` [PATCH 3/3] ARM: mach-virt: allow PCI support to be selected Will Deacon
2014-02-04 16:53 ` Will Deacon
2014-04-03 22:07 ` [PATCH 0/3] ARM: PCI: implement virtual PCI host controller Bjorn Helgaas
2014-04-03 22:07 ` Bjorn Helgaas
2014-04-14 17:13 ` Will Deacon
2014-04-14 17:13 ` Will Deacon
2014-04-14 18:48 ` Arnd Bergmann
2014-04-14 18:48 ` Arnd Bergmann
2014-04-15 14:47 ` Will Deacon
2014-04-15 14:47 ` Will Deacon
2014-04-15 15:26 ` Arnd Bergmann
2014-04-15 15:26 ` Arnd Bergmann
2014-04-16 13:58 ` Will Deacon
2014-04-16 13:58 ` Will Deacon
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=20140212221526.60fd7f8b@skate \
--to=thomas.petazzoni@free-electrons.com \
--cc=arnd@arndb.de \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
/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.