From 630d8b87a570b87ec3a0a2f950e87f674d381800 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Mon, 7 Jan 2019 11:59:49 +0100 Subject: cns3xxx: use actual size reads for PCIe upstream commit 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") reimplemented cns3xxx_pci_read_config() using pci_generic_config_read32(), which preserved the property of only doing 32-bit reads. It also replaced cns3xxx_pci_write_config() with pci_generic_config_write(), so it changed writes from always being 32 bits to being the actual size, which works just fine. Due to: - The documentation does not mention that only 32 bit access is allowed. - Writes are already executed using the actual size - Extensive testing shows that 8b, 16b and 32b reads work as intended It makes perfectly sense to also swap 32 bit reading in favor of actual size. Signed-off-by: Koen Vandeputte --- ...rm-cns3xxx-use-actual-size-reads-for-PCIe.patch | 51 ++++++++++++++++++++++ ...rm-cns3xxx-use-actual-size-reads-for-PCIe.patch | 51 ++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 target/linux/generic/backport-4.14/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch create mode 100644 target/linux/generic/backport-4.9/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch (limited to 'target/linux') diff --git a/target/linux/generic/backport-4.14/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch b/target/linux/generic/backport-4.14/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch new file mode 100644 index 0000000000..44ca833705 --- /dev/null +++ b/target/linux/generic/backport-4.14/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch @@ -0,0 +1,51 @@ +From 4cc30de79d293f1e8c5f50ae3a9c005def9564a0 Mon Sep 17 00:00:00 2001 +From: Koen Vandeputte +Date: Mon, 7 Jan 2019 14:14:27 +0100 +Subject: [PATCH 2/2] arm: cns3xxx: use actual size reads for PCIe + +commit 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") +reimplemented cns3xxx_pci_read_config() using pci_generic_config_read32(), +which preserved the property of only doing 32-bit reads. + +It also replaced cns3xxx_pci_write_config() with pci_generic_config_write(), +so it changed writes from always being 32 bits to being the actual size, +which works just fine. + +Due to: +- The documentation does not mention that only 32 bit access is allowed. +- Writes are already executed using the actual size +- Extensive testing shows that 8b, 16b and 32b reads work as intended + +It makes perfectly sense to also swap 32 bit reading in favor of actual size. + +Fixes: 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") +Suggested-by: Bjorn Helgaas +Signed-off-by: Koen Vandeputte +CC: Arnd Bergmann +CC: Krzysztof Halasa +CC: Olof Johansson +CC: Robin Leblon +CC: Rob Herring +CC: Russell King +CC: Tim Harvey +CC: stable@vger.kernel.org # v4.0+ +--- + arch/arm/mach-cns3xxx/pcie.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c +index 5e11ad3164e0..95a11d5b3587 100644 +--- a/arch/arm/mach-cns3xxx/pcie.c ++++ b/arch/arm/mach-cns3xxx/pcie.c +@@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, + u32 mask = (0x1ull << (size * 8)) - 1; + int shift = (where % 4) * 8; + +- ret = pci_generic_config_read32(bus, devfn, where, size, val); ++ ret = pci_generic_config_read(bus, devfn, where, size, val); + + if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && + (where & 0xffc) == PCI_CLASS_REVISION) +-- +2.17.1 + diff --git a/target/linux/generic/backport-4.9/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch b/target/linux/generic/backport-4.9/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch new file mode 100644 index 0000000000..44ca833705 --- /dev/null +++ b/target/linux/generic/backport-4.9/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch @@ -0,0 +1,51 @@ +From 4cc30de79d293f1e8c5f50ae3a9c005def9564a0 Mon Sep 17 00:00:00 2001 +From: Koen Vandeputte +Date: Mon, 7 Jan 2019 14:14:27 +0100 +Subject: [PATCH 2/2] arm: cns3xxx: use actual size reads for PCIe + +commit 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") +reimplemented cns3xxx_pci_read_config() using pci_generic_config_read32(), +which preserved the property of only doing 32-bit reads. + +It also replaced cns3xxx_pci_write_config() with pci_generic_config_write(), +so it changed writes from always being 32 bits to being the actual size, +which works just fine. + +Due to: +- The documentation does not mention that only 32 bit access is allowed. +- Writes are already executed using the actual size +- Extensive testing shows that 8b, 16b and 32b reads work as intended + +It makes perfectly sense to also swap 32 bit reading in favor of actual size. + +Fixes: 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") +Suggested-by: Bjorn Helgaas +Signed-off-by: Koen Vandeputte +CC: Arnd Bergmann +CC: Krzysztof Halasa +CC: Olof Johansson +CC: Robin Leblon +CC: Rob Herring +CC: Russell King +CC: Tim Harvey +CC: stable@vger.kernel.org # v4.0+ +--- + arch/arm/mach-cns3xxx/pcie.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c +index 5e11ad3164e0..95a11d5b3587 100644 +--- a/arch/arm/mach-cns3xxx/pcie.c ++++ b/arch/arm/mach-cns3xxx/pcie.c +@@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, + u32 mask = (0x1ull << (size * 8)) - 1; + int shift = (where % 4) * 8; + +- ret = pci_generic_config_read32(bus, devfn, where, size, val); ++ ret = pci_generic_config_read(bus, devfn, where, size, val); + + if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && + (where & 0xffc) == PCI_CLASS_REVISION) +-- +2.17.1 + -- cgit v1.2.3