Received: by 10.213.65.68 with SMTP id h4csp130502imn; Thu, 15 Mar 2018 11:45:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELsaHdAE2nuqy7iJ1Pjix6MnWmH4u3gs0Hsjd3znO3Zt14wKp1xfPwcWO0DKTNuP9kdBgLL+ X-Received: by 10.99.141.200 with SMTP id z191mr7420580pgd.418.1521139518255; Thu, 15 Mar 2018 11:45:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521139518; cv=none; d=google.com; s=arc-20160816; b=m6+Dv/7Bm/Th6+IsKtwJGW0OzSH5OBzW5pYBTSmZZwW4iq4YN0PfKSnNuNGYdLc/Zu QK3PNsrzQDMTHIe1o5GtHsY3oPHgKHqRLKgbShdcgx1aepJnFMjVSdw6XLcGIA+f8Dsz YksP2PSSZU5Q/v+jJBOAN1JJD9GZ4Brv7Hrjhq/o0Df5hXxhJO7GwP3QjC3yUgOquIA6 fSRRfwRfEPL0e4Wpl0+VKmTEkKaZQT5Iw5+ueFkTPjso44k0XU/JrNUq3s/MdYPbDPBN pnD6HlJJChIp7Y37Ey7aIKcA4C0pA8uh7Gf8ZiPOrYoRMvJw8nAN5dTFhnFCgHvIzx2Z 6/9w== 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:dkim-signature:arc-authentication-results; bh=LhfxAKx/A249lX/zeRUZDkolCPXufgRLuoG9p+jYFqE=; b=LTCWNOUxejrYPwa6eSmv/JaAJMaDycFn2+15Zf5k7gF560wjoSkQ21nkwQSCy3e7x/ 0QOQjqpitX5jpn3/lSPw0XE4zJ4Or44eQBunS6rK/dfGkYYpufCeBUHrcJIRYO7wCkbF fGcIuQrYd3G02mH91RyW7JWWC8FTnbQr4zaLosrFLsFkHwDzLFXIwhvRFwB+VcPi86Wq rbrerl2imDJHAe4YoaxI06PFkaiEMuYLQftJmaF3D7yJN9RaEN1tZ+IjvLrTNQJ2zslA v2k1Lj6jLT2p024+1ve9APZk2oVvsxINZm42cRjMr/DmyJ/zbPfBDjp3UXOEYHwQJzN/ JFGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cx7cmha7; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 67-v6si454343ple.311.2018.03.15.11.45.03; Thu, 15 Mar 2018 11:45:18 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cx7cmha7; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752862AbeCOSnz (ORCPT + 99 others); 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-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 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 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, };