|
@@ -2984,6 +2984,13 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
|
|
|
return 1;
|
|
|
msr_info->data = vmcs_read64(GUEST_BNDCFGS);
|
|
|
break;
|
|
|
+ case MSR_IA32_MCG_EXT_CTL:
|
|
|
+ if (!msr_info->host_initiated &&
|
|
|
+ !(to_vmx(vcpu)->msr_ia32_feature_control &
|
|
|
+ FEATURE_CONTROL_LMCE))
|
|
|
+ return 1;
|
|
|
+ msr_info->data = vcpu->arch.mcg_ext_ctl;
|
|
|
+ break;
|
|
|
case MSR_IA32_FEATURE_CONTROL:
|
|
|
msr_info->data = to_vmx(vcpu)->msr_ia32_feature_control;
|
|
|
break;
|
|
@@ -3075,6 +3082,14 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
|
|
|
case MSR_IA32_TSC_ADJUST:
|
|
|
ret = kvm_set_msr_common(vcpu, msr_info);
|
|
|
break;
|
|
|
+ case MSR_IA32_MCG_EXT_CTL:
|
|
|
+ if ((!msr_info->host_initiated &&
|
|
|
+ !(to_vmx(vcpu)->msr_ia32_feature_control &
|
|
|
+ FEATURE_CONTROL_LMCE)) ||
|
|
|
+ (data & ~MCG_EXT_CTL_LMCE_EN))
|
|
|
+ return 1;
|
|
|
+ vcpu->arch.mcg_ext_ctl = data;
|
|
|
+ break;
|
|
|
case MSR_IA32_FEATURE_CONTROL:
|
|
|
if (!vmx_feature_control_msr_valid(vcpu, data) ||
|
|
|
(to_vmx(vcpu)->msr_ia32_feature_control &
|
|
@@ -6484,6 +6499,8 @@ static __init int hardware_setup(void)
|
|
|
|
|
|
kvm_set_posted_intr_wakeup_handler(wakeup_handler);
|
|
|
|
|
|
+ kvm_mce_cap_supported |= MCG_LMCE_P;
|
|
|
+
|
|
|
return alloc_kvm_area();
|
|
|
|
|
|
out8:
|
|
@@ -11109,6 +11126,16 @@ out:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+static void vmx_setup_mce(struct kvm_vcpu *vcpu)
|
|
|
+{
|
|
|
+ if (vcpu->arch.mcg_cap & MCG_LMCE_P)
|
|
|
+ to_vmx(vcpu)->msr_ia32_feature_control_valid_bits |=
|
|
|
+ FEATURE_CONTROL_LMCE;
|
|
|
+ else
|
|
|
+ to_vmx(vcpu)->msr_ia32_feature_control_valid_bits &=
|
|
|
+ ~FEATURE_CONTROL_LMCE;
|
|
|
+}
|
|
|
+
|
|
|
static struct kvm_x86_ops vmx_x86_ops = {
|
|
|
.cpu_has_kvm_support = cpu_has_kvm_support,
|
|
|
.disabled_by_bios = vmx_disabled_by_bios,
|
|
@@ -11238,6 +11265,8 @@ static struct kvm_x86_ops vmx_x86_ops = {
|
|
|
.set_hv_timer = vmx_set_hv_timer,
|
|
|
.cancel_hv_timer = vmx_cancel_hv_timer,
|
|
|
#endif
|
|
|
+
|
|
|
+ .setup_mce = vmx_setup_mce,
|
|
|
};
|
|
|
|
|
|
static int __init vmx_init(void)
|