get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1267696/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1267696,
    "url": "http://patchwork.ozlabs.org/api/patches/1267696/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200408012328.3344523-1-jeffrey.t.kirsher@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20200408012328.3344523-1-jeffrey.t.kirsher@intel.com>",
    "list_archive_url": null,
    "date": "2020-04-08T01:23:28",
    "name": "[next-queue,v8] Implementation of Virtual Bus",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "27772c87045b69d116680d92195a3730cce25c53",
    "submitter": {
        "id": 473,
        "url": "http://patchwork.ozlabs.org/api/people/473/?format=api",
        "name": "Kirsher, Jeffrey T",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200408012328.3344523-1-jeffrey.t.kirsher@intel.com/mbox/",
    "series": [
        {
            "id": 169132,
            "url": "http://patchwork.ozlabs.org/api/series/169132/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=169132",
            "date": "2020-04-08T01:23:28",
            "name": "[next-queue,v8] Implementation of Virtual Bus",
            "version": 8,
            "mbox": "http://patchwork.ozlabs.org/series/169132/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1267696/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1267696/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.138;\n\thelo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 48xmks17rHz9sSk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  8 Apr 2020 11:23:46 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 057DA82383;\n\tWed,  8 Apr 2020 01:23:44 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id kNy3eJaADAoF; Wed,  8 Apr 2020 01:23:41 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 843B181F70;\n\tWed,  8 Apr 2020 01:23:41 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 9F77A1BF4E7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  8 Apr 2020 01:23:40 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 958AC87D6E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  8 Apr 2020 01:23:40 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id XAwvTi+vC5pb for <intel-wired-lan@lists.osuosl.org>;\n\tWed,  8 Apr 2020 01:23:39 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id E1C91869D8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  8 Apr 2020 01:23:38 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t07 Apr 2020 18:23:38 -0700",
            "from jtkirshe-desk1.jf.intel.com ([134.134.177.86])\n\tby FMSMGA003.fm.intel.com with ESMTP; 07 Apr 2020 18:23:36 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "IronPort-SDR": [
            "7X6pnPi+2tvu9/GzCUQq0R8aAzsEA0MX9uSHgi8NTlaSTbXT8CQ/HZyhfLe3gPsBfTvQLuDB7V\n\tF+ZJTyU8p+KQ==",
            "zsy2iDaJga5DIn7ZuSEan+j+wt8/eZ+JLoVBAY0jItxFJFDM+oQDCZ96Ku56XHyAG+c9fdhA1h\n\ttoV5bjdMfuVw=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.72,357,1580803200\"; d=\"scan'208\";a=\"297102219\"",
        "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue,  7 Apr 2020 18:23:28 -0700",
        "Message-Id": "<20200408012328.3344523-1-jeffrey.t.kirsher@intel.com>",
        "X-Mailer": "git-send-email 2.25.2",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [next-queue v8] Implementation of Virtual Bus",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Dave Ertman <david.m.ertman@intel.com>\n\nThis is the initial implementation of the Virtual Bus,\nvirtbus_device and virtbus_driver.  The virtual bus is\na software based bus intended to support registering\nvirtbus_devices and virtbus_drivers and provide matching\nbetween them and probing of the registered drivers.\n\nThe bus will support probe/remove shutdown and\nsuspend/resume callbacks.\n\nKconfig and Makefile alterations are included\n\nSigned-off-by: Dave Ertman <david.m.ertman@intel.com>\nSigned-off-by: Kiran Patil <kiran.patil@intel.com>\nTested-by: Andrew Bowers <andrewx.bowers@intel.com>\n---\nv8: updated changes on recent changes to kernel and resolved conflicts\n    with latest rebase to net-next\n\n Documentation/driver-api/virtual_bus.rst |  62 ++++++\n drivers/bus/Kconfig                      |  10 +\n drivers/bus/Makefile                     |   2 +\n drivers/bus/virtual_bus.c                | 270 +++++++++++++++++++++++\n include/linux/mod_devicetable.h          |   8 +\n include/linux/virtual_bus.h              |  53 +++++\n scripts/mod/devicetable-offsets.c        |   3 +\n scripts/mod/file2alias.c                 |   7 +\n 8 files changed, 415 insertions(+)\n create mode 100644 Documentation/driver-api/virtual_bus.rst\n create mode 100644 drivers/bus/virtual_bus.c\n create mode 100644 include/linux/virtual_bus.h",
    "diff": "diff --git a/Documentation/driver-api/virtual_bus.rst b/Documentation/driver-api/virtual_bus.rst\nnew file mode 100644\nindex 000000000000..a79db0e9231e\n--- /dev/null\n+++ b/Documentation/driver-api/virtual_bus.rst\n@@ -0,0 +1,62 @@\n+===============================\n+Virtual Bus Devices and Drivers\n+===============================\n+\n+See <linux/virtual_bus.h> for the models for virtbus_device and virtbus_driver.\n+This bus is meant to be a lightweight software based bus to attach generic\n+devices and drivers to so that a chunk of data can be passed between them.\n+\n+One use case example is an RDMA driver needing to connect with several\n+different types of PCI LAN devices to be able to request resources from\n+them (queue sets).  Each LAN driver that supports RDMA will register a\n+virtbus_device on the virtual bus for each physical function.  The RDMA\n+driver will register as a virtbus_driver on the virtual bus to be\n+matched up with multiple virtbus_devices and receive a pointer to a\n+struct containing the callbacks that the PCI LAN drivers support for\n+registering with them.\n+\n+Sections in this document:\n+        Virtbus devices\n+        Virtbus drivers\n+        Device Enumeration\n+        Device naming and driver binding\n+        Virtual Bus API entry points\n+\n+Virtbus devices\n+~~~~~~~~~~~~~~~\n+Virtbus_devices support the minimal device functionality.  Devices will\n+accept a name, and then, when added to the virtual bus, an automatically\n+generated index is concatenated onto it for the virtbus_device->name.\n+\n+Virtbus drivers\n+~~~~~~~~~~~~~~~\n+Virtbus drivers register with the virtual bus to be matched with virtbus\n+devices.  They expect to be registered with a probe and remove callback,\n+and also support shutdown, suspend, and resume callbacks.  They otherwise\n+follow the standard driver behavior of having discovery and enumeration\n+handled in the bus infrastructure.\n+\n+Virtbus drivers register themselves with the API entry point\n+virtbus_register_driver and unregister with virtbus_unregister_driver.\n+\n+Device Enumeration\n+~~~~~~~~~~~~~~~~~~\n+Enumeration is handled automatically by the bus infrastructure via the\n+ida_simple methods.\n+\n+Device naming and driver binding\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+The virtbus_device.dev.name is the canonical name for the device. It is\n+built from two other parts:\n+\n+        - virtbus_device.name (also used for matching).\n+        - virtbus_device.id (generated automatically from ida_simple calls)\n+\n+Virtbus device IDs are always in \"<name>.<instance>\" format.  Instances are\n+automatically selected through an ida_simple_get so are positive integers.\n+Name is taken from the device name field.\n+\n+Driver IDs are simple <name>.\n+\n+Need to extract the name from the Virtual Device compare to name of the\n+driver.\ndiff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig\nindex 6d4e4497b59b..8b6c709730ba 100644\n--- a/drivers/bus/Kconfig\n+++ b/drivers/bus/Kconfig\n@@ -203,4 +203,14 @@ config DA8XX_MSTPRI\n source \"drivers/bus/fsl-mc/Kconfig\"\n source \"drivers/bus/mhi/Kconfig\"\n \n+config VIRTUAL_BUS\n+       tristate \"Software based Virtual Bus\"\n+       help\n+         Provides a software bus for virtbus_devices to be added to it\n+         and virtbus_drivers to be registered on it.  It matches driver\n+         and device based on id and calls the driver's pobe routine.\n+         One example is the irdma driver needing to connect with various\n+         PCI LAN drivers to request resources (queues) to be able to perform\n+         its function.\n+\n endmenu\ndiff --git a/drivers/bus/Makefile b/drivers/bus/Makefile\nindex 05f32cd694a4..d30828a4768c 100644\n--- a/drivers/bus/Makefile\n+++ b/drivers/bus/Makefile\n@@ -37,3 +37,5 @@ obj-$(CONFIG_DA8XX_MSTPRI)\t+= da8xx-mstpri.o\n \n # MHI\n obj-$(CONFIG_MHI_BUS)\t\t+= mhi/\n+\n+obj-$(CONFIG_VIRTUAL_BUS)\t+= virtual_bus.o\ndiff --git a/drivers/bus/virtual_bus.c b/drivers/bus/virtual_bus.c\nnew file mode 100644\nindex 000000000000..fb14cca40eea\n--- /dev/null\n+++ b/drivers/bus/virtual_bus.c\n@@ -0,0 +1,270 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/*\n+ * virtual_bus.c - lightweight software based bus for virtual devices\n+ *\n+ * Copyright (c) 2019-20 Intel Corporation\n+ *\n+ * Please see Documentation/driver-api/virtual_bus.rst for\n+ * more information\n+ */\n+\n+#include <linux/string.h>\n+#include <linux/virtual_bus.h>\n+#include <linux/of_irq.h>\n+#include <linux/module.h>\n+#include <linux/init.h>\n+#include <linux/pm_runtime.h>\n+#include <linux/pm_domain.h>\n+#include <linux/acpi.h>\n+#include <linux/device.h>\n+\n+MODULE_LICENSE(\"GPL v2\");\n+MODULE_DESCRIPTION(\"Virtual Bus\");\n+MODULE_AUTHOR(\"David Ertman <david.m.ertman@intel.com>\");\n+MODULE_AUTHOR(\"Kiran Patil <kiran.patil@intel.com>\");\n+\n+static DEFINE_IDA(virtbus_dev_ida);\n+\n+static const\n+struct virtbus_dev_id *virtbus_match_id(const struct virtbus_dev_id *id,\n+\t\t\t\t\tstruct virtbus_device *vdev)\n+{\n+\twhile (id->name[0]) {\n+\t\tif (!strcmp(vdev->name, id->name))\n+\t\t\treturn id;\n+\t\tid++;\n+\t}\n+\treturn NULL;\n+}\n+\n+static int virtbus_match(struct device *dev, struct device_driver *drv)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(drv);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(dev);\n+\n+\treturn virtbus_match_id(vdrv->id_table, vdev) != NULL;\n+}\n+\n+static int virtbus_probe(struct device *dev)\n+{\n+\treturn dev->driver->probe(dev);\n+}\n+\n+static int virtbus_remove(struct device *dev)\n+{\n+\treturn dev->driver->remove(dev);\n+}\n+\n+static void virtbus_shutdown(struct device *dev)\n+{\n+\tdev->driver->shutdown(dev);\n+}\n+\n+static int virtbus_suspend(struct device *dev, pm_message_t state)\n+{\n+\tif (dev->driver->suspend)\n+\t\treturn dev->driver->suspend(dev, state);\n+\n+\treturn 0;\n+}\n+\n+static int virtbus_resume(struct device *dev)\n+{\n+\tif (dev->driver->resume)\n+\t\treturn dev->driver->resume(dev);\n+\n+\treturn 0;\n+}\n+\n+struct bus_type virtual_bus_type = {\n+\t.name = \"virtbus\",\n+\t.match = virtbus_match,\n+\t.probe = virtbus_probe,\n+\t.remove = virtbus_remove,\n+\t.shutdown = virtbus_shutdown,\n+\t.suspend = virtbus_suspend,\n+\t.resume = virtbus_resume,\n+};\n+\n+/**\n+ * virtbus_release_device - Destroy a virtbus device\n+ * @_dev: device to release\n+ */\n+static void virtbus_release_device(struct device *_dev)\n+{\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\n+\tida_simple_remove(&virtbus_dev_ida, vdev->id);\n+\tvdev->release(vdev);\n+}\n+\n+/**\n+ * virtbus_register_device - add a virtual bus device\n+ * @vdev: virtual bus device to add\n+ */\n+int virtbus_register_device(struct virtbus_device *vdev)\n+{\n+\tint ret;\n+\n+\t/* Do this first so that all error paths perform a put_device */\n+\tdevice_initialize(&vdev->dev);\n+\n+\tif (!vdev->release) {\n+\t\tret = -EINVAL;\n+\t\tdev_err(&vdev->dev, \"virtbus_device MUST have a .release callback that does something.\\n\");\n+\t\tgoto device_pre_err;\n+\t}\n+\n+\t/* All device IDs are automatically allocated */\n+\tret = ida_simple_get(&virtbus_dev_ida, 0, 0, GFP_KERNEL);\n+\tif (ret < 0) {\n+\t\tdev_err(&vdev->dev, \"get IDA idx for virtbus device failed!\\n\");\n+\t\tgoto device_pre_err;\n+\t}\n+\n+\n+\tvdev->dev.bus = &virtual_bus_type;\n+\tvdev->dev.release = virtbus_release_device;\n+\n+\tvdev->id = ret;\n+\tdev_set_name(&vdev->dev, \"%s.%d\", vdev->name, vdev->id);\n+\n+\tdev_dbg(&vdev->dev, \"Registering virtbus device '%s'\\n\",\n+\t\tdev_name(&vdev->dev));\n+\n+\tret = device_add(&vdev->dev);\n+\tif (ret)\n+\t\tgoto device_add_err;\n+\n+\treturn 0;\n+\n+device_add_err:\n+\tida_simple_remove(&virtbus_dev_ida, vdev->id);\n+\n+device_pre_err:\n+\tdev_err(&vdev->dev, \"Add device to virtbus failed!: %d\\n\", ret);\n+\tput_device(&vdev->dev);\n+\n+\treturn ret;\n+}\n+EXPORT_SYMBOL_GPL(virtbus_register_device);\n+\n+/**\n+ * virtbus_unregister_device - remove a virtual bus device\n+ * @vdev: virtual bus device we are removing\n+ */\n+void virtbus_unregister_device(struct virtbus_device *vdev)\n+{\n+\tdevice_del(&vdev->dev);\n+\tput_device(&vdev->dev);\n+}\n+EXPORT_SYMBOL_GPL(virtbus_unregister_device);\n+\n+static int virtbus_probe_driver(struct device *_dev)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\tint ret;\n+\n+\tret = dev_pm_domain_attach(_dev, true);\n+\tif (ret) {\n+\t\tdev_warn(_dev, \"Failed to attatch to PM Domain : %d\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n+\tret = vdrv->probe(vdev);\n+\tif (ret) {\n+\t\tdev_err(&vdev->dev, \"Probe returned error\\n\");\n+\t\tdev_pm_domain_detach(_dev, true);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int virtbus_remove_driver(struct device *_dev)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\tint ret = 0;\n+\n+\tret = vdrv->remove(vdev);\n+\tdev_pm_domain_detach(_dev, true);\n+\n+\treturn ret;\n+}\n+\n+static void virtbus_shutdown_driver(struct device *_dev)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\n+\tvdrv->shutdown(vdev);\n+}\n+\n+static int virtbus_suspend_driver(struct device *_dev, pm_message_t state)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\n+\tif (vdrv->suspend)\n+\t\treturn vdrv->suspend(vdev, state);\n+\n+\treturn 0;\n+}\n+\n+static int virtbus_resume_driver(struct device *_dev)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\n+\tif (vdrv->resume)\n+\t\treturn vdrv->resume(vdev);\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * __virtbus_register_driver - register a driver for virtual bus devices\n+ * @vdrv: virtbus_driver structure\n+ * @owner: owning module/driver\n+ */\n+int __virtbus_register_driver(struct virtbus_driver *vdrv, struct module *owner)\n+{\n+\tif (!vdrv->probe || !vdrv->remove || !vdrv->shutdown || !vdrv->id_table)\n+\t\treturn -EINVAL;\n+\n+\tvdrv->driver.owner = owner;\n+\tvdrv->driver.bus = &virtual_bus_type;\n+\tvdrv->driver.probe = virtbus_probe_driver;\n+\tvdrv->driver.remove = virtbus_remove_driver;\n+\tvdrv->driver.shutdown = virtbus_shutdown_driver;\n+\tvdrv->driver.suspend = virtbus_suspend_driver;\n+\tvdrv->driver.resume = virtbus_resume_driver;\n+\n+\treturn driver_register(&vdrv->driver);\n+}\n+EXPORT_SYMBOL_GPL(__virtbus_register_driver);\n+\n+/**\n+ * virtbus_unregister_driver - unregister a driver for virtual bus devices\n+ * @vdrv: virtbus_driver structure\n+ */\n+void virtbus_unregister_driver(struct virtbus_driver *vdrv)\n+{\n+\tdriver_unregister(&vdrv->driver);\n+}\n+EXPORT_SYMBOL_GPL(virtbus_unregister_driver);\n+\n+static int __init virtual_bus_init(void)\n+{\n+\treturn bus_register(&virtual_bus_type);\n+}\n+\n+static void __exit virtual_bus_exit(void)\n+{\n+\tbus_unregister(&virtual_bus_type);\n+\tida_destroy(&virtbus_dev_ida);\n+}\n+\n+module_init(virtual_bus_init);\n+module_exit(virtual_bus_exit);\ndiff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h\nindex 4c2ddd0941a7..60bcfe75fb94 100644\n--- a/include/linux/mod_devicetable.h\n+++ b/include/linux/mod_devicetable.h\n@@ -832,4 +832,12 @@ struct mhi_device_id {\n \tkernel_ulong_t driver_data;\n };\n \n+#define VIRTBUS_NAME_SIZE 20\n+#define VIRTBUS_MODULE_PREFIX \"virtbus:\"\n+\n+struct virtbus_dev_id {\n+\tchar name[VIRTBUS_NAME_SIZE];\n+\tkernel_ulong_t driver_data;\n+};\n+\n #endif /* LINUX_MOD_DEVICETABLE_H */\ndiff --git a/include/linux/virtual_bus.h b/include/linux/virtual_bus.h\nnew file mode 100644\nindex 000000000000..4df06178e72f\n--- /dev/null\n+++ b/include/linux/virtual_bus.h\n@@ -0,0 +1,53 @@\n+/* SPDX-License-Identifier: GPL-2.0-only */\n+/*\n+ * virtual_bus.h - lightweight software bus\n+ *\n+ * Copyright (c) 2019-20 Intel Corporation\n+ *\n+ * Please see Documentation/driver-api/virtual_bus.rst for more information\n+ */\n+\n+#ifndef _VIRTUAL_BUS_H_\n+#define _VIRTUAL_BUS_H_\n+\n+#include <linux/device.h>\n+\n+struct virtbus_device {\n+\tstruct device dev;\n+\tconst char *name;\n+\tvoid (*release)(struct virtbus_device *);\n+\tint id;\n+};\n+\n+struct virtbus_driver {\n+\tint (*probe)(struct virtbus_device *);\n+\tint (*remove)(struct virtbus_device *);\n+\tvoid (*shutdown)(struct virtbus_device *);\n+\tint (*suspend)(struct virtbus_device *, pm_message_t);\n+\tint (*resume)(struct virtbus_device *);\n+\tstruct device_driver driver;\n+\tconst struct virtbus_dev_id *id_table;\n+};\n+\n+static inline\n+struct virtbus_device *to_virtbus_dev(struct device *dev)\n+{\n+\treturn container_of(dev, struct virtbus_device, dev);\n+}\n+\n+static inline\n+struct virtbus_driver *to_virtbus_drv(struct device_driver *drv)\n+{\n+\treturn container_of(drv, struct virtbus_driver, driver);\n+}\n+\n+int virtbus_register_device(struct virtbus_device *vdev);\n+void virtbus_unregister_device(struct virtbus_device *vdev);\n+int\n+__virtbus_register_driver(struct virtbus_driver *vdrv, struct module *owner);\n+void virtbus_unregister_driver(struct virtbus_driver *vdrv);\n+\n+#define virtbus_register_driver(vdrv) \\\n+\t__virtbus_register_driver(vdrv, THIS_MODULE)\n+\n+#endif /* _VIRTUAL_BUS_H_ */\ndiff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c\nindex 010be8ba2116..0c8e0e3a7c84 100644\n--- a/scripts/mod/devicetable-offsets.c\n+++ b/scripts/mod/devicetable-offsets.c\n@@ -241,5 +241,8 @@ int main(void)\n \tDEVID(mhi_device_id);\n \tDEVID_FIELD(mhi_device_id, chan);\n \n+\tDEVID(virtbus_dev_id);\n+\tDEVID_FIELD(virtbus_dev_id, name);\n+\n \treturn 0;\n }\ndiff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c\nindex 02d5d79da284..7d78fa3fba34 100644\n--- a/scripts/mod/file2alias.c\n+++ b/scripts/mod/file2alias.c\n@@ -1358,7 +1358,13 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)\n {\n \tDEF_FIELD_ADDR(symval, mhi_device_id, chan);\n \tsprintf(alias, MHI_DEVICE_MODALIAS_FMT, *chan);\n+\treturn 1;\n+}\n \n+static int do_virtbus_entry(const char *filename, void *symval, char *alias)\n+{\n+\tDEF_FIELD_ADDR(symval, virtbus_dev_id, name);\n+\tsprintf(alias, VIRTBUS_MODULE_PREFIX \"%s\", *name);\n \treturn 1;\n }\n \n@@ -1436,6 +1442,7 @@ static const struct devtable devtable[] = {\n \t{\"tee\", SIZE_tee_client_device_id, do_tee_entry},\n \t{\"wmi\", SIZE_wmi_device_id, do_wmi_entry},\n \t{\"mhi\", SIZE_mhi_device_id, do_mhi_entry},\n+\t{\"virtbus\", SIZE_virtbus_dev_id, do_virtbus_entry},\n };\n \n /* Create MODULE_ALIAS() statements.\n",
    "prefixes": [
        "next-queue",
        "v8"
    ]
}