Re: [PATCH v3 09/21] KVM:x86: Load guest FPU state when accessing xsaves-managed MSRs

From: Yang, Weijiang
Date: Thu Jun 15 2023 - 22:02:34 EST



On 6/16/2023 7:50 AM, Sean Christopherson wrote:
On Thu, May 11, 2023, Yang Weijiang wrote:
From: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>

Load the guest's FPU state if userspace is accessing MSRs whose values are
managed by XSAVES. Two MSR access helpers, i.e., kvm_{get,set}_xsave_msr(),
are introduced by a later patch to facilitate access to this kind of MSRs.


[...]
#define KVM_X86_OP(func) \
@@ -4336,6 +4339,21 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
}
EXPORT_SYMBOL_GPL(kvm_get_msr_common);
+static const u32 xsave_msrs[] = {
Can you change this to "xstate_msrs"?
OK, will change it in next version.


+ MSR_IA32_U_CET, MSR_IA32_PL3_SSP,
+};
+
+static bool is_xsaves_msr(u32 index)
And then is_xstate_msr(). The intent to is check if an MSR is managed as part of
the xstate, not if the MSR is somehow related to XSAVE itself.
Make sense, will change it. Thanks!