Page MenuHomeFreeBSD

gve: align dma buffers to requested boundary
Needs ReviewPublic

Authored by jtranoleary_google.com on Mon, Oct 5, 10:02 PM.

Details

Reviewers
markj
Group Reviewers
network
Summary

In the bus_dma(9) framework, allocating a DMA buffer where maxsize is
smaller than the requested alignment (e.g. requesting a 64-byte
structure with 4096-byte page alignment) can trigger edge cases in
sub-page allocators and violates standard busdma conventions.

Round up maxsize, maxsegsize, and the loaded DMA buffer size to the
requested alignment boundary using roundup2(). This ensures that
page-aligned hardware structures consistently receive full-page
allocations across all architectures and releases, preventing alignment
failures during device resource configuration.

Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77740
Build 74623: arc lint + arc unit

Event Timeline

This patch and the two that follow it fix boot panics caused by gve on some ARM images which don't have https://reviews.freebsd.org/D59476 . gve fails to attach properly due to DMA issues and then panics when trying to unwind allocations due to null pointer dereferences.

This patch and the two that follow it fix boot panics caused by gve on some ARM images which don't have https://reviews.freebsd.org/D59476 . gve fails to attach properly due to DMA issues and then panics when trying to unwind allocations due to null pointer dereferences.

Does the commit from D59476 fix the panic? If so, why do we need this patch?