qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>
Subject: Re: [PATCH 4/4] vhost: convert byte order on avail_event read
Date: Mon, 31 Oct 2022 08:35:26 -0400	[thread overview]
Message-ID: <20221031083449-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAJaqyWerZzwFK01+rrdp-dHqFAmrUx-3PYfK+VGY3zGRDOwJBw@mail.gmail.com>

On Mon, Oct 31, 2022 at 09:29:53AM +0100, Eugenio Perez Martin wrote:
> On Sat, Oct 29, 2022 at 12:53 AM Philippe Mathieu-Daudé
> <philmd@linaro.org> wrote:
> >
> > On 28/10/22 18:02, Eugenio Pérez wrote:
> > > This causes errors on virtio modern devices on big endian hosts
> > >
> > > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > > ---
> > >   hw/virtio/vhost-shadow-virtqueue.c | 3 ++-
> > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c
> > > index 18a49e1ecb..3131903edd 100644
> > > --- a/hw/virtio/vhost-shadow-virtqueue.c
> > > +++ b/hw/virtio/vhost-shadow-virtqueue.c
> > > @@ -231,7 +231,8 @@ static void vhost_svq_kick(VhostShadowVirtqueue *svq)
> > >           size_t num = svq->vring.num;
> > >           uint16_t *avail_event = (uint16_t *)&svq->vring.used->ring[num];
> > >
> >
> >    uint16_t avail_event = virtio_lduw_p(svq->vdev,
> >                                         &svq->vring.used->ring[num]);
> >    needs_kick = vring_need_event(avail_event,
> >                                  svq->shadow_avail_idx,
> >                                  svq->shadow_avail_idx - 1);
> >
> 
> It would work, but just because all vrings must be little endian for
> the moment. If we support legacy drivers on a big endian host and
> guest in the future, it would not work.
> 
> virtio_ld and virtio_st handle the conversions between the guest and
> the emulated device in qemu, but this conversion is between qemu
> shadow vring and the vdpa device (assuming modern, little endian for
> the moment).
> 
> Right now the feature set must be the same, but it could not be that
> way in the future.
> 
> Thanks!


I don't think this works  legacy and virtio data path are similar but
not similar enough to allow switches through svq alone.


> > > -        needs_kick = vring_need_event(*avail_event, svq->shadow_avail_idx,
> > > +        needs_kick = vring_need_event(le16_to_cpu(*avail_event),
> > > +                                      svq->shadow_avail_idx,
> > >                                         svq->shadow_avail_idx - 1);
> > >       } else {
> > >           needs_kick = !(svq->vring.used->flags & VRING_USED_F_NO_NOTIFY);
> >



  reply	other threads:[~2022-10-31 12:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 16:02 [PATCH 0/4] Endianess and coding style fixes for SVQ event idx support Eugenio Pérez
2022-10-28 16:02 ` [PATCH 1/4] vhost: Delete useless casting Eugenio Pérez
2022-10-28 22:43   ` Philippe Mathieu-Daudé
2022-10-28 16:02 ` [PATCH 2/4] vhost: convert byte order on SVQ used event write Eugenio Pérez
2022-10-28 22:48   ` Philippe Mathieu-Daudé
2022-10-31  8:17     ` Michael S. Tsirkin
2022-10-31  9:48       ` Philippe Mathieu-Daudé
2022-10-31  8:54     ` Eugenio Perez Martin
2022-10-31 12:33       ` Michael S. Tsirkin
2022-10-31 13:02         ` Eugenio Perez Martin
2022-10-31 15:09           ` Michael S. Tsirkin
2022-10-31 16:05             ` Eugenio Perez Martin
2022-10-31 17:29               ` Michael S. Tsirkin
2022-10-28 16:02 ` [PATCH 3/4] vhost: Fix lines over 80 characters Eugenio Pérez
2022-10-28 16:45   ` Michael S. Tsirkin
2022-10-31  7:43     ` Eugenio Perez Martin
2022-10-28 16:02 ` [PATCH 4/4] vhost: convert byte order on avail_event read Eugenio Pérez
2022-10-28 22:53   ` Philippe Mathieu-Daudé
2022-10-31  8:29     ` Eugenio Perez Martin
2022-10-31 12:35       ` Michael S. Tsirkin [this message]
2022-11-01  2:27         ` Jason Wang
2022-10-29  8:24 ` [PATCH 0/4] Endianess and coding style fixes for SVQ event idx support Michael S. Tsirkin
2022-10-31  8:14   ` Philippe Mathieu-Daudé
2022-11-01  2:41 ` Jason Wang
     [not found]   ` <CAJFLiB+kQ9mjy6V7uKXwoONhJ9-uiw2O3v-7WoM-B5Zaiv-jXg@mail.gmail.com>
2022-11-18  2:49     ` Lei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221031083449-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).