emulated PCI device BAR size
Chuck Tuffli
chuck at freebsd.org
Mon Mar 18 17:16:10 UTC 2019
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);
While this makes Windows happy, are there any implications to this
approach other than chewing up more memory than the device actually
needs? Alternatively, is there a better mechanism to use in this case?
--chuck
More information about the freebsd-virtualization
mailing list