On Thu, Jul 16, 2020 at 11:16:22AM +0800, Yang Weijiang wrote: > From: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > > A handful of CET MSRs are not context switched through "traditional" > methods, e.g. VMCS or manual switching, but rather are passed through > to the guest and are saved and restored by XSAVES/XRSTORS, i.e. in the > guest's FPU state. > > Load the guest's FPU state if userspace is accessing MSRs whose values > are managed by XSAVES so that the MSR helper, e.g. vmx_{get,set}_msr(), > can simply do {RD,WR}MSR to access the guest's value. > > Note that guest_cpuid_has() is not queried as host userspace is allowed > to access MSRs that have not been exposed to the guest, e.g. it might do > KVM_SET_MSRS prior to KVM_SET_CPUID2. No comments on the patch itself. Added a blurb to the changelog to call out the vcpu==NULL case is possible due to KVM_GET_MSRS also being a device scope ioctl(). > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > Co-developed-by: Yang Weijiang <weijiang.yang@xxxxxxxxx> > Signed-off-by: Yang Weijiang <weijiang.yang@xxxxxxxxx>