bhyve Unable to pass USB controller to guest

I am trying to run alpine linux as a guest in bhyve.

/boot/loader.conf:
Code:
vmm_load="YES"
pptdevs="0/20/0 0/26/0 0/29/0"

pciconf -lv:
Code:
ppt0@pci0:0:20:0:    class=0x0c0330 rev=0x04 hdr=0x00 vendor=0x8086 device=0x1e31 subvendor=0x1028 subdevice=0x0577
    vendor     = 'Intel Corporation'
    device     = '7 Series/C210 Series Chipset Family USB xHCI Host Controller'
    class      = serial bus
    subclass   = USB
ppt1@pci0:0:26:0:    class=0x0c0320 rev=0x04 hdr=0x00 vendor=0x8086 device=0x1e2d subvendor=0x1028 subdevice=0x0577
    vendor     = 'Intel Corporation'
    device     = '7 Series/C216 Chipset Family USB Enhanced Host Controller'
    class      = serial bus
    subclass   = USB
ppt2@pci0:0:29:0:    class=0x0c0320 rev=0x04 hdr=0x00 vendor=0x8086 device=0x1e26 subvendor=0x1028 subdevice=0x0577
    vendor     = 'Intel Corporation'
    device     = '7 Series/C216 Chipset Family USB Enhanced Host Controller'
    class      = serial bus
    subclass   = USB

/etc/rc.conf:
Code:
vm_enable="YES"
vm_dir="zfs:z_250.3/vms"

I have rebooted an can confirm that any USB devices plugged into the host no longer work with the host, so I am resorting to control the host over SSH.

Once I'm in, I am running vm-bhyve, specifically, alpine linux with the hopes of setting up hostapd to run a wifi AP.

alpine.conf:
Code:
loader="grub"
guest="linux"

cpu=1

memory=512M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="linux /boot/vmlinuz-virt initrd=/boot/initramfs-virt alpine_dev=cdrom:iso9660 modules=loop,squashfs,sd-mod,usb-storage,sr-mod"
grub_install1="initrd /boot/initramfs-virt"
grub_run0="linux /boot/vmlinuz-virt root=/dev/vda3 modules=ext4"
grub_run1="initrd /boot/initramfs-virt"

network0_mac="58:9c:fc:0f:de:05"
uuid="58a719b9-6c30-11ec-a85f-b8ca3a7a3269"

# @see: [URL]https://github.com/churchers/vm-bhyve/blob/master/sample-templates/config.sample[/URL]
# pass the PCI USB device
passthru0="0/20/0"

Now, the only configuration that successfully booted is the one with passthru0 set to 0/20/0 (the xHCI USB controller). If I include all of them, or any other controller or combination thereof, it won't boot. When including the xHCI controller and I run lsusb, I can see 2 USB hubs, but nothing beyond that. Additionally, running dmesg in the guest isn't showing any USB devices. I can see that the xhci kernel modules are loaded (lsmod | grep xhci).
 
Passing thru motherboard USB is problematic.
My suggestion is buy a cheap PCIe USB3 card and pass it thru.
 
Hi - thanks for the quick response.

What makes it problematic and why would a PCIe USB card work better?

Hmm, what I really want to do is setup an AP like I had before in Linux. All of my adapters are USB :(. If I just go buy a better PCIe wifi adapter, then that might be the best route to go then?
 
In my experience when you see all those USB addresses (0:0:20 0:0:28 0:0:29) it appears you can manipulate them separately.
As you have found that is not the case. All or none passed thru. Some boards all passed thru does not work right.
In my findings motherboard USB works best when there are separate USB2 and USB3 controllers.

You can try to pass through all onboard ports like your case but then you lose any host interface.
Everything must be done via ssh.

Note: Most passthrough devices have PCIe address like this 1:0:0 2:0:0 3:0:0
Those are your pass thru devices.
The lower addresses are motherboard resources.
 
Yes, I understand that by passing through the devices, I will lose that functionality.

I am confused by the last paragraph of your statement.

Are you suggesting I am using the wrong devices and that is why it isn't working? If so, I am taking the address like this (note: I turned off the machine that I was attempting to do the bhyve setup so this one has different addresses):
hostb0@pci0:0:0:0: class=0x060000 rev=0x09 hdr=0x00 vendor=0x8086 device=0x0150 subvendor=0x1028 subdevice=0x0577
vendor = 'Intel Corporation'
device = 'Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller'
class = bridge
subclass = HOST-PCI


Assuming this were of interest, then, its address would be 0/0/0, correct? That corresponds directly to: pci0:0:0:0. I do see separate controllers for USB 3 and USB 2. There are 2 controllers for USB 2 and 1 for USB 3.

But, as I had indicated, when I attempt to use all 3 devices, the VM won't boot. I'm not given very much information as to why.
 
I ended up buying a PCIe wifi adapter so I'd have faster wifi. The PCI passthru worked. Now, if I can just figure out what I need to do for routing, I'll have a working router :).
 
Back
Top