From patchwork Tue Mar 13 21:30:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10280879 X-Patchwork-Delegate: bhelgaas@google.com 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 9A9A9601A0 for ; Tue, 13 Mar 2018 21:30:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B6F42853A for ; Tue, 13 Mar 2018 21:30:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AF352852C; Tue, 13 Mar 2018 21:30:54 +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 0D8AC28536 for ; Tue, 13 Mar 2018 21:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932277AbeCMVaw (ORCPT ); Tue, 13 Mar 2018 17:30:52 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37945 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752375AbeCMVat (ORCPT ); Tue, 13 Mar 2018 17:30:49 -0400 Received: by mail-pf0-f194.google.com with SMTP id d26so459616pfn.5; Tue, 13 Mar 2018 14:30:49 -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=6aY8TJ0PjareK4RpApZKr1aTROHxHKpmUdsDlDkMyUE=; b=om3WMrBiTFGa0yZmAdTbLX5kXM3CZ2GfRjacJGWGAUqX6JZF9+a/qJ0AXksY9Ynpjy KgHJlZZlRdARKvrb4TZreyB0X9jZQxRJkJlKISKH+dUe+epxrKCnwigJD0L/5q4sjWQM qt5WeldPq6BEjBKn/yTgvyqk/IY+xoU3xUlJyDkvXtM3mOUUHvL5A1b0p+lyywWFOKfu c3/9hdZBb2NN39CsZgeOsYB/Y7KlBM3AXxjPb7m8ax5rvHIWW6FT4mVjHEX6g36frXXt 1qF0crp3Yu2w8xMGP07WCpUdNXdyOn0bsFTB/A3cqPGZs6vRe76yh9YlRB3PgPOL25nb p9ow== 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=6aY8TJ0PjareK4RpApZKr1aTROHxHKpmUdsDlDkMyUE=; b=XweZMvin6IuCC8dSNyGKA6xF/NE1dzVrde6meYglfeLLgBuqtNbxPLOQSecs1ZF0jZ L84qmmjKz7AL/b15J7WKKJS9aw84npWpeMiO8njVhXtR/rvxVgoeNEbz6dC6A/yN9Kxz 8XnlLcuvj5A6rmHDWLKaoLnX0KAws6x1bP1pkKjz7SNZaXP26h2LAHvxhdveMsp3akA1 N5TX17NTqSAM7IsTjeW4vtTl83w+lZTDMRbM7oLOaxs/ruevv++vNBdU4i/l6/4Brs3y MFSsfEFIH0/Pde9J0hqWXvnytCDbYQ9u+ypLSybKazBep7LePoCKHJjitwuchMHro95Z 32jA== X-Gm-Message-State: AElRT7G9JkxZoKddiDp25Q/ELeZGqwlXGVVoBos4gYddQIimq4BMFNgW pgJ7K2sXstWBwS1Q4+4xd4M= X-Google-Smtp-Source: AG47ELty4MqFKjzdSRG5I0TQ7XLZR9vkJDVIpt1I8TR6HeGoAnWCtwpNN+fwnsQUHOkOt/6MKkxx+w== X-Received: by 10.99.132.72 with SMTP id k69mr1649092pgd.367.1520976649096; Tue, 13 Mar 2018 14:30:49 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id s9sm1707373pfm.39.2018.03.13.14.30.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Mar 2018 14:30:48 -0700 (PDT) Subject: [pci PATCH v6 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: Tue, 13 Mar 2018 14:30:47 -0700 Message-ID: <20180313213034.3553.47677.stgit@localhost.localdomain> In-Reply-To: <20180313212508.3553.65326.stgit@localhost.localdomain> References: <20180313212508.3553.65326.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. Signed-off-by: Alexander Duyck Reviewed-by: Christoph Hellwig --- v5: Replaced call to pci_sriov_configure_unmanaged with pci_sriov_configure_simple v6: Dropped "#ifdef" checks for IOV wrapping sriov_configure definition 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, };