I have seen that some people have had issues with getting cpu host-passthrough working for libvirt when using qemu 5 and a 5.6 kernel on AMD Ryzen CPUs.
Below I have a quick fix for this that allows you to use libvirt without using qemu:commandline.
- Apply the below patch to :
@@ -480,6 +480,9 @@ <feature name='ibpb'> <cpuid eax_in='0x80000008' ebx='0x00001000'/> </feature> + <feature name='amd-stibp'> + <cpuid eax_in='0x80000008' ebx='0x00008000'/> + </feature> <feature name='amd-ssbd'> <cpuid eax_in='0x80000008' ebx='0x01000000'/> </feature>
- Add a line to disable amd-stibp on your guest (something like)
<cpu mode='host-passthrough' check='none'> <topology sockets='1' dies='1' cores='4' threads='2'/> <feature policy='require' name='topoext'/> <feature policy='disable' name='amd-stibp'/> </cpu>
May need to restart libvirt services
Start your guest OS
I will probably submit a patch adding that cpu feature to libvirt later if one hasn’t been made already