From nobody Thu Jun 02 16:11:00 2022 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 3A7BA1B74F97 for ; Thu, 2 Jun 2022 16:11:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LDWGD07gPz3DdG for ; Thu, 2 Jun 2022 16:11:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAA61179E0 for ; Thu, 2 Jun 2022 16:10:59 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 252GAxiv079646 for ; Thu, 2 Jun 2022 16:10:59 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 252GAxpI079645 for virtualization@FreeBSD.org; Thu, 2 Jun 2022 16:10:59 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 264417] bhyve guest cannot be restarted if it has usb xhci pci controller passed thru to it: /usr/src/usr.sbin/bhyve, L:451 Date: Thu, 02 Jun 2022 16:11:00 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: 13.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: lettergrabber@yandex.ru X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654186260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eiWWX7EKbsiGw4mKoBhqVHvx9D2xdCLMO58zDfdQrGA=; b=jKjV1TS/saXJIZExMwYM8Fnwv+iugxXiDwEYOrmTIsKxsgzZR6YpppAkXyIkAX1ovaT0NN w9GLAJtbDMWELnbnKqyETP6OvF4JxHC46qj7MvPgBkVWmRF5j27hi8js53ol8IA8i52Cee gyuWH9GguoSvTiOtjz2vOSbJf+ONtR08QS3M11IzPXcsQ2f7ru2zK0V2o2qaZgfJP9LakU wx6pBgX3eCp/y7yagBZ1JGyDaP1rZ/t8fsa7OGYhaOvKVnWhXMcPBHjJG5RGqmtUJKTji8 6HoKuZJ+UXL2kbopsSVtlnx+6htHDPliuJ/bFt9CR9lHNRMCkDdpFrA0CpBang== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654186260; a=rsa-sha256; cv=none; b=KdN30nzsxQmCCceM3FeEM5LSEIsVqeipfFmPE2ci0L6Y68k4xWCmcc4QleLlz0NfskKjxW erBtCXfAsNypAHNwtL3LODX/LeB+1Enz5zg6Ku7dv+kozl3eejeJQJG4MjRoZ3c11vZdXv +1ifODvc0fG6bz4dIBxxjYemqnq1CWoJ/k+mrCRz+5VsYmSUsF0KF0Cg8vcNt6bFsNl8A/ MCe42mg00WjXtDlDTV6/oOLTon2t3cPkd8CCaa9BGctyAeKvAM9MCO3GHEZj7UA89I7Nl6 wN6VwIOocAf+sTeVf0wN3oj8lo83L2tk7/t9Uz1a0ptsTTi1yqargOdkbzuk4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264417 Bug ID: 264417 Summary: bhyve guest cannot be restarted if it has usb xhci pci controller passed thru to it: /usr/src/usr.sbin/bhyve, L:451 Product: Base System Version: 13.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bhyve Assignee: virtualization@FreeBSD.org Reporter: lettergrabber@yandex.ru I upgraded FreeBSD 13.0-RELEASE to FreeBSD 13.1-RELEASE and now I can't res= tart VM. What I doing: I start VM with the command: sudo bhyve -c 8,sockets=3D2,cores=3D2,threads=3D2 -m 16G -H -w -S \ -s 0,hostbridge \ -s 3,ahci-cd,/neat/iso/Win10_21H1_Russian_x64.iso \ -s 4,ahci-hd,/neat/bsd1/vms/w10.img \ -s 5,virtio-net,tap0 \ -s 7,passthru,216/0/0 \ -s 29,fbuf,tcp=3D0.0.0.0:5900,w=3D1920,h=3D1200,wait \ -s 30,xhci,tablet \ -s 31,lpc \ -l com1,stdio \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ w10 Then, I connect to it: vncviewer freebsd:0 I do some work inside VM, include that which uses 'usb xhci pci' I passed t= hru to VM, there it is: xhci3@pci0:216:0:0: class=3D0x0c0330 rev=3D0x03 hdr=3D0x00 vendor=3D0x1912 device=3D0x0014 subvendor=3D0x1912 subdevice=3D0x0014 vendor =3D 'Renesas Technology Corp.' device =3D 'uPD720201 USB 3.0 Host Controller' class =3D serial bus subclass =3D USB The usb controller (I passed thru to VM) is used with the card readers to t= est smart cards. Then I quit VM and destroy it: sudo bhyvectl --destroy --vm=3Dw10 After that I can't run it again: sudo bhyve -c 8,sockets=3D2,cores=3D2,threads=3D2 -m 16G -H -w -S \ -s 0,hostbridge \ -s 3,ahci-cd,/neat/iso/Win10_21H1_Russian_x64.iso \ -s 4,ahci-hd,/neat/bsd1/vms/w10.img \ -s 5,virtio-net,tap0 \ -s 7,passthru,216/0/0 \ -s 29,fbuf,tcp=3D0.0.0.0:5900,w=3D1920,h=3D1200,wait \ -s 30,xhci,tablet \ -s 31,lpc \ -l com1,stdio \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ w10 bhyve: Failed to map MSI-X table BAR on 216/0/0: Device busy bhyve: failed to initialize BARs for PCI 216/0/0 device emulation initialization error: Device busy On FreeBSD 13.0-RELEASE I have no trouble with restart VM. My rc.conf, devfs.conf, loader.conf are the same as they were in FreeBSD 13.0-RELEASE: [lanin@freebsd /etc]$ cat rc.conf=20 ... kld_list=3D"nvidia-modeset vmm nmdm" devfs_system_ruleset=3D"system" cloned_interfaces=3D"bridge0 tap0 tap1" ifconfig_bridge0=3D"addm igb0 addm tap0 addm tap1 up" [lanin@freebsd /etc]$ cat devfs.conf=20 [system=3D10] add path 'usb/*' mode 0660 group operator [lanin@freebsd /boot]$ cat loader.conf=20 ... vmm_load=3D"YES" vmm_name=3D"/boot/kernel/vmm.ko" nmdm_load=3D"YES" if_bridge_load=3D"YES" if_tap_load=3D"YES" pptdevs=3D"134/0/0 216/0/0/0" ... I tried to wait...and restart devfs service - no effect. I tried to unload/load vmm.ko. It has been unloaded succsessfully (it means that bhyve's VM was destroyed well). After vmm.ko has been loaded again, I tried to start VM, and got the same error... I tried to start VM without the device passed thru to it- in this case VM started well. I also tried the variant when I do not use passed thru device inside VM (I = do not connect anything to it inside the VM). Result is the same - VM is not restarted. I always disconnect all my readers from VM before I quit it. When I quit vncviewer while VM is up, VM's window disappeared, but VM still working... And when I run vncviewer again, it connects to running VM. That's right. When I quit VM while vncviewer is up, it quits automatically. In fact, I have two passed thru devices, which differ only by PCI address: [lanin@freebsd ~]$ sudo pciconf -lc |grep -A3 -e "ppt0" -e "ppt1" ppt0@pci0:134:0:0: class=3D0x0c0330 rev=3D0x03 hdr=3D0x00 vendor=3D0x1912 device=3D0x0014 subvendor=3D0x1912 subdevice=3D0x0014 cap 01[50] =3D powerspec 3 supports D0 D3 current D0 cap 05[70] =3D MSI supports 8 messages, 64 bit=20 cap 11[90] =3D MSI-X supports 8 messages -- ppt1@pci0:216:0:0: class=3D0x0c0330 rev=3D0x03 hdr=3D0x00 vendor=3D0x1912 device=3D0x0014 subvendor=3D0x1912 subdevice=3D0x0014 cap 01[50] =3D powerspec 3 supports D0 D3 current D0 cap 05[70] =3D MSI supports 8 messages, 64 bit=20 cap 11[90] =3D MSI-X supports 8 messages One of them I passed thru to VM-1, and other - to VM-2. I start these VMs simultaneously. My first VM has: '-s 7,passthru,216/0/0' and other: '-s 7,passthru,134/0/0' I think, that message I have in the terminal is here: /usr/src/usr.sbin/bhyve/pci_passthru.c, L:451: --=20 You are receiving this mail because: You are the assignee for the bug.=