summary refs log tree commit diff stats
path: root/hw/virtio/vhost-vsock-common.c
diff options
context:
space:
mode:
authorCindy Lu <lulu@redhat.com>2021-11-05 00:48:18 +0800
committerMichael S. Tsirkin <mst@redhat.com>2022-01-06 06:11:39 -0500
commitbf1d85c166c19af95dbd27b1faba1d2909732323 (patch)
treeb5aa07ac6e4b08fe8b789723657d748b6dddf6bf /hw/virtio/vhost-vsock-common.c
parent9bd6565ccee68f72d5012e24646e12a1c662827e (diff)
downloadfocaccia-qemu-bf1d85c166c19af95dbd27b1faba1d2909732323.tar.gz
focaccia-qemu-bf1d85c166c19af95dbd27b1faba1d2909732323.zip
virtio: introduce macro IRTIO_CONFIG_IRQ_IDX
To support configure interrupt for vhost-vdpa
Introduce VIRTIO_CONFIG_IRQ_IDX -1 as configure interrupt's queue index,
Then we can reuse the functions guest_notifier_mask and guest_notifier_pending.
Add the check of queue index in these drivers, if the driver does not support
configure interrupt, the function will just return

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20211104164827.21911-2-lulu@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/vhost-vsock-common.c')
-rw-r--r--hw/virtio/vhost-vsock-common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index 3f3771274e..d1b9c027b6 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -125,6 +125,9 @@ static void vhost_vsock_common_guest_notifier_mask(VirtIODevice *vdev, int idx,
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
 
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     vhost_virtqueue_mask(&vvc->vhost_dev, vdev, idx, mask);
 }
 
@@ -133,6 +136,9 @@ static bool vhost_vsock_common_guest_notifier_pending(VirtIODevice *vdev,
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
 
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_virtqueue_pending(&vvc->vhost_dev, idx);
 }