Looks good from here!Download: vmlinux-4.15-rc1-2-AmigaOne_X1000_X5000.tar.gz
...
Please test it.
Thanks,
Christian
tom
Looks good from here!Download: vmlinux-4.15-rc1-2-AmigaOne_X1000_X5000.tar.gz
...
Please test it.
Thanks,
Christian
Hi Tom,tbreeden wrote: Looks good from here!
tom
Code: Select all
commit 75eaf674066590e79b3e03d32488871fc881ab40
Author: Bjorn Helgaas <bhelgaas@google.com>
Date: Thu Nov 30 15:22:39 2017 -0600
PCI: Make PCI_SCAN_ALL_PCIE_DEVS work for Root Ports as well as Downstream
Previously PCI_SCAN_ALL_PCIE_DEVS (set by quirks or the "pci=pcie_scan_all"
kernel parameter) only affected Switch Downstream Ports, not Root Ports.
Simplify and restructure only_one_child() so PCI_SCAN_ALL_PCIE_DEVS means
we scan for all possible devices below Root Ports as well as Switch
Downstream Ports.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 14e0ea1ff38b..9e57d4ef0c1f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2217,20 +2217,28 @@ static int only_one_child(struct pci_bus *bus)
{
struct pci_dev *parent = bus->self;
- if (!parent || !pci_is_pcie(parent))
+ if (!parent)
+ return 0;
+
+ /*
+ * Systems with unusual topologies set PCI_SCAN_ALL_PCIE_DEVS so
+ * we scan for all possible devices, not just Device 0.
+ */
+ if (pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
return 0;
- if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
- return 1;
/*
- * PCIe downstream ports are bridges that normally lead to only a
- * device 0, but if PCI_SCAN_ALL_PCIE_DEVS is set, scan all
- * possible devices, not just device 0. See PCIe spec r3.0,
- * sec 7.3.1.
+ * A PCIe Downstream Port normally leads to a Link with only Device
+ * 0 on it (PCIe spec r3.1, sec 7.3.1). As an optimization, scan
+ * only for Device 0 in that situation.
+ *
+ * Checking has_secondary_link is a hack to identify Downstream
+ * Ports because sometimes Switches are configured such that the
+ * PCIe Port Type labels are backwards.
*/
- if (parent->has_secondary_link &&
- !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
+ if (pci_is_pcie(parent) && parent->has_secondary_link)
return 1;
+
return 0;
}
Bjorn wrote: Thanks for testing that. I'll merge a similar patch for v4.16.
I don't think using "pci=pcie_scan_all" is really an acceptable
long-term answer for you, though. Is there some way we can identify
at run-time whether we're on a Nemo system? If so, we can make this
happen automatically.
Bjorn
Bjorn wrote: PCIe Downstream Ports normally have only a Device 0 below them. To
optimize enumeration, we don't scan for other devices *unless* the
PCI_SCAN_ALL_PCIE_DEVS flag is set by set by quirks or the
"pci=pcie_scan_all" kernel parameter.
Previously PCI_SCAN_ALL_PCIE_DEVS only affected scanning below Switch
Downstream Ports, not Root Ports.
But the "Nemo" system, also known as the AmigaOne X1000, has a PA Semi Root
Port whose link leads to an AMD/ATI SB600 South Bridge. The Root Port is a
PCIe device, of course, but the SB600 contains only conventional PCI
devices with no visible PCIe port.
Simplify and restructure only_one_child() so that we scan for all possible
devices below Root Ports as well as Switch Downstream Ports when
PCI_SCAN_ALL_PCIE_DEVS is set.
This is enough to make Nemo work with "pci=pcie_scan_all". We would also
like to add a quirk to set PCI_SCAN_ALL_PCIE_DEVS automatically on Nemo so
users wouldn't have to use the "pci=pcie_scan_all" parameter, but we don't
have that yet.
Link: https://lkml.kernel.org/r/CAErSpo55Q8Q= ... .gmail.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=198057
Reported-and-Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/probe.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 14e0ea1ff38b..303c0cb0550c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2215,22 +2215,27 @@ static unsigned next_fn(struct pci_bus *bus, struct pci_dev *dev, unsigned fn)
static int only_one_child(struct pci_bus *bus)
{
- struct pci_dev *parent = bus->self;
+ struct pci_dev *bridge = bus->self;
- if (!parent || !pci_is_pcie(parent))
+ /*
+ * Systems with unusual topologies set PCI_SCAN_ALL_PCIE_DEVS so
+ * we scan for all possible devices, not just Device 0.
+ */
+ if (pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
return 0;
- if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
- return 1;
/*
- * PCIe downstream ports are bridges that normally lead to only a
- * device 0, but if PCI_SCAN_ALL_PCIE_DEVS is set, scan all
- * possible devices, not just device 0. See PCIe spec r3.0,
- * sec 7.3.1.
+ * A PCIe Downstream Port normally leads to a Link with only Device
+ * 0 on it (PCIe spec r3.1, sec 7.3.1). As an optimization, scan
+ * only for Device 0 in that situation.
+ *
+ * Checking has_secondary_link is a hack to identify Downstream
+ * Ports because sometimes Switches are configured such that the
+ * PCIe Port Type labels are backwards.
*/
- if (parent->has_secondary_link &&
- !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
+ if (bridge && pci_is_pcie(bridge) && bridge->has_secondary_link)
return 1;
+
return 0;
}
Secondly, I released the RC1-3 with Bjorn's patch for the AmigaOne X1000 today. You need to add pci=pcie_scan_all to the boot arguments.Hi Bjorn,
Many thanks for your effort! I appreciate it very much.
We can identify the Nemo board at the boot time. See dmesg output: [ 0.061592] NEMO SB600 IOB base e0000000
@linuxppc-dev
Any other ideas? Maybe the same as we can identify the other P.A. Semi boards (Electra, Chitra, and Athena).
@Olof
Maybe you know how we can identify the P.A. Semi Nemo board at the run-time.
@Darren
Do you have an idea?
Thanks to all for your help.
Cheers,
Christian
Olof Johansson wrote: The below patch, together with Bjorn's, should do it. Christian, can you test and report back?
I'm guessing it won't do any harm to set this on non-X1000 platforms. My test system is currently powered down so I can't check.
Code: Select all
arch/powerpc/platforms/pasemi/pci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index 5ff6108..ea54ed2 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -224,6 +224,8 @@ void __init pas_pci_init(void)
return;
}
+ pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS);
+
for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
if (np->name && !strcmp(np->name, "pxp") && !pas_add_bridge(np))
of_node_get(np);
Darren wrote: Actually the root ports on the Nemo's PA6T processor don't respond to the SB600 unless we turn on a special 'relax pci-e' bit in one of its control registers. We use a small out of tree init routine to do this, and there would be the ideal place to put a call to
pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS).
Code: Select all
^~~~~~~~~
arch/powerpc/platforms/pasemi/pci.c: In function ‘pas_pci_init’:
arch/powerpc/platforms/pasemi/pci.c:298:2: error: implicit declaration of function ‘pci_set_flag’ [-Werror=implicit-function-declaration]
pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS);
^~~~~~~~~~~~
cc1: some warnings being treated as errors
Code: Select all
arch/powerpc/platforms/pasemi/pci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index 5ff6108..ea54ed2 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -224,6 +224,8 @@ void __init pas_pci_init(void)
return;
}
+ pci_set_flags(PCI_SCAN_ALL_PCIE_DEVS);
+
for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
if (np->name && !strcmp(np->name, "pxp") && !pas_add_bridge(np))
of_node_get(np);