summary refs log tree commit diff stats
path: root/hw/virtio/vhost-user-gpio.c
diff options
context:
space:
mode:
authorCindy Lu <lulu@redhat.com>2022-12-22 15:04:42 +0800
committerMichael S. Tsirkin <mst@redhat.com>2023-01-08 01:54:22 -0500
commit544f0278afcab2bebab61b14e4c2c58e65911f5b (patch)
treeba1f9052a42d1e1d0f714d8dd56598dabdcd5938 /hw/virtio/vhost-user-gpio.c
parentc9bdc449f97422e62dc802fd2cbe11b840195595 (diff)
downloadfocaccia-qemu-544f0278afcab2bebab61b14e4c2c58e65911f5b.tar.gz
focaccia-qemu-544f0278afcab2bebab61b14e4c2c58e65911f5b.zip
virtio: introduce macro VIRTIO_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: <20221222070451.936503-2-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@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-user-gpio.c')
-rw-r--r--hw/virtio/vhost-user-gpio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
index b7b82a1099..fe3da32c74 100644
--- a/hw/virtio/vhost-user-gpio.c
+++ b/hw/virtio/vhost-user-gpio.c
@@ -191,6 +191,16 @@ static void vu_gpio_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
 {
     VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
+
     vhost_virtqueue_mask(&gpio->vhost_dev, vdev, idx, mask);
 }