From: Cindy Lu <lulu@redhat.com>
To: lulu@redhat.com, mst@redhat.com, jasowang@redhat.com,
qemu-devel@nongnu.org
Subject: [PATCH v4 3/4] virtio-mmio: add support for configure interrupt
Date: Tue, 23 Mar 2021 09:56:40 +0800 [thread overview]
Message-ID: <20210323015641.10820-4-lulu@redhat.com> (raw)
In-Reply-To: <20210323015641.10820-1-lulu@redhat.com>
add configure interrupt support for virtio-mmio bus. This
interrupt will working while backend is vhost-vdpa
Signed-off-by: Cindy Lu <lulu@redhat.com>
---
hw/virtio/virtio-mmio.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index e1b5c3b81e..beabd129ef 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -627,12 +627,30 @@ static int virtio_mmio_set_guest_notifier(DeviceState *d, int n, bool assign,
}
if (vdc->guest_notifier_mask && vdev->use_guest_notifier_mask) {
- vdc->guest_notifier_mask(vdev, n, !assign);
+ vdc->guest_notifier_mask(vdev, n, !assign, VIRTIO_VQ_VECTOR);
}
-
return 0;
}
+static int virtio_mmio_set_config_notifier(DeviceState *d, bool assign)
+{
+ VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+ VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
+ EventNotifier *notifier = virtio_get_config_notifier(vdev);
+ int r = 0;
+ if (assign) {
+ r = event_notifier_init(notifier, 0);
+ virtio_set_config_notifier_fd_handler(vdev, true, false);
+ } else {
+ virtio_set_config_notifier_fd_handler(vdev, false, false);
+ event_notifier_cleanup(notifier);
+ }
+ if (vdc->guest_notifier_mask && vdev->use_guest_notifier_mask) {
+ vdc->guest_notifier_mask(vdev, 0, !assign, VIRTIO_CONFIG_VECTOR);
+ }
+ return r;
+}
static int virtio_mmio_set_guest_notifiers(DeviceState *d, int nvqs,
bool assign)
{
@@ -654,8 +672,15 @@ static int virtio_mmio_set_guest_notifiers(DeviceState *d, int nvqs,
goto assign_error;
}
}
+ r = virtio_mmio_set_config_notifier(d, assign);
+ if (r < 0) {
+ goto config_assign_error;
+ }
return 0;
+config_assign_error:
+ assert(assign);
+ r = virtio_mmio_set_config_notifier(d, false);
assign_error:
/* We get here on assignment failure. Recover by undoing for VQs 0 .. n. */
@@ -666,6 +691,7 @@ assign_error:
return r;
}
+
static void virtio_mmio_pre_plugged(DeviceState *d, Error **errp)
{
VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
--
2.21.3
next prev parent reply other threads:[~2021-03-23 2:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-23 1:56 [PATCH v4 0/4] vhost-vdpa: add support for configure interrupt Cindy Lu
2021-03-23 1:56 ` [PATCH v4 1/4] virtio:add support in " Cindy Lu
2021-03-24 6:30 ` Jason Wang
2021-03-25 7:15 ` Cindy Lu
2021-03-26 8:29 ` Jason Wang
2021-03-29 6:05 ` Cindy Lu
2021-03-23 1:56 ` [PATCH v4 2/4] vhost-vdpa: add callback function for " Cindy Lu
2021-03-24 6:33 ` Jason Wang
2021-03-25 7:17 ` Cindy Lu
2021-03-23 1:56 ` Cindy Lu [this message]
2021-03-23 1:56 ` [PATCH v4 4/4] virtio-pci: add support " Cindy Lu
2021-03-24 6:34 ` Jason Wang
2021-03-25 6:07 ` 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=20210323015641.10820-4-lulu@redhat.com \
--to=lulu@redhat.com \
--cc=jasowang@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).