On Wed, Feb 12, 2025 at 7:11 PM Philippe Mathieu-Daudé <phi...@linaro.org> wrote: > > On 12/2/25 17:49, Konstantin Shkolnyy wrote: > > VDPA didn't work on a big-endian machine due to missing/incorrect > > CPU<->LE data format conversions. > > > > Signed-off-by: Konstantin Shkolnyy <k...@linux.ibm.com> > > --- > > Changes in v2: Change desc_next[] from LE format to "CPU". > > > > hw/virtio/vhost-shadow-virtqueue.c | 18 ++++++++++-------- > > 1 file changed, 10 insertions(+), 8 deletions(-) > > > > @@ -228,10 +228,12 @@ static void vhost_svq_kick(VhostShadowVirtqueue *svq) > > smp_mb(); > > > > if (virtio_vdev_has_feature(svq->vdev, VIRTIO_RING_F_EVENT_IDX)) { > > - uint16_t avail_event = *(uint16_t > > *)(&svq->vring.used->ring[svq->vring.num]); > > + uint16_t avail_event = le16_to_cpu( > > + *(uint16_t *)(&svq->vring.used->ring[svq->vring.num])); > > Nitpicking, sometimes using the ld/st API is cleaner (here lduw_le_p). >
I'm not sure if it is right in SVQ, as it is not accessing guest memory but QEMU memory that has been mapped to a device. But if you think it is still a valid use case for ld* and st* family I'd be totally ok with that usage. > > needs_kick = vring_need_event(avail_event, svq->shadow_avail_idx, > > svq->shadow_avail_idx - 1); > > } else { > > - needs_kick = !(svq->vring.used->flags & VRING_USED_F_NO_NOTIFY); > > + needs_kick = > > + !(svq->vring.used->flags & > > cpu_to_le16(VRING_USED_F_NO_NOTIFY)); > > } >