From nobody Tue Feb 8 17:45:32 2022 X-Original-To: freebsd-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 7F78C19B1B25 for ; Tue, 8 Feb 2022 17:46:14 +0000 (UTC) (envelope-from marietto2008@gmail.com) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JtVmf0PvNz3BmY for ; Tue, 8 Feb 2022 17:46:10 +0000 (UTC) (envelope-from marietto2008@gmail.com) Received: by mail-lf1-x12f.google.com with SMTP id f23so3560601lfe.5 for ; Tue, 08 Feb 2022 09:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bP8KAkx7ABN6Fk/wRLIUT7e183Dl+VOAK7GcCFPDV2Y=; b=Pt6m09VeIfc0fApRk2HKs3xqncckNEqM8H4lh45fGo2j7rav55wvp+UR04RI6TGKXe wUNze5lpbNve8qkMNJKKupDwAVDORxoUnC1hw36bO6gYbX4S6NkTs1/i0EVOSAvulHip jBTy1Lvc8aDRBLdvN+Guu21d4TNf8EZRJhCzX7Np7mPam1q3Os/Vali8AyxbO17J0TfK kFph4HVsjTRKOoIoaOgwzul1BjyriFuv1koHnYUjiyRhxScnC42dM2V5VvIJGR/zhCRB fIObJE4NUhydErULhOO7SRwYojtf525q2MfGBpcKWcro/bkK+p/xoAMMOAetUGCHGLyi fi6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bP8KAkx7ABN6Fk/wRLIUT7e183Dl+VOAK7GcCFPDV2Y=; b=Qorle1SYjrKhw6rlr86JDvDdegUBoMtucXGaDKQDwhWgLPEJ8Zvjhtd70XWwnrjPAh Sl09XWp7APW9FYr8AXhd4zs9e6KQcvvBVCRfY4ShsMyBF1wGkHHiMg5jsUaPQyRX9Uoh lLxuW33j/WvvNTlIAC6eP46SqrCbObRxjiCEGrHreZzSn72GlnRCQInCCDNxT+0o8Zbt p1jqRfRJlgpniJplmmPUmZatLx020WYgWUdM8+QeWa+Klw4+YFoqQxGCwJH/gN3GKcdr y/UCRxDTbmFOzF6XgywWNE6AmR2pa1d35EkUG+eiYCWjCWy1YwOZlqtcK2eIn/CORumh Mc8w== X-Gm-Message-State: AOAM530kJLXXldmTxNHwcI4p9AITP0cD4kEKsEAiRO+caSvXKU3i3nQA zyC2ohI4PGRqjWj4Ir1zLHOpTU35hBIZKLE4+g0pUfb3Oas= X-Google-Smtp-Source: ABdhPJzV/UCKKe9LfiT1TsqDv4+Pq+aoZYOke5qKog8jkeyQpQALhftgyEl2W+NDGJ0KTgO0pkiwA7TuUcUfNiap1Dw= X-Received: by 2002:a05:6512:c08:: with SMTP id z8mr3496387lfu.644.1644342368406; Tue, 08 Feb 2022 09:46:08 -0800 (PST) List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Mario Marietto Date: Tue, 8 Feb 2022 18:45:32 +0100 Message-ID: Subject: Re: Multiple bugs on bhyve present on FreeBSD 13R p7 while passing thru USB controller and graphic card To: Aryeh Friedman Cc: FreeBSD virtualization Content-Type: multipart/alternative; boundary="000000000000c212b005d7854a47" X-Rspamd-Queue-Id: 4JtVmf0PvNz3BmY X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=Pt6m09Ve; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of marietto2008@gmail.com designates 2a00:1450:4864:20::12f as permitted sender) smtp.mailfrom=marietto2008@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; URI_COUNT_ODD(1.00)[1]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-virtualization@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; BLOCKLISTDE_FAIL(0.00)[2a00:1450:4864:20::12f:server fail]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::12f:from]; HTTP_TO_IP(1.00)[]; MLMMJ_DEST(0.00)[freebsd-virtualization]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --000000000000c212b005d7854a47 Content-Type: text/plain; charset="UTF-8" In my system I have two graphic cards. This is the first one,configured as default from the bios and used on the freebsd host : vgapci0@pci0:0:2:0: class=0x030000 rev=0x02 hdr=0x00 vendor=0x8086 device=0x3e98 subvendor=0x1458 subdevice=0xd000 vendor = 'Intel Corporation' device = 'CoffeeLake-S GT2 [UHD Graphics 630]' class = display subclass = VGA the USB controller that I'm trying to pass thru is the following : ppt0@pci0:1:0:0: class=0x0c0330 rev=0x03 hdr=0x00 vendor=0x1912 device=0x0014 subvendor=0x1912 subdevice=0x0015 vendor = 'Renesas Technology Corp.' device = 'uPD720201 USB 3.0 Host Controller' class = serial bus subclass = USB the graphic card that I'm trying to pass thru is the following : ppt1@pci0:2:0:0: class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1e04 subvendor=0x19da subdevice=0x2503 vendor = 'NVIDIA Corporation' device = 'TU102 [GeForce RTX 2080 Ti]' class = display subclass = VGA ppt2@pci0:2:0:1: class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f7 subvendor=0x19da subdevice=0x2503 vendor = 'NVIDIA Corporation' device = 'TU102 High Definition Audio Controller' class = multimedia subclass = HDA ppt3@pci0:2:0:2: class=0x0c0330 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1ad6 subvendor=0x19da subdevice=0x2503 vendor = 'NVIDIA Corporation' device = 'TU102 USB 3.1 Host Controller' class = serial bus subclass = USB ppt4@pci0:2:0:3: class=0x0c8000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1ad7 subvendor=0x19da subdevice=0x2503 vendor = 'NVIDIA Corporation' device = 'TU102 USB Type-C UCSI Controller' class = serial bus On the file /boot/loader.conf I have reserved the following PCI addresses : pptdevs="1/0/0 2/0/0 2/0/1 2/0/2 2/0/3" If I try to boot a virtual machine in raw format passing thru my usb controller and my graphic card I get a different error : this bhyve commands : bhyve -S -c sockets=2,cores=2,threads=2 -m 8G -w -H \ -s 0,hostbridge \ -s 1,virtio-blk,/mnt/da2p2/bhyve/os/Linux/impish-cuda-11-5-nvidia-495.img \ -s 3:0,passthru,2/0/0 \ -s 3:1,passthru,2/0/1 \ -s 3:2,passthru,2/0/2 \ -s 3:3,passthru,2/0/3 \ -s 4:0,passthru,1/0/0 \ -s 9,virtio-net,tap0 \ -s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900 \ -s 30,xhci,tablet \ -s 31,lpc \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ -l com1,stdio \ vm0 produces this error : fbuf frame buffer base: 0xa43800000 [sz 16777216] Assertion failed: (error == 0), function modify_bar_registration, file /usr/src/usr.sbin/bhyve/pci_emul.c, line 501. Abort. Il giorno mar 8 feb 2022 alle ore 18:17 Aryeh Friedman < aryeh.friedman@gmail.com> ha scritto: > > I'm using bhyve on FreeBSD 13R p7 and I'm trying to pass thru my usb >> controller and / or my graphic card while at the same time I'm trying to >> boot 3 operating systems (Ubuntu,Windows and FreeBSD 13) installed on a >> SATA and / or NVME disk using the virtio-blk driver and the ahci-hd driver. >> > > It is my understand for devices to be successfully passed through (based > on my own semi-working attempts and research) the device must meet the > following two conditions: > > 1. Be used exclusively by the guest OS and not the host OS > 2. The host OS needs to not even load drivers for the device(s) > > For example on the GPU this means you would need to boot the host from a > serial port and/or GPU that is not used by the host and not loaded at boot > time and then, and only then, can you pass it through to the guest OS > (wither or not the guest OS recognizes it is an other question though). > > As to good stable bhyve invocation I recommend you look at the source > code/output of either the shell based ports for making bhyve VM's or at > PetiteCloud (if you do the second I would be very interested in the results > so I can incorporate them into a future version of PC). > > > -- > Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org > -- Mario. --000000000000c212b005d7854a47 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In my system I have two graphic cards. This is the fi= rst one,configured as default from the bios and used on the freebsd host :<= /div>

vgapci0@pci0:0:2:0:= =C2=A0=C2=A0=C2=A0=C2=A0class=3D0x030000 rev=3D0x02 hdr=3D0x00 vendor=3D0x= 8086 device=3D0x3e98 subvendor=3D0x1458 subdevice=3D0xd000
=C2=A0=C2=A0=C2=A0vendor =C2=A0=C2=A0=C2=A0=C2=A0=3D 'Intel= Corporation'
=C2=A0=C2=A0=C2=A0device =C2=A0=C2=A0=C2=A0=C2=A0=3D 'CoffeeLake-S= GT2 [UHD Graphics 630]'
=C2=A0=C2=A0=C2=A0class =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D display
=C2=A0=C2=A0=C2=A0subclass =C2=A0=C2=A0=3D VGA


= the USB controller that I'm trying to pass thru is the following :

ppt0@pci0:1:0:0: =C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0class=3D0x0c0330 rev=3D0x03 hdr=3D0x00 ven= dor=3D0x1912 device=3D0x0014 subvendor=3D0x1912 subdevice=3D0x0015
=C2=A0=C2=A0=C2=A0vendor =C2=A0=C2=A0=C2=A0=C2=A0=3D 'Renes= as Technology Corp.'
=C2=A0=C2=A0=C2=A0device =C2=A0=C2=A0=C2=A0=C2=A0=3D 'uPD720201 US= B 3.0 Host Controller'
=C2=A0=C2=A0=C2=A0class =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D serial bus
=C2=A0=C2=A0=C2=A0subclass =C2=A0=C2=A0=3D USB
=C2=A0
the gr= aphic card that I'm trying to pass thru is the following :
=

ppt1@pci0:2:0:= 0: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0class=3D0x030000 rev=3D0xa1 hd= r=3D0x00 vendor=3D0x10de device=3D0x1e04 subvendor=3D0x19da subdevice=3D0x2= 503
=C2=A0=C2=A0=C2=A0vendor =C2=A0=C2=A0=C2=A0=C2=A0=3D 'NVIDIA Corpo= ration'
=C2=A0=C2=A0=C2=A0device =C2=A0=C2=A0=C2=A0=C2=A0=3D 'TU102 [GeFor= ce RTX 2080 Ti]'
=C2=A0=C2=A0=C2=A0class =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D display
=C2=A0=C2=A0=C2=A0subclass =C2=A0=C2=A0=3D VGA
ppt2@pci0:2:0:1: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0class=3D0x04= 0300 rev=3D0xa1 hdr=3D0x00 vendor=3D0x10de device=3D0x10f7 subvendor=3D0x19= da subdevice=3D0x2503
=C2=A0=C2=A0=C2=A0vendor =C2=A0=C2=A0=C2=A0=C2=A0=3D 'NVIDIA Corpo= ration'
=C2=A0=C2=A0=C2=A0device =C2=A0=C2=A0=C2=A0=C2=A0=3D 'TU102 High D= efinition Audio Controller'
=C2=A0=C2=A0=C2=A0class =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D multimedia
=C2=A0=C2=A0=C2=A0subclass =C2=A0=C2=A0=3D HDA
ppt3@pci0:2:0:2: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0class=3D0x0c= 0330 rev=3D0xa1 hdr=3D0x00 vendor=3D0x10de device=3D0x1ad6 subvendor=3D0x19= da subdevice=3D0x2503
=C2=A0=C2=A0=C2=A0vendor =C2=A0=C2=A0=C2=A0=C2=A0=3D 'NVIDIA Corpo= ration'
=C2=A0=C2=A0=C2=A0device =C2=A0=C2=A0=C2=A0=C2=A0=3D 'TU102 USB 3.= 1 Host Controller'
=C2=A0=C2=A0=C2=A0class =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D serial bus
=C2=A0=C2=A0=C2=A0subclass =C2=A0=C2=A0=3D USB
ppt4@pci0:2:0:3: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0class=3D0x0c= 8000 rev=3D0xa1 hdr=3D0x00 vendor=3D0x10de device=3D0x1ad7 subvendor=3D0x19= da subdevice=3D0x2503
=C2=A0=C2=A0=C2=A0vendor =C2=A0=C2=A0=C2=A0=C2=A0=3D 'NVIDIA Corpo= ration'
=C2=A0=C2=A0=C2=A0device =C2=A0=C2=A0=C2=A0=C2=A0=3D 'TU102 USB Ty= pe-C UCSI Controller'
=C2=A0=C2=A0=C2=A0class =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D serial bus
On the file /boot/loader.conf I have reserved= the following PCI addresses :

pptdevs=3D"1/0/0 2/0/0 2/= 0/1 2/0/2 2/0/3"

If I try to boot a virtual machine in raw format pa= ssing thru my usb controller and my graphic card I get a different error :<= br>
<= br>
t= his bhyve commands :

bhyve -S -c sockets=3D2,cores= =3D2,threads=3D2 -m 8G -w -H \
-s 0,hostbridge \
-s 1,virtio-blk,/mnt/da2p2/bhyve/os/Linux/impish-cuda-11-5-nvidia-495.i= mg \
-s 3:0,passthru,2/0/0 \
-s 3:1,passthru,2/0/1 \
-s 3:2,passthru,2/0/2 \
-s 3:3,passthru,2/0/3 \
-s 4:0,passthru,1/0/0 \
-s 9,virtio-net,tap0 \
-s 29,fbuf,tcp=3D0.0.0.0:5900,w=3D1= 440,h=3D900 \
-s 30,xhci,tablet \
-s 31,lpc \ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
-l bootrom,/usr/local/share/uefi-firmware= /BHYVE_UEFI.fd \
-l com1,stdio \
vm0

produces this error :

= fbuf frame buffer base: 0xa43800000 [sz 1677= 7216]
Assertion failed: (error =3D=3D 0), function modify_bar_registra= tion, file /usr/src/usr.sbin/bhyve/pci_emul.c, line 501. Abort.
<= /span>

<= /span>

Il giorno mar 8 feb 2022 alle ore 18:17 Aryeh Fri= edman <aryeh.friedman@gmail.= com> ha scritto:

I'm using bhyve on FreeBSD 13R p7 and I'm trying to pass thru= my usb controller and / or my graphic card while at the same time I'm = trying to boot 3 operating systems (Ubuntu,Windows and FreeBSD 13) installe= d on a SATA and / or NVME disk using the virtio-blk driver and the ahci-hd = driver.

It is my und= erstand for devices to be successfully passed through (based on my own semi= -working attempts and research) the device must meet the following two cond= itions:

1. Be used exclusively by the guest OS and= not the host OS
2. The host OS needs to not even load drivers fo= r the device(s)

For example on the GPU this means = you would need to boot the host from a serial port and/or GPU that is not u= sed by the host and not loaded at boot time and then, and only then, can yo= u pass it through to the guest OS (wither or not the guest OS recognizes it= is an other question though).

As to good stable b= hyve invocation I recommend you look at the source code/output of either th= e shell based ports for making bhyve VM's or at PetiteCloud (if you do = the second I would be very interested in the results so I can incorporate t= hem into a future version of PC).


-- <= br>
Aryeh M. Friedman, Lead Developer, http://www.PetiteClou= d.org


--
Mario.
--000000000000c212b005d7854a47--