From nobody Sat Dec 28 09:41:05 2024 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 4YKy7C6jqhz5j6TS for ; Sat, 28 Dec 2024 09:41:43 +0000 (UTC) (envelope-from marietto2008@gmail.com) Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) (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 "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YKy7C47Ftz44sP for ; Sat, 28 Dec 2024 09:41:43 +0000 (UTC) (envelope-from marietto2008@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2f441791e40so8224939a91.3 for ; Sat, 28 Dec 2024 01:41:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735378902; x=1735983702; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EnyC3cmdET3i1k4FrZ6k+MSLVfdcftKIqVmrtBuJ+CI=; b=hbvr1yyhi2+YBTj9tA0MG76cCsHURbjqGXaoew4UYRmVCHuDa3t6uH++kokIEft+jV oyK91PgSoeJM8ZlKZqa9hMErG4fEQR5G1LOGK0nldI8vTua/WmpH+q7vE+9yhBpZVXOA JRVIujvy9QH6z/tV+wvrNe9VQWI9fhiEVg0p1eGcS5Yig3AW2lAwC96mF9epczV2ogad qAPjxCXnED7WLvcGaqjyfZd7xoXnCkCxMXkylj9OJDwLR98zlQ/r5zSUsrYs2RsQuboP ZHiCu80kBCeZVOzwFgjzGQx2q2lO1sQQN5b/PPOlasLZ8bztW/H6+BWzdZU4syjmCTKQ IyKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735378902; x=1735983702; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EnyC3cmdET3i1k4FrZ6k+MSLVfdcftKIqVmrtBuJ+CI=; b=P+w6xOfZF8Ut74UJSYjLmiuximssV3uPY5s73u6tYTX/VCtwgn53ICxB70+bYRQfFu QzOsCRO401zbTE6fgzjwi/uWrRZb5uqtFkn6lckzlLO1g9DW67dh9XQMCUT6+QIlB415 yDPq7g7rPNnBghukTuexyaaaB4SefoFAvpPHP3FxNDe/sgmisvVjCVK7k+/AM8hwnCQk vaPZxqT4q+TCzXqRhuZCmkRrVWfNA6KiC1FEGMFCdO0zDILcFKydab02DO6eDLaHQLLO ouzqGq5KQKnAy0+Fb29mtMcQnwXMjbwcomg6/redRld1k1K47Ac4gHb2pS2339jxmP2m 9TIw== X-Gm-Message-State: AOJu0Yw8N9w5IDA3BsvrY7w6NdusbFvUSeklLqNxd6VVZTBQPR3ZxCiK lZ4UNzyBaUDetTSKbFQ4l8JsdwwFRFubGYwyAhyrOUEAg9NtF9EmCc4OcEpMKA8MDM94YpGMunY 31mpO+38c90JJfYxV2SP9UzD9ZFI= X-Gm-Gg: ASbGncsn8nLrA51oo2s6QXKz60POrK225KKGyvlpMj8AQHmX33ERn5CohQ0Lhqi3C5J HdGHNF2qvThiZz0uHb8+cJmFvWYgAnrQsTslPAQY= X-Google-Smtp-Source: AGHT+IE/di659H2bkVo4RvrFNYNJvTrCBqZoMS+gSvJVnvlIyNHvGZ3DqO0Fw66riM8gAxyab5U3lFyAlGzM/Xm/+HM= X-Received: by 2002:a17:90b:5246:b0:2ee:4b8f:a59c with SMTP id 98e67ed59e1d1-2f452e490d6mr37264738a91.22.1735378902124; Sat, 28 Dec 2024 01:41:42 -0800 (PST) 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 References: <7dabef84-a572-4ded-a676-c73011b37e3c@gmail.com> <5cd601ba-560d-4252-9f17-7c450cf5d66d@gmail.com> In-Reply-To: <5cd601ba-560d-4252-9f17-7c450cf5d66d@gmail.com> From: Mario Marietto Date: Sat, 28 Dec 2024 10:41:05 +0100 Message-ID: Subject: Re: usb devices passthrough in bhyve To: Steven Friedrich Cc: freebsd-virtualization@freebsd.org Content-Type: multipart/alternative; boundary="00000000000003113d062a516330" X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4YKy7C47Ftz44sP X-Spamd-Bar: ---- --00000000000003113d062a516330 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello. I have a situation similar to yours. This is my USB controller integrated with the motherboard (INTEL AORUS PRO) : 00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10) I have attached a lot of USB disks to that USB controller,but I never reserved it, placing it on the /boot/loader. Let's take this disk for example,that's attached there : =3D> 40 3907029095 da5 GPT (1.8T) 40 532480 1 efi (260M) 532520 1024 2 freebsd-boot (512K) 533544 984 - free - (492K) 534528 4194304 3 freebsd-swap (2.0G) 4728832 3902300160 4 freebsd-zfs (1.8T) 3907028992 143 - free - (72K) If I want to use it with bhyve,I do : bhyve-lin -S -c sockets=3D2,cores=3D1,threads=3D1 -m 4G -w -H -A \ -s 0,hostbridge \ -s 1,ahci-hd,/dev/da5 \ Easy,isn't it ? But this technique works only with the disks. If you have a different kind of device,you should use an additional USB to PCI controller.... On Sat, Dec 28, 2024 at 3:13=E2=80=AFAM Steven Friedrich < freebsdlouisville@gmail.com> wrote: > I have an HP Envy running FreeBSD 14.2. > > I am a bhyve noob, but I am able to create a bhyve guest, and installed > freebsd 14.2 on it. > > Here's my host pci devices: > > xhci1@pci0:0:20:0: class=3D0x0c0330 rev=3D0x00 hdr=3D0x00 vendor=3D0= x8086 > device=3D0x06ed subvendor=3D0x103c subdevice=3D0x8767 > vendor =3D 'Intel Corporation' > device =3D 'Comet Lake USB 3.1 xHCI Host Controller' > class =3D serial bus > subclass =3D USB > > xhci0@pci0:1:0:0: class=3D0x0c0330 rev=3D0x00 hdr=3D0x00 vendor=3D0= x1b21 > device=3D0x3242 subvendor=3D0x1b21 subdevice=3D0x3242 > vendor =3D 'ASMedia Technology Inc.' > device =3D 'ASM3242 USB 3.2 Host Controller' > class =3D serial bus > subclass =3D USB > > Here's my usbconfig: > > usbconfig > ugen1.1: at usbus1, cfg=3D0 md=3DHOST spd=3DSUPER > (5.0Gbps) pwr=3DSAVE (0mA) > ugen0.1: <(0x1b21) XHCI root HUB> at usbus0, cfg=3D0 md=3DHOST spd=3DSUPE= R > (5.0Gbps) pwr=3DSAVE (0mA) > ugen0.2: at usbus0, cfg=3D0 md=3DHOST spd=3DSUP= ER > (5.0Gbps) pwr=3DSAVE (0mA) > ugen1.2: at usbus1, cfg=3D0 md=3DHOST spd= =3DLOW > (1.5Mbps) pwr=3DON (100mA) > ugen1.3: at usbus1, cfg=3D0 md=3DHOST spd=3DLOW > (1.5Mbps) pwr=3DON (100mA) > ugen1.4: at usbus1, cfg=3D0 md=3DHOST spd=3DFUL= L > (12Mbps) pwr=3DON (500mA) > ugen0.3: at usbus0, cfg=3D0 md=3DHOST spd=3DSUPER (5.0= Gbps) > pwr=3DON (126mA) > ugen0.4: at usbus0, cfg=3D0 md=3DHOST spd=3DHIG= H > (480Mbps) pwr=3DSAVE (100mA) > > Originally, my PNY flash drive was on usbus1, but when I added pptdevs=3D= "0/20/0" > to /boot/loader.conf, I lost my mouse and keyboard. > > Fortunately, I recently added a pcie card supporting usb 20 gbps rates. > > So I changed /boot/loader.conf to pptdevs=3D"1/0/0" > > But I don't know how to see the PNY flash drive in the guest. I was > hoping I could use gpart show -l and see a /dev/da0 or /dev/da1 drive, bu= t > I don't. > > In the guest, usbconfig: > > usbconfig > No device match or lack of permissions. > > and pciconf -v -l: > > pciconf -v -l > hostb0@pci0:0:0:0: class=3D0x060000 rev=3D0x00 hdr=3D0x00 vendor=3D0= x1275 > device=3D0x1275 subvendor=3D0x0000 subdevice=3D0x0000 > vendor =3D 'Network Appliance Corporation' > class =3D bridge > subclass =3D HOST-PCI > isab0@pci0:0:1:0: class=3D0x060100 rev=3D0x00 hdr=3D0x00 vendor=3D0= x8086 > device=3D0x7000 subvendor=3D0x0000 subdevice=3D0x0000 > vendor =3D 'Intel Corporation' > device =3D '82371SB PIIX3 ISA [Natoma/Triton II]' > class =3D bridge > subclass =3D PCI-ISA > virtio_pci0@pci0:0:2:0: class=3D0x020000 rev=3D0x00 hdr=3D0x00 vendor=3D0= x1af4 > device=3D0x1000 subvendor=3D0x1af4 subdevice=3D0x0001 > vendor =3D 'Red Hat, Inc.' > device =3D 'Virtio network device' > class =3D network > subclass =3D ethernet > virtio_pci1@pci0:0:3:0: class=3D0x010000 rev=3D0x00 hdr=3D0x00 vendor=3D0= x1af4 > device=3D0x1001 subvendor=3D0x1af4 subdevice=3D0x0002 > vendor =3D 'Red Hat, Inc.' > device =3D 'Virtio block device' > class =3D mass storage > subclass =3D SCSI > > How do I fix this? > --=20 Mario. --00000000000003113d062a516330 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello.
I have a situation similar to yours. This is my USB controller= integrated with the motherboard (INTEL AORUS PRO) :

00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xH= CI Host Controller (rev 10)

I have attached = a lot of USB disks to that USB controller,but I never reserved it, placing = it on the /boot/loader.

Let's take this disk f= or example,that's attached there :

=3D> =C2= =A0 =C2=A0 =C2=A0 =C2=A040 =C2=A03907029095 =C2=A0da5 =C2=A0GPT =C2=A0(1.8T= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 40 =C2=A0 =C2=A0 =C2=A0532480 =C2= =A0 =C2=A01 =C2=A0efi =C2=A0(260M)
=C2=A0 =C2=A0 =C2=A0 532520 =C2=A0 = =C2=A0 =C2=A0 =C2=A01024 =C2=A0 =C2=A02 =C2=A0freebsd-boot =C2=A0(512K)
= =C2=A0 =C2=A0 =C2=A0 533544 =C2=A0 =C2=A0 =C2=A0 =C2=A0 984 =C2=A0 =C2=A0 = =C2=A0 - free - =C2=A0(492K)
=C2=A0 =C2=A0 =C2=A0 534528 =C2=A0 =C2=A0 4= 194304 =C2=A0 =C2=A03 =C2=A0freebsd-swap =C2=A0(2.0G)
=C2=A0 =C2=A0 =C2= =A04728832 =C2=A03902300160 =C2=A0 =C2=A04 =C2=A0freebsd-zfs =C2=A0(1.8T)=C2=A0 3907028992 =C2=A0 =C2=A0 =C2=A0 =C2=A0 143 =C2=A0 =C2=A0 =C2=A0 - = free - =C2=A0(72K)

If I want to use it with b= hyve,I do :

bhyve-lin -S -c sockets=3D2,cores=3D1,= threads=3D1 -m 4G -w -H -A \
-s 0,hostbridge \
-s 1,ahci-hd,/dev/da5 = \

Easy,isn't it ? But this technique works= only with the disks. If you have a different kind of device,you should use= an additional USB to PCI controller....

On Sat, Dec 28, 2024= at 3:13=E2=80=AFAM Steven Friedrich <freebsdlouisville@gmail.com> wrote:
=20 =20 =20

I have an HP Envy running FreeBSD 14.2.

I am a bhyve noob, but I am able to create a bhyve guest, and installed freebsd 14.2 on it.

Here's my host pci devices:

xhci1@pci0:0:20:0:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 class=3D0x= 0c0330 rev=3D0x00 hdr=3D0x00 vendor=3D0x8086 device=3D0x06ed subvendor=3D0= x103c subdevice=3D0x8767
=C2=A0=C2=A0=C2=A0 vendor=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'Intel Co= rporation'
=C2=A0=C2=A0=C2=A0 device=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'Comet La= ke USB 3.1 xHCI Host Controller'
=C2=A0=C2=A0=C2=A0 class=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D serial b= us
=C2=A0=C2=A0=C2=A0 subclass=C2=A0=C2=A0 =3D USB

xhci0@pci0:1:0:0:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 class= =3D0x0c0330 rev=3D0x00 hdr=3D0x00 vendor=3D0x1b21 device=3D0x3242 subvendor=3D0= x1b21 subdevice=3D0x3242
=C2=A0=C2=A0=C2=A0 vendor=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'ASMedia = Technology Inc.'
=C2=A0=C2=A0=C2=A0 device=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'ASM3242 = USB 3.2 Host Controller'
=C2=A0=C2=A0=C2=A0 class=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D serial b= us
=C2=A0=C2=A0=C2=A0 subclass=C2=A0=C2=A0 =3D USB

Here's my usbconfig:

usbconfig
ugen1.1: <Intel XHCI root HUB> at usbus1, cfg=3D0 md=3DHOST spd=3DSUPER (5.0Gbps) pwr=3DSAVE (0mA)
ugen0.1: <(0x1b21) XHCI root HUB> at usbus0, cfg=3D0 md=3DHOST spd=3DSUPER (5.0Gbps) pwr=3DSAVE (0mA)
ugen0.2: <Hub Genesys Logic, Inc.> at usbus0, cfg=3D0 md=3DHOST spd=3DSUPER (5.0Gbps) pwr=3DSAVE (0mA)
ugen1.2: <PixArt HP USB Optical Mouse> at usbus1, cfg=3D0 md=3DHOST spd=3DLOW (1.5Mbps) pwr=3DON (100mA)
ugen1.3: <Chicony HP USB Keyboard> at usbus1, cfg=3D0 md=3DHOST spd=3DLOW (1.5Mbps) pwr=3DON (100mA)
ugen1.4: <Realtek Bluetooth Radio> at usbus1, cfg=3D0 md=3DHOST spd=3DFULL (12Mbps) pwr=3DON (500mA)
ugen0.3: <PNY USB 3.2.1 FD> at usbus0, cfg=3D0 md=3DHOST spd=3DSUPER (5.0Gbps) pwr=3DON (126mA)
ugen0.4: <Hub Genesys Logic, Inc.> at usbus0, cfg=3D0 md=3DHOST spd=3DHIGH (480Mbps) pwr=3DSAVE (100mA)

Originally, my
PNY flash drive was on usbus1, but when I added pptdevs=3D"0/20/0" to= =C2=A0 /boot/loader.conf, I lost my mouse and keyboard.

Fortunately, I recently added a pcie card supporting usb 20 gbps rates.

So I changed /boot/loader.conf to=C2=A0 pptdevs=3D"1/0/0"= ;

But I don't know how to = see the PNY flash drive in the guest.=C2=A0 I was hoping I could use gpart show -l and see a /dev/da0 or /dev/da1 drive, but I don't.

In the guest, usbconfig:

usbconfig
No device match or lack of permissions.

and pciconf -v -l:

pciconf -v -l
hostb0@pci0:0:0:0:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 class=3D0x0= 60000 rev=3D0x00 hdr=3D0x00 vendor=3D0x1275 device=3D0x1275 subvendor=3D0= x0000 subdevice=3D0x0000
=C2=A0=C2=A0=C2=A0 vendor=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'Network = Appliance Corporation'
=C2=A0=C2=A0=C2=A0 class=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D bridge =C2=A0=C2=A0=C2=A0 subclass=C2=A0=C2=A0 =3D HOST-PCI
isab0@pci0:0:1:0:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 class= =3D0x060100 rev=3D0x00 hdr=3D0x00 vendor=3D0x8086 device=3D0x7000 subvendor=3D0= x0000 subdevice=3D0x0000
=C2=A0=C2=A0=C2=A0 vendor=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'Intel Co= rporation'
=C2=A0=C2=A0=C2=A0 device=C2=A0=C2=A0=C2=A0=C2=A0 =3D '82371SB = PIIX3 ISA [Natoma/Triton II]'
=C2=A0=C2=A0=C2=A0 class=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D bridge =C2=A0=C2=A0=C2=A0 subclass=C2=A0=C2=A0 =3D PCI-ISA
virtio_pci0@pci0:0:2:0: class=3D0x020000 rev=3D0x00 hdr=3D0x00 vendor=3D0x1af4 device=3D0x1000 subvendor=3D0x1af4 subdevice=3D0x0001
=C2=A0=C2=A0=C2=A0 vendor=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'Red Hat,= Inc.'
=C2=A0=C2=A0=C2=A0 device=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'Virtio n= etwork device'
=C2=A0=C2=A0=C2=A0 class=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D network<= br> =C2=A0=C2=A0=C2=A0 subclass=C2=A0=C2=A0 =3D ethernet
virtio_pci1@pci0:0:3:0: class=3D0x010000 rev=3D0x00 hdr=3D0x00 vendor=3D0x1af4 device=3D0x1001 subvendor=3D0x1af4 subdevice=3D0x0002
=C2=A0=C2=A0=C2=A0 vendor=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'Red Hat,= Inc.'
=C2=A0=C2=A0=C2=A0 device=C2=A0=C2=A0=C2=A0=C2=A0 =3D 'Virtio b= lock device'
=C2=A0=C2=A0=C2=A0 class=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D mass sto= rage
=C2=A0=C2=A0=C2=A0 subclass=C2=A0=C2=A0 =3D SCSI

How do I fix this?



--
Ma= rio.
--00000000000003113d062a516330--