[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write
From: |
Michael S. Tsirkin |
Subject: |
Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write |
Date: |
Mon, 31 Oct 2022 04:17:01 -0400 |
On Sat, Oct 29, 2022 at 12:48:43AM +0200, Philippe Mathieu-Daudé wrote:
> On 28/10/22 18:02, Eugenio Pérez wrote:
> > This causes errors on virtio modern devices on big endian hosts
> >
> > Fixes: 01f8beacea2a ("vhost: toggle device callbacks using used event idx")
> > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > ---
> > hw/virtio/vhost-shadow-virtqueue.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/virtio/vhost-shadow-virtqueue.c
> > b/hw/virtio/vhost-shadow-virtqueue.c
> > index 70766ea740..467099f5d9 100644
> > --- a/hw/virtio/vhost-shadow-virtqueue.c
> > +++ b/hw/virtio/vhost-shadow-virtqueue.c
> > @@ -382,7 +382,7 @@ static bool
> > vhost_svq_enable_notification(VhostShadowVirtqueue *svq)
> > {
> > if (virtio_vdev_has_feature(svq->vdev, VIRTIO_RING_F_EVENT_IDX)) {
> > uint16_t *used_event = &svq->vring.avail->ring[svq->vring.num];
> > - *used_event = svq->shadow_used_idx;
> > + *used_event = cpu_to_le16(svq->shadow_used_idx);
>
> This looks correct, but what about:
>
> virtio_stw_p(svq->vdev, used_event, svq->shadow_used_idx);
Philippe thanks for review but this comment isn't all that clear.
I think you meant something like:
this won't handle endian-ness for legacy virtio devices
on BE correctly. I think virtio_stw_p would be better.
which would make sense.
Yes contributors should document motivation for changes but so
should reviewers.
> > } else {
> > svq->vring.avail->flags &=
> > ~cpu_to_le16(VRING_AVAIL_F_NO_INTERRUPT);
> > }
- [PATCH 0/4] Endianess and coding style fixes for SVQ event idx support, Eugenio Pérez, 2022/10/28
- [PATCH 3/4] vhost: Fix lines over 80 characters, Eugenio Pérez, 2022/10/28
- [PATCH 2/4] vhost: convert byte order on SVQ used event write, Eugenio Pérez, 2022/10/28
- Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write, Philippe Mathieu-Daudé, 2022/10/28
- Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write, Eugenio Perez Martin, 2022/10/31
- Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write, Michael S. Tsirkin, 2022/10/31
- Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write, Eugenio Perez Martin, 2022/10/31
- Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write, Michael S. Tsirkin, 2022/10/31
- Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write, Eugenio Perez Martin, 2022/10/31
- Re: [PATCH 2/4] vhost: convert byte order on SVQ used event write, Michael S. Tsirkin, 2022/10/31
[PATCH 4/4] vhost: convert byte order on avail_event read, Eugenio Pérez, 2022/10/28