No idea if it's right .. and syborg does not support vectors so we won't get performance gains out of it either - so quite likely it's best to just keep this patch out of qemu. But just to show what's possible.
Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- hw/syborg_virtio.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/hw/syborg_virtio.c b/hw/syborg_virtio.c index 65239a0..ef6364f 100644 --- a/hw/syborg_virtio.c +++ b/hw/syborg_virtio.c @@ -249,9 +249,34 @@ static unsigned syborg_virtio_get_features(void *opaque) return proxy->host_features; } +static void syborg_virtio_irqfd_read(void *opaque) +{ + VirtQueue *vq = opaque; + virtio_irq(vq->vdev, vq); +} + +static int syborg_virtio_irqfd(void * opaque, int n, int fd, bool assign) +{ + SyborgVirtIOProxy *proxy = opaque; + VirtQueue *vq = &proxy->vdev->vq[n]; + + qemu_set_fd_handler(fd, assign ? syborg_virtio_irqfd_read : NULL, NULL, vq); + return 0; +} + +static int syborg_virtio_queuefd(void * opaque, int n, int fd, bool assign) +{ + SyborgVirtIOProxy *proxy = opaque; + return kvm_set_ioeventfd(proxy->busdev.mmio[0].addr + + SYBORG_VIRTIO_QUEUE_NOTIFY << 2, + n, fd, assign); +} + static VirtIOBindings syborg_virtio_bindings = { .notify = syborg_virtio_update_irq, .get_features = syborg_virtio_get_features, + .set_irqfd = syborg_virtio_irqfd, + .set_queuefd = syborg_virtio_queuefd, }; static int syborg_virtio_init(SyborgVirtIOProxy *proxy, VirtIODevice *vdev) -- 1.6.6.rc1.43.gf55cc