Re: [PATCH v2] virtio: add VIRTIO_F_NOTIFICATION_DATA feature support

From: Cornelia Huck
Date: Tue Mar 21 2023 - 09:11:21 EST


On Tue, Mar 21 2023, "Michael S. Tsirkin" <mst@xxxxxxxxxx> wrote:

> 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.

FWIW, the notification data needs to go via the third parameter of
kvm_hypercall3() in virtio_ccw_kvm_notify().