# vm-bhyve problems with ethernet (realtek) pci passtrough



## jdb (Oct 14, 2018)

Hey guys 

I have problems with getting pci passtrough and vm-bhyve to work. Every time I start the VM the whole host system freezes and reboots (I think only when an ethernet cable is connected otherwise the VM simply won't start).


The VM only starts if I comment the passtrough line out. 
	
	



```
#passthru0="21/0/0"
```


*Information about the NIC:*
`pciconf -lv`


```
re0@pci0:21:0:0:    class=0x020000 card=0x34687470 chip=0x816810ec rev=0x06 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
```


Thanks in advance!


----------



## yuripv (Oct 14, 2018)

You need to reserve the devices you want to passthrough, see vmm(4).

Edit: here's a better link, looks like vmm.4 isn't installed in 11.2: https://www.freebsd.org/cgi/man.cgi...h=FreeBSD+12-current&arch=default&format=html


----------



## jdb (Oct 14, 2018)

Thanks for the fast answer yuripv 

For some reason I didn't save the file or I forgot the "_pptdevs"_ line in /boot/loader.conf.

Now the VM starts but crashes while booting Windows 10... :/

Edit: I'm gonna do a fresh install maybe that solves the problem...


----------



## jdb (Oct 14, 2018)

So after reinstalling Windows 10 the VM still crashes while booting


----------



## yuripv (Oct 14, 2018)

At least it's VM now and not the host system  do you get any output from bhyve?


----------



## jdb (Oct 14, 2018)

I never use the `bhyve` command. `bhyve` looks like it has more debugging features than *vm-bhyve */ `vm`

When I use `vm console <vmname>` then I get this output everytime:


```
Boot Failed. EFI DVD/CDROM
```

The windows logo shows up for a second and the VM crashes...

I also enabled 
	
	



```
debug="yes"
```
 in the VM config file.


----------



## SirDice (Oct 15, 2018)

Post your config for the Windows machine. 
https://github.com/churchers/vm-bhyve/wiki/Supported-Guest-Examples


----------



## jdb (Oct 15, 2018)

here is my config file


```
guest="windows"
uefi="yes"
#loader="default"
cpu=4
memory=16384M
debug="yes"
passthru0="21/0/0"
disk0_type="ahci-hd"
disk0_name="/dev/zvol/zroot/vm/<vmname>/<vmname>-disk0"
disk0_dev="custom"
#disk1_name="/usr/home/<username>/virtio-win-0.1.141.iso"
#disk1_type="ahci-cd"
#disk1_dev="custom"
graphics="yes"
xhci_mouse="yes"
graphics_listen="192.168.***.***"
graphics_port="5901"
graphics_res="1920x1080"
uuid="a494b05a-****-****-****-************"
```


----------



## SirDice (Oct 15, 2018)

How did you configure pptdevs?


----------



## jdb (Oct 15, 2018)

```
pptdevs="21/0/0"
```
 in /boot/loader.conf

```
vmm_load="YES"
```
 vmm is also enabled and loaded in to kernel


----------



## SirDice (Oct 15, 2018)

Did you reboot? Does pciconf(8) show it's not attached to if_re(4) any more?


----------



## jdb (Oct 15, 2018)

Yes I rebooted

Output of:
`pciconf -lev`

```
ppt0@pci0:21:0:0:    class=0x020000 card=0x34687470 chip=0x816810ec rev=0x06 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
```

`ifconfig` doesn't show *re0* and it's *not* attached to if_re(4)

Output of:
`vm passthru`


```
DEVICE     BHYVE ID     READY        DESCRIPTION
ppt0       21/0/0       Yes          RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
```


----------

