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

* Re: [PATCH] virtio-blk: store the zone-append sector as little-endian
  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é
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2026-06-18 15:20 UTC (permalink / raw)
  To: Michael Bommarito
  Cc: Michael S . Tsirkin, Kevin Wolf, Hanna Reitz, qemu-block,
	qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

On Wed, Jun 17, 2026 at 11:17:39AM -0400, Michael Bommarito wrote:
> 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(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] virtio-blk: store the zone-append sector as little-endian
  2026-06-18 15:20 ` Stefan Hajnoczi
@ 2026-06-18 16:23   ` Daniel P. Berrangé
  2026-06-18 17:49     ` Michael Bommarito
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel P. Berrangé @ 2026-06-18 16:23 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Michael Bommarito, Michael S . Tsirkin, Kevin Wolf, Hanna Reitz,
	qemu-block, qemu-devel

On Thu, Jun 18, 2026 at 11:20:59AM -0400, Stefan Hajnoczi wrote:
> On Wed, Jun 17, 2026 at 11:17:39AM -0400, Michael Bommarito wrote:
> > 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

^^^^^^^  strictly speaking this may not be compatible with our
policy if Claude was used to write the patch.  If Claude was
merely used for research or testing, that's fine.

If it did write the patch, we could make an exception on the
basis that there is only a single way to write this trivial fix.

None the less the Assisted-by advertizing hoarding should be
removed before merging, as even our new proposed looser policy,
rejects use of Assisted-by.

> > 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(-)
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>



With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



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

* Re: [PATCH] virtio-blk: store the zone-append sector as little-endian
  2026-06-18 16:23   ` Daniel P. Berrangé
@ 2026-06-18 17:49     ` Michael Bommarito
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Bommarito @ 2026-06-18 17:49 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Stefan Hajnoczi, Michael S . Tsirkin, Kevin Wolf, Hanna Reitz,
	qemu-block, qemu-devel

On Thu, Jun 18, 2026 at 12:23 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
> If it did write the patch, we could make an exception on the
> basis that there is only a single way to write this trivial fix.
>
> None the less the Assisted-by advertizing hoarding should be
> removed before merging, as even our new proposed looser policy,
> rejects use of Assisted-by.

FWIW, the patch is pretty mechanical and basically consisted of sed on
a single function based on conversation with MST.  I told Claude to
make the change, and then it ran the rest of the testing and patch
setup.

Appreciate the policy is in flux and sorry for not flagging that before.

Thanks,
Mike


^ permalink raw reply	[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.