Skip to content

Commit 20800bc

Browse files
aprzywaravikivity
authored andcommitted
KVM: fix XSAVE bit scanning
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>
1 parent 0857b9e commit 20800bc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎arch/x86/kvm/x86.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,9 +2395,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
23952395
int i;
23962396

23972397
entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
2398-
for (i = 1; *nent < maxnent; ++i) {
2399-
if (entry[i - 1].eax == 0 && i != 2)
2400-
break;
2398+
for (i = 1; *nent < maxnent && i < 64; ++i) {
2399+
if (entry[i].eax == 0)
2400+
continue;
24012401
do_cpuid_1_ent(&entry[i], function, i);
24022402
entry[i].flags |=
24032403
KVM_CPUID_FLAG_SIGNIFCANT_INDEX;

0 commit comments

Comments
 (0)