From patchwork Mon May 4 07:07:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 6323451 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 E29EB9F1C2 for ; Mon, 4 May 2015 07:08:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10F5C2035E for ; Mon, 4 May 2015 07:08:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20F73202FF for ; Mon, 4 May 2015 07:08:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752165AbbEDHI4 (ORCPT ); Mon, 4 May 2015 03:08:56 -0400 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:39959 "EHLO e23smtp02.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbbEDHIz (ORCPT ); Mon, 4 May 2015 03:08:55 -0400 Received: from /spool/local by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 May 2015 17:08:54 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 4 May 2015 17:08:51 +1000 Received: from d23relay10.au.ibm.com (d23relay10.au.ibm.com [9.190.26.77]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 56B0B357804F for ; Mon, 4 May 2015 17:08:51 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t4478hpM33685584 for ; Mon, 4 May 2015 17:08:51 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t4478Ikl031884 for ; Mon, 4 May 2015 17:08:18 +1000 Received: from localhost ([9.123.251.135]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t4478HiY031535; Mon, 4 May 2015 17:08:18 +1000 From: Wei Yang To: gwshan@linux.vnet.ibm.com, bhelgaas@google.com Cc: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, Wei Yang Subject: [PATCH V3 1/9] pci/iov: rename and export virtfn_add/virtfn_remove Date: Mon, 4 May 2015 15:07:30 +0800 Message-Id: <1430723258-21299-2-git-send-email-weiyang@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1430723258-21299-1-git-send-email-weiyang@linux.vnet.ibm.com> References: <1430723258-21299-1-git-send-email-weiyang@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15050407-0005-0000-0000-000001BB575B 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 the EEH procedure, when a device's driver is not EEH aware or no driver is binded with a device, EEH core would do hotplug on this devices. While it isn't feasible for a VF with usual hotplug procedure. During removal of a VF, virt_bus should be removed if necessary. During the re-creation, the pci_scan_slot() doesn't work on a VF. This patch exports two functions to handle the hotplug case for VF properly. They will be invoked when the EEH core do the hotplug case for VFs. Signed-off-by: Wei Yang --- drivers/pci/iov.c | 10 +++++----- include/linux/pci.h | 2 ++ 2 files changed, 7 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 353db8d..94bacfa 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1679,6 +1679,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);