From: Jason Wang <jasowang@redhat.com>
To: Cindy Lu <lulu@redhat.com>, mst@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v5 4/6] vhost-vdpa: add support for configure interrupt
Date: Fri, 9 Apr 2021 15:24:14 +0800 [thread overview]
Message-ID: <d23aa6a5-8794-c61e-f84c-1d0f96c9e5d9@redhat.com> (raw)
In-Reply-To: <20210408093824.14985-5-lulu@redhat.com>
在 2021/4/8 下午5:38, Cindy Lu 写道:
> Add support for configure interrupt. Set the notifier's fd to
> the kernel driver when vdpa start. also set -1 while vdpa stop.
> then the kernel will release the related resource
>
> Signed-off-by: Cindy Lu <lulu@redhat.com>
> ---
> hw/virtio/vhost-vdpa.c | 26 +++++++++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 9ba2a2bed4..7825366f64 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -467,11 +467,33 @@ static int vhost_vdpa_get_config(struct vhost_dev *dev, uint8_t *config,
> }
> return ret;
> }
> -
Let's keep this blank line.
> +static void vhost_vdpa_config_notify_start(struct vhost_dev *dev,
> + struct VirtIODevice *vdev, bool start)
> +{
> + int fd = 0;
> + int r = 0;
> + if (!(dev->features & (0x1ULL << VIRTIO_NET_F_STATUS))) {
> + return;
> + }
> + if (start) {
> + fd = event_notifier_get_fd(&vdev->config_notifier);
> + r = dev->vhost_ops->vhost_set_config_call(dev, &fd);
So you introduce a general vhost ops but it's call by devic specific
code (vhost-vdpa).
Any reason that we don't do that in vhost_dev_start/vhost_dev_stop?
Thanks
> + if (!r) {
> + vdev->use_config_notifier = true;
> + event_notifier_set(&vdev->config_notifier);
> + }
> + } else {
> + fd = -1;
> + vdev->use_config_notifier = false;
> + r = dev->vhost_ops->vhost_set_config_call(dev, &fd);
> + }
> + return;
> +}
> static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started)
> {
> struct vhost_vdpa *v = dev->opaque;
> trace_vhost_vdpa_dev_start(dev, started);
> + VirtIODevice *vdev = dev->vdev;
> if (started) {
> uint8_t status = 0;
> memory_listener_register(&v->listener, &address_space_memory);
> @@ -479,8 +501,10 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started)
> vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
> vhost_vdpa_call(dev, VHOST_VDPA_GET_STATUS, &status);
>
> + vhost_vdpa_config_notify_start(dev, vdev, true);
> return !(status & VIRTIO_CONFIG_S_DRIVER_OK);
> } else {
> + vhost_vdpa_config_notify_start(dev, vdev, false);
> vhost_vdpa_reset_device(dev);
> vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE |
> VIRTIO_CONFIG_S_DRIVER);
next prev parent reply other threads:[~2021-04-09 7:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 9:38 [PATCH v5 0/6] vhost-vdpa: add support for configure interrupt Cindy Lu
2021-04-08 9:38 ` [PATCH v5 1/6] virtio: introduce new type in interrupt process Cindy Lu
2021-04-09 6:57 ` Jason Wang
2021-04-12 8:09 ` Cindy Lu
2021-04-08 9:38 ` [PATCH v5 2/6] vhost: add new call back function for config interrupt Cindy Lu
2021-04-09 7:12 ` Jason Wang
2021-04-12 8:06 ` Cindy Lu
2021-04-08 9:38 ` [PATCH v5 3/6] virtio:add support in configure interrupt Cindy Lu
2021-04-09 7:21 ` Jason Wang
2021-04-12 8:05 ` Cindy Lu
2021-04-08 9:38 ` [PATCH v5 4/6] vhost-vdpa: add support for " Cindy Lu
2021-04-09 7:24 ` Jason Wang [this message]
2021-04-12 8:18 ` Cindy Lu
2021-04-08 9:38 ` [PATCH v5 5/6] virtio-mmio: " Cindy Lu
2021-04-09 7:27 ` Jason Wang
2021-04-08 9:38 ` [PATCH v5 6/6] virtio-pci: " Cindy Lu
2021-04-09 7:39 ` Jason Wang
2021-04-12 8:27 ` Cindy Lu
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=d23aa6a5-8794-c61e-f84c-1d0f96c9e5d9@redhat.com \
--to=jasowang@redhat.com \
--cc=lulu@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).