On Wed, Jun 17, 2026 at 11:17:27AM -0400, Michael Bommarito wrote: > The zoned block-device fields in the virtio-blk header are typed > __virtio{32,64}, so their endianness follows VIRTIO_F_VERSION_1. The > zoned feature is only defined for VIRTIO 1.x devices, and the virtio > specification defines all of its fields as little-endian. Commit > b16a1756c716 ("virtio_blk: mark all zone fields LE") tagged them > __le* for exactly this reason, but commit f1ba4e674feb ("virtio-blk: > fix to match virtio spec") re-applied the reviewed version of the > original zoned series -- which predated b16a1756 -- and silently > restored the __virtio* typing together with the matching > virtio*_to_cpu() / virtio_cread() accessors in the driver. > > Restore the little-endian typing for the zoned configuration-space > characteristics, the zone descriptor, the zone report header and the > ZONE_APPEND in-header sector, and read them with le*_to_cpu() and > virtio_cread_le() to match. > > There is no functional change on any spec-compliant device: zoned > requires VIRTIO_F_VERSION_1, and for a VERSION_1 device > virtio*_to_cpu() is identical to le*_to_cpu(). The change makes the > uapi types describe the actual wire format and removes a latent > endianness mismatch for a (non-conformant) legacy device on a > big-endian guest. > > Fixes: f1ba4e674feb ("virtio-blk: fix to match virtio spec") > Suggested-by: Michael S. Tsirkin > Assisted-by: Claude:claude-opus-4-8 > Signed-off-by: Michael Bommarito > --- > Testing: > - Builds with no new warnings; sparse endian-clean (C=2, > __CHECK_ENDIAN__, CONFIG_BLK_DEV_ZONED=y) both before and after. > - Booted under QEMU with a host-managed zoned device exposed through > virtio-blk. Zone revalidation, blkzone report and a sequential > write / write-pointer check return correct values; blktests zbd > device tests 001-006 (sysfs+ioctl, report zone, reset, write split, > write ordering, revalidate) pass, with results identical before and > after this change -- expected, since on a VIRTIO_F_VERSION_1 device > virtio*_to_cpu() == le*_to_cpu(). > > drivers/block/virtio_blk.c | 38 +++++++++++++++------------------ > include/uapi/linux/virtio_blk.h | 18 ++++++++-------- > 2 files changed, 26 insertions(+), 30 deletions(-) Reviewed-by: Stefan Hajnoczi