Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2019 10:15:50 -0700
From:      Chuck Tuffli <chuck@freebsd.org>
To:        freebsd-virtualization@freebsd.org
Subject:   emulated PCI device BAR size
Message-ID:  <CAKAYmMKd5o=f8Z5uzF6pQnZqWLzRLAL3U7iM5inuodQs92pudA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKAYmMKd5o=f8Z5uzF6pQnZqWLzRLAL3U7iM5inuodQs92pudA>