aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-04-30 13:31:24 +0300
committerMichael S. Tsirkin <mst@redhat.com>2012-05-02 17:51:27 +0300
commit57d3ee522717d3402786043ba8f11851597ed0db (patch)
tree4f981ab10613762395443b7f4f59716c723e93ca
parentb295cfd75d02d6db159e76185e050417aa286a15 (diff)
downloadvhost-57d3ee522717d3402786043ba8f11851597ed0db.tar.gz
kvm: fix cpuid eax
cpuid eax should return the max leaf so that guests can find out the valid range. This matches Xen et al. Update documentation to match. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--Documentation/virtual/kvm/cpuid.txt6
-rw-r--r--arch/x86/kvm/cpuid.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/Documentation/virtual/kvm/cpuid.txt b/Documentation/virtual/kvm/cpuid.txt
index 882068538c9c9..83afe65d4966d 100644
--- a/Documentation/virtual/kvm/cpuid.txt
+++ b/Documentation/virtual/kvm/cpuid.txt
@@ -10,11 +10,15 @@ a guest.
KVM cpuid functions are:
function: KVM_CPUID_SIGNATURE (0x40000000)
-returns : eax = 0,
+returns : eax = 0x40000001,
ebx = 0x4b4d564b,
ecx = 0x564b4d56,
edx = 0x4d.
Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM".
+The value in eax corresponds to the maximum cpuid function present in this leaf,
+and will be updated if more functions are added in the future.
+Note also that old hosts set eax value to 0x0. This should
+be interpreted as if the value was 0x40000001.
This function queries the presence of KVM cpuid leafs.
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 9fed5bedaad6a..eba834546d6e2 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -397,7 +397,7 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
case KVM_CPUID_SIGNATURE: {
char signature[12] = "KVMKVMKVM\0\0";
u32 *sigptr = (u32 *)signature;
- entry->eax = 0;
+ entry->eax = KVM_CPUID_FEATURES;
entry->ebx = sigptr[0];
entry->ecx = sigptr[1];
entry->edx = sigptr[2];