RE: Virtio-win driver (virtio-blk and virtio-scsi) don't work when they are used on bhyve with Windows 11 as guest os

From: <jason_at_tubnor.net>
Date: Sun, 27 Mar 2022 21:15:39 UTC
 

 

 


What I want to achieve is to pass thru two of my NTFS "formatted" disks to a Windows 11 VM,but without passing them thru using the USB controller in FreeBSD with a bhyve virtual machine (in the example below I tried to boot Windows 11 from the nvme disk nvd0.

I've configured the bhyve VM like this :

 
bhyve -S -c sockets=1,cores=2,threads=2 -m 4G -w -H -A \
-s 0,hostbridge \
-s 1,ahci-hd,/dev/nvd0 \
-s 2,virtio-blk,/dev/da4p2 \
-s 3,virtio-blk,/dev/da2p1 \
-s 8,virtio-net,tap4 \
-s 10,hda,play=/dev/dsp,rec=/dev/dsp \
-s 29,fbuf,tcp=[0.0.0.0:5904](http://0.0.0.0:5904/),w=1440,h=900 \
-s 30,xhci,tablet \
-s 31,lpc \                           
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
vm4 < /dev/null & sleep 2 && vncviewer 0:4

 

These are the NTFS disks that I would like to see inside the Windows 11 guest os :


-s 2,virtio-blk,/dev/da4p2 \
-s 3,virtio-blk,/dev/da2p1 \
 
 
=>         34  19532873661  da4  GPT  (9.1T)
           34        32734    1  ms-reserved  (16M)
32768  19532838912    2  ms-basic-data  (9.1T)
19532871680         2015       - free -  (1.0M)
 
 
=>         34  23437705149  da2  GPT  (11T)
           34         2014       - free -  (1.0M)
2048  23437701120    1  ms-basic-data  (11T)
23437703168         2015       - free -  (1.0M)

I've tried also like this :


bhyve -S -c sockets=1,cores=2,threads=2 -m 4G -w -H -A \
-s 0,hostbridge \
-s 1,ahci-hd,/dev/nvd0 \
-s 2,virtio-blk,/dev/da4 \
-s 3,virtio-blk,/dev/da2 \
-s 8,virtio-net,tap4 \
-s 10,hda,play=/dev/dsp,rec=/dev/dsp \
-s 29,fbuf,tcp=[0.0.0.0:5904](http://0.0.0.0:5904/),w=1440,h=900 \
-s 30,xhci,tablet \
-s 31,lpc \                           
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
vm4 < /dev/null & sleep 2 && vncviewer 0:4

 

and I get this error :

 

Assertion failed: (n >= 2 && n <= BLOCKIF_IOV_MAX + 2), function pci_vtblk_proc, file /usr/src/usr.sbin/bhyve/pci_virtio_block.c, line 324.

I have also opened a bug request below,but no one replied until now. 

 

Use nvme or ahci-hd for da4/da2 and see what you get. The whole disk needs to go in there so Windows sees the GPT label. The other thing that comes to mind is that FreeBSD has hold of the disks and won’t allow them to be inserted, similar to issues when passing zvol into guests when volmode<>dev.

 

Cheers,

 

Jason.