Download raw body.
[PATCH 0/7] Hyper-V Generation 2 guests on amd64
OpenBSD/amd64 doesn't run as a Hyper-V Generation 2 (UEFI) guest today: the kernel hangs right after the boot loader hands over, the installer finds no disks, the virtual DVD can't be read, and there is no keyboard because Generation 2 VMs have no i8042. This series fixes that. The patches are against -current (6afb24b0786) and apply in order with "patch -p0" from /usr/src. 1/7 is an independent bug fix. 2/7 also moves the IDE disks of Generation 1 VMs from wd(4) to sd(4). Installs that use DUIDs, as the installer sets up, come up normally; an fstab that names wd devices has to be changed. Details are in 2/7. Tested on Windows 11 (build 26300) Hyper-V, firmware Hyper-V UEFI v4.1. Rebasing from 39ced97e2ed to 6afb24b0786 didn't change the patches. On 6afb24b0786, with these patches: - GENERIC, GENERIC.MP and RAMDISK_CD build without warnings; GENERIC.MP also after each patch. - Generation 2: MP and SP kernels boot; wscons event and raw keyboard input on the console; the whole install ISO read from cd0 with a matching checksum. - QEMU/SeaBIOS with an AHCI disk (no Hyper-V): the 8.0 install from the Generation 1 tests below boots multi-user. On 39ced97e2ed, with the same changes: - pvbus.c, wskbd.c and hidkbd.c compile for i386; wskbd.c and hidkbd.c pass the compiler front end for arm64, armv7 and riscv64. - Generation 2: DDB entered from the keyboard, "show registers", "continue". Without 3/7, reads from cd0 fail with EIO. - Generation 1: an 8.0 install on wd0 (root, swap and fstab by DUID) boots as root on sd0a and mounts every fstab entry. pciide(4) reports channel 0 disabled. The IDE DVD is still cd0 on atapiscsi(4). With disks at IDE 0:0, 0:1 and 1:1 and SCSI 0:0, each appears once as sd0-sd3 with the right size. Concurrent writes read back intact. The stock kernel shows the IDE disks as wd0-wd2 and doesn't see the SCSI disk. With a display console pckbd(4) is the console keyboard and hvkbd(4) doesn't attach. With a serial console hvkbd(4) attaches next to pckbd(4). - With an earlier revision of these changes: Generation 2 install from a CD built with its kernels, KARL relinking and reboots, and the QEMU/OVMF installer. Fault injection: rejected keyboard negotiation; wskbd(4) disabled with config -e; oversized keyboard messages are dropped and input continues (without hv_channel_skip() the keyboard stops for good). The only changes since then are dropping a Generation 1 IDE exception, a comment in 3/7, the hvkbd(4) negotiation timeout and an always-true condition in wscn_input_init(). None of them affects those paths on Generation 2. Not tested: other Hyper-V versions, Azure, live migration, saved state, Secure Boot, and hypervisors exposing Hyper-V enlightenments (QEMU hv-*, VirtualBox), although detection there is unchanged. Yamasaki Yuu (7): hyperv: revoke ring GPADL before freeing it, don't sleep when cold hyperv: attach drivers to channels regardless of monitor notification hvs: use 10-byte commands with the Hyper-V virtual DVD drive amd64: select the Hyper-V delay function before console probing hidkbd: don't claim the console when another keyboard already has it hyperv: add hv_channel_skip() hvkbd: Hyper-V synthetic keyboard driver distrib/sets/lists/man/mi | 1 + share/man/man4/Makefile | 2 +- share/man/man4/hvkbd.4 | 79 +++++ share/man/man4/hyperv.4 | 4 +- sys/arch/amd64/amd64/machdep.c | 8 + sys/arch/amd64/amd64/wscons_machdep.c | 8 + sys/arch/amd64/conf/GENERIC | 2 + sys/arch/amd64/conf/RAMDISK_CD | 2 + sys/dev/hid/hidkbd.c | 3 +- sys/dev/pckbc/files.pckbc | 2 +- sys/dev/pv/files.pv | 5 + sys/dev/pv/hvkbd.c | 436 ++++++++++++++++++++++++++ sys/dev/pv/hvkbdvar.h | 19 ++ sys/dev/pv/hvs.c | 10 + sys/dev/pv/hyperv.c | 57 +++- sys/dev/pv/hypervic.c | 3 +- sys/dev/pv/hypervvar.h | 4 +- sys/dev/pv/pvbus.c | 85 +++-- sys/dev/pv/pvvar.h | 1 + sys/dev/wscons/wskbd.c | 6 + sys/dev/wscons/wskbdvar.h | 1 + 21 files changed, 706 insertions(+), 32 deletions(-) create mode 100644 share/man/man4/hvkbd.4 create mode 100644 sys/dev/pv/hvkbd.c create mode 100644 sys/dev/pv/hvkbdvar.h base-commit: 6afb24b0786a15a1b41b8bfce97d26a83bbbb508
[PATCH 0/7] Hyper-V Generation 2 guests on amd64