Re: Multiple bugs on bhyve present on FreeBSD 13R p7 while passing thru USB controller and graphic card

From: Mario Marietto <marietto2008_at_gmail.com>
Date: Tue, 08 Feb 2022 17:45:32 UTC
In my system I have two graphic cards. This is the first one,configured as
default from the bios and used on the freebsd host :

vgapci0@pci0:0:2:0:     class=0x030000 rev=0x02 hdr=0x00 vendor=0x8086
device=0x3e98 subvendor=0x1458 subdevice=0xd000
   vendor     = 'Intel Corporation'
   device     = 'CoffeeLake-S GT2 [UHD Graphics 630]'
   class      = display
   subclass   = VGA


the USB controller that I'm trying to pass thru is the following :

ppt0@pci0:1:0:0:        class=0x0c0330 rev=0x03 hdr=0x00 vendor=0x1912
device=0x0014 subvendor=0x1912 subdevice=0x0015
   vendor     = 'Renesas Technology Corp.'
   device     = 'uPD720201 USB 3.0 Host Controller'
   class      = serial bus
   subclass   = USB

the graphic card that I'm trying to pass thru is the following :

ppt1@pci0:2:0:0:        class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de
device=0x1e04 subvendor=0x19da subdevice=0x2503
   vendor     = 'NVIDIA Corporation'
   device     = 'TU102 [GeForce RTX 2080 Ti]'
   class      = display
   subclass   = VGA
ppt2@pci0:2:0:1:        class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de
device=0x10f7 subvendor=0x19da subdevice=0x2503
   vendor     = 'NVIDIA Corporation'
   device     = 'TU102 High Definition Audio Controller'
   class      = multimedia
   subclass   = HDA
ppt3@pci0:2:0:2:        class=0x0c0330 rev=0xa1 hdr=0x00 vendor=0x10de
device=0x1ad6 subvendor=0x19da subdevice=0x2503
   vendor     = 'NVIDIA Corporation'
   device     = 'TU102 USB 3.1 Host Controller'
   class      = serial bus
   subclass   = USB
ppt4@pci0:2:0:3:        class=0x0c8000 rev=0xa1 hdr=0x00 vendor=0x10de
device=0x1ad7 subvendor=0x19da subdevice=0x2503
   vendor     = 'NVIDIA Corporation'
   device     = 'TU102 USB Type-C UCSI Controller'
   class      = serial bus

On the file /boot/loader.conf I have reserved the following PCI addresses :

pptdevs="1/0/0 2/0/0 2/0/1 2/0/2 2/0/3"

If I try to boot a virtual machine in raw format passing thru my usb
controller and my graphic card I get a different error :

this bhyve commands :

bhyve -S -c sockets=2,cores=2,threads=2 -m 8G -w -H \
-s 0,hostbridge \
-s 1,virtio-blk,/mnt/da2p2/bhyve/os/Linux/impish-cuda-11-5-nvidia-495.img \
-s 3:0,passthru,2/0/0 \
-s 3:1,passthru,2/0/1 \
-s 3:2,passthru,2/0/2 \
-s 3:3,passthru,2/0/3 \
-s 4:0,passthru,1/0/0 \
-s 9,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900 \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
-l com1,stdio \
vm0

produces this error :

fbuf frame buffer base: 0xa43800000 [sz 16777216]
Assertion failed: (error == 0), function modify_bar_registration, file
/usr/src/usr.sbin/bhyve/pci_emul.c, line 501. Abort.


Il giorno mar 8 feb 2022 alle ore 18:17 Aryeh Friedman <
aryeh.friedman@gmail.com> ha scritto:

>
> I'm using bhyve on FreeBSD 13R p7 and I'm trying to pass thru my usb
>> controller and / or my graphic card while at the same time I'm trying to
>> boot 3 operating systems (Ubuntu,Windows and FreeBSD 13) installed on a
>> SATA and / or NVME disk using the virtio-blk driver and the ahci-hd driver.
>>
>
> It is my understand for devices to be successfully passed through (based
> on my own semi-working attempts and research) the device must meet the
> following two conditions:
>
> 1. Be used exclusively by the guest OS and not the host OS
> 2. The host OS needs to not even load drivers for the device(s)
>
> For example on the GPU this means you would need to boot the host from a
> serial port and/or GPU that is not used by the host and not loaded at boot
> time and then, and only then, can you pass it through to the guest OS
> (wither or not the guest OS recognizes it is an other question though).
>
> As to good stable bhyve invocation I recommend you look at the source
> code/output of either the shell based ports for making bhyve VM's or at
> PetiteCloud (if you do the second I would be very interested in the results
> so I can incorporate them into a future version of PC).
>
>
> --
> Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org
>


-- 
Mario.