bhyve: passthrough of PCIe device without MSI possible?

Neel Natu neelnatu at gmail.com
Tue May 22 19:43:19 UTC 2018


On Sun, May 20, 2018 at 12:04 PM, Mario Lobo <lobo at bsd.com.br> wrote:
> Hi Felix;
>
> I had the same impression and I was attempting to do the same with no
> success.
>
> Have you managed to make it work?
>
> 2018-05-11 12:26 GMT-03:00 Felix Palmen <felix at palmen-it.de>:
>
>> I have the following PCIe card on a host running 11.1-RELEASE:
>>
>> | ppt0 at pci0:5:0:0:      class=0x078000 card=0x00011b74 chip=0x08101b74
>> rev=0x14 hdr=0x00
>> |     vendor     = 'OpenVox Communication Co. Ltd.'
>> |     class      = simple comms
>>
>> it doesn't support MSI according to `pciconf -lbc`:
>>
>> | ppt0 at pci0:5:0:0:    class=0x078000 card=0x00011b74 chip=0x08101b74
>> rev=0x14 hdr=0x00
>> |     bar   [10] = type Memory, range 32, base 0xdfe00000, size 524288,
>> enabled
>>
>> Trying to pass this card to a guest using `vm-bhyve` gives me the
>> following in `bhyve.log`:
>>
>> | bhyve: failed to initialize MSI for PCI 5/0/0
>>
>> and this in `vm-byve.log`:
>>
>> | [bhyve options: -c 2 -m 2G -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd
>> -U 9f2546f5-5464-11e8-8b52-d05099c0f275 -S]
>> | [bhyve devices: -s 0,hostbridge -s 31,lpc -s
>> 4:0,virtio-blk,/dev/zvol/zroot/vm/pbx/disk0 -s
>> 5:0,virtio-net,tap2,mac=58:9c:fc:00:d7:6b -s 6:0,passthru,5/0/0 -s
>> 7:0,fbuf,tcp=0.0.0.0:5900]
>> | [bhyve console: -l com1,/dev/nmdm0A]
>> | [bhyve iso device: -s 3:0,ahci-cd,/var/vm/.config/null.iso]
>> | starting bhyve (run 1)
>> | bhyve exited with status 1
>>
>> Now .. is it actually possible to pass such a device to a bhyve guest?
>> From the code comment here:
>> <https://github.com/freebsd/freebsd/blob/master/usr.sbin/bhy
>> ve/pci_passthru.c#L257>
>> I assumed MSI would be "emulated" if necessary?
>>

I suspect that your PCI device does not advertise the capabilities bit
in its status register.

MSI emulation depends on this bit being set:
https://github.com/freebsd/freebsd/blob/master/usr.sbin/bhyve/pci_passthru.c#L263

I can't see any reason this wouldn't work by emulating that bit and
the capabilities pointer in config space.

best
Neel

>> TIA, Felix
>>
>> --
>>  Dipl.-Inform. Felix Palmen  <felix at palmen-it.de>   ,.//..........
>>  {web}  http://palmen-it.de  {jabber} [see email]   ,//palmen-it.de
>>  {pgp public key}     http://palmen-it.de/pub.txt   //   """""""""""
>>  {pgp fingerprint} ED9B 62D0 BE39 32F9 2488 5D0C 8177 9D80 5ECF F683
>> _______________________________________________
>> freebsd-virtualization at freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>> To unsubscribe, send any mail to "freebsd-virtualization-unsubs
>> cribe at freebsd.org"
>>
>
>
>
> --
> Mario Lobo
> http://www.mallavoodoo.com.br
> FreeBSD since version 2.2.8 [not Pro-Audio.... YET!!]
> _______________________________________________
> freebsd-virtualization at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe at freebsd.org"


More information about the freebsd-virtualization mailing list