emulated PCI device BAR size

Chuck Tuffli chuck at freebsd.org
Sat Mar 23 21:35:56 UTC 2019


On Mon, Mar 18, 2019 at 10:15 AM Chuck Tuffli <chuck at freebsd.org> wrote:
>
> In debugging why Windows doesn't like bhyve's NVMe device emulation,
> another developer mentioned that the NVMe specification defines the
> minimum size of BAR[0] to be 16K bytes. And while most OS don't
> enforce this requirement, evidently, Windows does.
>
> On the surface, a "minimum BAR size" sounds odd, but the MMIO BAR in
> NVMe includes the doorbell registers for each queue. And since the
> maximum number of queues is implementation specific, there isn't a
> fixed size for the BAR.
>
> So my question is how to best fix this. The easiest would be to add a
> check to the BAR size calculation in pci_nvme.c along the lines of:
>     #define NVME_MMIO_SPACE_MIN    (1 << 14)
>     ...
>     pci_membar_sz = MAX( <calculation based on queue count>,
> NVME_MMIO_SPACE_MIN);

I went down this route and have a patch up for review
(https://reviews.freebsd.org/D19676) if anyone is interested.

--chuck


More information about the freebsd-virtualization mailing list