From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
davem@davemloft.net, gregkh@linuxfoundation.org
Cc: Dave Ertman <david.m.ertman@intel.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
nhorman@redhat.com, sassmann@redhat.com, jgg@ziepe.ca,
parav@mellanox.com, galpress@amazon.com,
selvin.xavier@broadcom.com, sriharsha.basavapatna@broadcom.com,
benve@cisco.com, bharat@chelsio.com, xavier.huwei@huawei.com,
yishaih@mellanox.com, leonro@mellanox.com, mkalderon@marvell.com,
aditr@vmware.com, ranjani.sridharan@linux.intel.com,
Kiran Patil <kiran.patil@intel.com>,
Andrew Bowers <andrewx.bowers@intel.com>
Subject: Re: [net-next 1/9] Implementation of Virtual Bus
Date: Fri, 17 Apr 2020 14:14:00 -0500 [thread overview]
Message-ID: <c5197d2f-3840-d304-6b09-d334cae81294@linux.intel.com> (raw)
In-Reply-To: <20200417171034.1533253-2-jeffrey.t.kirsher@intel.com>
On 4/17/20 12:10 PM, Jeff Kirsher wrote:
> From: Dave Ertman <david.m.ertman@intel.com>
>
> This is the initial implementation of the Virtual Bus,
> virtbus_device and virtbus_driver. The virtual bus is
> a software based bus intended to support registering
> virtbus_devices and virtbus_drivers and provide matching
> between them and probing of the registered drivers.
>
> The bus will support probe/remove shutdown and
> suspend/resume callbacks.
>
> Kconfig and Makefile alterations are included
>
> Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
> Signed-off-by: Kiran Patil <kiran.patil@intel.com>
> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
FWIW we are planning to use this Virtual Bus to support multiple clients
for the Sound Open Firmware driver, instead of using platform devices as
suggested by GregKH.
Minor nit-picks below, please feel free to add my tag for patch 1/9:
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> +config VIRTUAL_BUS
> + tristate "Software based Virtual Bus"
> + help
> + Provides a software bus for virtbus_devices to be added to it
> + and virtbus_drivers to be registered on it. It matches driver
> + and device based on id and calls the driver's pobe routine.
typo: probe
[...]
> diff --git a/drivers/bus/virtual_bus.c b/drivers/bus/virtual_bus.c
> new file mode 100644
> index 000000000000..fb14cca40eea
> --- /dev/null
> +++ b/drivers/bus/virtual_bus.c
> @@ -0,0 +1,270 @@
> +// SPDX-License-Identifier: GPL-2.0
did you mean GPL-2.0-only, as done for virtual-bus.h?
> +/*
> + * virtual_bus.c - lightweight software based bus for virtual devices
> + *
> + * Copyright (c) 2019-20 Intel Corporation
I think the recommendation is to use 2019-2020 explicitly.
> + *
> + * Please see Documentation/driver-api/virtual_bus.rst for
> + * more information
> + */
> +
> +#include <linux/string.h>
> +#include <linux/virtual_bus.h>
> +#include <linux/of_irq.h>
is of_irq.h required?
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/pm_domain.h>
> +#include <linux/acpi.h>
is there any ACPI dependency?
> +#include <linux/device.h>
alphabetical order for the headers maybe?
[...]
> +int virtbus_register_device(struct virtbus_device *vdev)
> +{
> + int ret;
> +
> + /* Do this first so that all error paths perform a put_device */
> + device_initialize(&vdev->dev);
> +
> + if (!vdev->release) {
> + ret = -EINVAL;
> + dev_err(&vdev->dev, "virtbus_device MUST have a .release callback that does something.\n");
> + goto device_pre_err;
> + }
> +
> + /* All device IDs are automatically allocated */
> + ret = ida_simple_get(&virtbus_dev_ida, 0, 0, GFP_KERNEL);
> + if (ret < 0) {
> + dev_err(&vdev->dev, "get IDA idx for virtbus device failed!\n");
> + goto device_pre_err;
> + }
> +
> +
extra line
> + vdev->dev.bus = &virtual_bus_type;
> + vdev->dev.release = virtbus_release_device;
> +
> + vdev->id = ret;
> + dev_set_name(&vdev->dev, "%s.%d", vdev->name, vdev->id);
> +
> + dev_dbg(&vdev->dev, "Registering virtbus device '%s'\n",
> + dev_name(&vdev->dev));
> +
> + ret = device_add(&vdev->dev);
> + if (ret)
> + goto device_add_err;
> +
> + return 0;
> +
> +device_add_err:
> + ida_simple_remove(&virtbus_dev_ida, vdev->id);
> +
> +device_pre_err:
> + dev_err(&vdev->dev, "Add device to virtbus failed!: %d\n", ret);
> + put_device(&vdev->dev);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(virtbus_register_device);
> +
> +/**
> + * virtbus_unregister_device - remove a virtual bus device
> + * @vdev: virtual bus device we are removing
> + */
> +void virtbus_unregister_device(struct virtbus_device *vdev)
> +{
> + device_del(&vdev->dev);
> + put_device(&vdev->dev);
looks like device_unregister(&vdev->dev) ?
> +}
> +EXPORT_SYMBOL_GPL(virtbus_unregister_device);
> +
> +static int virtbus_probe_driver(struct device *_dev)
> +{
> + struct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);
> + struct virtbus_device *vdev = to_virtbus_dev(_dev);
> + int ret;
> +
> + ret = dev_pm_domain_attach(_dev, true);
> + if (ret) {
> + dev_warn(_dev, "Failed to attatch to PM Domain : %d\n", ret);
typo: attach
[...]
> diff --git a/include/linux/virtual_bus.h b/include/linux/virtual_bus.h
> new file mode 100644
> index 000000000000..4df06178e72f
> --- /dev/null
> +++ b/include/linux/virtual_bus.h
> @@ -0,0 +1,53 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * virtual_bus.h - lightweight software bus
> + *
> + * Copyright (c) 2019-20 Intel Corporation
2019-2020?
next prev parent reply other threads:[~2020-04-17 19:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 17:10 [net-next 0/9][pull request] 100GbE Intel Wired LAN Driver Updates 2020-04-17 Jeff Kirsher
2020-04-17 17:10 ` [net-next 1/9] Implementation of Virtual Bus Jeff Kirsher
2020-04-17 19:14 ` Pierre-Louis Bossart [this message]
2020-04-17 19:51 ` Jason Gunthorpe
2020-04-20 23:16 ` Ertman, David M
2020-04-21 0:44 ` Jason Gunthorpe
2020-04-21 23:27 ` Ertman, David M
2020-04-18 12:50 ` Greg KH
2020-04-20 22:59 ` Ertman, David M
2020-04-21 6:52 ` Greg KH
2020-04-20 23:46 ` Ranjani Sridharan
2020-04-17 17:10 ` [net-next 2/9] ice: Create and register virtual bus for RDMA Jeff Kirsher
2020-04-17 19:17 ` Jason Gunthorpe
2020-04-20 23:47 ` Kirsher, Jeffrey T
2020-04-17 23:49 ` Jason Gunthorpe
2020-04-17 17:10 ` [net-next 3/9] ice: Complete RDMA peer registration Jeff Kirsher
2020-04-17 17:10 ` [net-next 4/9] ice: Support resource allocation requests Jeff Kirsher
2020-04-17 17:10 ` [net-next 5/9] ice: Enable event notifications Jeff Kirsher
2020-04-17 17:10 ` [net-next 6/9] ice: Allow reset operations Jeff Kirsher
2020-04-17 17:10 ` [net-next 7/9] ice: Pass through communications to VF Jeff Kirsher
2020-04-17 17:10 ` [net-next 8/9] i40e: Move client header location Jeff Kirsher
2020-04-17 17:10 ` [net-next 9/9] i40e: Register a virtbus device to provide RDMA Jeff Kirsher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c5197d2f-3840-d304-6b09-d334cae81294@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=aditr@vmware.com \
--cc=andrewx.bowers@intel.com \
--cc=benve@cisco.com \
--cc=bharat@chelsio.com \
--cc=davem@davemloft.net \
--cc=david.m.ertman@intel.com \
--cc=galpress@amazon.com \
--cc=gregkh@linuxfoundation.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jgg@ziepe.ca \
--cc=kiran.patil@intel.com \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=mkalderon@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=parav@mellanox.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sassmann@redhat.com \
--cc=selvin.xavier@broadcom.com \
--cc=sriharsha.basavapatna@broadcom.com \
--cc=xavier.huwei@huawei.com \
--cc=yishaih@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.