aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-05-02 10:55:56 -0400
committerAvi Kivity <avi@redhat.com>2012-05-06 08:51:56 -0400
commit57c22e5f35aa4b9b2fe11f73f3e62bbf9ef36190 (patch)
tree0ec4365a32d290c7e80d02bb67f7f28c188b39a2
parente726b1bd64b0b8945c171d2d4bf749fba9fc0800 (diff)
KVM: fix cpuid eax for KVM leaf
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. Tested with -cpu host. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Avi Kivity <avi@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 882068538c9c..83afe65d4966 100644
--- a/Documentation/virtual/kvm/cpuid.txt
+++ b/Documentation/virtual/kvm/cpuid.txt
@@ -10,11 +10,15 @@ a guest.
10KVM cpuid functions are: 10KVM cpuid functions are:
11 11
12function: KVM_CPUID_SIGNATURE (0x40000000) 12function: KVM_CPUID_SIGNATURE (0x40000000)
13returns : eax = 0, 13returns : eax = 0x40000001,
14 ebx = 0x4b4d564b, 14 ebx = 0x4b4d564b,
15 ecx = 0x564b4d56, 15 ecx = 0x564b4d56,
16 edx = 0x4d. 16 edx = 0x4d.
17Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM". 17Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM".
18The value in eax corresponds to the maximum cpuid function present in this leaf,
19and will be updated if more functions are added in the future.
20Note also that old hosts set eax value to 0x0. This should
21be interpreted as if the value was 0x40000001.
18This function queries the presence of KVM cpuid leafs. 22This function queries the presence of KVM cpuid leafs.
19 23
20 24
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index c2134b881033..7df1c6d839fb 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -398,7 +398,7 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
398 case KVM_CPUID_SIGNATURE: { 398 case KVM_CPUID_SIGNATURE: {
399 char signature[12] = "KVMKVMKVM\0\0"; 399 char signature[12] = "KVMKVMKVM\0\0";
400 u32 *sigptr = (u32 *)signature; 400 u32 *sigptr = (u32 *)signature;
401 entry->eax = 0; 401 entry->eax = KVM_CPUID_FEATURES;
402 entry->ebx = sigptr[0]; 402 entry->ebx = sigptr[0];
403 entry->ecx = sigptr[1]; 403 entry->ecx = sigptr[1];
404 entry->edx = sigptr[2]; 404 entry->edx = sigptr[2];