Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5946020ybi; Wed, 12 Jun 2019 11:09:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpgjZTvuioeYeH//qpH8Mjx8CLcJl9nSBKULC3FBHGbXRsqJeiGmhLSBy7xRea4IsItwvN X-Received: by 2002:a65:510c:: with SMTP id f12mr25334062pgq.92.1560362982816; Wed, 12 Jun 2019 11:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560362982; cv=none; d=google.com; s=arc-20160816; b=jIinjCi8iz9APCJrp1GVQZ+HKK11C/BBElSmYcfiVLHEFxURSxP7CcJb6K+n4GTGyv Iz+DRLjlFvzkvJSjOhmuVml4ZedEwfrBNKgNvKk8Y5lvFvwafh1REtkpRWDgXp+BWVGQ 46es99HwJYBvwxIQ/ksi2n6gIN6LYm5cOWS2AyVhPxYNZyEoOZTAd9a3a5qrDWk/mWwK YRhuK4KChVE9UjdVQzk3b8H1hSmNIFzLKf2lkaZR8McNTIhYe1zE7ZbyAxUfD5PanalT zZdt0uqZuFLbIs0FmyB067AJggRLK5+tNTuhkXeR0i1ly3YTLm4M+PAnWeKjQw7RXoe3 pLAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=NZHFlxSb4SUA6sj9PSTvwwqthrJCEbGQn3CYsFk/qOY=; b=g7+uMzK5bhI/o4RZJQSedWWzqtTzBZgZQA4LtGktIP5Xra1vdRPU+WLwkfDNiZqvkj cfBZdKJP4lj9nSxB+uF2PgC0YNEPHM4K5jMl/81dMyCbkSzV2/R+m0eeVdKwe1ypquC5 TfgqayJDoSruhTkTFh+dYs1054p4VYRtrmDYQNUfrvaHSiP0eZxrp53rqP+ZX7AGRj1k KnDoixeTrB3G+OKGCWyd/4bNoiFT7BoVx3vJgj7voOVqjEui0MLAu9usK6x9BOpc5RZr aefPHJwV0vDJxSmZmCI3dYRqMhpYQkJR3ei5nz7rwz09GVyDNbaKAvYWav4C6uho/7vd YJnw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13si440865pgd.347.2019.06.12.11.09.27; Wed, 12 Jun 2019 11:09:42 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391719AbfFLRKz (ORCPT + 99 others); Wed, 12 Jun 2019 13:10:55 -0400 Received: from mga11.intel.com ([192.55.52.93]:44951 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391554AbfFLRKz (ORCPT ); Wed, 12 Jun 2019 13:10:55 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2019 10:10:54 -0700 X-ExtLoop1: 1 Received: from skuppusw-desk.jf.intel.com ([10.54.74.33]) by fmsmga008.fm.intel.com with ESMTP; 12 Jun 2019 10:10:54 -0700 From: sathyanarayanan.kuppuswamy@linux.intel.com To: bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ashok.raj@intel.com, keith.busch@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, mike.campin@intel.com Subject: [PATCH v2 1/1] PCI/IOV: Fix incorrect cfg_size for VF > 0 Date: Wed, 12 Jun 2019 10:06:47 -0700 Message-Id: <20190612170647.43220-1-sathyanarayanan.kuppuswamy@linux.intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuppuswamy Sathyanarayanan Commit 975bb8b4dc93 ("PCI/IOV: Use VF0 cached config space size for other VFs") calculates and caches the cfg_size for VF0 device before initializing the pcie_cap of the device which results in using incorrect cfg_size for all VF devices > 0. So set pcie_cap of the device before calculating the cfg_size of VF0 device. Fixes: 975bb8b4dc93 ("PCI/IOV: Use VF0 cached config space size for other VFs") Cc: Ashok Raj Suggested-by: Mike Campin Signed-off-by: Kuppuswamy Sathyanarayanan --- Changes since v1: * Fixed a typo in commit message. drivers/pci/iov.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 3aa115ed3a65..2869011c0e35 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -160,6 +160,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id) virtfn->device = iov->vf_device; virtfn->is_virtfn = 1; virtfn->physfn = pci_dev_get(dev); + virtfn->pcie_cap = pci_find_capability(virtfn, PCI_CAP_ID_EXP); if (id == 0) pci_read_vf_config_common(virtfn); -- 2.21.0