From patchwork Sat Mar 3 04:33:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KarimAllah Ahmed X-Patchwork-Id: 10255957 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AE364602B5 for ; Sat, 3 Mar 2018 04:33:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8938D286FD for ; Sat, 3 Mar 2018 04:33:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7995928702; Sat, 3 Mar 2018 04:33:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB5B4286FD for ; Sat, 3 Mar 2018 04:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750810AbeCCEd2 (ORCPT ); Fri, 2 Mar 2018 23:33:28 -0500 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:29436 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750775AbeCCEd2 (ORCPT ); Fri, 2 Mar 2018 23:33:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1520051607; x=1551587607; h=from:to:cc:subject:date:message-id; bh=/6pQ9wZe8fMkvO8M/cxgolw6foQwtrftv3eYeMfIkXo=; b=SJq4DzZd241a1PLcAbpLduxytQ6gzbwDiR6WxuXijYu1mMKPkhJMuZ2W IS0fLgK3kSnzz8N2L+xue9ICssxZ6P4oNAWrdZg9+8pXINwM6w7wYsipD nxYbirOnwFUB8Fr11QOFLuCphL5IuijItop94JwnqdNxP31k/u+OvXGck s=; X-IronPort-AV: E=Sophos;i="5.47,415,1515456000"; d="scan'208";a="725499333" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2c-cd289015.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Mar 2018 04:33:25 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (pdx2-ws-svc-lb17-vlan2.amazon.com [10.247.140.66]) by email-inbound-relay-2c-cd289015.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w234XL86122305 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 3 Mar 2018 04:33:23 GMT Received: from u54e1ad5160425a4b64ea.ant.amazon.com (localhost [127.0.0.1]) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w234XKpP011828; Sat, 3 Mar 2018 05:33:20 +0100 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id w234XKwi011812; Sat, 3 Mar 2018 05:33:20 +0100 From: KarimAllah Ahmed To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: KarimAllah Ahmed , Bjorn Helgaas Subject: [PATCH] PCI/IOV: Skip initializing the base addresses from the VF config space Date: Sat, 3 Mar 2018 05:33:10 +0100 Message-Id: <1520051590-11750-1-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Per PCIe r4.0, sec 9.3.4.1.11, the BARs registers from the VF config space are all RO Zero for PCI VFs. So just skip reading them for VFs. This is an optimization when enabling SR-IOV on a device with many VFs. Cc: Bjorn Helgaas Cc: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org Suggested-by: Bjorn Helgaas Signed-off-by: KarimAllah Ahmed --- drivers/pci/probe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a96837e..7204d46 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -329,6 +329,10 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) if (dev->non_compliant_bars) return; + /* Per PCIe r4.0, sec 9.3.4.1.11, the VF BARs are all RO Zero */ + if (dev->is_virtfn) + return; + for (pos = 0; pos < howmany; pos++) { struct resource *res = &dev->resource[pos]; reg = PCI_BASE_ADDRESS_0 + (pos << 2);