From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751906AbbBRNKD (ORCPT ); Wed, 18 Feb 2015 08:10:03 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40557 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259AbbBRNKA (ORCPT ); Wed, 18 Feb 2015 08:10:00 -0500 Message-ID: <1424264987.23608.87.camel@decadent.org.uk> Subject: Re: [PATCH 3.2 015/152] PCI: Restore detection of read-only BARs From: Ben Hutchings To: Bjorn Helgaas Cc: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Andrew Morton , Matthew Wilcox , Myron Stowe , William Unruh , Martin Lucina Date: Wed, 18 Feb 2015 13:09:47 +0000 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-RCXjiHEBXgtn6QxIMb+4" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 192.168.4.249 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-RCXjiHEBXgtn6QxIMb+4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2015-02-17 at 11:01 -0600, Bjorn Helgaas wrote: > On Mon, Feb 16, 2015 at 7:46 PM, Ben Hutchings wrot= e: > > 3.2.67-rc1 review patch. If anyone has any objections, please let me k= now. >=20 > No objections, but I think you want 06cf35f903aa ("PCI: Handle > read-only BARs on AMD CS553x devices") at the same time. Thanks, I've added that as well. For the pending stable update, I only checked 'cc: stable' commits in mainline up to 3.19-rc7 so I hadn't yet seen that. Ben. > > ------------------ > > > > From: Myron Stowe > > > > commit 36e8164882ca6d3c41cb91e6f09a3ed236841f80 upstream. > > > > Commit 6ac665c63dca ("PCI: rewrite PCI BAR reading code") masked off > > low-order bits from 'l', but not from 'sz'. Both are passed to pci_siz= e(), > > which compares 'base =3D=3D maxbase' to check for read-only BARs. The = masking > > of 'l' means that comparison will never be 'true', so the check for > > read-only BARs no longer works. > > > > Resolve this by also masking off the low-order bits of 'sz' before pass= ing > > it into pci_size() as 'maxbase'. With this change, pci_size() will onc= e > > again catch the problems that have been encountered to date: > > > > - AGP aperture BAR of AMD-7xx host bridges: if the AGP window is > > disabled, this BAR is read-only and read as 0x00000008 [1] > > > > - BARs 0-4 of ALi IDE controllers can be non-zero and read-only [1] > > > > - Intel Sandy Bridge - Thermal Management Controller [8086:0103]; > > BAR 0 returning 0xfed98004 [2] > > > > - Intel Xeon E5 v3/Core i7 Power Control Unit [8086:2fc0]; > > Bar 0 returning 0x00001a [3] > > > > Link: [1] https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git= /commit/drivers/pci/probe.c?id=3D1307ef6621991f1c4bc3cec1b5a4ebd6fd3d66b9 (= "PCI: probing read-only BARs" (pre-git)) > > Link: [2] https://bugzilla.kernel.org/show_bug.cgi?id=3D43331 > > Link: [3] https://bugzilla.kernel.org/show_bug.cgi?id=3D85991 > > Reported-by: William Unruh > > Reported-by: Martin Lucina > > Signed-off-by: Myron Stowe > > Signed-off-by: Bjorn Helgaas > > CC: Matthew Wilcox > > Signed-off-by: Ben Hutchings > > --- > > drivers/pci/probe.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > --- a/drivers/pci/probe.c > > +++ b/drivers/pci/probe.c > > @@ -175,14 +175,17 @@ int __pci_read_base(struct pci_dev *dev, > > res->flags |=3D IORESOURCE_SIZEALIGN; > > if (res->flags & IORESOURCE_IO) { > > l &=3D PCI_BASE_ADDRESS_IO_MASK; > > + sz &=3D PCI_BASE_ADDRESS_IO_MASK; > > mask =3D PCI_BASE_ADDRESS_IO_MASK & (u32) IO_SP= ACE_LIMIT; > > } else { > > l &=3D PCI_BASE_ADDRESS_MEM_MASK; > > + sz &=3D PCI_BASE_ADDRESS_MEM_MASK; > > mask =3D (u32)PCI_BASE_ADDRESS_MEM_MASK; > > } > > } else { > > res->flags |=3D (l & IORESOURCE_ROM_ENABLE); > > l &=3D PCI_ROM_ADDRESS_MASK; > > + sz &=3D PCI_ROM_ADDRESS_MASK; > > mask =3D (u32)PCI_ROM_ADDRESS_MASK; > > } > > > > --=20 Ben Hutchings To err is human; to really foul things up requires a computer. --=-RCXjiHEBXgtn6QxIMb+4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIVAwUAVOSPH+e/yOyVhhEJAQphxg/+LBIxckqtGxWkDb8Cv974GfgdnJuK6fEz Kt/I9H+PzigSUmzGJ2nUdJoofgeCdCCa0isjkKtPC+2Q0+IZhc1LJTZ4NptoLbbT oruRP63J7c7Ma8JQKl6lLu+9ecCHVu4xBDqnYw6XkwyG473lf/3Slfv6LoIUTSyA yFhF+rIpnE6FuEKVpkL9oUEwUAEfLVzGUZs72jduNaliaGIP3HZnwAkdePVRIi3V acgekwbwvpr5eLf7KIpv/gau8sUXMvSRkmkBylB7YowP1K5/2IGtDA9eD8VKJZwc VfVr+xCjuO25vHkjTnSsesO+GUQu/GKawOo3Yc76BbA05O+fLFcJEHS01dsQ+CSm 1vb202bgCBz8I+tgKXenBd1U3Bqno5FOBI/CUDBARzqFf8osmhxQObaor9ZsP7g4 fEQnpyAQ7L64JTHZb7SQmqizyxmpMGtE9ckQQXQDsAeE1aDYNJbDV44IeywduzxP O3UwW/41DVU713hORC1MGg/ssJgOwsTC2Zo6rd0AQMzbeYNm8PeYMCxA+U4Y9lm+ aPxTUDSuTrDw+sT2O1xcjOdE8Y9Xl87UKVFp0ajJarRXFTgqus/h7isC2Kcj8Fu3 ClmCyhAMJPffKHBSjTd/m7+nuJKoyr1+GBQYhd7fSa00Ei1JpPyRHa0SquTbe5JH As8MSo0s8Fg= =Yd/O -----END PGP SIGNATURE----- --=-RCXjiHEBXgtn6QxIMb+4--