Skip to contentSkip to conversation

Marvell PCIe driver improvements

PATCH New Thomas Petazzoni 6 participants 17 messages May 22, 2013 – May 23, 2013 PCI

lore
Share & tools
lore
#0 lore raw

cover Marvell PCIe driver improvements

Bjorn, Jason, Andrew, Gregory,

You'll find in this patch series 4 small patches that make various improvements to the Marvell PCIe driver.

I'd like those improvements to be kept separated from the original PCIe driver itself: while the PCIe driver has been around and reviewed for a long time, those improvements are newer. And I clearly do not want the PCIe driver to miss 3.11 because of any problem that could be found in those additional improvements.

The main improvement being brought here is that the PCI-to-PCI bridge logic is fixed/extended to properly support physical PCIe bridges that are connected on a PCIe interface of a Marvell board. Without this improvement, only the devices connected directly to the PCIe interfaces of the board are properly enumerated. Any device that would sit beyond a physical bridge is not visible.

The other improvements are more minor, and the patch description should be sufficient to understand what's going on.

Those patches have been tested on both Armada 370/XP and Kirkwood.

Bjorn, with your Acked-by, could the Marvell maintainers include those patches in their branch, merged through arm-soc? They already have the Marvell PCIe driver itself, so I believe it makes sense to merge those improvements through the same path.

Jason, those patches have been prepared on top of my marvell-pcie-v10 branch, I hope that's ok for you. If you want me to rebase them on some other branch in which you have integrated the PCIe driver, don't hesitate to tell me to do so. That said, since those patches are only touching the driver itself and no other file, they should not cause any conflict with other changes.

Thanks,

Thomas

Thomas Petazzoni (4):
pci: mvebu: no longer fake the slot location of downstream devices
pci: mvebu: allow the enumeration of devices beyond physical bridges
pci: mvebu: emulate an empty capability list
pci: mvebu: fix the emulation of the status register

 drivers/pci/host/pci-mvebu.c |   65 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 58 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 pci: mvebu: no longer fake the slot location of downstream devices

By default, the Marvell hardware, for each PCIe interface, exhibits the following devices:

* On slot 0, a "Marvell Memory controller", identical on all PCIe interfaces, and which isn't useful when the Marvell SoC is the PCIe root complex (i.e, the normal case when we run Linux on the Marvell SoC).

* On slot 1, the real PCIe card connected into the PCIe slot of the board.

So, what the Marvell PCIe driver was doing in its PCI-to-PCI bridge emulation is that when the Linux PCI core was trying to access the device in slot 0, we were in fact forwarding the configuration transaction to the device in slot 1. For all other slots, we were telling the Linux PCI core that there was no device connected.

However, new versions of bootloaders from Marvell change the default PCIe configuration, and make the real device appear in slot 0, and the "Marvell Memory controller" in slot 1.

Therefore, this commit modifies the Marvell PCIe driver to adjust the PCIe hardware configuration to make sure that this behavior (real device in slot 0, "Marvell Memory controller" in slot 1) is the one we'll see regardless of what the bootloader has done. It allows to remove the little hack that was forwarding configuration transactions on slot 0 to slot 1, which is nice.

---
 drivers/pci/host/pci-mvebu.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/pci/host/pci-mvebu.c +15 -4
index ad1c46b..0bc21b0 100644
@@ -51,6 +51,7 @@
 #define  PCIE_CTRL_X1_MODE		0x0001
 #define PCIE_STAT_OFF		0x1a04
 #define  PCIE_STAT_BUS                  0xff00
+#define  PCIE_STAT_DEV                  0x1f0000
 #define  PCIE_STAT_LINK_DOWN		BIT(0)
 #define PCIE_DEBUG_CTRL         0x1a60
 #define  PCIE_DEBUG_SOFT_RESET		BIT(20)
@@ -148,6 +149,16 @@ static void mvebu_pcie_set_local_bus_nr(struct mvebu_pcie_port *port, int nr)
 	writel(stat, port->base + PCIE_STAT_OFF);
 }
 
+static void mvebu_pcie_set_local_dev_nr(struct mvebu_pcie_port *port, int nr)
+{
+	u32 stat;
+
+	stat = readl(port->base + PCIE_STAT_OFF);
+	stat &= ~PCIE_STAT_DEV;
+	stat |= nr << 16;
+	writel(stat, port->base + PCIE_STAT_OFF);
+}
+
 /*
  * Setup PCIE BARs and Address Decode Wins:
  * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks
@@ -572,8 +583,7 @@ static int mvebu_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
 
 	/* Access the real PCIe interface */
 	spin_lock_irqsave(&port->conf_lock, flags);
-	ret = mvebu_pcie_hw_wr_conf(port, bus,
-				    PCI_DEVFN(1, PCI_FUNC(devfn)),
+	ret = mvebu_pcie_hw_wr_conf(port, bus, devfn,
 				    where, size, val);
 	spin_unlock_irqrestore(&port->conf_lock, flags);
 
@@ -606,8 +616,7 @@ static int mvebu_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
 
 	/* Access the real PCIe interface */
 	spin_lock_irqsave(&port->conf_lock, flags);
-	ret = mvebu_pcie_hw_rd_conf(port, bus,
-				    PCI_DEVFN(1, PCI_FUNC(devfn)),
+	ret = mvebu_pcie_hw_rd_conf(port, bus, devfn,
 				    where, size, val);
 	spin_unlock_irqrestore(&port->conf_lock, flags);
 
@@ -817,6 +826,8 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
 			continue;
 		}
 
+		mvebu_pcie_set_local_dev_nr(port, 1);
+
 		if (mvebu_pcie_link_up(port)) {
 			port->haslink = 1;
 			dev_info(&pdev->dev, "PCIe%d.%d: link up\n",
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 pci: mvebu: allow the enumeration of devices beyond physical bridges

In reply to Thomas Petazzoni

Until now, the Marvell PCIe driver was only allowing the enumeration of the devices in the secondary bus of the emulated PCI-to-PCI bridge. This works fine when a PCIe device is directly connected into a PCIe slot of the Marvell board.

However, when the device connected in the PCIe slot is a physical PCIe bridge, beyond which a real PCIe device is connected, it no longer worked, as the driver was preventing the Linux PCI core from seeing such devices.

This commit fixes that by ensuring that configuration transactions on subordinate busses are properly forwarded on the right PCIe interface.

Thanks to this patch, a PCIe card beyond a PCIe bridge, itself beyond the emulated PCI-to-PCI bridge is properly detected, with the following layout:

-[0000:00]-+-01.0-[01]----00.0

           +-09.0-[02-07]----00.0-[03-07]--+-01.0-[04]--
           |                               +-05.0-[05]--
           |                               +-07.0-[06]--
           |                               \-09.0-[07]----00.0
           \-0a.0-[08]----00.0

Where the PCIe interface that sits beyond the emulated PCI-to-PCI bridge at 09.0 allows to access the secondary bus 02, on which there is a PCIe bridge that allows to access the 3 to 7 busses, that are subordinates to this bridge. And on one of this bus (bus 7), there is one real PCIe device connected.

---
 drivers/pci/host/pci-mvebu.c |   31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
drivers/pci/host/pci-mvebu.c +28 -3
index 0bc21b0..c21ca84 100644
@@ -554,7 +554,8 @@ mvebu_pcie_find_port(struct mvebu_pcie *pcie, struct pci_bus *bus,
 		if (bus->number == 0 && port->devfn == devfn)
 			return port;
 		if (bus->number != 0 &&
-		    port->bridge.secondary_bus == bus->number)
+		    bus->number >= port->bridge.secondary_bus &&
+		    bus->number <= port->bridge.subordinate_bus)
 			return port;
 	}
 
@@ -578,7 +579,18 @@ static int mvebu_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
 	if (bus->number == 0)
 		return mvebu_sw_pci_bridge_write(port, where, size, val);
 
-	if (!port->haslink || PCI_SLOT(devfn) != 0)
+	if (!port->haslink)
+		return PCIBIOS_DEVICE_NOT_FOUND;
+
+	/*
+	 * On the secondary bus, we don't want to expose any other
+	 * device that the device physically connected in the PCIe
+	 * slot, visible in slot 0. In slot 1, there's a special
+	 * Marvell device that only makes sense when the Armada is
+	 * used as a PCIe endpoint.
+	 */
+	if (bus->number == port->bridge.secondary_bus &&
+	    PCI_SLOT(devfn) != 0)
 		return PCIBIOS_DEVICE_NOT_FOUND;
 
 	/* Access the real PCIe interface */
@@ -609,7 +621,20 @@ static int mvebu_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
 	if (bus->number == 0)
 		return mvebu_sw_pci_bridge_read(port, where, size, val);
 
-	if (!port->haslink || PCI_SLOT(devfn) != 0) {
+	if (!port->haslink) {
+		*val = 0xffffffff;
+		return PCIBIOS_DEVICE_NOT_FOUND;
+	}
+
+	/*
+	 * On the secondary bus, we don't want to expose any other
+	 * device that the device physically connected in the PCIe
+	 * slot, visible in slot 0. In slot 1, there's a special
+	 * Marvell device that only makes sense when the Armada is
+	 * used as a PCIe endpoint.
+	 */
+	if (bus->number == port->bridge.secondary_bus &&
+	    PCI_SLOT(devfn) != 0) {
 		*val = 0xffffffff;
 		return PCIBIOS_DEVICE_NOT_FOUND;
 	}
Signature · 1 line
1.7.9.5
maintainer
#3 lore raw

PATCH 2/4 pci: mvebu: allow the enumeration of devices beyond physical bridges

Quoted 50 lines · Thomas Petazzoni

Until now, the Marvell PCIe driver was only allowing the enumeration of the devices in the secondary bus of the emulated PCI-to-PCI bridge. This works fine when a PCIe device is directly connected into a PCIe slot of the Marvell board.

However, when the device connected in the PCIe slot is a physical PCIe bridge, beyond which a real PCIe device is connected, it no longer worked, as the driver was preventing the Linux PCI core from seeing such devices.

This commit fixes that by ensuring that configuration transactions on subordinate busses are properly forwarded on the right PCIe interface.

Thanks to this patch, a PCIe card beyond a PCIe bridge, itself beyond the emulated PCI-to-PCI bridge is properly detected, with the following layout:

-[0000:00]-+-01.0-[01]----00.0

           +-09.0-[02-07]----00.0-[03-07]--+-01.0-[04]--
           |                               +-05.0-[05]--
           |                               +-07.0-[06]--
           |                               \-09.0-[07]----00.0
           \-0a.0-[08]----00.0

Where the PCIe interface that sits beyond the emulated PCI-to-PCI bridge at 09.0 allows to access the secondary bus 02, on which there is a PCIe bridge that allows to access the 3 to 7 busses, that are subordinates to this bridge. And on one of this bus (bus 7), there is one real PCIe device connected.

---
 drivers/pci/host/pci-mvebu.c |   31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
drivers/pci/host/pci-mvebu.c +2 -1
index 0bc21b0..c21ca84 100644
@@ -554,7 +554,8 @@ mvebu_pcie_find_port(struct mvebu_pcie *pcie, struct pci_bus *bus,
                if (bus->number == 0 && port->devfn == devfn)
                        return port;
                if (bus->number != 0 &&
-                   port->bridge.secondary_bus == bus->number)
+                   bus->number >= port->bridge.secondary_bus &&
+                   bus->number <= port->bridge.subordinate_bus)
                        return port;
        }
 

drivers/pci/host/pci-mvebu.c static int mvebu_pcie_wr_conf(struct pci_bus *bus, u32 devfn, · line 587

Quoted 10 lines
drivers/pci/host/pci-mvebu.c +6 -1
@@ -578,7 +579,18 @@ static int mvebu_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
        if (bus->number == 0)
                return mvebu_sw_pci_bridge_write(port, where, size, val);
 
-       if (!port->haslink || PCI_SLOT(devfn) != 0)
+       if (!port->haslink)
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       /*
+        * On the secondary bus, we don't want to expose any other
+        * device that the device physically connected in the PCIe

s/that/than/ (also below)

Quoted 38 lines
drivers/pci/host/pci-mvebu.c +20 -2
+        * slot, visible in slot 0. In slot 1, there's a special
+        * Marvell device that only makes sense when the Armada is
+        * used as a PCIe endpoint.
+        */
+       if (bus->number == port->bridge.secondary_bus &&
+           PCI_SLOT(devfn) != 0)
                return PCIBIOS_DEVICE_NOT_FOUND;
 
        /* Access the real PCIe interface */
@@ -609,7 +621,20 @@ static int mvebu_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
        if (bus->number == 0)
                return mvebu_sw_pci_bridge_read(port, where, size, val);
 
-       if (!port->haslink || PCI_SLOT(devfn) != 0) {
+       if (!port->haslink) {
+               *val = 0xffffffff;
+               return PCIBIOS_DEVICE_NOT_FOUND;
+       }
+
+       /*
+        * On the secondary bus, we don't want to expose any other
+        * device that the device physically connected in the PCIe
+        * slot, visible in slot 0. In slot 1, there's a special
+        * Marvell device that only makes sense when the Armada is
+        * used as a PCIe endpoint.
+        */
+       if (bus->number == port->bridge.secondary_bus &&
+           PCI_SLOT(devfn) != 0) {
                *val = 0xffffffff;
                return PCIBIOS_DEVICE_NOT_FOUND;
        }
--

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

#4 lore raw

PATCH 3/4 pci: mvebu: emulate an empty capability list

In reply to Thomas Petazzoni

Currently, our PCI-to-PCI bridge emulation doesn't emulate a proper capability list, which leads 'lspci -v' to show:

Capabilities: [fc] <chain broken>

In order to fix this, this commit improve the PCI-to-PCI bridge emulation to emulate an empty capability list. It might be later extended to expose things like the PCI Express Capability header, but an empty capability list is sufficient for now.

lspci -v now shows the much nicer:

Capabilities: [40] #00 [0000]

---
 drivers/pci/host/pci-mvebu.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/pci/host/pci-mvebu.c +10 -0
index c21ca84..c887598 100644
@@ -440,6 +440,16 @@ static int mvebu_sw_pci_bridge_read(struct mvebu_pcie_port *port,
 		*value = 0;
 		break;
 
+	case PCI_CAPABILITY_LIST:
+		/* Offset of the capability list */
+		*value = 0x40;
+		break;
+
+	case 0x40:
+		/* We have no element in our capability list */
+		*value = 0;
+		break;
+
 	default:
 		*value = 0xffffffff;
 		return PCIBIOS_BAD_REGISTER_NUMBER;
Signature · 1 line
1.7.9.5
maintainer
#5 lore raw

PATCH 3/4 pci: mvebu: emulate an empty capability list

Quoted 6 lines · Thomas Petazzoni

Currently, our PCI-to-PCI bridge emulation doesn't emulate a proper capability list, which leads 'lspci -v' to show:

Capabilities: [fc] <chain broken>

In order to fix this, this commit improve the PCI-to-PCI bridge

s/improve/improves/

Quoted 7 lines

emulation to emulate an empty capability list. It might be later extended to expose things like the PCI Express Capability header, but an empty capability list is sufficient for now.

lspci -v now shows the much nicer:

Capabilities: [40] #00 [0000]

It'd be even better if you could make the Capabilities List bit in the Device Status register be zero. Then lspci wouldn't even try to read the Capabilities Pointer at 0x34, and you wouldn't have to deal with reads of 0x40.

Quoted 33 lines
---
 drivers/pci/host/pci-mvebu.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/pci/host/pci-mvebu.c +10 -1
index c21ca84..c887598 100644
@@ -440,6 +440,16 @@ static int mvebu_sw_pci_bridge_read(struct mvebu_pcie_port *port,
                *value = 0;
                break;
 
+       case PCI_CAPABILITY_LIST:
+               /* Offset of the capability list */
+               *value = 0x40;
+               break;
+
+       case 0x40:
+               /* We have no element in our capability list */
+               *value = 0;
+               break;
+
        default:
                *value = 0xffffffff;
                return PCIBIOS_BAD_REGISTER_NUMBER;
--

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

#6 lore raw

PATCH 3/4 pci: mvebu: emulate an empty capability list

Dear Bjorn Helgaas,

Quoted 4 lines · Bjorn Helgaas
Quoted 4 lines

emulation to emulate an empty capability list. It might be later extended to expose things like the PCI Express Capability header, but an empty capability list is sufficient for now.

Quoted 8 lines
Quoted 3 lines

lspci -v now shows the much nicer:

Capabilities: [40] #00 [0000]

It'd be even better if you could make the Capabilities List bit in the Device Status register be zero. Then lspci wouldn't even try to read the Capabilities Pointer at 0x34, and you wouldn't have to deal with reads of 0x40.

The Device Status register is emulated with an initial value of zero. Then, whenever the Linux PCI core writes into it, those writes are preserved. So to me, it looks like the Linux PCI core might be setting this Capabilities List bit, and later re-reads it and finds it to be set to 1.

Should this bit be emulated as a read-only bit (it's not made explicit for this particular bit in the PCI-to-PCI bridge specification that I have in front of me) ? Or even the entire Device Status register ?

Thanks for your comments!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#7 lore raw

PATCH 4/4 pci: mvebu: fix the emulation of the status register

In reply to Thomas Petazzoni

In a PCI configuration header, the 'devsel' bits of the status register are read-only, and indicate the timing of the secondary interface. Currently, we implement them as read/write, so when the Linux PCI core writes all 1's to this register, it gets 11b as the 'devsel' value, which is reserved.

This commit fixes the PCI-to-PCI bridge emulation of the Marvell PCIe driver to ensure those bits remain set to 00b, which indicate a fast devsel decoding.

This allows to fix the lspci -v output from:

Flags: bus master, 66MHz, user-definable features, ?? devsel, latency 0

to:

Flags: bus master, 66MHz, user-definable features, fast devsel, latency 0

---
 drivers/pci/host/pci-mvebu.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/host/pci-mvebu.c +5 -0
index c887598..d730bf4 100644
@@ -490,6 +490,11 @@ static int mvebu_sw_pci_bridge_write(struct mvebu_pcie_port *port,
 	case PCI_COMMAND:
 		bridge->command = value & 0xffff;
 		bridge->status = value >> 16;
+		/*
+		 * The devsel bits are read-only, and we want to keep
+		 * them set to 0
+		 */
+		bridge->status &= ~PCI_STATUS_DEVSEL_MASK;
 		break;
 
 	case PCI_BASE_ADDRESS_0 ... PCI_BASE_ADDRESS_1:
Signature · 1 line
1.7.9.5
maintainer
#8 lore raw

PATCH 4/4 pci: mvebu: fix the emulation of the status register

Quoted 5 lines · Thomas Petazzoni

In a PCI configuration header, the 'devsel' bits of the status register are read-only, and indicate the timing of the secondary interface. Currently, we implement them as read/write, so when the Linux PCI core writes all 1's to this register, it gets 11b as the 'devsel' value, which is reserved.

I suppose the problem is that pci_scan_bridge() writes 0xffff to the PCI_STATUS register?

PCI_STATUS is documented as containing either RO or RW1C (write-1-to-clear status) bits, so it makes sense to write all ones to clear all status bits. But there are other RO bits that I think you should mask out, too: Interrupt Status, Capabilities List, etc.

Maybe if you fix this, it will also fix the Capability List issue you saw in patch 3/4.

Quoted 40 lines

This commit fixes the PCI-to-PCI bridge emulation of the Marvell PCIe driver to ensure those bits remain set to 00b, which indicate a fast devsel decoding.

This allows to fix the lspci -v output from:

Flags: bus master, 66MHz, user-definable features, ?? devsel, latency 0

to:

Flags: bus master, 66MHz, user-definable features, fast devsel, latency 0

---
 drivers/pci/host/pci-mvebu.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/host/pci-mvebu.c +5 -1
index c887598..d730bf4 100644
@@ -490,6 +490,11 @@ static int mvebu_sw_pci_bridge_write(struct mvebu_pcie_port *port,
        case PCI_COMMAND:
                bridge->command = value & 0xffff;
                bridge->status = value >> 16;
+               /*
+                * The devsel bits are read-only, and we want to keep
+                * them set to 0
+                */
+               bridge->status &= ~PCI_STATUS_DEVSEL_MASK;
                break;
 
        case PCI_BASE_ADDRESS_0 ... PCI_BASE_ADDRESS_1:
--

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

#9 lore raw

cover Marvell PCIe driver improvements

In reply to Thomas Petazzoni

Thomas,

Quoted 10 lines · Thomas Petazzoni

Bjorn, Jason, Andrew, Gregory,

You'll find in this patch series 4 small patches that make various improvements to the Marvell PCIe driver.

I'd like those improvements to be kept separated from the original PCIe driver itself: while the PCIe driver has been around and reviewed for a long time, those improvements are newer. And I clearly do not want the PCIe driver to miss 3.11 because of any problem that could be found in those additional improvements.

Agreed.

For Bjorn and others:

The original patch series Thomas is referring to missed the merge window for v3.10 due to a build failure. It is currently sitting in our mvebu repo. The first three patches, "of/pci ..." are in mvebu/of_pci. The rest of the series is on top of that in the branch mvebu/pcie.

I've sent pull requests for both branches to arm-soc. There are two other arm SoC pcie efforts which are depending on mvebu/of_pci. Hence why I did a separate branch.

Both branches are also merged into mvebu/for-next, and have survived linux-next for three days or so. But, it's early, so we'll see how it goes. :-)

Quoted 4 lines

Bjorn, with your Acked-by, could the Marvell maintainers include those patches in their branch, merged through arm-soc? They already have the Marvell PCIe driver itself, so I believe it makes sense to merge those improvements through the same path.

I agree, please see above regarding arm-soc dependencies.

Quoted 6 lines

Jason, those patches have been prepared on top of my marvell-pcie-v10 branch, I hope that's ok for you. If you want me to rebase them on some other branch in which you have integrated the PCIe driver, don't hesitate to tell me to do so. That said, since those patches are only touching the driver itself and no other file, they should not cause any conflict with other changes.

Should be fine, I'll let you know.

thx,

Jason.

#10 lore raw

cover Marvell PCIe driver improvements

Quoted 8 lines · Jason Cooper

Thomas,

Quoted 5 lines · Thomas Petazzoni

Bjorn, Jason, Andrew, Gregory,

You'll find in this patch series 4 small patches that make various improvements to the Marvell PCIe driver.

Quoted 7 lines
Quoted 5 lines

I'd like those improvements to be kept separated from the original PCIe driver itself: while the PCIe driver has been around and reviewed for a long time, those improvements are newer. And I clearly do not want the PCIe driver to miss 3.11 because of any problem that could be found in those additional improvements.

Agreed.

All the changes are located in one single file drivers/pci/host/pci-mvebu.c. So as soon as they will be acked by Bjron, I think we can make a PR for them. As nothing else depend of it, even if for a reason or another it is dropped, there will be no reason to drop anything else.

Quoted 36 lines

For Bjorn and others:

The original patch series Thomas is referring to missed the merge window for v3.10 due to a build failure. It is currently sitting in our mvebu repo. The first three patches, "of/pci ..." are in mvebu/of_pci. The rest of the series is on top of that in the branch mvebu/pcie.

I've sent pull requests for both branches to arm-soc. There are two other arm SoC pcie efforts which are depending on mvebu/of_pci. Hence why I did a separate branch.

Both branches are also merged into mvebu/for-next, and have survived linux-next for three days or so. But, it's early, so we'll see how it goes. :-)

Quoted 4 lines

Bjorn, with your Acked-by, could the Marvell maintainers include those patches in their branch, merged through arm-soc? They already have the Marvell PCIe driver itself, so I believe it makes sense to merge those improvements through the same path.

I agree, please see above regarding arm-soc dependencies.

Quoted 6 lines

Jason, those patches have been prepared on top of my marvell-pcie-v10 branch, I hope that's ok for you. If you want me to rebase them on some other branch in which you have integrated the PCIe driver, don't hesitate to tell me to do so. That said, since those patches are only touching the driver itself and no other file, they should not cause any conflict with other changes.

Should be fine, I'll let you know.

thx,

Jason.

Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#11 lore raw

cover Marvell PCIe driver improvements

Quoted 15 lines · Gregory CLEMENT
Quoted 14 lines · Jason Cooper

Thomas,

Quoted 10 lines · Thomas Petazzoni

Bjorn, Jason, Andrew, Gregory,

You'll find in this patch series 4 small patches that make various improvements to the Marvell PCIe driver.

I'd like those improvements to be kept separated from the original PCIe driver itself: while the PCIe driver has been around and reviewed for a long time, those improvements are newer. And I clearly do not want the PCIe driver to miss 3.11 because of any problem that could be found in those additional improvements.

Quoted 6 lines
Quoted 1 line

Agreed.

All the changes are located in one single file drivers/pci/host/pci-mvebu.c. So as soon as they will be acked by Bjron, I think we can make a PR for them. As nothing else depend of it, even if for a reason or another it is dropped, there will be no reason to drop anything else.

Right, which is why we'll put it in a separate branch. Say, mvebu/pcie_bridge. This way if /pcie_bridge has to be dropped (say an API that it used is changed), /pcie would remain. Which is the main concern.

Had I known enough last time around, I would have done the /of_pci | /pcie split. /pcie would have been dropped, and /of_pci would have made it in. As well as LinusW's work which depends upon it (and now Arnd might have something using it as well).

thx,

Jason.

#12 lore raw

cover Marvell PCIe driver improvements

In reply to Thomas Petazzoni

Hi Thomas,

Quoted 4 lines · Thomas Petazzoni

Bjorn, Jason, Andrew, Gregory,

You'll find in this patch series 4 small patches that make various improvements to the Marvell PCIe driver.

(...)

FWIW, these patches applied on top of your pcie-v10 tree have made my mini-pcie dual-nic appear for the first time on the mirabox. Till now I never knew if it was a hardware or software issue since the NIC does not appear in u-boot nor lspci, whatever the kernel versions, including the original Marvell one's. The NIC has two functions (one per controller) and no bridge, so it may be a side effect of your improvements (or maybe you fixed a bug).

Anyway for me it's a great improvement !

I've not tried it on the OpenBlocks AX3 yet (it was not detected there previously). But I have good hopes.

For reference, the NIC is Jetway's ADMPEIDLA (intel i350-AM2).

Best regards,
Willy

#13 lore raw

cover Marvell PCIe driver improvements

Dear Willy Tarreau,

Quoted 11 lines · Willy Tarreau
Quoted 2 lines

You'll find in this patch series 4 small patches that make various improvements to the Marvell PCIe driver.

(...)

FWIW, these patches applied on top of your pcie-v10 tree have made my mini-pcie dual-nic appear for the first time on the mirabox. Till now I never knew if it was a hardware or software issue since the NIC does not appear in u-boot nor lspci, whatever the kernel versions, including the original Marvell one's. The NIC has two functions (one per controller) and no bridge, so it may be a side effect of your improvements (or maybe you fixed a bug).

Hum, interesting. Can you show the output of lspci -v and lspci -t (which a pciutils version of lspci, not Busybox one) ? I'm interested in seeing the layout of the PCIe bus with such a device, to get a better understanding.

Quoted 6 lines

Anyway for me it's a great improvement !

I've not tried it on the OpenBlocks AX3 yet (it was not detected there previously). But I have good hopes.

For reference, the NIC is Jetway's ADMPEIDLA (intel i350-AM2).

Should I be taking this as a formal Tested-by from you? :-)

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#14 lore raw

cover Marvell PCIe driver improvements

Quoted 8 lines · Thomas Petazzoni
Quoted 7 lines

FWIW, these patches applied on top of your pcie-v10 tree have made my mini-pcie dual-nic appear for the first time on the mirabox. Till now I never knew if it was a hardware or software issue since the NIC does not appear in u-boot nor lspci, whatever the kernel versions, including the original Marvell one's. The NIC has two functions (one per controller) and no bridge, so it may be a side effect of your improvements (or maybe you fixed a bug).

Quoted 4 lines

Hum, interesting. Can you show the output of lspci -v and lspci -t (which a pciutils version of lspci, not Busybox one) ? I'm interested in seeing the layout of the PCIe bus with such a device, to get a better understanding.

(send privately in another thread).

Quoted 8 lines
Quoted 6 lines

Anyway for me it's a great improvement !

I've not tried it on the OpenBlocks AX3 yet (it was not detected there previously). But I have good hopes.

For reference, the NIC is Jetway's ADMPEIDLA (intel i350-AM2).

Should I be taking this as a formal Tested-by from you? :-)

Yes, obviously, feel free to add this one :

Willy

#15 lore raw

cover Marvell PCIe driver improvements

In reply to Willy Tarreau
Quoted 9 lines · Willy Tarreau

Hi Thomas,

Quoted 4 lines · Thomas Petazzoni

Bjorn, Jason, Andrew, Gregory,

You'll find in this patch series 4 small patches that make various improvements to the Marvell PCIe driver.

(...)

Quoted 7 lines

FWIW, these patches applied on top of your pcie-v10 tree have made my mini-pcie dual-nic appear for the first time on the mirabox. Till now I never knew if it was a hardware or software issue since the NIC does not appear in u-boot nor lspci, whatever the kernel versions, including the original Marvell one's. The NIC has two functions (one per controller) and no bridge, so it may be a side effect of your improvements (or maybe you fixed a bug).

There was some talk earlier that some buggy chips required their device number to be 0. I'm guessing Thomas's change to ensure that always happens by moving the device number of the internal device is the root fix here?

Regards,
Jason

#16 lore raw

cover Marvell PCIe driver improvements

Dear Jason Gunthorpe,

Quoted 8 lines · Jason Gunthorpe
Quoted 7 lines

FWIW, these patches applied on top of your pcie-v10 tree have made my mini-pcie dual-nic appear for the first time on the mirabox. Till now I never knew if it was a hardware or software issue since the NIC does not appear in u-boot nor lspci, whatever the kernel versions, including the original Marvell one's. The NIC has two functions (one per controller) and no bridge, so it may be a side effect of your improvements (or maybe you fixed a bug).

Quoted 4 lines

There was some talk earlier that some buggy chips required their device number to be 0. I'm guessing Thomas's change to ensure that always happens by moving the device number of the internal device is the root fix here?

You're correct. Off-list, I've sent to Willy a patch that applies on top of those additional "bridge-related" fixes, but that reverts back the slot number of the real PCIe device to be 1 instead of 0. And in this case, the PCIe device that Willy is using is not detected.

So indeed, there are some PCIe devices who really want to receive "configuration transactions" as slot 0.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com