Re: bhyve passthru problem

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Fri, 14 Jun 2024 06:35:31 UTC
On Thu, 2024-06-13 at 10:53 +0300, Oleksandr Kryvulia wrote:
>  I'm trying to passthru a wwan-adapter to linux guest using
> sysutils/vm-bhyve-devel.
>  
>  ppt0@pci0:8:0:0:        class=0x0d4000 rev=0x01 hdr=0x00
> vendor=0x8086 device=0x7560 subvendor=0x1cf8 subdevice=0x8654 
>     vendor     = 'Intel Corporation' 
>     device     = 'XMM7560 LTE Advanced Pro Modem' 
>     class      = wireless controller 
>     subclass   = cellular controller/modem
>  
>  The guest does not start with an error:
>  
>  bhyve: passthru device 8/0/0 BAR 2: base 0xbc201000 or size 0x100
> not page aligned 
>  bhyve: failed to initialize BARs for PCI 8/0/0 
>  Device emulation initialization error: No such file or directory
>  
>  What I am doing wrong?
>   

The BAR size of your device is smaller than a page. Unfortunately, you
can't change it, so there's nothing you can do right now.

I don't know why bhyve validates the BAR size. The commit adding this
check is old [1] and doesn't explain it. What bhyve could do is
rounding up the BAR size to a full page size when allocating memory for
the BAR.

[1] https://github.com/freebsd/freebsd-
src/commit/7a902ec0eccc752c9c38533ed123121eaaea1225


-- 
Kind regards,
Corvin