aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah Walker <sarah.walker2@arm.com>2026-03-17 10:54:30 +0000
committerAndrew Turner <andrew@FreeBSD.org>2026-03-17 10:56:27 +0000
commit1d13d938fe6c7639d2bb4cb5248a1f81275b6891 (patch)
tree7230ce43c66bca7a786eb31994cdb84d223dc810
parent7b9bb32d1cc6779139780baed983129b53a7f36e (diff)
virtio: Ensure power-of-two alignment for indirect queue
Some platforms enforce power-of-two alignment for bus_dma tags. Rounding up the natural size may result in over-alignment, but should be safe. PR: 293770 Reviewed by: andrew Fixes: c499ad6f997c ("virtio: Use bus_dma for ring and indirect buffer allocations") Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D55843
-rw-r--r--sys/dev/virtio/virtqueue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/virtio/virtqueue.c b/sys/dev/virtio/virtqueue.c
index b7fdb4703ccb..10b5179bd3d5 100644
--- a/sys/dev/virtio/virtqueue.c
+++ b/sys/dev/virtio/virtqueue.c
@@ -341,7 +341,7 @@ virtqueue_init_indirect(struct virtqueue *vq, int indirect_size)
align = size;
error = bus_dma_tag_create(
bus_get_dma_tag(dev), /* parent */
- align, /* alignment */
+ roundup_pow_of_two(align), /* alignment */
0, /* boundary */
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */