linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: don't UNSET resource even reassign fails
@ 2014-06-16 11:29 Guo Chao
  2014-06-16 20:44 ` Bjorn Helgaas
  2014-06-18 19:19 ` Bjorn Helgaas
  0 siblings, 2 replies; 6+ messages in thread
From: Guo Chao @ 2014-06-16 11:29 UTC (permalink / raw)
  To: linux-pci; +Cc: Guo Chao

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 <yan@linux.vnet.ibm.com>
---
 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;
+
 	return ret;
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-18 19:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-16 11:29 [PATCH] PCI: don't UNSET resource even reassign fails Guo Chao
2014-06-16 20:44 ` Bjorn Helgaas
2014-06-17  5:44   ` Guo Chao
2014-06-17 18:10     ` Bjorn Helgaas
2014-06-18  7:22       ` Guo Chao
2014-06-18 19:19 ` Bjorn Helgaas

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).