HomeFreeBSD

nvme: Add handling for bar5

Description

nvme: Add handling for bar5

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.

This enables FreeBSD on Google Compute Engine C4 Machines.

Approved by: re (cperciva)
MFC after: 3 days
Reviewed by: imp
Sponsored by: Google
Co-authored-by: Matt Delco <delco@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>
Differential Revision: https://reviews.freebsd.org/D53140

(cherry picked from commit 7b32f4f0a7fe9b1b2f5a3905ca15f656713255ad)
(cherry picked from commit 6c321dc15d5234742c6452e975f41f4a24b52e1d)

Details

Provenance
jtranoleary_google.comAuthored on Oct 28 2025, 8:43 PM
cpercivaCommitted on Nov 4 2025, 12:29 AM
Reviewer
imp
Differential Revision
D53140: nvme: Add handling for bar5
Parents
rG83a23ceb4088: ice(4): Add support for E835-XXV-4 adapter
Branches
Unknown
Tags
Unknown