[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 for 9.1 3/6] virtio-mmio: Handle extra notification data
From: |
Jonah Palmer |
Subject: |
[PATCH v3 for 9.1 3/6] virtio-mmio: Handle extra notification data |
Date: |
Fri, 15 Mar 2024 12:55:54 -0400 |
Add support to virtio-mmio devices for handling the extra data sent from
the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport
feature has been negotiated.
The extra data that's passed to the virtio-mmio device when this feature
is enabled varies depending on the device's virtqueue layout.
The data passed to the virtio-mmio device is in the same format as the
data passed to virtio-pci devices.
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
---
hw/virtio/virtio-mmio.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 22f9fbcf5a..003c363f0b 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -248,6 +248,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset,
uint64_t value,
{
VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque;
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+ uint16_t vq_idx;
trace_virtio_mmio_write_offset(offset, value);
@@ -407,8 +408,13 @@ static void virtio_mmio_write(void *opaque, hwaddr offset,
uint64_t value,
}
break;
case VIRTIO_MMIO_QUEUE_NOTIFY:
- if (value < VIRTIO_QUEUE_MAX) {
- virtio_queue_notify(vdev, value);
+ vq_idx = value;
+ if (vq_idx < VIRTIO_QUEUE_MAX && virtio_queue_get_num(vdev, vq_idx)) {
+ if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) {
+ virtio_queue_set_shadow_avail_idx(virtio_get_queue(vdev,
vq_idx),
+ (value >> 16) & 0xFFFF);
+ }
+ virtio_queue_notify(vdev, vq_idx);
}
break;
case VIRTIO_MMIO_INTERRUPT_ACK:
--
2.39.3
- [PATCH v3 for 9.1 0/6] virtio, vhost: Add VIRTIO_F_NOTIFICATION_DATA support, Jonah Palmer, 2024/03/15
- [PATCH v3 for 9.1 3/6] virtio-mmio: Handle extra notification data,
Jonah Palmer <=
- [PATCH v3 for 9.1 4/6] virtio-ccw: Handle extra notification data, Jonah Palmer, 2024/03/15
- [PATCH v3 for 9.1 2/6] virtio: Prevent creation of device using notification-data with ioeventfd, Jonah Palmer, 2024/03/15
- [PATCH v3 for 9.1 5/6] vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits, Jonah Palmer, 2024/03/15
- [PATCH v3 for 9.1 6/6] virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition, Jonah Palmer, 2024/03/15
- [PATCH v3 for 9.1 1/6] virtio/virtio-pci: Handle extra notification data, Jonah Palmer, 2024/03/15
- Re: [PATCH v3 for 9.1 0/6] virtio, vhost: Add VIRTIO_F_NOTIFICATION_DATA support, Jiri Pirko, 2024/03/16