[tip:tools/kvm] kvm tools: set the HYPERVISOR flag in cpuid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  5fffd63db1260fb56a3ed37cf2bbc5f901fcbad4
Gitweb:     http://git.kernel.org/tip/5fffd63db1260fb56a3ed37cf2bbc5f901fcbad4
Author:     Sasha Levin <levinsasha928@xxxxxxxxx>
AuthorDate: Wed, 20 Jun 2012 11:37:39 +0400
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Wed, 20 Jun 2012 10:41:10 +0300

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 <levinsasha928@xxxxxxxxx>
[gorcunov@: Add comments on bits]
Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/x86/cpuid.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tools/kvm/x86/cpuid.c b/tools/kvm/x86/cpuid.c
index 75f3b4d..4c140f0 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:
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux