linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Koen Vandeputte <koen.vandeputte@ncentric.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-pci@vger.kernel.org,
	Koen Vandeputte <koen.vandeputte@ncentric.com>,
	Arnd Bergmann <arnd@arndb.de>, Krzysztof Halasa <khalasa@piap.pl>,
	Olof Johansson <olof@lixom.net>,
	Robin Leblon <robin.leblon@ncentric.com>,
	Rob Herring <robh@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Tim Harvey <tharvey@gateworks.com>,
	stable@vger.kernel.org
Subject: [PATCH v2 2/2] arm: cns3xxx: use actual size reads for PCIe
Date: Mon,  7 Jan 2019 14:45:10 +0100	[thread overview]
Message-ID: <20190107134510.32494-2-koen.vandeputte@ncentric.com> (raw)
In-Reply-To: <20190107134510.32494-1-koen.vandeputte@ncentric.com>

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 <bhelgaas@google.com>
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Krzysztof Halasa <khalasa@piap.pl>
CC: Olof Johansson <olof@lixom.net>
CC: Robin Leblon <robin.leblon@ncentric.com>
CC: Rob Herring <robh@kernel.org>
CC: Russell King <linux@armlinux.org.uk>
CC: Tim Harvey <tharvey@gateworks.com>
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


  reply	other threads:[~2019-01-07 13:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07 13:45 [PATCH v2 1/2] arm: cns3xxx: fix writing to wrong PCI registers after alignment Koen Vandeputte
2019-01-07 13:45 ` Koen Vandeputte [this message]
2019-01-08  6:10   ` [PATCH v2 2/2] arm: cns3xxx: use actual size reads for PCIe Krzysztof Hałasa
2019-01-25 10:55   ` Krzysztof Hałasa
2019-01-24 11:56 ` [PATCH v2 1/2] arm: cns3xxx: fix writing to wrong PCI registers after alignment Lorenzo Pieralisi
2019-01-24 15:23   ` Koen Vandeputte
2019-01-24 16:27     ` Lorenzo Pieralisi
2019-01-30 22:08       ` Arnd Bergmann
2019-01-30 23:06         ` Bjorn Helgaas
2019-01-31  8:00           ` Arnd Bergmann
2019-01-31 21:16             ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190107134510.32494-2-koen.vandeputte@ncentric.com \
    --to=koen.vandeputte@ncentric.com \
    --cc=arnd@arndb.de \
    --cc=khalasa@piap.pl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=olof@lixom.net \
    --cc=robh@kernel.org \
    --cc=robin.leblon@ncentric.com \
    --cc=stable@vger.kernel.org \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).