All of lore.kernel.org
 help / color / mirror / Atom feed
* PCIe bridges on Jetson TK1
@ 2016-07-17  0:27 ` Andreas Färber
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2016-07-17  0:27 UTC (permalink / raw)
  To: Stephen Warren; +Cc: U-Boot, linux-tegra, Alexander Graf

Hi,

When I boot my Jetson TK1, by default I get this from lspci:

00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)

If however I plug some mini PCIe card, I get this instead:

00:01.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x4 Bridge (rev a1)
00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
01:00.0 Network controller: MEDIATEK Corp. Device 7612
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)

I.e., there is a new Tegra PCIe x4 bridge and the number of the previous
x1 bridge changed.

That is ugly because it changes the ID of the on-board PCI NIC from
01:00.0 to 02:00.0, which on openSUSE renames the network interface from
enp1s0 to enp2s0, so that my /etc/sysconfig/network/ifcfg-enp1s0 does
not take effect and the network interface doesn't come up.

Tested with U-Boot v2016.05 and v2016.07 and kernel 4.6.2 and 4.7-rc6.

Shouldn't U-Boot or the kernel driver always configure the PCIe ports
the same way (both bridges available) since the slot is always there on
this board?

Thanks,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] PCIe bridges on Jetson TK1
@ 2016-07-17  0:27 ` Andreas Färber
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2016-07-17  0:27 UTC (permalink / raw)
  To: u-boot

Hi,

When I boot my Jetson TK1, by default I get this from lspci:

00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)

If however I plug some mini PCIe card, I get this instead:

00:01.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x4 Bridge (rev a1)
00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
01:00.0 Network controller: MEDIATEK Corp. Device 7612
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)

I.e., there is a new Tegra PCIe x4 bridge and the number of the previous
x1 bridge changed.

That is ugly because it changes the ID of the on-board PCI NIC from
01:00.0 to 02:00.0, which on openSUSE renames the network interface from
enp1s0 to enp2s0, so that my /etc/sysconfig/network/ifcfg-enp1s0 does
not take effect and the network interface doesn't come up.

Tested with U-Boot v2016.05 and v2016.07 and kernel 4.6.2 and 4.7-rc6.

Shouldn't U-Boot or the kernel driver always configure the PCIe ports
the same way (both bridges available) since the slot is always there on
this board?

Thanks,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [U-Boot] PCIe bridges on Jetson TK1
  2016-07-17  0:27 ` [U-Boot] " Andreas Färber
@ 2016-07-18  6:27     ` Thierry Reding
  -1 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2016-07-18  6:27 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Stephen Warren, linux-tegra, U-Boot

[-- Attachment #1: Type: text/plain, Size: 2208 bytes --]

On Sun, Jul 17, 2016 at 02:27:25AM +0200, Andreas Färber wrote:
> Hi,
> 
> When I boot my Jetson TK1, by default I get this from lspci:
> 
> 00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
> 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
> 
> If however I plug some mini PCIe card, I get this instead:
> 
> 00:01.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x4 Bridge (rev a1)
> 00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
> 01:00.0 Network controller: MEDIATEK Corp. Device 7612
> 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
> 
> I.e., there is a new Tegra PCIe x4 bridge and the number of the previous
> x1 bridge changed.
> 
> That is ugly because it changes the ID of the on-board PCI NIC from
> 01:00.0 to 02:00.0, which on openSUSE renames the network interface from
> enp1s0 to enp2s0, so that my /etc/sysconfig/network/ifcfg-enp1s0 does
> not take effect and the network interface doesn't come up.
> 
> Tested with U-Boot v2016.05 and v2016.07 and kernel 4.6.2 and 4.7-rc6.
> 
> Shouldn't U-Boot or the kernel driver always configure the PCIe ports
> the same way (both bridges available) since the slot is always there on
> this board?

I don't think that's going to ensure stable naming of devices. Linux
uses depth-first sorting when enumerating devices, so if you attach any
kind of bridge device to the first port, anything downstream of the
second port still won't get a stable B/D/F.

That said, I see how what you're proposing could help at least minimize
the potential for instability in numbering. Could you try to uncomment
the tegra_pcie_port_free() line in tegra_pcie_enable() of the Tegra PCI
host controller driver (drivers/pci/host/pci-tegra.c) and see if that
improves things in your use-case? It's slightly hackish because it does
allow access to the root port even if it's disabled, so I'm not sure it
will work (might give you an external abort or something like that) but
it might be worth a quick try.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] PCIe bridges on Jetson TK1
@ 2016-07-18  6:27     ` Thierry Reding
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2016-07-18  6:27 UTC (permalink / raw)
  To: u-boot

On Sun, Jul 17, 2016 at 02:27:25AM +0200, Andreas F?rber wrote:
> Hi,
> 
> When I boot my Jetson TK1, by default I get this from lspci:
> 
> 00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
> 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
> 
> If however I plug some mini PCIe card, I get this instead:
> 
> 00:01.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x4 Bridge (rev a1)
> 00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
> 01:00.0 Network controller: MEDIATEK Corp. Device 7612
> 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
> 
> I.e., there is a new Tegra PCIe x4 bridge and the number of the previous
> x1 bridge changed.
> 
> That is ugly because it changes the ID of the on-board PCI NIC from
> 01:00.0 to 02:00.0, which on openSUSE renames the network interface from
> enp1s0 to enp2s0, so that my /etc/sysconfig/network/ifcfg-enp1s0 does
> not take effect and the network interface doesn't come up.
> 
> Tested with U-Boot v2016.05 and v2016.07 and kernel 4.6.2 and 4.7-rc6.
> 
> Shouldn't U-Boot or the kernel driver always configure the PCIe ports
> the same way (both bridges available) since the slot is always there on
> this board?

I don't think that's going to ensure stable naming of devices. Linux
uses depth-first sorting when enumerating devices, so if you attach any
kind of bridge device to the first port, anything downstream of the
second port still won't get a stable B/D/F.

That said, I see how what you're proposing could help at least minimize
the potential for instability in numbering. Could you try to uncomment
the tegra_pcie_port_free() line in tegra_pcie_enable() of the Tegra PCI
host controller driver (drivers/pci/host/pci-tegra.c) and see if that
improves things in your use-case? It's slightly hackish because it does
allow access to the root port even if it's disabled, so I'm not sure it
will work (might give you an external abort or something like that) but
it might be worth a quick try.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160718/9cce1dbd/attachment.sig>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [U-Boot] PCIe bridges on Jetson TK1
  2016-07-18  6:27     ` Thierry Reding
@ 2016-07-18 10:19         ` Thierry Reding
  -1 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2016-07-18 10:19 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Stephen Warren, linux-tegra, U-Boot

[-- Attachment #1: Type: text/plain, Size: 3476 bytes --]

On Mon, Jul 18, 2016 at 08:27:18AM +0200, Thierry Reding wrote:
> On Sun, Jul 17, 2016 at 02:27:25AM +0200, Andreas Färber wrote:
> > Hi,
> > 
> > When I boot my Jetson TK1, by default I get this from lspci:
> > 
> > 00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
> > 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> > RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
> > 
> > If however I plug some mini PCIe card, I get this instead:
> > 
> > 00:01.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x4 Bridge (rev a1)
> > 00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
> > 01:00.0 Network controller: MEDIATEK Corp. Device 7612
> > 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> > RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
> > 
> > I.e., there is a new Tegra PCIe x4 bridge and the number of the previous
> > x1 bridge changed.
> > 
> > That is ugly because it changes the ID of the on-board PCI NIC from
> > 01:00.0 to 02:00.0, which on openSUSE renames the network interface from
> > enp1s0 to enp2s0, so that my /etc/sysconfig/network/ifcfg-enp1s0 does
> > not take effect and the network interface doesn't come up.
> > 
> > Tested with U-Boot v2016.05 and v2016.07 and kernel 4.6.2 and 4.7-rc6.
> > 
> > Shouldn't U-Boot or the kernel driver always configure the PCIe ports
> > the same way (both bridges available) since the slot is always there on
> > this board?
> 
> I don't think that's going to ensure stable naming of devices. Linux
> uses depth-first sorting when enumerating devices, so if you attach any
> kind of bridge device to the first port, anything downstream of the
> second port still won't get a stable B/D/F.
> 
> That said, I see how what you're proposing could help at least minimize
> the potential for instability in numbering. Could you try to uncomment
> the tegra_pcie_port_free() line in tegra_pcie_enable() of the Tegra PCI
> host controller driver (drivers/pci/host/pci-tegra.c) and see if that
> improves things in your use-case? It's slightly hackish because it does
> allow access to the root port even if it's disabled, so I'm not sure it
> will work (might give you an external abort or something like that) but
> it might be worth a quick try.

The below seems to work fine for me. Can you verify that this works for
you, too?

Thanks,
Thierry

--- >8 ---
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index c388468c202a..0b8616e25d7b 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -587,17 +587,6 @@ static void tegra_pcie_port_disable(struct tegra_pcie_port *port)
 	afi_writel(port->pcie, value, ctrl);
 }
 
-static void tegra_pcie_port_free(struct tegra_pcie_port *port)
-{
-	struct tegra_pcie *pcie = port->pcie;
-
-	devm_iounmap(pcie->dev, port->base);
-	devm_release_mem_region(pcie->dev, port->regs.start,
-				resource_size(&port->regs));
-	list_del(&port->list);
-	devm_kfree(pcie->dev, port);
-}
-
 /* Tegra PCIE root complex wrongly reports device class */
 static void tegra_pcie_fixup_class(struct pci_dev *dev)
 {
@@ -2053,7 +2042,6 @@ static int tegra_pcie_enable(struct tegra_pcie *pcie)
 		dev_info(pcie->dev, "link %u down, ignoring\n", port->index);
 
 		tegra_pcie_port_disable(port);
-		tegra_pcie_port_free(port);
 	}
 
 	memset(&hw, 0, sizeof(hw));

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] PCIe bridges on Jetson TK1
@ 2016-07-18 10:19         ` Thierry Reding
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2016-07-18 10:19 UTC (permalink / raw)
  To: u-boot

On Mon, Jul 18, 2016 at 08:27:18AM +0200, Thierry Reding wrote:
> On Sun, Jul 17, 2016 at 02:27:25AM +0200, Andreas F?rber wrote:
> > Hi,
> > 
> > When I boot my Jetson TK1, by default I get this from lspci:
> > 
> > 00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
> > 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> > RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
> > 
> > If however I plug some mini PCIe card, I get this instead:
> > 
> > 00:01.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x4 Bridge (rev a1)
> > 00:02.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
> > 01:00.0 Network controller: MEDIATEK Corp. Device 7612
> > 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> > RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
> > 
> > I.e., there is a new Tegra PCIe x4 bridge and the number of the previous
> > x1 bridge changed.
> > 
> > That is ugly because it changes the ID of the on-board PCI NIC from
> > 01:00.0 to 02:00.0, which on openSUSE renames the network interface from
> > enp1s0 to enp2s0, so that my /etc/sysconfig/network/ifcfg-enp1s0 does
> > not take effect and the network interface doesn't come up.
> > 
> > Tested with U-Boot v2016.05 and v2016.07 and kernel 4.6.2 and 4.7-rc6.
> > 
> > Shouldn't U-Boot or the kernel driver always configure the PCIe ports
> > the same way (both bridges available) since the slot is always there on
> > this board?
> 
> I don't think that's going to ensure stable naming of devices. Linux
> uses depth-first sorting when enumerating devices, so if you attach any
> kind of bridge device to the first port, anything downstream of the
> second port still won't get a stable B/D/F.
> 
> That said, I see how what you're proposing could help at least minimize
> the potential for instability in numbering. Could you try to uncomment
> the tegra_pcie_port_free() line in tegra_pcie_enable() of the Tegra PCI
> host controller driver (drivers/pci/host/pci-tegra.c) and see if that
> improves things in your use-case? It's slightly hackish because it does
> allow access to the root port even if it's disabled, so I'm not sure it
> will work (might give you an external abort or something like that) but
> it might be worth a quick try.

The below seems to work fine for me. Can you verify that this works for
you, too?

Thanks,
Thierry

--- >8 ---
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index c388468c202a..0b8616e25d7b 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -587,17 +587,6 @@ static void tegra_pcie_port_disable(struct tegra_pcie_port *port)
 	afi_writel(port->pcie, value, ctrl);
 }
 
-static void tegra_pcie_port_free(struct tegra_pcie_port *port)
-{
-	struct tegra_pcie *pcie = port->pcie;
-
-	devm_iounmap(pcie->dev, port->base);
-	devm_release_mem_region(pcie->dev, port->regs.start,
-				resource_size(&port->regs));
-	list_del(&port->list);
-	devm_kfree(pcie->dev, port);
-}
-
 /* Tegra PCIE root complex wrongly reports device class */
 static void tegra_pcie_fixup_class(struct pci_dev *dev)
 {
@@ -2053,7 +2042,6 @@ static int tegra_pcie_enable(struct tegra_pcie *pcie)
 		dev_info(pcie->dev, "link %u down, ignoring\n", port->index);
 
 		tegra_pcie_port_disable(port);
-		tegra_pcie_port_free(port);
 	}
 
 	memset(&hw, 0, sizeof(hw));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160718/a61a3d8f/attachment.sig>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-18 10:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-17  0:27 PCIe bridges on Jetson TK1 Andreas Färber
2016-07-17  0:27 ` [U-Boot] " Andreas Färber
     [not found] ` <3a41e071-f7a2-f995-8c3d-ef211df6aa3a-l3A5Bk7waGM@public.gmane.org>
2016-07-18  6:27   ` Thierry Reding
2016-07-18  6:27     ` Thierry Reding
     [not found]     ` <20160718062718.GC10785-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-07-18 10:19       ` Thierry Reding
2016-07-18 10:19         ` Thierry Reding

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.