Re: [PATCH v13 05/21] KVM: x86: Load guest FPU state when access XSAVE-managed MSRs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 6b01c6e9330e..799ac76679c9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4566,6 +4569,21 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
  }
  EXPORT_SYMBOL_GPL(kvm_get_msr_common);
+/*
+ *  Returns true if the MSR in question is managed via XSTATE, i.e. is context
+ *  switched with the rest of guest FPU state.
+ */
+static bool is_xstate_managed_msr(u32 index)
+{
+	switch (index) {
+	case MSR_IA32_U_CET:


Why MSR_IA32_S_CET is not included here?


+	case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:
+		return true;
+	default:
+		return false;
+	}
+}


Is it better to do?

static bool is_xstate_managed_msr(u32 index)
{
         if (!kvm_caps.supported_xss)
                 return false;

         switch (index) {
         case MSR_IA32_U_CET:
         case MSR_IA32_S_CET:
         case MSR_IA32_PL1_SSP ... MSR_IA32_PL3_SSP:
                 return kvm_caps.supported_xss & XFEATURE_MASK_CET_USER &&
                        kvm_caps.supported_xss & XFEATURE_MASK_CET_KERNEL;
         default:
                 return false;
         }
}

And it would be obvious how to add new MSRs related to other XFEATURE bits.

Thanks!
    Xin




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux