Received: by 10.223.185.116 with SMTP id b49csp332800wrg; Fri, 2 Mar 2018 20:34:52 -0800 (PST) X-Google-Smtp-Source: AG47ELvZaBJFUPy65vhncBz5YSST0jdppW3fH4tNCSrCZY7CpksVG91C+tdYAPvOXw1ctQyc5DsI X-Received: by 10.101.97.139 with SMTP id c11mr5412672pgv.431.1520051692123; Fri, 02 Mar 2018 20:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520051692; cv=none; d=google.com; s=arc-20160816; b=pY1cHfEFLlzD05kKlmDzVi6NcG68e7Nbd3MwvN9azdNvPuHv8vUyGO2gdsnCxlI8FV Ct6iSgGDiosy51VU7Y+VFcp4V/q6LQdR9KU9YgCd50ht9/0rz8Om8Uk6defLi8aBvudR rAvUqK3vKL3+RanBMlBZ6WwYhRl1NGKh0n2GFkS1LBbW9LjhMMX1kTxP2TfrmwjtUxgO kZhdyyx5wz6wl80glHNqvundPf6FVlzuDN2IgphEUUtt9ThHTr2LYRCmpzgX0GGxRCGM 5JEY7qgk66LfKQdTyu1y88gUmIMiHyf7D0zWQRatDiXD2CsmmZ92BgOdIfj1dQIWPVPE h6Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=/6pQ9wZe8fMkvO8M/cxgolw6foQwtrftv3eYeMfIkXo=; b=tyLQS5Kluwp/oiynTlHR2AEv/5eiTaWfnnAC4f9/Xqs+kLne8UHeWeB08jB0pImoeh 68buBs3JfWm4K9W09IVI19l9qjbz130FSJ2yesjtKL2FLTW3icThzuTu5VV/F8Wpv4ht g+O5AcjNSTKytGGkfSLBewIVh4R1jbxxQ6XKl24B3eqGh3ftlGtk1W+fYY3XU0JaWIIc Cm4oawHX0d0II4IFl/vVx8OMzo4liQhiET3r3vy344D/FhOfuCWj9MWpu23hsItfj2R8 TCJ7cMnn8nUdg5tQ35xsZn8K5gMmM9XX32W/BSFo5S9b3zvKTIZ4LY3BybOienkuWmdU HQBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=SJq4DzZd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si5901249plc.368.2018.03.02.20.34.23; Fri, 02 Mar 2018 20:34:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=SJq4DzZd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751126AbeCCEd3 (ORCPT + 99 others); Fri, 2 Mar 2018 23:33:29 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.7.4