KVM: Fix cpuid leaf 0xb loop termination
authorNitin A Kamble <nitin.a.kamble@intel.com>
Wed, 5 Nov 2008 23:37:36 +0000 (15:37 -0800)
committerAvi Kivity <avi@redhat.com>
Wed, 31 Dec 2008 14:52:24 +0000 (16:52 +0200)
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>
arch/x86/kvm/x86.c

index 9a4a39c..2889a0f 100644 (file)
@@ -1276,7 +1276,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);