acrn-hypervisor/hypervisor/include/arch/x86/asm/guest
Yuanyuan Zhao 0a4c76357e hv: hide mwait from guest.
When CPU support MONITOR/MWAIT, OS prefer to use it enter
deeper C-state.

Now ACRN pass through MONITOR/MWAIT to guest.

For vCPUs (ie vCPU A and vCPU B) share a pCPU, if vCPU A uses MWait to enter C state,
vCPU B could run only after the time slice of vCPU A is expired. This time slice of
vCPU A is gone to waste.

For Local APIC pass-through (used for RTVM), the guest pay more attention to
timeliness than power saving.

So this patch hides MONITOR/MWAIT by:
    1. Clear vCPUID.05H, vCPUID.01H:ECX.[bit 3] and
    MSR_IA32_MISC_ENABLE_MONITOR_ENA to tell the guest VM's vCPU
    does not support MONITOR/MAIT.
    2. Enable MSR_IA32_MISC_ENABLE_MONITOR_ENA bit for
    MSR_IA32_MISC_ENABLE inject 'GP'.
    3. Trap instruction 'MONITOR' and 'MWAIT' and inject 'UD'.
    4. Clear vCPUID.07H:ECX.[bit 5] to hide 'UMONITOR/UMWAIT'.
    5. Clear  "enable user wait and pause" VM-execution control, so
    UMONITOR/MWAIT causes an 'UD'.

Tracked-On: #8253
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
2022-11-04 18:55:52 +08:00
..
assign.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
ept.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
guest_memory.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
guest_pm.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
hyperv.h hv: tlfs: add tlfs TSC freq MSR support for WaaG 2022-07-18 16:15:29 +08:00
instr_emul.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
lock_instr_emul.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
nested.h hv: nested: enable multiple active VMCS12 support 2021-09-26 08:49:35 +08:00
optee.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
trusty.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
ucode.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vcat.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vcpu.h hv: improve smp call to support debugging RTVM 2022-09-26 13:28:02 +08:00
vcpuid.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vept.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
virq.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
virtual_cr.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vlapic.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vm_reset.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vm.h hv: hide mwait from guest. 2022-11-04 18:55:52 +08:00
vmcs.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vmexit.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vmtrr.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vmx_io.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00