acrn-hypervisor/hypervisor/arch/x86/guest
Shiqing Gao d90dbc0d91 hv: check the capability of XSAVES/XRSTORS instructions before execution
For platforms that do not support XSAVES/XRSTORS instructions, like QEMU,
executing these instructions causes #UD.
This patch adds the check before the execution of XSAVES/XRSTORS instructions.

It also refines the logic inside rstore_xsave_area for the following reason:
If XSAVES/XRSTORS instructions are supported, restore XSAVE area if any of the
following conditions is met:
 1. "vcpu->launched" is false (state initialization for guest)
 2. "vcpu->arch.xsave_enabled" is true (state restoring for guest)

 * Before vCPU is launched, condition 1 is satisfied.
 * After vCPU is launched, condition 2 is satisfied because
   is_valid_xsave_combination() guarantees that "vcpu->arch.xsave_enabled"
   is consistent with pcpu_has_cap(X86_FEATURE_XSAVES).
Therefore, the check against "vcpu->launched" and "vcpu->arch.xsave_enabled"
can be eliminated here.

Tracked-On: #6481

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@Intel.com>
2021-08-26 09:42:23 +08:00
..
assign.c hv: validate input for dmar_free_irte function 2021-06-08 09:03:10 +08:00
ept.c hv: Use 64 bits definition for 64 bits MSR_IA32_VMX_EPT_VPID_CAP operation 2021-07-02 09:24:12 +08:00
guest_memory.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
hyperv.c hv/mod_timer: split tsc handling code from timer. 2021-05-18 16:43:28 +08:00
instr_emul.c HV: Fix decode_instruction() trigger #UD for emulating UC-lock 2021-07-21 11:25:47 +08:00
lock_instr_emul.c HV: rename splitlock file name 2021-07-21 11:25:47 +08:00
nested.c hv: nested: fix bugs in init_vmx_msrs() 2021-08-20 09:40:50 +08:00
pm.c hv: dm: Use new power management data structures 2021-07-15 11:53:54 +08:00
trusty.c hv/mod_timer: split tsc handling code from timer. 2021-05-18 16:43:28 +08:00
ucode.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
vcpu.c hv: check the capability of XSAVES/XRSTORS instructions before execution 2021-08-26 09:42:23 +08:00
vcpuid.c hv: mask off LA57 in cpuid 2021-08-20 11:02:21 +08:00
ve820.c hv:enable GVT-d for pre-launched linux guest in logical partion mode 2021-08-19 11:56:26 +08:00
vept.c hv: nested: Keep privilege bits sync in shadow EPT entry 2021-07-02 09:24:12 +08:00
virq.c HV: rename splitlock file name 2021-07-21 11:25:47 +08:00
virtual_cr.c hv: nested: enable nested virtualization 2021-05-13 16:16:30 +08:00
vlapic_priv.h hv: add ops to vlapic structure 2019-07-19 16:47:06 +08:00
vlapic.c HV: Fix decode_instruction() trigger #UD for emulating UC-lock 2021-07-21 11:25:47 +08:00
vm_reset.c hv: dm: Use new power management data structures 2021-07-15 11:53:54 +08:00
vm.c hv: quirks: SMBIOS passthrough for prelaunched-VM 2021-08-26 09:24:50 +08:00
vmcall.c hv: dm: Use new VM management ioctls 2021-07-15 11:53:54 +08:00
vmcs.c hv: Pass-through IA32_TSC_AUX MSR to L1 guest 2021-08-26 09:25:54 +08:00
vmexit.c hv: remove xsave dependence 2021-08-10 16:36:15 +08:00
vmsr.c hv: Pass-through IA32_TSC_AUX MSR to L1 guest 2021-08-26 09:25:54 +08:00
vmtrr.c hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
vmx_asm.S hv: mod: do not use explicit arch name when including headers 2021-05-08 11:15:46 +08:00
vmx_io.c HV: Fix decode_instruction() trigger #UD for emulating UC-lock 2021-07-21 11:25:47 +08:00