From patchwork Wed Nov 4 03:28:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 7548051 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A3AC19F327 for ; Wed, 4 Nov 2015 03:30:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6AD820693 for ; Wed, 4 Nov 2015 03:30:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 996D3206A3 for ; Wed, 4 Nov 2015 03:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753898AbbKDDac (ORCPT ); Tue, 3 Nov 2015 22:30:32 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:48740 "EHLO e23smtp06.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753667AbbKDDab (ORCPT ); Tue, 3 Nov 2015 22:30:31 -0500 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Nov 2015 13:30:29 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Nov 2015 13:30:27 +1000 X-Helo: d23dlp01.au.ibm.com X-MailFrom: weiyang@linux.vnet.ibm.com X-RcptTo: linux-pci@vger.kernel.org Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id B1E192CE8050 for ; Wed, 4 Nov 2015 14:30:26 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tA43UItO65601546 for ; Wed, 4 Nov 2015 14:30:26 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tA43TrVx008568 for ; Wed, 4 Nov 2015 14:29:54 +1100 Received: from localhost (richards-mbp.cn.ibm.com [9.123.229.42]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tA43TrLg007768; Wed, 4 Nov 2015 14:29:53 +1100 From: Wei Yang To: gwshan@linux.vnet.ibm.com, bhelgaas@google.com, mpe@ellerman.id.au, aik@ozlabs.ru Cc: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, Wei Yang Subject: [PATCH V12 1/9] PCI/IOV: Rename and export virtfn_add/virtfn_remove Date: Wed, 4 Nov 2015 11:28:44 +0800 Message-Id: <1446607732-4166-2-git-send-email-weiyang@linux.vnet.ibm.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1446607732-4166-1-git-send-email-weiyang@linux.vnet.ibm.com> References: <1446607732-4166-1-git-send-email-weiyang@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15110403-0021-0000-0000-00000218CDF7 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP During EEH recovery, hotplug is applied to the devices which don't have drivers or their drivers don't support EEH. However, the hotplug, which was implemented based on PCI bus, can't be applied to VF directly. Rename virtn_{add,remove}() and export them so they can be used in PCI hotplug during EEH recovery. Signed-off-by: Wei Yang Acked-by: Bjorn Helgaas --- drivers/pci/iov.c | 10 +++++----- include/linux/pci.h | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index ee0ebff..cc941dd 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -108,7 +108,7 @@ resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno) return dev->sriov->barsz[resno - PCI_IOV_RESOURCES]; } -static int virtfn_add(struct pci_dev *dev, int id, int reset) +int pci_iov_virtfn_add(struct pci_dev *dev, int id, int reset) { int i; int rc = -ENOMEM; @@ -183,7 +183,7 @@ failed: return rc; } -static void virtfn_remove(struct pci_dev *dev, int id, int reset) +void pci_iov_virtfn_remove(struct pci_dev *dev, int id, int reset) { char buf[VIRTFN_ID_LEN]; struct pci_dev *virtfn; @@ -320,7 +320,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) } for (i = 0; i < initial; i++) { - rc = virtfn_add(dev, i, 0); + rc = pci_iov_virtfn_add(dev, i, 0); if (rc) goto failed; } @@ -332,7 +332,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) failed: for (j = 0; j < i; j++) - virtfn_remove(dev, j, 0); + pci_iov_virtfn_remove(dev, j, 0); iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); pci_cfg_access_lock(dev); @@ -361,7 +361,7 @@ static void sriov_disable(struct pci_dev *dev) return; for (i = 0; i < iov->num_VFs; i++) - virtfn_remove(dev, i, 0); + pci_iov_virtfn_remove(dev, i, 0); pcibios_sriov_disable(dev); diff --git a/include/linux/pci.h b/include/linux/pci.h index e90eb22..3628a09 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1719,6 +1719,8 @@ int pci_iov_virtfn_devfn(struct pci_dev *dev, int id); int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); void pci_disable_sriov(struct pci_dev *dev); +int pci_iov_virtfn_add(struct pci_dev *dev, int id, int reset); +void pci_iov_virtfn_remove(struct pci_dev *dev, int id, int reset); int pci_num_vf(struct pci_dev *dev); int pci_vfs_assigned(struct pci_dev *dev); int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); @@ -1736,6 +1738,12 @@ static inline int pci_iov_virtfn_devfn(struct pci_dev *dev, int id) static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) { return -ENODEV; } static inline void pci_disable_sriov(struct pci_dev *dev) { } +static inline int pci_iov_virtfn_add(struct pci_dev *dev, int id, int reset) +{ + return -ENOSYS; +} +static inline void pci_iov_virtfn_remove(struct pci_dev *dev, int id, int reset) +{ } static inline int pci_num_vf(struct pci_dev *dev) { return 0; } static inline int pci_vfs_assigned(struct pci_dev *dev) { return 0; }