Page MenuHomeFreeBSD

nvme: Add handling for bar5
ClosedPublic

Authored by jtranoleary_google.com on Oct 16 2025, 7:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 8, 4:46 PM
Unknown Object (File)
Tue, Nov 4, 12:12 PM
Unknown Object (File)
Fri, Oct 31, 1:15 PM
Unknown Object (File)
Thu, Oct 30, 4:04 PM
Unknown Object (File)
Sun, Oct 26, 9:13 PM
Unknown Object (File)
Sat, Oct 25, 5:38 PM
Unknown Object (File)
Wed, Oct 22, 4:50 PM
Unknown Object (File)
Tue, Oct 21, 11:35 PM

Details

Summary

The NVMe spec allows the Table BIR (TBIR) and PBA DIR (PBIR) to
be 0, 4, or 5. The existing NVMe driver basically only has support
for 4, perhaps under the assumption that BAR4 is 64-bit and also
occupies BAR5.

This change adds support for BAR5, covering the case where BAR4
and BAR5 might both be present and 32-bit, where the Table BIR
might be 4 and the PBA BIR might be 5, or vice versa.

The NVMe spec (in the SR-IOV section) also permits VFs to use BIR=2,
so I haven't added stricter checks on which BIR will be permitted
by the driver.

Co-authored-by: Matt Delco <delco@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/dev/nvme/nvme_ctrlr.c
1773

double free if these are the same BAR?

This looks good to me... Never mind my earlier misreading.

sys/dev/nvme/nvme_ctrlr.c
1773

oh! I confused the _id and _resource variables.

This revision is now accepted and ready to land.Tue, Oct 28, 7:42 PM

I will commit this, with MFC to all supported branches, as soon as my CI finishes.

This revision was automatically updated to reflect the committed changes.