Re: bhyve NVMe 1.4 support

From: Chuck Tuffli <>
Date: Sun, 20 Mar 2022 18:35:33 UTC
On Sun, Mar 20, 2022 at 8:13 AM Mario Marietto <> wrote:
> ----> Help me understand what "not recognized" means. The device nvme0n1 :
> I don't see the partitions that are stored inside the disk nvme. And I'm not able to mount the NTFS partition that's mapped as nvd0p2 under FreeBSD.

Thank you, I understand the question now. As an experiment, I created
a zvol, copied a FreeBSD disk image to it, and verified that fdisk
showed what I expected on the guest. I.e. :

#  zfs create -V 20G zroot/vmvol/gptdisk
#  dd if=/vms/.img/FreeBSD-14.0-CURRENT-amd64.raw
of=/dev/zvol/zroot/vmvol/gptdisk bs=1m
#  gpart recover zvol/zroot/vmvol/gptdisk
< add /dev/zvol/zroot/vmvol/gptdisk to test-vm configuration >
# vm start test-vm
# ssh root@test-vm lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 21.04
Release:        21.04
Codename:       hirsute
No LSB modules are available.
#  ssh root@test-vm fdisk -l /dev/nvme1n1
Disk /dev/nvme1n1: 20 GiB, 21474836480 bytes, 41943040 sectors
Disk model: bhyve-NVMe
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1B73327C-EAE2-11EB-90A0-002590EC5BF2

Device           Start      End Sectors  Size Type
/dev/nvme1n1p1       3      129     127 63.5K FreeBSD boot
/dev/nvme1n1p2     130    66713   66584 32.5M EFI System
/dev/nvme1n1p3   66714  2163865 2097152    1G FreeBSD swap
/dev/nvme1n1p4 2163866 10552473 8388608    4G FreeBSD UFS

The bhyve invocation is:
bhyve -c 2 -m 2G -Hw \
    -s 0,hostbridge \
    -s 4:0,virtio-blk,/dev/zvol/zroot/vms/test-vm/disk0 \
    -s 5:0,nvme,/dev/zvol/zroot/vmvol/disk0 \
    -s 6:0,nvme,/dev/zvol/zroot/vmvol/gptdisk \
    -s 7:0,virtio-net,tap0,mac=58:9c:fc:0b:ed:d6
    -s 31,lpc \
    -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
    -l com1,/dev/nmdm-test-vm.1A \

Note that my experiment is different from what you are doing. But I
would expect a Zvol and raw block device to behave the same as a
backing-store for an emulated NVMe drive in bhyve. My experiment ran
on -current, but the behavior in this area should be identical to the
13.0-p8 version you are using.

Does the output on the host of
 # hd -n 256 /dev/nvd0
match the output on the guest of
 # hd -n 256 /dev/nvme0n1