Skip to content

Commit

Permalink
virtio: rng: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX
Browse files Browse the repository at this point in the history
Since the driver doesn't support interrupts, we must return early when
index is set to VIRTIO_CONFIG_IRQ_IDX.  Basically the same thing Viresh
did for "91208dd297f2 virtio: i2c: Check notifier helpers for
VIRTIO_CONFIG_IRQ_IDX".

Fixes: 544f027 ("virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX")
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Message-Id: <20231025171841.3379663-1-mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
mathieupoirier authored and mstsirkin committed Dec 25, 2023
1 parent 80f1709 commit df72f01
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hw/virtio/vhost-user-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,29 @@ static void vu_rng_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
{
VHostUserRNG *rng = VHOST_USER_RNG(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(&rng->vhost_dev, vdev, idx, mask);
}

static bool vu_rng_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VHostUserRNG *rng = VHOST_USER_RNG(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(&rng->vhost_dev, idx);
}

Expand Down

0 comments on commit df72f01

Please sign in to comment.