]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
KVM: fix cpuid eax for KVM leaf
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 2 May 2012 14:55:56 +0000 (17:55 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 6 May 2012 12:51:56 +0000 (15:51 +0300)
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>
Documentation/virtual/kvm/cpuid.txt
arch/x86/kvm/cpuid.c

index 882068538c9c95fc08fd5dec62ac008a5bda1cc3..83afe65d4966d0664186e2163083510da5aba012 100644 (file)
@@ -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.
 
 
index c2134b88103365d277f83a09752d426299ae0a25..7df1c6d839fb495f9024851987ea622442338d70 100644 (file)
@@ -398,7 +398,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];