Intel 12th Gen CPU not working with QEMU Hyper-V nested virtualization
Host environment
- Guest Operating system: Manjaro
- Host OS/kernel version: 5.18.0-rc7 GNOME
- Architecture: x86_64
- QEMU flavor: qemu-system-x86_64
- QEMU version: QEMU emulator version 7.0.0
Emulated/Virtualized environment
- Operating system: Windows 10
- OS/kernel version: 21H2 (tried 1909 as well)
- Architecture: x86_64
Description of problem
When booting with Hyper-V + host-passthrough it gets stuck at tianocore, does not change until I reboot which then loops into windows diagnostics which leads nowhere. Done using Windows 10, tried using newest windows version and 1909.
Specs: Manjaro Gnome 5.15 LTS, i5-12600k, z690 gigabyte aorus elite ddr4, rtx 3070ti.
I’ve spent days trying to figure out what was messing with it and it turned out I could boot when messing with my CPU topology, for some reason my 12th gen + Hyper-V + host-passthrough only works with sockets. Cores and threads above 1 causes boot problems, apart from disabling vme which boots, but the hypervisor does not load.
This fails (normal host-passthrough):
<cpu mode="host-passthrough" check="none" migratable="on">
<topology sockets="1" dies="1" cores="6" threads="2"/>
</cpu>
This boots (-can only change sockets):
<cpu mode="host-passthrough" check="none" migratable="on">
<topology sockets="12" dies="1" cores="1" threads="1"/>
</cpu>
This boots (-no hypervisor):
<cpu mode="host-passthrough" check="partial" migratable="off">
<topology sockets="1" dies="1" cores="6" threads="2"/>
<feature policy="disable" name="vme"/>
</cpu>
No matter what adjustment I do I cannot change the cores or threads or it will result in a boot failure, host-model just does not work once I boot the machine the host model changes to cooperlake.
My current way of bypassing this is I’ve downloaded the QEMU source code, gone through cpu.c and modified the default skylake-client CPU model to match my CPU, then I added in most of my i5-12600k flags manually, this seems to work with a 35-45% performance drop in CPU and in ram. Without Hyper-V enabled and using the normal host-passthrough I get near bare metal performance.
Tried with multiple versions of QEMU, EDK2, and loads of kernel versions (to add to this my i5-12600k gen does not work on kernel version 5.13 and below) even went ahead to try Ubuntu and had the same problem, my other (i7-9700k) PC works fine with Hyper-V. Also disabled my E-cores through bios resulting in the same issue. CPU pinning the P-cores to the guest does not seem to help.
Steps to reproduce
- Enable hyper-v in windows features
- Restart guest
- Boot failure
Additional information
Hyper-V host-passthrough XML: https://pst.klgrth.io/paste/yc5wk