From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Claude <noreply@claude.ai>, Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH master 1/3] virtio: ring: fix stale data in queue after reset
Date: Mon, 12 Jan 2026 09:55:39 +0100 [thread overview]
Message-ID: <20260112085548.2952525-1-a.fatoum@barebox.org> (raw)
When resetting barebox for QEMU Virt or chainloading it, the log is
spammed with:
virtio_net virtio1: id 65536 out of range
This is because we have two ways to allocate the vrings, either via
dma_alloc_coherent or memalign and the latter doesn't zero the queues.
A better fix that makes use of the DMA APIs unconditionally will follow
in a later release.
Co-developed-by: Claude <noreply@claude.ai>
[ahmad: Claude was pointed at QEMU, Linux and U-Boot implementations
and found the discrepancy, but had a different less efficient fix]
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/virtio/virtio_ring.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index c1c84e49615f..8b6469f54d2a 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -369,6 +369,8 @@ static void *vring_alloc_queue(struct virtio_device *vdev,
phys_addr_t phys_addr = virt_to_phys(queue);
*dma_handle = (dma_addr_t)phys_addr;
+ memset(queue, 0x00, PAGE_ALIGN(size));
+
/*
* Sanity check: make sure we dind't truncate
* the address. The only arches I can find that
--
2.47.3
next reply other threads:[~2026-01-12 8:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 8:55 Ahmad Fatoum [this message]
2026-01-12 8:55 ` [PATCH master 2/3] scripts: Makefile.lib: suppress graph_port warnings for overlays Ahmad Fatoum
2026-01-12 8:55 ` [PATCH master 3/3] ARM: Rockchip: rk3576-prtpuk: suppress video graph warning Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260112085548.2952525-1-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
--cc=noreply@claude.ai \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox