]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: set the HYPERVISOR flag in cpuid
authorSasha Levin <levinsasha928@gmail.com>
Wed, 20 Jun 2012 07:37:39 +0000 (11:37 +0400)
committerPekka Enberg <penberg@kernel.org>
Wed, 20 Jun 2012 07:41:10 +0000 (10:41 +0300)
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 <levinsasha928@gmail.com>
[gorcunov@: Add comments on bits]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/x86/cpuid.c

index 75f3b4d2e7f32533b62ae0d5bf8158527d8b51f8..4c140f0c57e6d5b5a9ebf210df4dedcace5726d1 100644 (file)
@@ -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: