From nobody Sat Jun 15 07:14:35 2024 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4W1S855WkFz5NVdj for ; Sat, 15 Jun 2024 07:14:45 +0000 (UTC) (envelope-from shuriku@shurik.kiev.ua) Received: from mail.flex-it.com.ua (mail.flex-it.com.ua [193.239.74.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4W1S843Yrhz4Y8M for ; Sat, 15 Jun 2024 07:14:44 +0000 (UTC) (envelope-from shuriku@shurik.kiev.ua) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of shuriku@shurik.kiev.ua designates 193.239.74.7 as permitted sender) smtp.mailfrom=shuriku@shurik.kiev.ua Received: from 93.183.208.50.ipv4.datagroup.ua ([93.183.208.50] helo=[192.168.200.135]) by mail.flex-it.com.ua with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.97.1 (FreeBSD)) (envelope-from ) id 1sINcR-00000000Cu2-2YLg for virtualization@freebsd.org; Sat, 15 Jun 2024 10:14:35 +0300 Content-Type: multipart/alternative; boundary="------------KilYgKZ0T86fPkH2U738yvWL" Message-ID: Date: Sat, 15 Jun 2024 10:14:35 +0300 List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-virtualization@freebsd.org Sender: owner-freebsd-virtualization@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bhyve passthru problem To: virtualization@freebsd.org References: <38c9656c26fc3cee7ba733168c0fa2cdd01209d9.camel@FreeBSD.org> Content-Language: uk-UA From: Oleksandr Kryvulia In-Reply-To: X-ACL-Warn: SPF failed. 93.183.208.50 is not allowed to send mail from shurik.kiev.ua. X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.18 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.89)[-0.885]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; XM_UA_NO_VERSION(0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:35297, ipnet:193.239.72.0/22, country:UA]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_ALL(0.00)[]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[virtualization@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[shurik.kiev.ua]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 4W1S843Yrhz4Y8M This is a multi-part message in MIME format. --------------KilYgKZ0T86fPkH2U738yvWL Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit I can try your files or better a patch against current. Thank you, Mario. 14.06.24 10:27, Mario Marietto: > Oleksandr,I would like to try an experiment to try to fix your > problem. If you agree,I could send you my bhyve and vmm.ko files,if > you want. I suspect that they may fix your problem. Let me know if you > want to try. > > On Fri, Jun 14, 2024 at 8:35 AM Corvin Köhne wrote: > > 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 > > > > -- > Mario. --------------KilYgKZ0T86fPkH2U738yvWL Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit I can try your files or better a patch against current.
Thank you, Mario. 

14.06.24 10:27, Mario Marietto:
Oleksandr,I would like to try an experiment to try to fix your problem. If you agree,I could send you my bhyve and vmm.ko files,if you want. I suspect that they may fix your problem. Let me know if you want to try.

On Fri, Jun 14, 2024 at 8:35 AM Corvin Köhne <corvink@freebsd.org> wrote:
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


--
Mario.

--------------KilYgKZ0T86fPkH2U738yvWL--