All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-blk: store the zone-append sector as little-endian
@ 2026-06-17 15:17 Michael Bommarito
  2026-06-18 15:20 ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Bommarito @ 2026-06-17 15:17 UTC (permalink / raw)
  To: Stefan Hajnoczi, Michael S . Tsirkin
  Cc: Kevin Wolf, Hanna Reitz, qemu-block, qemu-devel

The zone-append completion path writes the append sector back to the
guest with virtio_stq_p(), the VIRTIO_F_VERSION_1-aware accessor,
while the rest of the zoned reply path (the zone report descriptors
and the report header) stores its fields with cpu_to_le64(). The
zoned feature is only defined for VIRTIO 1.x devices and the virtio
specification defines all of its fields as little-endian, so store the
append sector with stq_le_p() too, for a single spec-matching
convention across the zoned path.

This is not a functional change for a VIRTIO 1.x device, where
virtio_stq_p() already stores little-endian; it only removes the mixed
convention within the zoned reply path.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
---
Testing: builds (qemu-system-x86_64) and the qos-test virtio-blk cases
(basic, indirect, config, resize, msix, idx, nxvirtq, hotplug) pass
against the patched binary. No functional change on a
VIRTIO_F_VERSION_1 device, where virtio_stq_p() already stores
little-endian.

 hw/block/virtio-blk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 9cb9f1fb2..e2a35fae2 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -762,8 +762,8 @@ static void virtio_blk_zone_append_complete(void *opaque, int ret)
         goto out;
     }
 
-    virtio_stq_p(vdev, &append_sector,
-                 data->zone_append_data.offset >> BDRV_SECTOR_BITS);
+    stq_le_p(&append_sector,
+             data->zone_append_data.offset >> BDRV_SECTOR_BITS);
     n = iov_from_buf(data->in_iov, data->in_num, 0, &append_sector,
                      sizeof(append_sector));
     if (n != sizeof(append_sector)) {
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-18 17:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 15:17 [PATCH] virtio-blk: store the zone-append sector as little-endian Michael Bommarito
2026-06-18 15:20 ` Stefan Hajnoczi
2026-06-18 16:23   ` Daniel P. Berrangé
2026-06-18 17:49     ` Michael Bommarito

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.