APM X-Gene PCIe controller
v3 cover APM X-Gene PCIe controller
This patch adds support for AppliedMicro X-Gene PCIe host controller. The driver is tested on X-Gene platform with different gen1/2/3 PCIe endpoint cards.
X-Gene PCIe controller driver has depedency on the pcie arch support for arm64. The arm64 pcie arch support is not yet part of mainline Linux kernel and approach for arch support is under discussion with arm64 maintainers. The reference patch can be found here --> https://lkml.org/lkml/2013/10/23/244
If someone wishes to test PCIe on X-Gene, arch support patch must be applied before the patches in this patch set.
changes since V2:
1. redefined each PCI port in different PCI domain correctly.
2. removed setup_lane and setup_link functions from driver.
3. removed scan_bus wrapper and set_primary_bus hack.
4. added pci_ioremap_io for io resources.
changes since V1:
1. added PCI domain support
2. reading cpu and pci addresses from device tree to configure regions.
3. got rid of unnecessary wrappers for readl and writel.
4. got rid of endpoint configuration code.
5. added 'dma-ranges' property support to read inbound region configuration.
6. renamed host driver file to 'pci-xgene.c' from 'pcie-xgene.c'
7. dropped 'clock-names' property from bindings
8. added comments whereever requested.
Tanmay Inamdar (4):
pci: APM X-Gene PCIe controller driver
arm64: dts: APM X-Gene PCIe device tree nodes
dt-bindings: pci: xgene pcie device tree bindings
MAINTAINERS: entry for APM X-Gene PCIe host driver
.../devicetree/bindings/pci/xgene-pci.txt | 52 ++ MAINTAINERS | 7 + arch/arm64/boot/dts/apm-mustang.dts | 8 + arch/arm64/boot/dts/apm-storm.dtsi | 155 ++++ drivers/pci/host/Kconfig | 10 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-xgene.c | 784 ++++++++++++++++++++ 7 files changed, 1017 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/xgene-pci.txt create mode 100644 drivers/pci/host/pci-xgene.c
Signature · 1 line
1.7.9.5
RFC PATCH v3 1/4 pci: APM X-Gene PCIe controller driver
This patch adds the AppliedMicro X-Gene SOC PCIe controller driver. X-Gene PCIe controller supports maximum upto 8 lanes and GEN3 speed. X-Gene has maximum 5 PCIe ports supported.
--- drivers/pci/host/Kconfig | 10 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-xgene.c | 784 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 795 insertions(+) create mode 100644 drivers/pci/host/pci-xgene.c
drivers/pci/host/Kconfig +10 -0
@@ -33,4 +33,14 @@ config PCI_RCAR_GEN2 There are 3 internal PCI controllers available with a single built-in EHCI/OHCI host controller present on each one. +config PCI_XGENE + bool "X-Gene PCIe controller" + depends on ARCH_XGENE + depends on OF + select PCIEPORTBUS + help + Say Y here if you want internal PCI support on APM X-Gene SoC. + There are 5 internal PCIe ports available. Each port is GEN3 capable + and have varied lanes from x1 to x8. + endmenu
drivers/pci/host/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_PCI_IMX6) += pci-imx6.o obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o +obj-$(CONFIG_PCI_XGENE) += pci-xgene.o
drivers/pci/host/pci-xgene.c new file +784 -0
784 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH v3 2/4 arm64: dts: APM X-Gene PCIe device tree nodes
In reply to Tanmay InamdarThis patch adds the device tree nodes for APM X-Gene PCIe controller and PCIe clock interface. Since X-Gene SOC supports maximum 5 ports, 5 dts nodes are added.
--- arch/arm64/boot/dts/apm-mustang.dts | 8 ++ arch/arm64/boot/dts/apm-storm.dtsi | 155 +++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+)
arch/arm64/boot/dts/apm-mustang.dts +8 -0
@@ -24,3 +24,11 @@ reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */ }; }; + +&pcie0clk { + status = "ok"; +}; + +&pcie0 { + status = "ok"; +};
arch/arm64/boot/dts/apm-storm.dtsi +155 -0
161 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH v3 3/4 dt-bindings: pci: xgene pcie device tree bindings
In reply to Tanmay InamdarThis patch adds the bindings for X-Gene PCIe driver. The driver resides under 'drivers/pci/host/pci-xgene.c' file.
--- .../devicetree/bindings/pci/xgene-pci.txt | 52 ++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/xgene-pci.txt
Documentation/devicetree/bindings/pci/xgene-pci.txt new file +52 -0
@@ -0,0 +1,52 @@ +* AppliedMicro X-Gene PCIe interface + +Required properties: +- device_type: set to "pci" +- compatible: should contain "xgene,pcie" to identify the core. +- reg: A list of physical base address and length for each set of controller + registers. Must contain an entry for each entry in the reg-names + property. +- reg-names: Must include the following entries: + "csr": controller configuration registers. + "cfg": pcie configuration space registers. +- #address-cells: set to <3> +- #size-cells: set to <2> +- ranges: ranges for the outbound memory, I/O regions. +- dma-ranges: ranges for the inbound memory regions. +- #interrupt-cells: set to <1> +- interrupt-map-mask and interrupt-map: standard PCI properties + to define the mapping of the PCIe interface to interrupt + numbers. +- clocks: from common clock binding: handle to pci clock. + +Optional properties: +- status: Either "ok" or "disabled". + +Example: + +SoC specific DT Entry: + pcie0: pcie at 1f2b0000 { + status = "disabled"; + device_type = "pci"; + compatible = "apm,xgene-pcie"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + reg = < 0x00 0x1f2b0000 0x0 0x00010000 /* Controller registers */ + 0xe0 0xd0000000 0x0 0x00200000>; /* PCI config space */ + reg-names = "csr", "cfg"; + ranges = <0x01000000 0x00 0x00000000 0xe0 0x00000000 0x00 0x00010000 /* io */ + 0x02000000 0x00 0x10000000 0xe0 0x10000000 0x00 0x80000000>; /* mem */ + dma-ranges = <0x42000000 0x40 0x00000000 0x40 0x00000000 0x40 0x00000000>; + interrupt-map-mask = <0x0 0x0 0x0 0x7>; + interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0xc2 0x1 + 0x0 0x0 0x0 0x2 &gic 0x0 0xc3 0x1 + 0x0 0x0 0x0 0x3 &gic 0x0 0xc4 0x1 + 0x0 0x0 0x0 0x4 &gic 0x0 0xc5 0x1>; + clocks = <&pcie0clk 0>; + }; + +Board specific DT Entry: + &pcie0 { + status = "ok"; + };
Signature · 1 line
1.7.9.5
RFC PATCH v3 4/4 MAINTAINERS: entry for APM X-Gene PCIe host driver
In reply to Tanmay InamdarAdd entry for AppliedMicro X-Gene PCIe host driver.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -6539,6 +6539,13 @@ L: linux-pci at vger.kernel.org S: Maintained F: drivers/pci/host/*designware* +PCI DRIVER FOR APPLIEDMICRO XGENE +M: Tanmay Inamdar <[email protected]> +L: linux-pci at vger.kernel.org +L: linux-arm-kernel at lists.infradead.org +S: Maintained +F: drivers/pci/host/pci-xgene.c + PCMCIA SUBSYSTEM P: Linux PCMCIA Team L: linux-pcmcia at lists.infradead.org
Signature · 1 line
1.7.9.5
Quoted 8 lines · Tanmay Inamdar
This patch adds support for AppliedMicro X-Gene PCIe host controller. The driver is tested on X-Gene platform with different gen1/2/3 PCIe endpoint cards.
X-Gene PCIe controller driver has depedency on the pcie arch support for arm64. The arm64 pcie arch support is not yet part of mainline Linux kernel and approach for arch support is under discussion with arm64 maintainers. The reference patch can be found here --> https://lkml.org/lkml/2013/10/23/244
The reference patch looks corrupted (pcibios.c has no includes, etc), would you mind reposting?
-dann
Quoted 43 lines
If someone wishes to test PCIe on X-Gene, arch support patch must be applied before the patches in this patch set.
changes since V2:
1. redefined each PCI port in different PCI domain correctly.
2. removedsetup_laneandsetup_linkfunctions from driver.
3. removedscan_buswrapper andset_primary_bushack.
4. addedpci_ioremap_iofor io resources.changes since V1:
1. added PCI domain support
2. reading cpu and pci addresses from device tree to configure regions.
3. got rid of unnecessary wrappers for readl and writel.
4. got rid of endpoint configuration code.
5. added 'dma-ranges' property support to read inbound region configuration.
6. renamed host driver file to 'pci-xgene.c' from 'pcie-xgene.c'
7. dropped 'clock-names' property from bindings
8. added comments whereever requested.Tanmay Inamdar (4):
pci: APM X-Gene PCIe controller driver
arm64: dts: APM X-Gene PCIe device tree nodes
dt-bindings: pci: xgene pcie device tree bindings
MAINTAINERS: entry for APM X-Gene PCIe host driver.../devicetree/bindings/pci/xgene-pci.txt | 52 ++ MAINTAINERS | 7 + arch/arm64/boot/dts/apm-mustang.dts | 8 + arch/arm64/boot/dts/apm-storm.dtsi | 155 ++++ drivers/pci/host/Kconfig | 10 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-xgene.c | 784 ++++++++++++++++++++ 7 files changed, 1017 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/xgene-pci.txt create mode 100644 drivers/pci/host/pci-xgene.c--
1.7.9.5--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Dann Frazier
Quoted 4 lines · Tanmay Inamdar
This patch adds support for AppliedMicro X-Gene PCIe host controller. The driver is tested on X-Gene platform with different gen1/2/3 PCIe endpoint cards.
Quoted 7 lines
Quoted 4 lines
X-Gene PCIe controller driver has depedency on the pcie arch support for arm64. The arm64 pcie arch support is not yet part of mainline Linux kernel and approach for arch support is under discussion with arm64 maintainers. The reference patch can be found here --> https://lkml.org/lkml/2013/10/23/244
The reference patch looks corrupted (
pcibios.chas no includes, etc), would you mind reposting?
Yes. You are right. I will re-post the patch.
Quoted 46 lines
-dann
Quoted 43 lines
If someone wishes to test PCIe on X-Gene, arch support patch must be applied before the patches in this patch set.
changes since V2:
1. redefined each PCI port in different PCI domain correctly.
2. removedsetup_laneandsetup_linkfunctions from driver.
3. removedscan_buswrapper andset_primary_bushack.
4. addedpci_ioremap_iofor io resources.changes since V1:
1. added PCI domain support
2. reading cpu and pci addresses from device tree to configure regions.
3. got rid of unnecessary wrappers for readl and writel.
4. got rid of endpoint configuration code.
5. added 'dma-ranges' property support to read inbound region configuration.
6. renamed host driver file to 'pci-xgene.c' from 'pcie-xgene.c'
7. dropped 'clock-names' property from bindings
8. added comments whereever requested.Tanmay Inamdar (4):
pci: APM X-Gene PCIe controller driver
arm64: dts: APM X-Gene PCIe device tree nodes
dt-bindings: pci: xgene pcie device tree bindings
MAINTAINERS: entry for APM X-Gene PCIe host driver.../devicetree/bindings/pci/xgene-pci.txt | 52 ++ MAINTAINERS | 7 + arch/arm64/boot/dts/apm-mustang.dts | 8 + arch/arm64/boot/dts/apm-storm.dtsi | 155 ++++ drivers/pci/host/Kconfig | 10 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-xgene.c | 784 ++++++++++++++++++++ 7 files changed, 1017 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/xgene-pci.txt create mode 100644 drivers/pci/host/pci-xgene.c--
1.7.9.5--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas
maintainerQuoted 5 lines · Dann Frazier
Quoted 4 lines · Tanmay Inamdar
This patch adds support for AppliedMicro X-Gene PCIe host controller. The driver is tested on X-Gene platform with different gen1/2/3 PCIe endpoint cards.
Quoted 7 lines
Quoted 4 lines
X-Gene PCIe controller driver has depedency on the pcie arch support for arm64. The arm64 pcie arch support is not yet part of mainline Linux kernel and approach for arch support is under discussion with arm64 maintainers. The reference patch can be found here --> https://lkml.org/lkml/2013/10/23/244
The reference patch looks corrupted (
pcibios.chas no includes, etc), would you mind reposting?
When you repost, please make sure you fix whatever problem is preventing your email from appearing on the vger mailing lists. I won't apply things that haven't appeared on the linux-pci list, because that list is the opportunity for other people to review them.
Bjorn
Quoted 12 lines · Bjorn Helgaas
Quoted 10 lines · Dann Frazier
Quoted 8 lines · Tanmay Inamdar
This patch adds support for AppliedMicro X-Gene PCIe host controller. The driver is tested on X-Gene platform with different gen1/2/3 PCIe endpoint cards.
X-Gene PCIe controller driver has depedency on the pcie arch support for arm64. The arm64 pcie arch support is not yet part of mainline Linux kernel and approach for arch support is under discussion with arm64 maintainers. The reference patch can be found here --> https://lkml.org/lkml/2013/10/23/244
Quoted 8 lines
Quoted 2 lines
The reference patch looks corrupted (
pcibios.chas no includes, etc), would you mind reposting?When you repost, please make sure you fix whatever problem is preventing your email from appearing on the vger mailing lists. I won't apply things that haven't appeared on the linux-pci list, because that list is the opportunity for other people to review them.
You are absolutely right. If the patches are not reaching mailing list, they should not appear on archive list as well. However I am seeing my patches recorded on archives. So I am not sure if they are actually getting dropped on linux-pci or any other mailing list.
http://www.spinics.net/lists/linux-pci/msg28198.html
http://article.gmane.org/gmane.linux.kernel.pci/28442/match=tanmay+inamdar
Quoted 1 line
Bjorn
Re: [RFC PATCH V3 2/4] arm64: dts: APM X-Gene PCIe device tree nodes
In reply to Tanmay Inamdararch/arm64/boot/dts/apm-storm.dtsi line 305
Quoted 4 lines · Tanmay Inamdar
arch/arm64/boot/dts/apm-storm.dtsi +4
-0+ pcie3: pcie at 1f500000 { + reg-names = "csr", "cfg"; + ranges = <0x01000000 0x0 0x00000000 0xa0 0x00000000 0x0 0x00010000 /* mem */ + 0x02000000 0x0 0x10000000 0xa0 0x10000000 0x0 0x80000000>; /* io */
The two comments are wrong for this instance.
Arnd
Re: [RFC PATCH V3 1/4] pci: APM X-Gene PCIe controller driver
In reply to Tanmay InamdarQuoted 6 lines · Tanmay Inamdar
drivers/pci/host/pci-xgene.c new file +6
-0+static void xgene_pcie_fixup_bridge (struct pci_dev *dev) +{ +int i; + +/* Hide the PCI host BARs from the kernel as their content doesn't +* fit well in the resource management
drivers/pci/host/pci-xgene.c line 467
Quoted 10 lines
drivers/pci/host/pci-xgene.c new file +10
-0+*/ +for (i =0 ; i <DEVICE_COUNT_RESOURCE ; i++) { + dev->resource[i].start = dev->resource[i].end =0 ; + dev->resource[i].flags =0 ; + } +dev_info (&dev->dev,"Hiding X-Gene pci host bridge resources %s\n" , +pci_name (dev)); +} +DECLARE_PCI_FIXUP_HEADER (XGENE_PCIE_VENDORID ,XGENE_PCIE_DEVICEID , + xgene_pcie_fixup_bridge);
Shouldn't this be gone now that the host bridge is correctly shown at the domain root?
Quoted 7 lines
drivers/pci/host/pci-xgene.c new file +7
-0+static int xgene_pcie_setup (int nr,struct pci_sys_data *sys) +{ +struct xgene_pcie_port *pp = sys->private_data; +struct resource *io = &pp->realio; + + io->start = sys->domain *SZ_64K ; + io->end = io->start +SZ_64K ;
drivers/pci/host/pci-xgene.c line 715
Quoted 10 lines
drivers/pci/host/pci-xgene.c new file +10
-0+ io->flags = pp->io.res.flags; + io->name ="PCI IO" ; +pci_ioremap_io (io->start, pp->io.res.start); + +pci_add_resource_offset (&sys->resources, io, sys->io_offset); + sys->mem_offset = pp->mem.res.start - pp->mem.pci_addr; +pci_add_resource_offset (&sys->resources, &pp->mem.res, + sys->mem_offset); +return 1 ; +}
Thanks for bringing back the I/O space handling.
You don't seem to set sys->io_offset anywhere, but each of the ports listed in your DT starts a local bus I/O register range at port 0.
AFAICT, you need to add (somewhere)
sys->io_offset = pp->realio.start - pp->io.pci_addr;
but there could be something else missing. You clearly haven't tested if the I/O space actually works.
If you want to try out the I/O space, I'd suggest using an Intel e1000 network card, which has both memory and i/o space. There is a patch at http://www.spinics.net/lists/linux-pci/msg27684.html
that lets you check the I/O registers on it, or you can go through /dev/port from user space.
I also haven't seen your patch that adds pci_ioremap_io() for arm64. It would be helpful to keep it in the same patch series, since it won't build without this patch.
Arnd
Quoted 11 lines · Tanmay Inamdar
This patch adds support for AppliedMicro X-Gene PCIe host controller. The driver is tested on X-Gene platform with different gen1/2/3 PCIe endpoint cards.
X-Gene PCIe controller driver has depedency on the pcie arch support for arm64. The arm64 pcie arch support is not yet part of mainline Linux kernel and approach for arch support is under discussion with arm64 maintainers. The reference patch can be found here --> https://lkml.org/lkml/2013/10/23/244
If someone wishes to test PCIe on X-Gene, arch support patch must be applied before the patches in this patch set.
This is starting to look really good now. I have a few small comments left, otherwise it can get merged. As mentioned in one of my review comments, it would be good to have the arch support patch posted along with the driver.
Arnd
Quoted 6 lines · Tanmay Inamdar
Quoted 6 lines
When you repost, please make sure you fix whatever problem is preventing your email from appearing on the vger mailing lists. I won't apply things that haven't appeared on the linux-pci list, because that list is the opportunity for other people to review them.
Quoted 7 lines
You are absolutely right. If the patches are not reaching mailing list, they should not appear on archive list as well. However I am seeing my patches recorded on archives. So I am not sure if they are actually getting dropped on linux-pci or any other mailing list.
http://www.spinics.net/lists/linux-pci/msg28198.html
http://article.gmane.org/gmane.linux.kernel.pci/28442/match=tanmay+inamdar
Very strange. I can also confirm that I received the patches through the linux-arm-kernel and devicetree mailing lists without problems.
Arnd
Bjorn Helgaas
maintainerQuoted 12 lines · Arnd Bergmann
Quoted 11 lines · Tanmay Inamdar
Quoted 6 lines
When you repost, please make sure you fix whatever problem is preventing your email from appearing on the vger mailing lists. I won't apply things that haven't appeared on the linux-pci list, because that list is the opportunity for other people to review them.
You are absolutely right. If the patches are not reaching mailing list, they should not appear on archive list as well. However I am seeing my patches recorded on archives. So I am not sure if they are actually getting dropped on linux-pci or any other mailing list.
Quoted 5 lines
Quoted 2 lines
http://www.spinics.net/lists/linux-pci/msg28198.html
http://article.gmane.org/gmane.linux.kernel.pci/28442/match=tanmay+inamdarVery strange. I can also confirm that I received the patches through the linux-arm-kernel and devicetree mailing lists without problems.
Sorry, the problem was on my end. I must have mistakenly marked one of those messages as spam, and gmail thought all the rest were spam, too. Sorry about that.
Bjorn
Re: [RFC PATCH V3 1/4] pci: APM X-Gene PCIe controller driver
In reply to Arnd BergmannQuoted 13 lines · Arnd Bergmann
Quoted 11 lines · Tanmay Inamdar
drivers/pci/host/pci-xgene.c new file +11
-0+static void xgene_pcie_fixup_bridge (struct pci_dev *dev) +{ +int i; + +/* Hide the PCI host BARs from the kernel as their content doesn't +* fit well in the resource management +*/ +for (i =0 ; i <DEVICE_COUNT_RESOURCE ; i++) { + dev->resource[i].start = dev->resource[i].end =0 ; + dev->resource[i].flags =0 ; + }
Quoted 8 lines
drivers/pci/host/pci-xgene.c line 467
Quoted 5 lines
drivers/pci/host/pci-xgene.c new file +5
-0+dev_info (&dev->dev,"Hiding X-Gene pci host bridge resources %s\n" , +pci_name (dev)); +} +DECLARE_PCI_FIXUP_HEADER (XGENE_PCIE_VENDORID ,XGENE_PCIE_DEVICEID , + xgene_pcie_fixup_bridge);Shouldn't this be gone now that the host bridge is correctly shown at the domain root?
In inbound region configuration, whole DDR space is mapped into the BAR of RC. When Linux PCI mid-layer starts enumerating, it reads the size of BAR of RC and tries to fit it into the memory resource. First thing is that the outbound memory is not enough to map the inbound BAR space. This creates problem with the resource management logic and second thing is that, it is not required to map inbound BAR space RC bar as no one will be accessing it further.
As Jason suggested, Bridge BAR's should be 0 size unless the bridge itself has registers. However this is not the case with XGene PCIe controller. It may have been inherited from the legacy design. 'arch/powerpc/sysdev/ppc4xx_pci.c' has similar fixup function.
Quoted 25 lines
Quoted 8 lines
drivers/pci/host/pci-xgene.c new file +7
-0+static int xgene_pcie_setup (int nr,struct pci_sys_data *sys) +{ +struct xgene_pcie_port *pp = sys->private_data; +struct resource *io = &pp->realio; + + io->start = sys->domain *SZ_64K ; + io->end = io->start +SZ_64K ;drivers/pci/host/pci-xgene.c line 715
Quoted 10 lines
drivers/pci/host/pci-xgene.c new file +10
-0+ io->flags = pp->io.res.flags; + io->name ="PCI IO" ; +pci_ioremap_io (io->start, pp->io.res.start); + +pci_add_resource_offset (&sys->resources, io, sys->io_offset); + sys->mem_offset = pp->mem.res.start - pp->mem.pci_addr; +pci_add_resource_offset (&sys->resources, &pp->mem.res, + sys->mem_offset); +return 1 ; +}Thanks for bringing back the I/O space handling.
You don't seem to set
sys->io_offsetanywhere, but each of the ports listed in your DT starts a local bus I/O register range at port 0.
Quoted 6 lines
AFAICT, you need to add (somewhere)
sys->io_offset = pp->realio.start - pp->io.pci_addr;but there could be something else missing. You clearly haven't tested if the I/O space actually works.
That is correct :-). Could not find the card. Thanks for the patch below.
Quoted 10 lines
If you want to try out the I/O space, I'd suggest using an Intel e1000 network card, which has both memory and i/o space. There is a patch at http://www.spinics.net/lists/linux-pci/msg27684.html
that lets you check the I/O registers on it, or you can go through/dev/portfrom user space.I also haven't seen your patch that adds
pci_ioremap_io()for arm64. It would be helpful to keep it in the same patch series, since it won't build without this patch.
I will post the arm64 pci patch along with next revision of this driver. That will cover the 'pci_ioremap_io' as well.
Quoted 2 lines
Arnd
Re: [RFC PATCH V3 1/4] pci: APM X-Gene PCIe controller driver
Quoted 31 lines · On Monday 03 February 2014 11:42:22 Tanmay Inamdar wrote:
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · Tanmay Inamdar
drivers/pci/host/pci-xgene.c new file +11
-0+static void xgene_pcie_fixup_bridge (struct pci_dev *dev) +{ +int i; + +/* Hide the PCI host BARs from the kernel as their content doesn't +* fit well in the resource management +*/ +for (i =0 ; i <DEVICE_COUNT_RESOURCE ; i++) { + dev->resource[i].start = dev->resource[i].end =0 ; + dev->resource[i].flags =0 ; + }Quoted 8 lines
drivers/pci/host/pci-xgene.c line 467
Quoted 5 lines
drivers/pci/host/pci-xgene.c new file +5
-0+dev_info (&dev->dev,"Hiding X-Gene pci host bridge resources %s\n" , +pci_name (dev)); +} +DECLARE_PCI_FIXUP_HEADER (XGENE_PCIE_VENDORID ,XGENE_PCIE_DEVICEID , + xgene_pcie_fixup_bridge);Shouldn't this be gone now that the host bridge is correctly shown at the domain root?
In inbound region configuration, whole DDR space is mapped into the BAR of RC. When Linux PCI mid-layer starts enumerating, it reads the size of BAR of RC and tries to fit it into the memory resource. First thing is that the outbound memory is not enough to map the inbound BAR space. This creates problem with the resource management logic and second thing is that, it is not required to map inbound BAR space RC bar as no one will be accessing it further.
Quoted 4 lines
As Jason suggested, Bridge BAR's should be 0 size unless the bridge itself has registers. However this is not the case with XGene PCIe controller. It may have been inherited from the legacy design. '
arch/powerpc/sysdev/ppc4xx_pci.c' has similar fixup function.
Are you sure that is true for the root bridge as well? I don't remember the details, but I though that for the host bridge, we don't actually look at the BARs at all.
Quoted 6 lines
Quoted 6 lines
If you want to try out the I/O space, I'd suggest using an Intel e1000 network card, which has both memory and i/o space. There is a patch at http://www.spinics.net/lists/linux-pci/msg27684.html
that lets you check the I/O registers on it, or you can go through/dev/portfrom user space.
Quoted 6 lines
Quoted 3 lines
I also haven't seen your patch that adds
pci_ioremap_io()for arm64. It would be helpful to keep it in the same patch series, since it won't build without this patch.I will post the arm64 pci patch along with next revision of this driver. That will cover the '
pci_ioremap_io' as well.
Please note that today, Liviu Dudau has also posted patches for this, so you should coordinate a bit.
Arnd
Re: [RFC PATCH V3 1/4] pci: APM X-Gene PCIe controller driver
Quoted 51 lines · Arnd Bergmann
Quoted 31 lines · On Monday 03 February 2014 11:42:22 Tanmay Inamdar wrote:
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · Tanmay Inamdar
drivers/pci/host/pci-xgene.c new file +11
-0+static void xgene_pcie_fixup_bridge (struct pci_dev *dev) +{ +int i; + +/* Hide the PCI host BARs from the kernel as their content doesn't +* fit well in the resource management +*/ +for (i =0 ; i <DEVICE_COUNT_RESOURCE ; i++) { + dev->resource[i].start = dev->resource[i].end =0 ; + dev->resource[i].flags =0 ; + }Quoted 8 lines
drivers/pci/host/pci-xgene.c line 467
Quoted 5 lines
drivers/pci/host/pci-xgene.c new file +5
-0+dev_info (&dev->dev,"Hiding X-Gene pci host bridge resources %s\n" , +pci_name (dev)); +} +DECLARE_PCI_FIXUP_HEADER (XGENE_PCIE_VENDORID ,XGENE_PCIE_DEVICEID , + xgene_pcie_fixup_bridge);Shouldn't this be gone now that the host bridge is correctly shown at the domain root?
In inbound region configuration, whole DDR space is mapped into the BAR of RC. When Linux PCI mid-layer starts enumerating, it reads the size of BAR of RC and tries to fit it into the memory resource. First thing is that the outbound memory is not enough to map the inbound BAR space. This creates problem with the resource management logic and second thing is that, it is not required to map inbound BAR space RC bar as no one will be accessing it further.
Quoted 4 lines
As Jason suggested, Bridge BAR's should be 0 size unless the bridge itself has registers. However this is not the case with XGene PCIe controller. It may have been inherited from the legacy design. '
arch/powerpc/sysdev/ppc4xx_pci.c' has similar fixup function.Are you sure that is true for the root bridge as well? I don't remember the details, but I though that for the host bridge, we don't actually look at the BARs at all.
Quoted 10 lines
Quoted 9 lines
If you want to try out the I/O space, I'd suggest using an Intel e1000 network card, which has both memory and i/o space. There is a patch at http://www.spinics.net/lists/linux-pci/msg27684.html
that lets you check the I/O registers on it, or you can go through/dev/portfrom user space.I also haven't seen your patch that adds
pci_ioremap_io()for arm64. It would be helpful to keep it in the same patch series, since it won't build without this patch.
Quoted 5 lines
Quoted 2 lines
I will post the arm64 pci patch along with next revision of this driver. That will cover the '
pci_ioremap_io' as well.Please note that today, Liviu Dudau has also posted patches for this, so you should coordinate a bit.
Yes. Just looking at his patches. Looks similar to what I have. I will wait till your solution shapes up.
Quoted 2 lines
Arnd
Re: [RFC PATCH V3 1/4] pci: APM X-Gene PCIe controller driver
In reply to Arnd BergmannQuoted 3 lines · Arnd Bergmann
Are you sure that is true for the root bridge as well? I don't remember the details, but I though that for the host bridge, we don't actually look at the BARs at all.
That is right, but this isn't a host bridge device, it is a PCI-PCI bridge with root complex registers. The root complex bridge is not the same as the host bridge.
Unfortunately the implementation is non-conforming. :(
Jason
Re: [RFC PATCH V3 1/4] pci: APM X-Gene PCIe controller driver
Quoted 11 lines · Jason Gunthorpe
Quoted 3 lines · Arnd Bergmann
Are you sure that is true for the root bridge as well? I don't remember the details, but I though that for the host bridge, we don't actually look at the BARs at all.
That is right, but this isn't a host bridge device, it is a PCI-PCI bridge with root complex registers. The root complex bridge is not the same as the host bridge.
Unfortunately the implementation is non-conforming. :(
Ok, I see. I was probably asking the wrong question then earlier when I tried to find out what this is.
Arnd