arm64/pci: Add quirks for Cavium Thunder PCI bridges.
PATCH 1/1 arm64/pci: Add quirks for Cavium Thunder PCI bridges.
From: David Daney <[email protected]>
The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new quirks.c file there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX.
--- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/kernel/quirks.c
arch/arm64/Kconfig +11 -0
@@ -359,6 +359,17 @@ config CAVIUM_ERRATUM_23154 If unsure, say Y. +config CAVIUM_THUNDER_PCI_QUIRKS + bool "Cavium PCI quirk workarounds" + depends on PCI + help + + Some ThunderX systems have PCI quirk workarounds that must + be enabled to be able to use PCI devices. This option + enables the workarounds. + + If unsure, say Y. + endmenu
arch/arm64/kernel/Makefile +1 -1
@@ -33,7 +33,7 @@ arm64-obj-$(CONFIG_CPU_IDLE) += cpuidle.o arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o arm64-obj-$(CONFIG_KGDB) += kgdb.o arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o -arm64-obj-$(CONFIG_PCI) += pci.o +arm64-obj-$(CONFIG_PCI) += pci.o quirks.o arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o arm64-obj-$(CONFIG_ACPI) += acpi.o
arch/arm64/kernel/quirks.c new file +36 -0
@@ -0,0 +1,36 @@ +/* +* PCIe quirks for arm64 +* +* Copyright (C) 2015 Cavium, Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +*/ + +#include <linux/pci.h> + +#ifdef CONFIG_CAVIUM_THUNDER_PCI_QUIRKS +static void thunder_bridge_fixup (struct pci_dev *dev) +{ +/* +* This bridge is broken in that it doesn't have correct +* resource ranges for the buses behind it. +* +* The upstream bus resources are a close enough approximation +* to what is needed, that they can be used instead. Copy +* upstream root bus resources so that resource claiming for +* downstream devices can be done. +*/ +int resno; +struct pci_bus *bus = dev->subordinate; + +for (resno =0 ; resno <PCI_BRIDGE_RESOURCE_NUM ; resno++) { + bus->resource[resno] = +pci_bus_resource_n (bus->parent, +PCI_BRIDGE_RESOURCE_NUM + resno); + } +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_CAVIUM ,0xa002 , thunder_bridge_fixup); +#endif /* CONFIG_CAVIUM_THUNDER_PCI_QUIRKS */
Signature · 1 line
1.9.1
Quoted 8 lines · On Tuesday 22 September 2015 17:09:56 David Daney wrote:
From: David Daney <[email protected]>
The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new
quirks.cfile there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX.
Quoted 8 lines
Signed-off-by David Daney <[email protected]>--- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/kernel/quirks.c
Looks reasonable to me. Just one question: Is the same bridge used on MIPS machines? If so, maybe it should be moved to drivers/pci/quirks.c instead for better reuse.
Arnd
Quoted 18 lines · Arnd Bergmann
Quoted 8 lines · On Tuesday 22 September 2015 17:09:56 David Daney wrote:
From: David Daney <[email protected]>
The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new
quirks.cfile there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX.Quoted 8 lines
Signed-off-by David Daney <[email protected]>--- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-)create mode 100644
arch/arm64/kernel/quirks.c
Quoted 2 lines
Looks reasonable to me. Just one question: Is the same bridge used on MIPS machines?
No. The MIPS64 based OCTEON family of SoCs does not contain PCI-buses/config-space/bridges for on-chip hardware blocks. The on-chip blocks in OCTEON are all platform devices. So, ...
Quoted 2 lines
If so, maybe it should be moved to
drivers/pci/quirks.cinstead for better reuse.
The quirk is specific to some arm64 based SoCs, thus my idea to have arch specific quirks.
David Daney
Quoted 8 lines · David Daney
From: David Daney <[email protected]>
The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new
quirks.cfile there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX.
Quoted 7 lines
Signed-off-by David Daney <[email protected]>--- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/kernel/quirks.c
Why does this have to live in the arch/arm64/ directory? The quirks have nothing to do with the architecture code.
Will
Quoted 17 lines · Will Deacon
Quoted 8 lines · David Daney
From: David Daney <[email protected]>
The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new
quirks.cfile there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX.Quoted 7 lines
Signed-off-by David Daney <[email protected]>--- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-)create mode 100644
arch/arm64/kernel/quirks.c
Quoted 3 lines
Why does this have to live in the
arch/arm64/directory? The quirks have nothing to do with the architecture code.
It doesn't have to live there. It is something that will never be used for any other architecture. So I thought we could do like arch/x86/kernel/quirks.c
I could move it to drivers/pci/quirks.c if people think that is a much better place for it.
David Daney
Quoted 26 lines · On Wednesday 23 September 2015 09:00:36 David Daney wrote:
Quoted 18 lines · Arnd Bergmann
Quoted 8 lines · On Tuesday 22 September 2015 17:09:56 David Daney wrote:
From: David Daney <[email protected]>
The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new
quirks.cfile there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX.Quoted 8 lines
Signed-off-by David Daney <[email protected]>--- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-)create mode 100644
arch/arm64/kernel/quirks.cQuoted 2 lines
Looks reasonable to me. Just one question: Is the same bridge used on MIPS machines?
No. The MIPS64 based OCTEON family of SoCs does not contain PCI-buses/config-space/bridges for on-chip hardware blocks. The on-chip blocks in OCTEON are all platform devices. So, ...
Quoted 5 lines
Quoted 2 lines
If so, maybe it should be moved to
drivers/pci/quirks.cinstead for better reuse.The quirk is specific to some arm64 based SoCs, thus my idea to have arch specific quirks.
Ok.
Arnd
Hi David,
Quoted 7 lines · David Daney
From: David Daney <[email protected]>
The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new
quirks.cfile there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX.
Is this still needed? I've seen some follow-up Cavium stuff, but nothing further on this one. If we still need it, we should figure out who should take it. It's all under arch/arm64, so ordinarily I would leave it up to the arm64 guys.
Quoted 17 lines
Signed-off-by David Daney <[email protected]>--- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/kernel/quirks.carch/arm64/kernel/quirks.c new file +9
-0+#ifdef CONFIG_CAVIUM_THUNDER_PCI_QUIRKS +static void thunder_bridge_fixup (struct pci_dev *dev) +{ +/* +* This bridge is broken in that it doesn't have correct +* resource ranges for the buses behind it. +* +* The upstream bus resources are a close enough approximation +* to what is needed, that they can be used instead. Copy
arch/arm64/kernel/quirks.c line 32
Quoted 10 lines
arch/arm64/kernel/quirks.c new file +10
-0+* upstream root bus resources so that resource claiming for +* downstream devices can be done. +*/ +int resno; +struct pci_bus *bus = dev->subordinate; + +for (resno =0 ; resno <PCI_BRIDGE_RESOURCE_NUM ; resno++) { + bus->resource[resno] = +pci_bus_resource_n (bus->parent, +PCI_BRIDGE_RESOURCE_NUM + resno);
I am curious about this. Is this a standard PCI-PCI bridge, or is it a host bridge. If the former, I guess it must be broken in some way that keeps the usual bridge window reading code from working?
Copying the upstream bus resources to the downstream bus might sort of work sometimes, but seems fragile in general. If the bridge has any peers, it seems like we're headed for a conflict between the peer's resources and anything downstream of the bridge.
Quoted 11 lines
arch/arm64/kernel/quirks.c new file +4
-0+ } +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_CAVIUM ,0xa002 , thunder_bridge_fixup); +#endif /* CONFIG_CAVIUM_THUNDER_PCI_QUIRKS */ Signature · 6 lines
1.9.1 -- 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 · Bjorn Helgaas
Hi David,
Quoted 2 lines · David Daney
From: David Daney <[email protected]>
Quoted 7 lines
Quoted 5 lines
The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new
quirks.cfile there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX.Is this still needed?
No.
The EA patch set that you merged to 4.4 supersedes this.
Quoted 26 lines
I've seen some follow-up Cavium stuff, but
nothing further on this one. If we still need it, we should figure out who should take it. It's all underarch/arm64, so ordinarily I would leave it up to the arm64 guys.Quoted 21 lines
Signed-off-by David Daney <[email protected]>--- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-)create mode 100644
arch/arm64/kernel/quirks.carch/arm64/kernel/quirks.c new file +13
-0+#ifdef CONFIG_CAVIUM_THUNDER_PCI_QUIRKS +static void thunder_bridge_fixup (struct pci_dev *dev) +{ +/* +* This bridge is broken in that it doesn't have correct +* resource ranges for the buses behind it. +* +* The upstream bus resources are a close enough approximation +* to what is needed, that they can be used instead. Copy +* upstream root bus resources so that resource claiming for +* downstream devices can be done. +*/ +int resno;
Quoted 8 lines
arch/arm64/kernel/quirks.c line 32
Quoted 6 lines
arch/arm64/kernel/quirks.c new file +6
-0+struct pci_bus *bus = dev->subordinate; + +for (resno =0 ; resno <PCI_BRIDGE_RESOURCE_NUM ; resno++) { + bus->resource[resno] = +pci_bus_resource_n (bus->parent, +PCI_BRIDGE_RESOURCE_NUM + resno);I am curious about this. Is this a standard PCI-PCI bridge,
Yes it is PCI-PCI
Quoted 8 lines
or is it
a host bridge. If the former, I guess it must be broken in some way that keeps the usual bridge window reading code from working?Copying the upstream bus resources to the downstream bus might sort of work sometimes, but seems fragile in general. If the bridge has any peers, it seems like we're headed for a conflict between the peer's resources and anything downstream of the bridge.
The problem is that all the downstream devices require 64-bit non-prefetchable addressing, which cannot be satisfied with the bridge provisioning code. EA allows this to be described.
In any event the patch is not needed now that the EA code is in place.
Quoted 12 lines
Quoted 12 lines
arch/arm64/kernel/quirks.c new file +4
-1+ } +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_CAVIUM ,0xa002 , thunder_bridge_fixup); +#endif /* CONFIG_CAVIUM_THUNDER_PCI_QUIRKS */ --1.9.1
--
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