Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Mar 2022 12:54:53 +0100
From:      Mario Marietto <marietto2008@gmail.com>
To:        FreeBSD virtualization <freebsd-virtualization@freebsd.org>, hackers@freebsd.org
Subject:   Virtio-win driver (virtio-blk and virtio-scsi) don't work when they are used on bhyve with Windows 11 as guest os
Message-ID:  <CA%2B1FSigxiPPHcE-eig20a6S%2BVEquEwiwG_NvpOahPK3BQh=kng@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--0000000000009ac17405db09a3ae
Content-Type: text/plain; charset="UTF-8"

Hello.

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'm using this FreeBSD version :


FreeBSD marietto 13.0-RELEASE FreeBSD 13.0-RELEASE #8
n244809-dff3dead3734: Wed Feb 23 13:16:32 CET
2022     marietto@marietto:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64


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)


As you can see I've used the virtio-blk driver,so inside the Windows 11 VM
I've installed the latest version of the virtio drivers. The disks attached
are 0 byte large,so they aren't recognized by Windows 11. Is this a bug or
what ? They are USB 3.0 disks. You can give a look at the images below if u
want to have a better understanding :


https://forums.freebsd.org/attachments/1-jpg.13311/
https://forums.freebsd.org/attachments/2-jpg.13312/


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 tried also with :


-s 2,virtio-scsi,/dev/da4p2 \
-s 3,virtio-scsi,/dev/da2p1 \


and I have also installed the virtio-scsi driver on Windows 11,that has
been accepted by windows,but the disks aren't recognized :


https://forums.freebsd.org/attachments/screenshot_2022-03-13_11-23-54-jpg.13321/
https://forums.freebsd.org/attachments/screenshot_2022-03-13_11-10-16-jpg.13320/


Finally I tried by virtualizing ubuntu with bhyve using the virtio-scsi
driver on ubuntu as guest os and it worked,so there is a bug only on the
drivers for windows. You can see what happens with ubuntu going on the
freebsd forum at this address :


https://forums.FreeBSD.org/threads/usb-3-0-disks-not-recognized-by-windows-if-passed-through-as-slots.84402/post-559924


I have also opened a bug request below,but no one replied until now.
https://github.com/virtio-win/kvm-guest-drivers-windows/issues/747


-- 
Mario.

--0000000000009ac17405db09a3ae
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello.</div><div><br></div><div></div><div><div><div =
id=3D"gmail-m_-5563554548007041422gmail-issue-1172720202"><div><div><span><=
table><tbody><tr><td><p dir=3D"auto"></p><p dir=3D"auto">What I want to ach=
ieve is to pass thru two of my NTFS=20
&quot;formatted&quot; disks to a Windows 11 VM,but without passing them thr=
u using
 the USB controller in FreeBSD with a bhyve virtual machine (in the=20
example below I tried to boot Windows 11 from the nvme disk nvd0.</p>
<p dir=3D"auto"><br></p><p dir=3D"auto">I&#39;m using this FreeBSD version =
:</p>
<div><pre><code><br>FreeBSD marietto 13.0-RELEASE FreeBSD 13.0-RELEASE #8 n=
244809-dff3dead3734: Wed Feb 23 13:16:32 CET
2022     marietto@marietto:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
</code></pre></div>
<p dir=3D"auto"><br></p><p dir=3D"auto">I&#39;ve configured the bhyve VM li=
ke this :</p>
<div><pre><code>
bhyve -S -c sockets=3D1,cores=3D2,threads=3D2 -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=3D/dev/dsp,rec=3D/dev/dsp \
-s 29,fbuf,tcp=3D[0.0.0.0:5904](<a href=3D"http://0.0.0.0:5904/" target=3D"=
_blank">http://0.0.0.0:5904/</a>),w=3D1440,h=3D900 \
-s 30,xhci,tablet \
-s 31,lpc \                          =20
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
vm4 &lt; /dev/null &amp; sleep 2 &amp;&amp; vncviewer 0:4
</code></pre></div>
<p dir=3D"auto"><br></p><p dir=3D"auto">These are the NTFS disks that I wou=
ld like to see inside the Windows 11 guest os :</p>
<div><pre><code><br>-s 2,virtio-blk,/dev/da4p2 \
-s 3,virtio-blk,/dev/da2p1 \


=3D&gt;         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)


=3D&gt;         34  23437705149  da2  GPT  (11T)
           34         2014       - free -  (1.0M)
2048  23437701120    1  ms-basic-data  (11T)
23437703168         2015       - free -  (1.0M)
</code></pre></div>
<p dir=3D"auto"><br></p><p dir=3D"auto">As you can see I&#39;ve used the vi=
rtio-blk driver,so inside=20
the Windows 11 VM I&#39;ve installed the latest version of the virtio=20
drivers. The disks attached are 0 byte large,so they aren&#39;t recognized=
=20
by Windows 11. Is this a bug or what ? They are USB 3.0 disks. You can=20
give a look at the images below if u want to have a better understanding
 :</p>
<p dir=3D"auto"><br></p><p dir=3D"auto"><a href=3D"https://forums.freebsd.o=
rg/attachments/1-jpg.13311/" rel=3D"nofollow" target=3D"_blank">https://for=
ums.freebsd.org/attachments/1-jpg.13311/</a><br>
<a href=3D"https://forums.freebsd.org/attachments/2-jpg.13312/" rel=3D"nofo=
llow" target=3D"_blank">https://forums.freebsd.org/attachments/2-jpg.13312/=
</a></p>
<p dir=3D"auto"><br></p><p dir=3D"auto">I&#39;ve tried also like this :</p>
<div><pre><code><br>bhyve -S -c sockets=3D1,cores=3D2,threads=3D2 -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=3D/dev/dsp,rec=3D/dev/dsp \
-s 29,fbuf,tcp=3D[0.0.0.0:5904](<a href=3D"http://0.0.0.0:5904/" target=3D"=
_blank">http://0.0.0.0:5904/</a>),w=3D1440,h=3D900 \
-s 30,xhci,tablet \
-s 31,lpc \                          =20
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
vm4 &lt; /dev/null &amp; sleep 2 &amp;&amp; vncviewer 0:4
</code></pre></div>
<p dir=3D"auto"><br></p><p dir=3D"auto">and I get this error :</p>
<p dir=3D"auto"><strong><br></strong></p><p dir=3D"auto"><strong>Assertion =
failed: (n &gt;=3D 2 &amp;&amp; n &lt;=3D=20
BLOCKIF_IOV_MAX + 2), function pci_vtblk_proc, file=20
/usr/src/usr.sbin/bhyve/pci_virtio_block.c, line 324.</strong></p>
<p dir=3D"auto"><br></p><p dir=3D"auto">I have tried also with :</p>
<div><pre><code><br>-s 2,virtio-scsi,/dev/da4p2 \
-s 3,virtio-scsi,/dev/da2p1 \
</code></pre></div>
<p dir=3D"auto"><br></p><p dir=3D"auto">and I have also installed the virti=
o-scsi driver on=20
Windows 11,that has been accepted by windows,but the disks aren&#39;t=20
recognized :</p>
<p dir=3D"auto"><br></p><p dir=3D"auto"><a href=3D"https://forums.freebsd.o=
rg/attachments/screenshot_2022-03-13_11-23-54-jpg.13321/" rel=3D"nofollow" =
target=3D"_blank">https://forums.freebsd.org/attachments/screenshot_2022-03=
-13_11-23-54-jpg.13321/</a><br>
<a href=3D"https://forums.freebsd.org/attachments/screenshot_2022-03-13_11-=
10-16-jpg.13320/" rel=3D"nofollow" target=3D"_blank">https://forums.freebsd=
.org/attachments/screenshot_2022-03-13_11-10-16-jpg.13320/</a></p>
<p dir=3D"auto"><br></p><p dir=3D"auto">Finally I tried by virtualizing ubu=
ntu with bhyve using=20
the virtio-scsi driver on ubuntu as guest os and it worked,so there is a
 bug only on the drivers for windows. You can see what happens with=20
ubuntu going on the freebsd forum at this address :</p><p dir=3D"auto"><br>=
</p>
<p dir=3D"auto"><a href=3D"https://forums.FreeBSD.org/threads/usb-3-0-disks=
-not-recognized-by-windows-if-passed-through-as-slots.84402/post-559924" re=
l=3D"nofollow" target=3D"_blank">https://forums.FreeBSD.org/threads/usb-3-0=
-disks-not-recognized-by-windows-if-passed-through-as-slots.84402/post-5599=
24</a></p><p dir=3D"auto"><br></p><p dir=3D"auto">I have also opened a bug =
request below,but no one replied until now. <br></p></td></tr></tbody></tab=
le></span></div></div></div></div></div><div><a href=3D"https://github.com/=
virtio-win/kvm-guest-drivers-windows/issues/747" target=3D"_blank">https://=
github.com/virtio-win/kvm-guest-drivers-windows/issues/747</a></div><br cle=
ar=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"gmail_signature" data-smart=
mail=3D"gmail_signature">Mario.<br></div></div>

--0000000000009ac17405db09a3ae--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B1FSigxiPPHcE-eig20a6S%2BVEquEwiwG_NvpOahPK3BQh=kng>