[PATCH v2 3/5] virtio: mmio: Keep vendor id little endian

Daniel Palmer daniel at thingy.jp
Mon Apr 6 16:24:09 CEST 2026


The vendor id is used as a little endian value but it gets
swapped to the CPU endian in readl(). Swap it back to le
to avoid the below weird output from `virtio info`.

Device 0: UMEQ VirtIO Block Device
            Type: Hard Disk
            Capacity: 1.0 MB = 0.0 GB (2056 x 512)

Signed-off-by: Daniel Palmer <daniel at thingy.jp>
---
 drivers/virtio/virtio_mmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 1cd737aca249..ddf873fa96fb 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -374,7 +374,7 @@ static int virtio_mmio_probe(struct udevice *udev)
 		 */
 		return 0;
 	}
-	uc_priv->vendor = readl(priv->base + VIRTIO_MMIO_VENDOR_ID);
+	uc_priv->vendor = cpu_to_le32(readl(priv->base + VIRTIO_MMIO_VENDOR_ID));
 
 	if (priv->version == 1)
 		writel(PAGE_SIZE, priv->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
-- 
2.51.0



More information about the U-Boot mailing list