From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"oe5hpm@gmail.com" <oe5hpm@gmail.com>,
Ralf Baechle <ralf@linux-mips.org>,
"James E.J. Bottomley" <jejb@parisc-linux.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Richard Henderson <rth@twiddle.net>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
David Howells <dhowells@redhat.com>,
Russell King <linux@arm.linux.org.uk>,
Tony Luck <tony.luck@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Ingo Molnar <mingo@redhat.com>,
Guenter Roeck <linux@roeck-us.net>,
Michal Simek <monstr@monstr.eu>, Chris Zankel <chris@zankel.net>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: trouble with PCI: Call pci_read_bridge_bases() from core instead of arch code
Date: Wed, 9 Sep 2015 18:38:28 +0100 [thread overview]
Message-ID: <20150909173828.GB12341@red-moon> (raw)
In-Reply-To: <CAE9FiQWUr6f_KsTyJrntRg-uuF1OL9VCqfUXB6eJ3Kpj+bf9=A@mail.gmail.com>
On Wed, Sep 09, 2015 at 06:22:34PM +0100, Yinghai Lu wrote:
> On Wed, Sep 9, 2015 at 9:59 AM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Wed, Sep 9, 2015 at 4:32 AM, Lorenzo Pieralisi
> > <lorenzo.pieralisi@arm.com> wrote:
> >> Subject: [PATCH] PCI: remove dead code in pci_claim_bridge_resource()
> >>
> > That should be regression from c770cb4cb505 ("PCI: Mark invalid BARs
> > as unassigned")
> > so right fix should be:
>
> completed format as attached:
> From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Subject: [PATCH] PCI: Fix clipped bridge resource reserve
>
> Commit 8505e729a2f6eb ("PCI: Add pci_claim_bridge_resource() to clip
> window if necessary") introduced a new API to claim bridge resources.
> pci_claim_bridge_resource() tries to claim a bridge resource, and if
> the claiming fails the function tries to clip the resource to make
> it fit within the parent resource window.
> If the clipping succeeds the bridge apertures are set-up accordingly
> and the pci_claim_bridge_resource() tries to claim the resource
> again.
>
> Commit c770cb4cb505 ("PCI: Mark invalid BARs as unassigned") added
> code that sets the IORESOURCE_UNSET flag on claiming failure.
>
> This means that the second resource claiming after window clipping will
> always fail, since the resource flags contain IORESOURCE_UNSET,
> previously set on failure by pci_claim_resource(), so the subsequent
> pci_claim_resource() call ends up spitting a log message and return
> failure with no chance whatsoever to succeed.
>
> This patch clear the UNSET in resource flags, and it makes second
> pci_claim_resource() work again.
>
> Fixes: c770cb4cb505 ("PCI: Mark invalid BARs as unassigned")
> Cc: stable@vger.kernel.org [v4.1+]
> [change to clear UNSET instead, Yinghai]
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
My Signed-off-by is missing, if you do not mind given that I reported
it and I obviously knew this was the real fix (I said that) I will
send the updated patch to the list accordingly or Bjorn can fix it up,
as you both prefer.
Thanks,
Lorenzo
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 508cc56..76b3349 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -733,6 +733,7 @@ int pci_claim_bridge_resource(struct pci_dev *bridge, int i)
> return -EINVAL;
> }
>
> + bridge->resource[i].flags &= ~IORESOURCE_UNSET;
> if (pci_claim_resource(bridge, i) == 0)
> return 0; /* claimed a smaller window */
>
next prev parent reply other threads:[~2015-09-09 17:38 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 9:51 trouble with PCI: Call pci_read_bridge_bases() from core instead of arch code oe5hpm
2015-09-02 17:47 ` Lorenzo Pieralisi
2015-09-02 20:32 ` Bjorn Helgaas
2015-09-03 10:01 ` Lorenzo Pieralisi
2015-09-03 16:21 ` Bjorn Helgaas
2015-09-03 17:57 ` Lorenzo Pieralisi
2015-09-04 14:19 ` Lorenzo Pieralisi
2015-09-04 16:00 ` Yinghai Lu
2015-09-04 16:44 ` Lorenzo Pieralisi
2015-09-04 23:53 ` Yinghai Lu
2015-09-07 9:12 ` Lorenzo Pieralisi
2015-09-14 10:09 ` Lorenzo Pieralisi
2015-09-14 16:05 ` Yinghai Lu
2015-09-14 16:28 ` Lorenzo Pieralisi
2015-09-14 17:36 ` Yinghai Lu
2015-09-14 23:58 ` Yinghai Lu
2015-09-15 9:46 ` Lorenzo Pieralisi
2015-09-15 15:57 ` Bjorn Helgaas
2015-09-15 16:30 ` Lorenzo Pieralisi
2015-09-15 16:51 ` Guenter Roeck
2015-09-15 19:25 ` Bjorn Helgaas
2015-09-15 20:26 ` Yinghai Lu
2015-09-16 8:58 ` Lorenzo Pieralisi
2015-09-15 20:17 ` Yinghai Lu
2015-09-15 21:07 ` Guenter Roeck
2015-09-15 21:12 ` Yinghai Lu
2015-09-09 11:32 ` Lorenzo Pieralisi
2015-09-09 16:59 ` Yinghai Lu
2015-09-09 17:22 ` Yinghai Lu
2015-09-09 17:38 ` Lorenzo Pieralisi [this message]
2015-09-03 10:03 ` oe5hpm
2015-09-03 10:30 ` oe5hpm
2015-09-03 10:51 ` Lorenzo Pieralisi
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=20150909173828.GB12341@red-moon \
--to=lorenzo.pieralisi@arm.com \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=chris@zankel.net \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=jejb@parisc-linux.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=linux@roeck-us.net \
--cc=mingo@redhat.com \
--cc=monstr@monstr.eu \
--cc=mpe@ellerman.id.au \
--cc=oe5hpm@gmail.com \
--cc=ralf@linux-mips.org \
--cc=rth@twiddle.net \
--cc=tony.luck@intel.com \
--cc=yinghai@kernel.org \
/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).