Index: sys/x86/x86/identcpu.c =================================================================== --- sys/x86/x86/identcpu.c +++ sys/x86/x86/identcpu.c @@ -1304,6 +1304,22 @@ if (cpu_feature2 & CPUID2_HV) { vm_guest = VM_GUEST_VM; do_cpuid(0x40000000, regs); + + if (regs[0] == 0) { + /* + * At least some versions of KVM return 0 in + * %eax rather than a valid hv_high value. + * Check to see if the vendor string is + * different from the leaf 0 string and + * overwrite the returned %eax to 0x4000000 in + * that case. + */ + if (regs[1] != ((u_int *)&cpu_vendor)[0] || + regs[2] != ((u_int *)&cpu_vendor)[1] || + regs[3] != ((u_int *)&cpu_vendor)[2]) + regs[0] = 0x40000000; + } + if (regs[0] >= 0x40000000) { hv_high = regs[0]; ((u_int *)&hv_vendor)[0] = regs[1];