HomeFreeBSD

bhyve: Fix NVMe BAR size calculation

Description

bhyve: Fix NVMe BAR size calculation

The NVMe specification defines bits 13:4 of BAR0 as Reserved (i.e. 0x0).
Most drivers do not enforce this, but the Windows NVMe driver does and
will refuse to start the device (i.e. error 10) if any of these bits are
set.

The current BAR size calculation tries to minimize the amount of memory
the device reserves by scaling the BAR size by the maximum number of
queues supported by the device. But unless the device supports a large
number of queue pairs (over 1536), it will reserve too little memory.

The fix is to allocate a minimum of 16K bytes for BAR0.

Tested on Windows Server 2016 and 2019

Reviewed by: imp (mentor), araujo, jhb, bhyve
Approved by: imp (mentor), bhyve (jhb)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19676

Details

Provenance
chuckAuthored on
Reviewer
imp
Differential Revision
D19676: bhyve: Fix NVMe BAR size calculation
Parents
rS345955: vn_vmap_seekhole(): align running offset to the block boundary.
Branches
Unknown
Tags
Unknown