From patchwork Thu Mar 15 18:43:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10285553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0A2DA602C2 for ; Thu, 15 Mar 2018 18:43:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE66828B63 for ; Thu, 15 Mar 2018 18:43:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2FFC28C0E; Thu, 15 Mar 2018 18:43:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AA2728B63 for ; Thu, 15 Mar 2018 18:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752868AbeCOSnz (ORCPT ); Thu, 15 Mar 2018 14:43:55 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:41229 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752370AbeCOSnw (ORCPT ); Thu, 15 Mar 2018 14:43:52 -0400 Received: by mail-pl0-f65.google.com with SMTP id b7-v6so239317plr.8; Thu, 15 Mar 2018 11:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=LhfxAKx/A249lX/zeRUZDkolCPXufgRLuoG9p+jYFqE=; b=Cx7cmha7BofVAsAPFj+tEytqks04eIQTsH3ulzpjjgT6y5ELLyjhB0nnkdEwambHz4 QOpilEOJZGksJSYWPae1tfGdkDfFanaFJG/hjDVMlhtGEu0b3Thw2bPIkPj3gw8ObZdD nvs4rSitIUIxdIgUGXxEUFu863dGzWysJY2TZc6dxPhiRi5ElLPds2Myn5vPfskA4Ofn RBYyzcsQDl8k5G/kQVDelujbTy5qO0dTRE0VD9rkhBvm2KW9K5SsfZ6vW0qNJOrkoT0Y zjjPAC3FNex+8tbJLX6dcDt2hNCb1/ZtJ8NKQipwE6/sdkS9Bp6txY41to8dnwlIKJwR 1G6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=LhfxAKx/A249lX/zeRUZDkolCPXufgRLuoG9p+jYFqE=; b=Bvlo6DxRPehlZnEIRFc00Njgxli5FK/39h2KM1kQLXK6MFpMNRT07+i0POACqZKgAZ 5P6QwMaEUbuInapisdWPYtz9rQwBhOTKFkvVHYXSVQpjZxMqZPazMMtBd4Zg4daHyN1J C0Yu3KlTxeTqOakRkrdYiYU2dHOfPIPSIWVstSmcKSDYSPeH4LP6nr4HYQyXZToqPjcN a+rFjxeii4PvC/q+ZQ8t+ai9rStnvqUlPNaAC8u5E2a43cddKWvaHImJGrxUKcIhgIHn JE3w6sC71TVI5b/mbks/u2S4+qtpexfOGzLPKmzcv2uMH/fr+pmQlW0zxoAXavyv0o4E QwAQ== X-Gm-Message-State: AElRT7Eq19iXuK9lpz84Y9T/WbxkYE6umiTbKMH+UNikkqunQ1IJaYvO IWTEZy9aeDPZqyg/+W9EgfQ= X-Google-Smtp-Source: AG47ELslEdERqLiFqQ/75WwQoRaVM225mdubCnh+02QtUqjQYQfzXjLy1akV0AqPm1KUuTjmHKkPVA== X-Received: by 2002:a17:902:2f:: with SMTP id 44-v6mr9270064pla.187.1521139431744; Thu, 15 Mar 2018 11:43:51 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id f82sm13184044pfd.175.2018.03.15.11.43.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 11:43:50 -0700 (PDT) Subject: [pci PATCH v7 4/5] nvme: Migrate over to unmanaged SR-IOV support From: Alexander Duyck To: bhelgaas@google.com, alexander.h.duyck@intel.com, linux-pci@vger.kernel.org Cc: virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, netdev@vger.kernel.org, dan.daly@intel.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, keith.busch@intel.com, netanel@amazon.com, ddutile@redhat.com, mheyne@amazon.de, liang-min.wang@intel.com, mark.d.rustad@intel.com, dwmw2@infradead.org, hch@lst.de, dwmw@amazon.co.uk Date: Thu, 15 Mar 2018 11:43:49 -0700 Message-ID: <20180315184328.3102.42818.stgit@localhost.localdomain> In-Reply-To: <20180315183449.3102.64791.stgit@localhost.localdomain> References: <20180315183449.3102.64791.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alexander Duyck Instead of implementing our own version of a SR-IOV configuration stub in the nvme driver we can just reuse the existing pci_sriov_configure_simple function. Reviewed-by: Christoph Hellwig Signed-off-by: Alexander Duyck --- v5: Replaced call to pci_sriov_configure_unmanaged with pci_sriov_configure_simple v6: Dropped "#ifdef" checks for IOV wrapping sriov_configure definition v7: No code change, added Reviewed-by drivers/nvme/host/pci.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 5933a5c732e8..5e963058882a 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2580,24 +2580,6 @@ static void nvme_remove(struct pci_dev *pdev) nvme_put_ctrl(&dev->ctrl); } -static int nvme_pci_sriov_configure(struct pci_dev *pdev, int numvfs) -{ - int ret = 0; - - if (numvfs == 0) { - if (pci_vfs_assigned(pdev)) { - dev_warn(&pdev->dev, - "Cannot disable SR-IOV VFs while assigned\n"); - return -EPERM; - } - pci_disable_sriov(pdev); - return 0; - } - - ret = pci_enable_sriov(pdev, numvfs); - return ret ? ret : numvfs; -} - #ifdef CONFIG_PM_SLEEP static int nvme_suspend(struct device *dev) { @@ -2716,7 +2698,7 @@ static void nvme_error_resume(struct pci_dev *pdev) .driver = { .pm = &nvme_dev_pm_ops, }, - .sriov_configure = nvme_pci_sriov_configure, + .sriov_configure = pci_sriov_configure_simple, .err_handler = &nvme_err_handler, };