Received: by 10.192.165.148 with SMTP id m20csp752184imm; Fri, 20 Apr 2018 15:12:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Wp58yCNyB29NVeWHqdQHjbqCTVdAFWbV0nJBrH03laZdimvKrcK7l/M0xWDONBWQppEqH X-Received: by 2002:a17:902:6b86:: with SMTP id p6-v6mr11912805plk.32.1524262359039; Fri, 20 Apr 2018 15:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524262359; cv=none; d=google.com; s=arc-20160816; b=wju6xrCfPZwC4Smw6CxxaxIGsCk7ryB0Rnl1TYlbv1lUqpRPkO8xYTmmO/Zu4mRrZv x8FWLpdb3FJdlym7r3kfFBeaEYtk/1n1Dk3FEShDmy4Vw0FIILjYHMhNRZVuoGPJ4/Jz s/IM/8ZdYiH15wB6VpgaDFn+9wQz9MKUAnQw5HlPx9Ba3HFL9RCJxP7eUM7bep3dqmtm eM3RkOpXyvGKvsSRtdqpy7mUg9fJQ5vVs/zymYpNTm5ZykiL9aW7Gjhi5yca4HWgyjIp C189BBYFt8j5aVg6gNm+R48G0u47I+Acxi/MgOJMs+sU/Dm0nPeuPUTV+1WpA1EC03oM MPMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=OPZ+ScqlFYSRql9UOObBkJDp0/F5RjRecplH5piCX0A=; b=W39FpIn03alC7EjFvPg5/kBPA1jtRYXNgxQ8Ng61dDZ4u4dqadF12gTNuttSCjlWCj jY90VxAaZxUaufIwWYJ7PXDu0foK9TmjkNf9sFv3eQVRKI5Lp18VXjgTW06o9sTmLddQ 3cG83Vy3s6MXKUkOZVhD6ND3copiWaOZ1DnsOI4Vqxa9zn1eFNfTL/WzNgQLg+aFqnS7 k3XZ+mNcSo1372p+zm/Xevo5uvzn72/u9XBu6k70JHFG7FzpJL4NCBLrdaVZJ9DORw8a T4+3OQnrmD1LXRTwCoJkRif+qD+HBZTqwo7Y62AaNbLU9Sblld9EvjTZQv7VhEH0/geJ c8hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=svmVL1ek; 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 b1-v6si6410043plc.403.2018.04.20.15.12.01; Fri, 20 Apr 2018 15:12:38 -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=svmVL1ek; 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 S1752771AbeDTWIv (ORCPT + 99 others); Fri, 20 Apr 2018 18:08:51 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33310 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100AbeDTWIt (ORCPT ); Fri, 20 Apr 2018 18:08:49 -0400 Received: by mail-pf0-f196.google.com with SMTP id f15so4860781pfn.0; Fri, 20 Apr 2018 15:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=OPZ+ScqlFYSRql9UOObBkJDp0/F5RjRecplH5piCX0A=; b=svmVL1ekSKNDis+A3YYUnerX/HsIt56WLmR0QjyHJweRMXfmKkt0YOT19N4ESsFk0i GXs83T3TVC5EHT32qXLy4QTZM70qBhMzOTjXxilYPMpF0kB3dLIqG6tJr/B37vj6h/4j 3c1laP8VFEsw2yRLGBFk61xj9py8iUgFVBccjraZkqs5rsnMPZ4mKd4pCjZej/aBXnfD AXUcAfLOX2oqj3aecU37ScjZkbYWOPJwBBC16CkOXivleJLW2Ks3FJV7ZoAaF9FDVath 9xD/yBnQmMK+cQQuTp6QO0hUJHKqM9IF3157jqeQguBYQnk5ocrGwSjNjm9zi+Zs1LSH z/RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=OPZ+ScqlFYSRql9UOObBkJDp0/F5RjRecplH5piCX0A=; b=fFT8PzWsa0fiX2tW76D35k/2+wjjzaavpt66hzG8GbMvCheiD2l2/XYxorRJU+P4UY 1L4+st7zGT7bfql5s6p8KJcdNFFisW/dHubd0f/Kl+H7MftbeNWGvKg0TWHNCMK7WNDM ttz3p542KNLfJEt/rRkViSdTn8OTzN+Yo/rJwdMd1NZN+xemcYrBkLVsaCmIBQZnngvZ WYykE2mrDzKTY12LWpI0vl33yJmI8q4SbNyTANHxSOnvwzUIxR0g6g6oN7ojvpr7iTPx 067K1i2nakT7NqwzxP/VdhnCHpupzlLaz/isoa6uAAhyc70MA3BzRtZt07zAGUUzQJsF 9uRg== X-Gm-Message-State: ALQs6tD902bJwoP9N15LvYTqSAORg3lqfk2Vbfov+2i0qICZ+4k11dsi gehW0rrSHJvg6PDlepXcj60= X-Received: by 10.98.166.206 with SMTP id r75mr11180234pfl.82.1524262128662; Fri, 20 Apr 2018 15:08:48 -0700 (PDT) Received: from [192.168.0.16] (67-5-146-204.ptld.qwest.net. [67.5.146.204]) by smtp.gmail.com with ESMTPSA id i2sm11772081pgo.57.2018.04.20.15.08.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Apr 2018 15:08:48 -0700 (PDT) Subject: Re: [pci PATCH v8 4/4] pci-pf-stub: Add PF driver stub for PFs that function only to enable VFs To: Alexander Duyck , bhelgaas@google.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 References: <20180420162633.46077.49012.stgit@ahduyck-green-test.jf.intel.com> <20180420163109.46077.60334.stgit@ahduyck-green-test.jf.intel.com> From: Gregory Rose Message-ID: <33785f68-d445-f49b-5668-3195cfa32159@gmail.com> Date: Fri, 20 Apr 2018 15:08:46 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180420163109.46077.60334.stgit@ahduyck-green-test.jf.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/20/2018 9:31 AM, Alexander Duyck wrote: > Add a new driver called "pci-pf-stub" to act as a "white-list" for PF > devices that provide no other functionality other then acting as a means of > allocating a set of VFs. For now I only have one example ID provided by > Amazon in terms of devices that require this functionality. The general > idea is that in the future we will see other devices added as vendors come > up with devices where the PF is more or less just a lightweight shim used > to allocate VFs. > > Signed-off-by: Alexander Duyck > --- > > v6: New driver to address concerns about Amazon devices left unsupported > v7: Dropped pci_id table explanation from pci-pf-stub driver > > drivers/pci/Kconfig | 12 ++++++++++ > drivers/pci/Makefile | 2 ++ > drivers/pci/pci-pf-stub.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ > include/linux/pci_ids.h | 2 ++ > 4 files changed, 70 insertions(+) > create mode 100644 drivers/pci/pci-pf-stub.c > > diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig > index 34b56a8..cdef2a2 100644 > --- a/drivers/pci/Kconfig > +++ b/drivers/pci/Kconfig > @@ -71,6 +71,18 @@ config PCI_STUB > > When in doubt, say N. > > +config PCI_PF_STUB > + tristate "PCI PF Stub driver" > + depends on PCI > + depends on PCI_IOV > + help > + Say Y or M here if you want to enable support for devices that > + require SR-IOV support, while at the same time the PF itself is > + not providing any actual services on the host itself such as > + storage or networking. > + > + When in doubt, say N. > + > config XEN_PCIDEV_FRONTEND > tristate "Xen PCI Frontend" > depends on PCI && X86 && XEN > diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile > index 9419709..4e133d3 100644 > --- a/drivers/pci/Makefile > +++ b/drivers/pci/Makefile > @@ -43,6 +43,8 @@ obj-$(CONFIG_PCI_SYSCALL) += syscall.o > > obj-$(CONFIG_PCI_STUB) += pci-stub.o > > +obj-$(CONFIG_PCI_PF_STUB) += pci-pf-stub.o > + > obj-$(CONFIG_PCI_ECAM) += ecam.o > > obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen-pcifront.o > diff --git a/drivers/pci/pci-pf-stub.c b/drivers/pci/pci-pf-stub.c > new file mode 100644 > index 0000000..9d5fdf2 > --- /dev/null > +++ b/drivers/pci/pci-pf-stub.c > @@ -0,0 +1,54 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* pci-pf-stub - simple stub driver for PCI SR-IOV PF device > + * > + * This driver is meant to act as a "white-list" for devices that provde > + * SR-IOV functionality while at the same time not actually needing a > + * driver of their own. > + */ > + > +#include > +#include > + > +/** > + * pci_pf_stub_white_list - White list of devices to bind pci-pf-stub onto > + * > + * This table provides the list of IDs this driver is supposed to bind > + * onto. You could think of this as a list of "quirked" devices where we > + * are adding support for SR-IOV here since there are no other drivers > + * that they would be running under. > + */ > +static const struct pci_device_id pci_pf_stub_white_list[] = { > + { PCI_VDEVICE(AMAZON, 0x0053) }, > + /* required last entry */ > + { 0 } > +}; > +MODULE_DEVICE_TABLE(pci, pci_pf_stub_white_list); > + > +static int pci_pf_stub_probe(struct pci_dev *dev, > + const struct pci_device_id *id) > +{ > + pci_info(dev, "claimed by pci-pf-stub\n"); > + return 0; > +} > + > +static struct pci_driver pf_stub_driver = { > + .name = "pci-pf-stub", > + .id_table = pci_pf_stub_white_list, > + .probe = pci_pf_stub_probe, > + .sriov_configure = pci_sriov_configure_simple, > +}; > + > +static int __init pci_pf_stub_init(void) > +{ > + return pci_register_driver(&pf_stub_driver); > +} > + > +static void __exit pci_pf_stub_exit(void) > +{ > + pci_unregister_driver(&pf_stub_driver); > +} > + > +module_init(pci_pf_stub_init); > +module_exit(pci_pf_stub_exit); > + > +MODULE_LICENSE("GPL"); > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h > index a637a7d..62dab14 100644 > --- a/include/linux/pci_ids.h > +++ b/include/linux/pci_ids.h > @@ -2549,6 +2549,8 @@ > #define PCI_VENDOR_ID_CIRCUITCO 0x1cc8 > #define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD 0x0001 > > +#define PCI_VENDOR_ID_AMAZON 0x1d0f > + > #define PCI_VENDOR_ID_TEKRAM 0x1de1 > #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 > > LGTM Reviewed-by: Greg Rose