Skip to content

Commit 05a9e06

Browse files
Like Xubonzini
authored andcommitted
KVM: x86: Sync the states size with the XCR0/IA32_XSS at, any time
XCR0 is reset to 1 by RESET but not INIT and IA32_XSS is zeroed by both RESET and INIT. The kvm_set_msr_common()'s handling of MSR_IA32_XSS also needs to update kvm_update_cpuid_runtime(). In the above cases, the size in bytes of the XSAVE area containing all states enabled by XCR0 or (XCRO | IA32_XSS) needs to be updated. For simplicity and consistency, existing helpers are used to write values and call kvm_update_cpuid_runtime(), and it's not exactly a fast path. Fixes: a554d20 ("KVM: X86: Processor States following Reset or INIT") Cc: [email protected] Signed-off-by: Like Xu <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 4c282e5 commit 05a9e06

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11266,8 +11266,8 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
1126611266

1126711267
vcpu->arch.msr_misc_features_enables = 0;
1126811268

11269-
vcpu->arch.xcr0 = XFEATURE_MASK_FP;
11270-
vcpu->arch.ia32_xss = 0;
11269+
__kvm_set_xcr(vcpu, 0, XFEATURE_MASK_FP);
11270+
__kvm_set_msr(vcpu, MSR_IA32_XSS, 0, true);
1127111271
}
1127211272

1127311273
/* All GPRs except RDX (handled below) are zeroed on RESET/INIT. */

0 commit comments

Comments
 (0)