]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: Fix cpuid leaf 0xb loop termination
authorNitin A Kamble <nitin.a.kamble@intel.com>
Mon, 23 Mar 2009 20:51:25 +0000 (17:51 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 2 May 2009 17:57:07 +0000 (10:57 -0700)
(cherry picked from 0853d2c1d849ef69884d2447d90d04007590b72b)

For cpuid leaf 0xb the bits 8-15 in ECX register define the end of counting
leaf.      The previous code was using bits 0-7 for this purpose, which is
a bug.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/x86.c

index 4e2135a780b25a8c9e3cd78050daa1f083f436a0..d818088f929bbe2880a9f00213e6ed061588215a 100644 (file)
@@ -1218,7 +1218,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
                entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
                /* read more entries until level_type is zero */
                for (i = 1; *nent < maxnent; ++i) {
-                       level_type = entry[i - 1].ecx & 0xff;
+                       level_type = entry[i - 1].ecx & 0xff00;
                        if (!level_type)
                                break;
                        do_cpuid_1_ent(&entry[i], function, i);