101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 4cc30de79d293f1e8c5f50ae3a9c005def9564a0 Mon Sep 17 00:00:00 2001
  2. From: Koen Vandeputte <[email protected]>
  3. Date: Mon, 7 Jan 2019 14:14:27 +0100
  4. Subject: [PATCH 2/2] arm: cns3xxx: use actual size reads for PCIe
  5. commit 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors")
  6. reimplemented cns3xxx_pci_read_config() using pci_generic_config_read32(),
  7. which preserved the property of only doing 32-bit reads.
  8. It also replaced cns3xxx_pci_write_config() with pci_generic_config_write(),
  9. so it changed writes from always being 32 bits to being the actual size,
  10. which works just fine.
  11. Due to:
  12. - The documentation does not mention that only 32 bit access is allowed.
  13. - Writes are already executed using the actual size
  14. - Extensive testing shows that 8b, 16b and 32b reads work as intended
  15. It makes perfectly sense to also swap 32 bit reading in favor of actual size.
  16. Fixes: 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors")
  17. Suggested-by: Bjorn Helgaas <[email protected]>
  18. Signed-off-by: Koen Vandeputte <[email protected]>
  19. CC: Arnd Bergmann <[email protected]>
  20. CC: Krzysztof Halasa <[email protected]>
  21. CC: Olof Johansson <[email protected]>
  22. CC: Robin Leblon <[email protected]>
  23. CC: Rob Herring <[email protected]>
  24. CC: Russell King <[email protected]>
  25. CC: Tim Harvey <[email protected]>
  26. CC: [email protected] # v4.0+
  27. ---
  28. arch/arm/mach-cns3xxx/pcie.c | 2 +-
  29. 1 file changed, 1 insertion(+), 1 deletion(-)
  30. diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c
  31. index 5e11ad3164e0..95a11d5b3587 100644
  32. --- a/arch/arm/mach-cns3xxx/pcie.c
  33. +++ b/arch/arm/mach-cns3xxx/pcie.c
  34. @@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
  35. u32 mask = (0x1ull << (size * 8)) - 1;
  36. int shift = (where % 4) * 8;
  37. - ret = pci_generic_config_read32(bus, devfn, where, size, val);
  38. + ret = pci_generic_config_read(bus, devfn, where, size, val);
  39. if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn &&
  40. (where & 0xffc) == PCI_CLASS_REVISION)
  41. --
  42. 2.17.1