qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cindy Lu <lulu@redhat.com>
To: mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org
Cc: lulu@redhat.com
Subject: [PATCH v3 4/5] virtio-mmio: add support for configure interrupt
Date: Tue, 26 Jan 2021 15:42:53 +0800	[thread overview]
Message-ID: <20210126074254.3225-5-lulu@redhat.com> (raw)
In-Reply-To: <20210126074254.3225-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 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index e1b5c3b81e..d580f1ea9a 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -666,6 +666,21 @@ assign_error:
     return r;
 }
 
+static int virtio_mmio_set_config_notifier(DeviceState *d,  bool assign)
+{
+    VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
+    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+    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);
+    }
+    return r;
+}
 static void virtio_mmio_pre_plugged(DeviceState *d, Error **errp)
 {
     VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
@@ -780,6 +795,7 @@ static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data)
     k->ioeventfd_assign = virtio_mmio_ioeventfd_assign;
     k->pre_plugged = virtio_mmio_pre_plugged;
     k->has_variable_vring_alignment = true;
+    k->set_config_notifiers = virtio_mmio_set_config_notifier;
     bus_class->max_dev = 1;
     bus_class->get_dev_path = virtio_mmio_bus_get_dev_path;
 }
-- 
2.21.3



  parent reply	other threads:[~2021-01-26  7:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26  7:42 [PATCH v3 0/5] vhost-vdpa: add support for configure interrupt Cindy Lu
2021-01-26  7:42 ` [PATCH v3 1/5] virtio: " Cindy Lu
2021-01-27  5:35   ` Jason Wang
2021-01-26  7:42 ` [PATCH v3 2/5] vhost_net: enable configure interrupt when vhost_net start Cindy Lu
2021-01-27  5:38   ` Jason Wang
2021-01-27  7:25     ` Cindy Lu
2021-01-26  7:42 ` [PATCH v3 3/5] virtio-pci: add support for configure interrupt Cindy Lu
2021-01-27  5:44   ` Jason Wang
2021-01-27  7:39     ` Cindy Lu
2021-01-26  7:42 ` Cindy Lu [this message]
2021-01-26  7:42 ` [PATCH v3 5/5] vhost-vdpa: add callback function " Cindy Lu
2021-01-26 14:53   ` Stefano Garzarella
2021-01-27  2:51     ` Cindy Lu
2021-01-27  5:47   ` Jason Wang
2021-01-27  7:51     ` Cindy Lu
2021-01-27  8:16       ` Jason Wang

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=20210126074254.3225-5-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).