From patchwork Thu Jun 30 23:47:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 933772 X-Patchwork-Delegate: bhelgaas@google.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5UNnBVN024543 for ; Thu, 30 Jun 2011 23:49:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753945Ab1F3Xs0 (ORCPT ); Thu, 30 Jun 2011 19:48:26 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:52280 "EHLO e7.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753799Ab1F3XsX (ORCPT ); Thu, 30 Jun 2011 19:48:23 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e7.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p5UNNduo018219; Thu, 30 Jun 2011 19:23:39 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p5UNmMSZ1720444; Thu, 30 Jun 2011 19:48:22 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p5UNmJ95007209; Thu, 30 Jun 2011 19:48:21 -0400 Received: from us.ibm.com (sig-9-65-220-236.mts.ibm.com [9.65.220.236]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p5UNmGxl007087; Thu, 30 Jun 2011 19:48:17 -0400 Received: by us.ibm.com (sSMTP sendmail emulation); Thu, 30 Jun 2011 16:48:12 -0700 From: Ram Pai To: jbarnes@virtuousgeek.org, torvalds@linux-foundation.org Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, yinghai@kernel.org, bhutchings@solarflare.com, socketcan@hartkopp.net, bhelgaas@google.com, linux@dominikbrodowski.net, Ram Pai Subject: [PATCH 3/5 v2] PCI: make SRIOV resources optional Date: Thu, 30 Jun 2011 16:47:40 -0700 Message-Id: <1309477662-18680-4-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1309477662-18680-1-git-send-email-linuxram@us.ibm.com> References: <1309477662-18680-1-git-send-email-linuxram@us.ibm.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 30 Jun 2011 23:49:12 +0000 (UTC) From: Yinghai Lu From: Yinghai Lu Allocate resources to SRIOV BARs only after all other required resource-requests are satisfied. Dont retry if resource allocation for SRIOV BARs fail. Signed-off-by: Ram Pai Signed-off-by: Yinghai Lu Tested-by: Oliver Hartkopp --- drivers/pci/setup-bus.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 9f2f15f..a0555cb 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -669,6 +669,16 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, if (r->parent || (r->flags & mask) != type) continue; r_size = resource_size(r); +#ifdef CONFIG_PCI_IOV + /* put SRIOV requested res to the optional list */ + if (add_head && i >= PCI_IOV_RESOURCES && + i <= PCI_IOV_RESOURCE_END) { + r->end = r->start - 1; + add_to_list(add_head, dev, r, r_size, 1); + children_add_size += r_size; + continue; + } +#endif /* For bridges size != alignment */ align = pci_resource_alignment(dev, r); order = __ffs(align) - 20;