]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: fix XSAVE bit scanning
authorAndre Przywara <andre.przywara@amd.com>
Wed, 30 Mar 2011 13:01:45 +0000 (15:01 +0200)
committerAvi Kivity <avi@redhat.com>
Thu, 7 Apr 2011 09:24:58 +0000 (12:24 +0300)
When KVM scans the 0xD CPUID leaf for propagating the XSAVE save area
leaves, it assumes that the leaves are contigious and stops at the
first zero one. On AMD hardware there is a gap, though, as LWP uses
leaf 62 to announce it's state save area.
So lets iterate through all 64 possible leaves and simply skip zero
ones to also cover later features.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index d95961369f3ed21f1f50ed3e8fe879aa5b6a92f2..9244f39c2a89a718a8799c08f1eb8a643830f6bd 100644 (file)
@@ -2402,9 +2402,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
                int i;
 
                entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
-               for (i = 1; *nent < maxnent; ++i) {
-                       if (entry[i - 1].eax == 0 && i != 2)
-                               break;
+               for (i = 1; *nent < maxnent && i < 64; ++i) {
+                       if (entry[i].eax == 0)
+                               continue;
                        do_cpuid_1_ent(&entry[i], function, i);
                        entry[i].flags |=
                               KVM_CPUID_FLAG_SIGNIFCANT_INDEX;