Date: Tue, 17 Mar 2026 11:34:58 +0000 From: Jessica Clarke <jrtc27@freebsd.org> To: Andrew Turner <andrew@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>, Sarah Walker <sarah.walker2@arm.com> Subject: Re: git: 1d13d938fe6c - main - virtio: Ensure power-of-two alignment for indirect queue Message-ID: <8F587FE2-CF54-4605-9CD6-581FC1D98D34@freebsd.org> In-Reply-To: <69b939d7.26113.1aca36de@gitrepo.freebsd.org>
index | next in thread | previous in thread | raw e-mail
On 17 Mar 2026, at 11:24, Andrew Turner <andrew@freebsd.org> wrote: > > The branch main has been updated by andrew: > > URL: https://cgit.FreeBSD.org/src/commit/?id=1d13d938fe6c7639d2bb4cb5248a1f81275b6891 > > commit 1d13d938fe6c7639d2bb4cb5248a1f81275b6891 > Author: Sarah Walker <sarah.walker2@arm.com> > AuthorDate: 2026-03-17 10:54:30 +0000 > Commit: Andrew Turner <andrew@FreeBSD.org> > CommitDate: 2026-03-17 10:56:27 +0000 > > 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 > --- > sys/dev/virtio/virtqueue.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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; Why is this the alignment in the first place? Pre-busdma it just used malloc with no explicit alignment. Given: size = indirect_size * sizeof(struct vring_desc); can’t this get quite large? Except VIRTIO_MAX_INDIRECT looks to be rather stale, tied to the malloc rather than busdma world... Jessica > 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 */ >home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8F587FE2-CF54-4605-9CD6-581FC1D98D34>
