79c4324644
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
56 lines
1.7 KiB
Diff
56 lines
1.7 KiB
Diff
From 7f25adf1fd99b5b8f9455537d0c6108837ee25de Mon Sep 17 00:00:00 2001
|
|
From: Viresh Kumar <viresh.kumar@linaro.org>
|
|
Date: Tue, 18 Apr 2023 09:24:54 +0530
|
|
Subject: [PATCH] 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>
|
|
Signed-off-by: fangyi <eric.fangyi@huawei.com>
|
|
---
|
|
hw/virtio/vhost-user-i2c.c | 16 ++++++++++++++++
|
|
1 file changed, 16 insertions(+)
|
|
|
|
diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
|
|
index dcaf471115..19add4a707 100644
|
|
--- a/hw/virtio/vhost-user-i2c.c
|
|
+++ b/hw/virtio/vhost-user-i2c.c
|
|
@@ -129,6 +129,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);
|
|
}
|
|
|
|
@@ -136,6 +144,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);
|
|
}
|
|
|
|
--
|
|
2.27.0
|
|
|