June 19, 2025 by Daniel F Dickinson2 minutes
Getting good performance with Windows 11 Pro running under Libvirt/KVM on Linux requires some special configs, especially if one wants to enable WSL2 (which requires 'Nested virtualization'). This is a brief cheatsheet on the required configuration.
Getting good performance with Windows 11 Pro running under Libvirt/KVM on Linux requires some special configs, especially if one wants to enable WSL2 (which requires ‘Nested virtualization’). This is a brief cheatsheet on the required configuration.
Assumes recent-ish version of Libvirt (e.g. Debian 12 Bookworm’s version as of 2026-06-19, which is later in the release cycle as the next Debian (Trixie) is now at RC1).
virt-manager
(Virtual Machine Manager) with editing of XML
enabled in preferences.Copy host CPU configuration (host-passthrough)
is
unchecked and model is the model that your were shown by
virsh capabilities
, and make sure you ‘Apply’ changes.Inside the <os firmware='efi'>…</os>
tags, add:
<firmware>
<feature enabled="yes" name="enrolled-keys"/>
<feature enabled="yes" name="secure-boot"/>
</firmware>
Inside the <features>…</features>
tags, add:
<vmport state="off"/>
<smm state="on"/>
Edit the <cpu mode=… match="exact">…</cpu>
section to be (modifying
topology appropriately for your CPU and the number of logical cores you
wish to assign. The example below will use 4 virtual cores with 2 threads
each for 8 virtual logical cores):
<cpu mode="custom" match="exact" check="partial">
<model>your_cpu_model</model>
<topology sockets="1" dies="1" cores="4" threads="2"/>
<feature policy="require" name="vmx"/>
<feature policy="disable" name="hypervisor"/>
<feature policy="disable" name="mpx"/>
</cpu>
Apply your changes.
msinfo32.exe
and confirm secure boot and
virtualization-based security are operational.Information was gleaned from the following sources, as well as the libvirt documentation, and testing.
See also: