Re: pci passthrough Mediatek MT7922 doesn't work

From: Peter Miller <feurry_at_gmail.com>
Date: Sat, 20 Apr 2024 20:48:40 UTC
doas sh -x /usr/share/examples/bhyve/vmrun.sh -p 1/0/0 -d
FreeBSD-14.0-STABLE-amd64.raw vm0

Loading kernel...
/boot/kernel/kernel text=0x17be70 text=0xd75798 text=0x4254ec
data=0x180 data=0x1866b0+0x478950 0x8+0x1894e0+0x8+0x1acde2\
Loading configured modules...
/etc/hostid size=0x25
/boot/entropy size=0x1000
+ bhyve_exit=0
+ [ 0 -ne 0 ]
+ nextslot=2
+ devargs=''
+ i=0
+ [ 0 -lt 1 ]
+ eval 'tapname=$tap_dev0'
+ tapname=tap0
+ devargs=' -s 2:0,virtio-net,tap0 '
+ nextslot=3
+ i=1
+ [ 1 -lt 1 ]
+ i=0
+ [ 0 -lt 1 ]
+ eval 'disk=$disk_dev0'
+ disk=FreeBSD-14.0-STABLE-amd64.raw
+ eval 'opts=$disk_opts0'
+ opts=''
+ make_and_check_diskdev FreeBSD-14.0-STABLE-amd64.raw
+ local 'virtio_diskdev=FreeBSD-14.0-STABLE-amd64.raw'
+ [ ! -e FreeBSD-14.0-STABLE-amd64.raw ]
+ [ ! -r FreeBSD-14.0-STABLE-amd64.raw ]
+ [ ! -w FreeBSD-14.0-STABLE-amd64.raw ]
+ devargs=' -s 2:0,virtio-net,tap0  -s
3:0,virtio-blk,FreeBSD-14.0-STABLE-amd64.raw '
+ nextslot=4
+ i=1
+ [ 1 -lt 1 ]
+ i=0
+ [ 0 -lt 1 ]
+ eval 'pass=$pass_dev0'
+ pass=1/0/0
+ echo 1/0/0
+ grep '^[0-9]\+/[0-9]\+/[0-9]\+$'
+ bsfform=1/0/0
+ [ -z 1/0/0 ]
+ bsf=1/0/0
+ devargs=' -s 2:0,virtio-net,tap0  -s
3:0,virtio-blk,FreeBSD-14.0-STABLE-amd64.raw  -s 4:0,passthru,1/0/0 '
+ nextslot=5
+ i=1
+ [ 1 -lt 1 ]
+ efiargs=''
+ [ 0 -gt 0 ]
+ /usr/sbin/bhyve -c 2 -m 512M -H -A -P -S -s 0:0,hostbridge -s
1:0,lpc -s 2:0,virtio-net,tap0 -s
3:0,virtio-blk,FreeBSD-14.0-STABLE-amd64.raw -s 4:0,passthru,1/0/0 -l
com1,stdio vm0
---<<BOOT>>---
Copyright (c) 1992-2023 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 14.0-STABLE #0 stable/14-n267376-ca8e2e4c91cc: Thu Apr 18
05:55:35 UTC 2024
    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
FreeBSD clang version 17.0.6 (https://github.com/llvm/llvm-project.git
llvmorg-17.0.6-0-g6009708b4367)
VT: init without driver.
CPU: AMD Ryzen 5 7540U w/ Radeon(TM) 740M Graphics   (3194.09-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0xa70f41  Family=0x19  Model=0x74  Stepping=1
  Features=0x1783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0xfed83203<SSE3,PCLMULQDQ,SSSE3,FMA,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND,HV>
  AMD Features=0x26500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,LM>
  AMD Features2=0x444231fb<LAHF,CMP,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,SKINIT,WDT,TCE,Topology,DBE,ADMSKX>
  Structured Extended
Features=0xf01703a9<FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,AVX512F,AVX512DQ,RDSEED,SMAP,AVX512CD,SHA,AVX512BW,AVX512VL>
  Structured Extended Features2=0x600<VAES,VPCLMULQDQ>
  XSAVE Features=0x1<XSAVEOPT>
  AMD Extended Feature Extensions ID EBX=0x7<CLZERO,IRPerf,XSaveErPtr>
  TSC: P-state invariant
Hypervisor: Origin = "bhyve bhyve "
real memory  = 536870912 (512 MB)
avail memory = 482742272 (460 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <BHYVE  BVAPIC >
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 2 package(s) x 1 core(s)
random: registering fast source Intel Secure Key RNG
random: fast provider: "Intel Secure Key RNG"
random: unblocking device.
ioapic0 <Version 1.1> irqs 0-31
Launching APs: 1
random: entropy device external interface
kbd1 at kbdmux0
smbios0: <System Management BIOS> at iomem 0xf1000-0xf101e
smbios0: Version: 2.6, BCD Revision: 2.6
aesni0: <AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS,SHA1,SHA256>
acpi0: <BHYVE BVXSDT >
acpi0: Power Button (fixed)
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 16777216 Hz quality 950
Event timer "HPET" frequency 16777216 Hz quality 550
Event timer "HPET1" frequency 16777216 Hz quality 450
Event timer "HPET2" frequency 16777216 Hz quality 450
Event timer "HPET3" frequency 16777216 Hz quality 450
Event timer "HPET4" frequency 16777216 Hz quality 450
Event timer "HPET5" frequency 16777216 Hz quality 450
Event timer "HPET6" frequency 16777216 Hz quality 450
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
virtio_pci0: <VirtIO PCI (legacy) Network adapter> port 0x2080-0x20bf
mem 0xc0108000-0xc0109fff irq 16 at device 2.0 on pci0
vtnet0: <VirtIO Networking Adapter> on virtio_pci0
vtnet0: Ethernet address: 00:a0:98:f0:55:05
vtnet0: netmap queues/slots: TX 1/1024, RX 1/512
000.000148 [ 452] vtnet_netmap_attach       vtnet attached txq=1,
txd=1024 rxq=1, rxd=512
virtio_pci1: <VirtIO PCI (legacy) Block adapter> port 0x2000-0x207f
mem 0xc010a000-0xc010bfff irq 17 at device 3.0 on pci0
vtblk0: <VirtIO Block Adapter> on virtio_pci1
vtblk0: 6176MB (12649685 512 byte sectors)
vmgenc0: <VM Generation Counter> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
driver bug: Unable to set devclass (class: atkbdc devname: (unknown))
Unhandled ps2 mouse command 0xe1
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
WARNING: Device "psm" is Giant locked and may be deleted before FreeBSD 15.0.
psm0: model Generic PS/2 mouse, device ID 0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: console (115200,n,8,1)
uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0
uart2: <16550 or compatible> port 0x3e8-0x3ef irq 4 on acpi0
uart3: <16550 or compatible> port 0x2e8-0x2ef irq 3 on acpi0
vga0: <Generic ISA VGA> at port 0x3b0-0x3bb iomem 0xb0000-0xb7fff
pnpid PNP0900 on isa0
Timecounter "TSC-low" frequency 1596990008 Hz quality 1000
Timecounters tick every 10.000 msec
usb_needs_explore_all: no devclass
Trying to mount root from ufs:/dev/gpt/rootfs [rw]...
Setting hostuuid: 60235bf5-9aa4-4048-a911-ef52282ae663.
Setting hostid: 0x0e7c51ad.
Starting file system checks:
/dev/gpt/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/gpt/rootfs: clean, 375808 free (16 frags, 46974 blocks, 0.0% fragmentation)
/dev/gpt/efiesp: FILESYSTEM CLEAN; SKIPPING CHECKS
Mounting local filesystems:.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32 /usr/lib32
Setting hostname: freebsd.
Setting up harvesting:
PURE_VMGENID,PURE_RDRAND,[CALLOUT],[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
Feeding entropy: .
lo0: link state changed to UP
vtnet0: link state changed to UP
    Starting Network: lo0 vtnet0.
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    groups: lo
    nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
vtnet0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP>
metric 0 mtu 1500
    options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
    ether 00:a0:98:f0:55:05
    inet6 fe80::2a0:98ff:fef0:5505%vtnet0 prefixlen 64 scopeid 0x1
    media: Ethernet autoselect (10Gbase-T <full-duplex>)
    status: active
    nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
Starting devd.
Starting dhclient.
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 18
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 21
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 14
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

Waiting 30s for the default route interface: .............................
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Updating /var/run/os-release done.
Clearing /tmp (X related).
Updating motd:.
Creating and/or trimming log files.
Starting syslogd.
Mounting late filesystems:.
Starting cron.
Starting background file system checks in 60 seconds.

Sat Apr 20 15:41:33 UTC 2024

FreeBSD/amd64 (freebsd) (ttyu0)

login: