From patchwork Wed Sep 16 03:19:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ethan zhao X-Patchwork-Id: 518251 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 80A2A1401B5 for ; Wed, 16 Sep 2015 13:12:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751904AbbIPDMs (ORCPT ); Tue, 15 Sep 2015 23:12:48 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:17463 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751272AbbIPDMr (ORCPT ); Tue, 15 Sep 2015 23:12:47 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t8G3CjSA011376 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 16 Sep 2015 03:12:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t8G3Cjkl000566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 16 Sep 2015 03:12:45 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t8G3CiGt021251; Wed, 16 Sep 2015 03:12:45 GMT Received: from localhost.localdomain.com (/10.182.70.25) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 15 Sep 2015 20:12:44 -0700 From: Ethan Zhao To: bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Ethan Zhao Subject: [PATCH v2] iov: restore NumVFs register to 0 before return from virtfn_max_buses() Date: Wed, 16 Sep 2015 12:19:53 +0900 Message-Id: <1442373593-8342-1-git-send-email-ethan.zhao@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org After commit 4449f079722c ("PCI: Calculate maximum number of buses required for VFs"),the initial value of NumVFs register was left to non-zero after sriov_init() and no VFs was enabled in device driver. this changed the behaviour of kernel exported by lspci and sysfs etc. so this patch restore the NumVFs register to zero after the calculation of max_VF_buses was done and before return from virtfn_max_buses(). Tested on stable 4.1 and passed building on stable 4.3-rc1 Signed-off-by: Ethan Zhao Tested-by: Sriharsha Yadagudde --- v1..v2: -Suggestions from Bjorn Helgaas (move the restoration of NumVFs register to virtfn_max_buses()) --- drivers/pci/iov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index ee0ebff..92cee06 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -71,6 +71,8 @@ static inline u8 virtfn_max_buses(struct pci_dev *dev) max = busnr; } + /* restore NumVFs register to 0 */ + pci_iov_set_numvfs(dev, 0); return max; }