From: Kirti Wankhede <kwankhede@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>, <cohuck@redhat.com>
Cc: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] mdev: Send uevents around parent device registration
Date: Wed, 10 Jul 2019 23:41:21 +0530 [thread overview]
Message-ID: <4f32e5e2-2bac-81f2-9fb6-3d0023ed009b@nvidia.com> (raw)
In-Reply-To: <156278027422.16516.5157992389394627876.stgit@gimli.home>
On 7/10/2019 11:11 PM, Alex Williamson wrote:
> This allows udev to trigger rules when a parent device is registered
> or unregistered from mdev.
>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>
> v3: Add Connie's R-b
> Add comment clarifying expected device requirements for unreg
>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Thanks,
Kirti
> drivers/vfio/mdev/mdev_core.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
> index ae23151442cb..23976db6c6c7 100644
> --- a/drivers/vfio/mdev/mdev_core.c
> +++ b/drivers/vfio/mdev/mdev_core.c
> @@ -146,6 +146,8 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
> {
> int ret;
> struct mdev_parent *parent;
> + char *env_string = "MDEV_STATE=registered";
> + char *envp[] = { env_string, NULL };
>
> /* check for mandatory ops */
> if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups)
> @@ -197,6 +199,8 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
> mutex_unlock(&parent_list_lock);
>
> dev_info(dev, "MDEV: Registered\n");
> + kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
> +
> return 0;
>
> add_dev_err:
> @@ -220,6 +224,8 @@ EXPORT_SYMBOL(mdev_register_device);
> void mdev_unregister_device(struct device *dev)
> {
> struct mdev_parent *parent;
> + char *env_string = "MDEV_STATE=unregistered";
> + char *envp[] = { env_string, NULL };
>
> mutex_lock(&parent_list_lock);
> parent = __find_parent_device(dev);
> @@ -243,6 +249,9 @@ void mdev_unregister_device(struct device *dev)
> up_write(&parent->unreg_sem);
>
> mdev_put_parent(parent);
> +
> + /* We still have the caller's reference to use for the uevent */
> + kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
> }
> EXPORT_SYMBOL(mdev_unregister_device);
>
>
prev parent reply other threads:[~2019-07-10 18:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 17:41 Alex Williamson
2019-07-10 18:11 ` Kirti Wankhede [this message]
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=4f32e5e2-2bac-81f2-9fb6-3d0023ed009b@nvidia.com \
--to=kwankhede@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®