> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c > index 7a37c70..a2aab95 100644 > --- a/src/qemu/qemu_conf.c > +++ b/src/qemu/qemu_conf.c > @@ -3494,13 +3496,36 @@ error: > } > > > +#define CPUID_FUNCTION_SVM 0x80000001 > +#define CPUID_ECX_SVM 0x00000004 > + > +#define CPUID_FUNCTION_VMX 0x00000001 > +#define CPUID_ECX_VMX 0x00000020 > + > +static bool qemuCpuHasHwVirt(union cpuData *data) > +{ > + int i; > + for (i = 0 ; i < data->x86.basic_len ; i++) { > + if (data->x86.basic[i].function == CPUID_FUNCTION_VMX && > + (data->x86.basic[i].ecx & CPUID_ECX_VMX)) > + return true; > + } > + for (i = 0 ; i < data->x86.extended_len ; i++) { > + if (data->x86.extended[i].function == CPUID_FUNCTION_SVM && > + (data->x86.extended[i].ecx & CPUID_ECX_SVM)) > + return true; > + } > + return false; > +} > + I think this would better fit as a new API in cpu/cpu.h with a signature like bool cpuHasFeature(const union cpuData *data, const char *feature) and then used as *hasHwVirt = cpuHasFeature(data, "vmx") || cpuHasFeature(data, "svm"); Yes, this is going to be terribly inefficient now since each of this calls will do its own parsing of cpu_map.xml but I'm planning to fix this stupidity. Jirka -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list