If the hardware supports faulting, and the guest has chosen to use it, leave
faulting active in HVM context.
It is more efficient to have hardware convert CPUID to a #GP fault (which we
don't intercept), than to take a VMExit and have Xen re-inject a #GP fault.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
* generating the maximum full cpuid policy into Xen, at which
* this problem will disappear.
*/
- set_cpuid_faulting(nextd && is_pv_domain(nextd) &&
- !is_control_domain(nextd));
+ set_cpuid_faulting(nextd && !is_control_domain(nextd) &&
+ (is_pv_domain(nextd) ||
+ next->arch.cpuid_faulting));
return;
}
break;
case MSR_INTEL_MISC_FEATURES_ENABLES:
+ {
+ bool old_cpuid_faulting = v->arch.cpuid_faulting;
+
if ( msr_content & ~MSR_MISC_FEATURES_CPUID_FAULTING )
goto gp_fault;
- v->arch.cpuid_faulting =
- !!(msr_content & MSR_MISC_FEATURES_CPUID_FAULTING);
+
+ v->arch.cpuid_faulting = msr_content & MSR_MISC_FEATURES_CPUID_FAULTING;
+
+ if ( cpu_has_cpuid_faulting &&
+ (old_cpuid_faulting ^ v->arch.cpuid_faulting) )
+ ctxt_switch_levelling(v);
break;
+ }
default:
if ( passive_domain_do_wrmsr(msr, msr_content) )