From 5fffd63db1260fb56a3ed37cf2bbc5f901fcbad4 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Wed, 20 Jun 2012 11:37:39 +0400 Subject: [PATCH] kvm tools: set the HYPERVISOR flag in cpuid We need to set the HYPERVISOR flag to let the kernel know we're running under a hypervisor. This makes the kernel enable all sorts of para-virtualization options such as kvm-clock. Signed-off-by: Sasha Levin [gorcunov@: Add comments on bits] Signed-off-by: Cyrill Gorcunov Signed-off-by: Pekka Enberg --- tools/kvm/x86/cpuid.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/kvm/x86/cpuid.c b/tools/kvm/x86/cpuid.c index 75f3b4d2e7f3..4c140f0c57e6 100644 --- a/tools/kvm/x86/cpuid.c +++ b/tools/kvm/x86/cpuid.c @@ -21,8 +21,13 @@ static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid) struct kvm_cpuid_entry2 *entry = &kvm_cpuid->entries[i]; switch (entry->function) { + case 1: + /* Set X86_FEATURE_HYPERVISOR */ + if (entry->index == 0) + entry->ecx |= (1 << 31); + break; case 6: - /* Clear presence of IA32_ENERGY_PERF_BIAS */ + /* Clear X86_FEATURE_EPB */ entry->ecx = entry->ecx & ~(1 << 3); break; case CPUID_FUNC_PERFMON: -- 2.39.5