summary refs log tree commit diff stats
path: root/hw/virtio/vhost-user-i2c.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2023-04-18 09:24:54 +0530
committerMichael S. Tsirkin <mst@redhat.com>2023-04-24 22:56:55 -0400
commit91208dd297f2686b778210ffda49acbfe36bd3b6 (patch)
tree3d8657283b6e3b442b7f25dcbccca14e5ca064b4 /hw/virtio/vhost-user-i2c.c
parent2a3f8b333b6efbc0ccaacb318fb9c9d53f25bcfd (diff)
downloadfocaccia-qemu-91208dd297f2686b778210ffda49acbfe36bd3b6.tar.gz
focaccia-qemu-91208dd297f2686b778210ffda49acbfe36bd3b6.zip
virtio: i2c: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX
Since the driver doesn't support interrupts, we must return early when
index is set to VIRTIO_CONFIG_IRQ_IDX.

Fixes: 544f0278afca ("virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Message-Id: <d53ec8bc002001eafac597f6bd9a8812df989257.1681790067.git.viresh.kumar@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/vhost-user-i2c.c')
-rw-r--r--hw/virtio/vhost-user-i2c.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
index 60eaf0d95b..4eef3f0633 100644
--- a/hw/virtio/vhost-user-i2c.c
+++ b/hw/virtio/vhost-user-i2c.c
@@ -128,6 +128,14 @@ static void vu_i2c_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
 {
     VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
 
+    /*
+     * We don't support interrupts, return early if index is set to
+     * VIRTIO_CONFIG_IRQ_IDX.
+     */
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
+
     vhost_virtqueue_mask(&i2c->vhost_dev, vdev, idx, mask);
 }
 
@@ -135,6 +143,14 @@ static bool vu_i2c_guest_notifier_pending(VirtIODevice *vdev, int idx)
 {
     VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
 
+    /*
+     * We don't support interrupts, return early if index is set to
+     * VIRTIO_CONFIG_IRQ_IDX.
+     */
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
+
     return vhost_virtqueue_pending(&i2c->vhost_dev, idx);
 }