From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ie0-f180.google.com ([209.85.223.180]:38312 "EHLO mail-ie0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752673AbaFRTTU (ORCPT ); Wed, 18 Jun 2014 15:19:20 -0400 Received: by mail-ie0-f180.google.com with SMTP id rl12so1091165iec.25 for ; Wed, 18 Jun 2014 12:19:19 -0700 (PDT) Date: Wed, 18 Jun 2014 13:19:16 -0600 From: Bjorn Helgaas To: Guo Chao Cc: linux-pci@vger.kernel.org Subject: Re: [PATCH] PCI: don't UNSET resource even reassign fails Message-ID: <20140618191916.GE30559@google.com> References: <1402918182-13082-1-git-send-email-yan@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1402918182-13082-1-git-send-email-yan@linux.vnet.ibm.com> Sender: linux-pci-owner@vger.kernel.org List-ID: On Mon, Jun 16, 2014 at 07:29:42PM +0800, Guo Chao wrote: > Commit bd064f0a sets IORESOURCE_UNSET flag if resource can not be > assgined. Part of these changes breaks resource assignment. > > If resource is too big, PCI core assgins basic part first and > extends (reassigns) it to include optional part (notably SR-IOV resources). > In this case, failure is permitted and IORESOURCE_UNSET should be not set. > Otherwise, these resources are never updated to hardware even they are > already propery assigned and we will see errors like this: > > pci 0003:00:00.0: can't enable device: BAR 15 [mem size 0x0c000000 64bit pref] not assigned > pci 0003:00:00.0: Error enabling bridge (-22), continuing > > Signed-off-by: Guo Chao > --- > drivers/pci/setup-res.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c > index caed1ce..1e1076a 100644 > --- a/drivers/pci/setup-res.c > +++ b/drivers/pci/setup-res.c > @@ -334,12 +334,14 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz > new_size = resource_size(res) + addsize; > ret = _pci_assign_resource(dev, resno, new_size, min_align); > if (!ret) { > - res->flags &= ~IORESOURCE_UNSET; > res->flags &= ~IORESOURCE_STARTALIGN; > dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res); > if (resno < PCI_BRIDGE_RESOURCES) > pci_update_resource(dev, resno); > } > + > + res->flags &= ~IORESOURCE_UNSET; This relies on the assumption that the resource was already assigned when we entered pci_reassign_resource(). That *might* always be true, but it takes a lot of code analysis to prove it. I think I'd be OK with restoring the original value of the IORESOURCE_UNSET bit. > return ret; > } > > -- > 1.8.3.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-pci" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html