On Tue, Mar 21, 2023 at 12:00:42PM +0300, Viktor Prutyanov wrote: > On Tue, Mar 21, 2023 at 5:29 AM Jason Wang <jasowang@xxxxxxxxxx> wrote: > > > > On Tue, Mar 21, 2023 at 7:21 AM Viktor Prutyanov <viktor@xxxxxxxxxx> wrote: > > > > > > According to VirtIO spec v1.2, VIRTIO_F_NOTIFICATION_DATA feature > > > indicates that the driver passes extra data along with the queue > > > notifications. > > > > > > In a split queue case, the extra data is 16-bit available index. In a > > > packed queue case, the extra data is 1-bit wrap counter and 15-bit > > > available index. > > > > > > Add support for this feature for MMIO and PCI transports. Channel I/O > > > transport will not accept this feature. > > > > > > Signed-off-by: Viktor Prutyanov <viktor@xxxxxxxxxx> > > > --- > > > > > > v2: reject the feature in virtio_ccw, replace __le32 with u32 > > > > > > drivers/s390/virtio/virtio_ccw.c | 4 +--- > > > drivers/virtio/virtio_mmio.c | 15 ++++++++++++++- > > > drivers/virtio/virtio_pci_common.c | 10 ++++++++++ > > > drivers/virtio/virtio_pci_common.h | 4 ++++ > > > drivers/virtio/virtio_pci_legacy.c | 2 +- > > > drivers/virtio/virtio_pci_modern.c | 2 +- > > > drivers/virtio/virtio_ring.c | 17 +++++++++++++++++ > > > include/linux/virtio_ring.h | 2 ++ > > > include/uapi/linux/virtio_config.h | 6 ++++++ > > > 9 files changed, 56 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c > > > index a10dbe632ef9..d72a59415527 100644 > > > --- a/drivers/s390/virtio/virtio_ccw.c > > > +++ b/drivers/s390/virtio/virtio_ccw.c > > > @@ -789,9 +789,7 @@ static u64 virtio_ccw_get_features(struct virtio_device *vdev) > > > > > > static void ccw_transport_features(struct virtio_device *vdev) > > > { > > > - /* > > > - * Currently nothing to do here. > > > - */ > > > + __virtio_clear_bit(vdev, VIRTIO_F_NOTIFICATION_DATA); > > > > Is there any restriction that prevents us from implementing > > VIRTIO_F_NOTIFICATION_DATA? (Spec seems doesn't limit us from this) > > Most likely, nothing. So pls code it up. It's the same format. > > > > > } > > > > > > static int virtio_ccw_finalize_features(struct virtio_device *vdev) > > > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c > > > index 3ff746e3f24a..0e13da17fe0a 100644 > > > --- a/drivers/virtio/virtio_mmio.c > > > +++ b/drivers/virtio/virtio_mmio.c > > > @@ -285,6 +285,19 @@ static bool vm_notify(struct virtqueue *vq) > > > return true; > > > } > > > > > > +static bool vm_notify_with_data(struct virtqueue *vq) > > > +{ > > > + struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); > > > + u32 data = vring_fill_notification_data(vq); > > > > Can we move this to the initialization? > > This data is new for each notification, because it helps to identify > the next available index. > > > > > Thanks > > > > Thanks, > Viktor Prutyanov