Received: by 10.192.165.148 with SMTP id m20csp472106imm; Fri, 20 Apr 2018 09:40:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4++cMQMwTc/SPs+wvyMJHgvKKB7wbDdoRuDs31UFMOBUUGOXdKaxBEO1qQstMLXuO6/mSWe X-Received: by 2002:a17:902:9a8c:: with SMTP id w12-v6mr11058329plp.333.1524242433851; Fri, 20 Apr 2018 09:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524242433; cv=none; d=google.com; s=arc-20160816; b=D148v+Ip9KpTqakvu/ya+pmtIgCabDj3MnqSFN/HY/GQ7q3bKZRVTkL1adTh+1qb0N TaER21T+E1CY4JbfEzLK3tVKVOLqxWjh3W9l4EFzD0QXU0FotrQeYFK+bcXh3viuqca/ iev0OsDjX9LtUh+oeYO7tu92ahDWBagkzC/DMrBxNArUEfIpARy+pu8uCkgiuronNYuz V/eLx/zKoGCMNO6aceQ+wib3iGkbB4Kt4zXrkl99CYnRLeIDl1jgSrsF89v+qNc6xWyb 6R0wbfthB6N4UFiBHW7aMRlKgNfePnmiELpyY0uW5G6IwFAVh1sYYzlb3mklyhn8xpJx F5+Q== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:arc-authentication-results; bh=rFJAH8UcG2G7yzpezGwfR3JDkBPhMazjFovyl/jj7CI=; b=fmZXjeMuwuMKL09B6NbHc2GbyOvVGwoXCERSTVWoWAqGJhgFdS6mgfwctZVdAIF+kT Q+h8aImss5iXdikBMhicXxxO0S2u7C9kIdjyhkFdBJJP3ZsIyrwqzxmlecrTa7lzVHH3 N7XZS/6KHEJxkjqqtlLs0/Fmmwja6NaXv1eNjU3uv1LH1PmDv+86ZyEdif403/+HXyu0 4kRC24NnSzACodAggBHuk2joBeqUKmYE8ZK96gu2N0YSMsZ26WxQw3YyGrPxve+WAiFG LE9+hdSYznbCR8QPbMIMc2Dc92S6YmvdJ2c/srLHRt3FEvAdwiLHWw2uTSm+xb2W1E/B gshA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si446088pgs.540.2018.04.20.09.40.19; Fri, 20 Apr 2018 09:40:33 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752903AbeDTQh7 (ORCPT + 99 others); Fri, 20 Apr 2018 12:37:59 -0400 Received: from mga01.intel.com ([192.55.52.88]:41833 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751467AbeDTQh4 (ORCPT ); Fri, 20 Apr 2018 12:37:56 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 09:37:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="218133904" Received: from ahduyck-green-test.jf.intel.com ([10.166.244.179]) by orsmga005.jf.intel.com with ESMTP; 20 Apr 2018 09:37:55 -0700 Subject: [pci PATCH v8 3/4] 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: Fri, 20 Apr 2018 12:31:03 -0400 Message-ID: <20180420163027.46077.93925.stgit@ahduyck-green-test.jf.intel.com> In-Reply-To: <20180420162633.46077.49012.stgit@ahduyck-green-test.jf.intel.com> References: <20180420162633.46077.49012.stgit@ahduyck-green-test.jf.intel.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 b6f43b7..ad85cf35 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2581,24 +2581,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) { @@ -2717,7 +2699,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, };