virtio: remove virtio_tswap16s() call in vring_packed_event_read()
PATCH 1/1 virtio: remove virtio_tswap16s() call in vring_packed_event_read()
Commit d152cdd6f6 ("virtio: use virtio accessor to access packed event") switched using of address_space_read_cached() to virito_lduw_phys_cached() to access packed descriptor event.
When we used address_space_read_cached(), we needed to call virtio_tswap16s() to handle the endianess of the field, but virito_lduw_phys_cached() already handles it internally, so we no longer need to call virtio_tswap16s() (as the commit had done for off_wrap, but forgot for flags).
--- hw/virtio/virtio.c | 1 - 1 file changed, 1 deletion(-)
hw/virtio/virtio.c +0 -1
@@ -323,7 +323,6 @@ static void vring_packed_event_read(VirtIODevice *vdev,/* Make sure flags is seen before off_wrap */ smp_rmb (); e->off_wrap =virtio_lduw_phys_cached (vdev, cache, off_off); -virtio_tswap16s (vdev, &e->flags); } static void vring_packed_off_wrap_write(VirtIODevice *vdev,
Signature · 1 line
2.45.2
Quoted 11 lines · Stefano Garzarella
Commit
d152cdd6f6("virtio: use virtio accessor to access packed event") switched using ofaddress_space_read_cached()tovirito_lduw_phys_cached()to access packed descriptor event.When we used
address_space_read_cached(), we needed to callvirtio_tswap16s()to handle the endianess of the field, butvirito_lduw_phys_cached()already handles it internally, so we no longer need to callvirtio_tswap16s()(as the commit had done foroff_wrap, but forgot forflags).
Quoted 6 lines
Fixes d152cdd6f6 ("virtio: use virtio accessor to access packed event")Reported-by Xoykie <[email protected]>Link https://lore.kernel.org/qemu-devel/CAFU8RB_pjr77zMLsM0Unf9xPNxfr_--Tjr49F_eX32ZBc5o2zQ@mail.gmail.com open hereSigned-off-by Stefano Garzarella <[email protected]>
Thanks
Quoted 19 lines
--- hw/virtio/virtio.c | 1 - 1 file changed, 1 deletion(-)hw/virtio/virtio.c +0
-2@@ -323,7 +323,6 @@ static void vring_packed_event_read(VirtIODevice *vdev,/* Make sure flags is seen before off_wrap */ smp_rmb (); e->off_wrap =virtio_lduw_phys_cached (vdev, cache, off_off); -virtio_tswap16s (vdev, &e->flags); } static void vring_packed_off_wrap_write(VirtIODevice *vdev, --2.45.2
Quoted 26 lines · Stefano Garzarella
Commit
d152cdd6f6("virtio: use virtio accessor to access packed event") switched using ofaddress_space_read_cached()tovirito_lduw_phys_cached()to access packed descriptor event.When we used
address_space_read_cached(), we needed to callvirtio_tswap16s()to handle the endianess of the field, butvirito_lduw_phys_cached()already handles it internally, so we no longer need to callvirtio_tswap16s()(as the commit had done foroff_wrap, but forgot forflags).Fixes d152cdd6f6 ("virtio: use virtio accessor to access packed event")Reported-by Xoykie <[email protected]>Link https://lore.kernel.org/qemu-devel/CAFU8RB_pjr77zMLsM0Unf9xPNxfr_--Tjr49F_eX32ZBc5o2zQ@mail.gmail.com open hereSigned-off-by Stefano Garzarella <[email protected]>--- hw/virtio/virtio.c | 1 - 1 file changed, 1 deletion(-)hw/virtio/virtio.c +0
-0
hw/virtio/virtio.c static void vring_packed_event_read(VirtIODevice *vdev, · line 326
Quoted 5 lines
hw/virtio/virtio.c +0
-1@@ -323,7 +323,6 @@ static void vring_packed_event_read(VirtIODevice *vdev,/* Make sure flags is seen before off_wrap */ smp_rmb (); e->off_wrap =virtio_lduw_phys_cached (vdev, cache, off_off); -virtio_tswap16s (vdev, &e->flags); }
thanks
-- PMM
Quoted 11 lines · Stefano Garzarella
Commit
d152cdd6f6("virtio: use virtio accessor to access packed event") switched using ofaddress_space_read_cached()tovirito_lduw_phys_cached()to access packed descriptor event.When we used
address_space_read_cached(), we needed to callvirtio_tswap16s()to handle the endianess of the field, butvirito_lduw_phys_cached()already handles it internally, so we no longer need to callvirtio_tswap16s()(as the commit had done foroff_wrap, but forgot forflags).
Quoted 6 lines
Fixes d152cdd6f6 ("virtio: use virtio accessor to access packed event")Reported-by Xoykie <[email protected]>Link https://lore.kernel.org/qemu-devel/CAFU8RB_pjr77zMLsM0Unf9xPNxfr_--Tjr49F_eX32ZBc5o2zQ@mail.gmail.com open hereSigned-off-by Stefano Garzarella <[email protected]>
I think it would be great to test the patches using a big endian host just in case.
Thanks!
Quoted 19 lines
--- hw/virtio/virtio.c | 1 - 1 file changed, 1 deletion(-)hw/virtio/virtio.c +0
-2@@ -323,7 +323,6 @@ static void vring_packed_event_read(VirtIODevice *vdev,/* Make sure flags is seen before off_wrap */ smp_rmb (); e->off_wrap =virtio_lduw_phys_cached (vdev, cache, off_off); -virtio_tswap16s (vdev, &e->flags); } static void vring_packed_off_wrap_write(VirtIODevice *vdev, --2.45.2
Quoted 19 lines · Eugenio Perez Martin
Quoted 11 lines · Stefano Garzarella
Commit
d152cdd6f6("virtio: use virtio accessor to access packed event") switched using ofaddress_space_read_cached()tovirito_lduw_phys_cached()to access packed descriptor event.When we used
address_space_read_cached(), we needed to callvirtio_tswap16s()to handle the endianess of the field, butvirito_lduw_phys_cached()already handles it internally, so we no longer need to callvirtio_tswap16s()(as the commit had done foroff_wrap, but forgot forflags).Quoted 6 lines
Fixes d152cdd6f6 ("virtio: use virtio accessor to access packed event")Reported-by Xoykie <[email protected]>Link https://lore.kernel.org/qemu-devel/CAFU8RB_pjr77zMLsM0Unf9xPNxfr_--Tjr49F_eX32ZBc5o2zQ@mail.gmail.com open hereSigned-off-by Stefano Garzarella <[email protected]>
Quoted 6 lines
Reviewed-by Eugenio Pérez <[email protected]>I think it would be great to test the patches using a big endian host just in case.
Thanks!
I think we really should move to using sparse tags for endian-ness, like Linux does, and away from swap calls.
Quoted 19 lines
Quoted 19 lines
--- hw/virtio/virtio.c | 1 - 1 file changed, 1 deletion(-)hw/virtio/virtio.c +0
-2@@ -323,7 +323,6 @@ static void vring_packed_event_read(VirtIODevice *vdev,/* Make sure flags is seen before off_wrap */ smp_rmb (); e->off_wrap =virtio_lduw_phys_cached (vdev, cache, off_off); -virtio_tswap16s (vdev, &e->flags); } static void vring_packed_off_wrap_write(VirtIODevice *vdev, --2.45.2