From patchwork Mon Jul 25 20:08: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: 1006062 X-Patchwork-Delegate: bhelgaas@google.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6PKNipj016225 for ; Mon, 25 Jul 2011 20:23:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752219Ab1GYUJh (ORCPT ); Mon, 25 Jul 2011 16:09:37 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:33734 "EHLO e9.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751721Ab1GYUJg (ORCPT ); Mon, 25 Jul 2011 16:09:36 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p6PJb7tP015256; Mon, 25 Jul 2011 15:37:07 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6PK9Zu7154416; Mon, 25 Jul 2011 16:09:35 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6PG9Lqw020713; Mon, 25 Jul 2011 13:09:23 -0300 Received: from us.ibm.com (sig-9-65-200-229.mts.ibm.com [9.65.200.229]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p6PG9IAA020388; Mon, 25 Jul 2011 13:09:18 -0300 Received: by us.ibm.com (sSMTP sendmail emulation); Mon, 25 Jul 2011 13:09:28 -0700 From: Ram Pai To: jbarnes@virtuousgeek.org Cc: torvalds@linux-foundation.org, 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, linuxram@us.ibm.com Subject: [PATCH 3/5 v3] PCI: make SRIOV resources optional Date: Mon, 25 Jul 2011 13:08:40 -0700 Message-Id: <1311624522-30242-4-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1311624522-30242-1-git-send-email-linuxram@us.ibm.com> References: <1311624522-30242-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 (demeter2.kernel.org [140.211.167.43]); Mon, 25 Jul 2011 20:23:48 +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 --- 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 73f1f5d..3ac64d6 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -676,6 +676,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;