|
@@ -422,6 +422,7 @@ struct nested_vmx {
|
|
struct list_head vmcs02_pool;
|
|
struct list_head vmcs02_pool;
|
|
int vmcs02_num;
|
|
int vmcs02_num;
|
|
u64 vmcs01_tsc_offset;
|
|
u64 vmcs01_tsc_offset;
|
|
|
|
+ bool change_vmcs01_virtual_x2apic_mode;
|
|
/* L2 must run next, and mustn't decide to exit to L1. */
|
|
/* L2 must run next, and mustn't decide to exit to L1. */
|
|
bool nested_run_pending;
|
|
bool nested_run_pending;
|
|
/*
|
|
/*
|
|
@@ -8424,6 +8425,12 @@ static void vmx_set_virtual_x2apic_mode(struct kvm_vcpu *vcpu, bool set)
|
|
{
|
|
{
|
|
u32 sec_exec_control;
|
|
u32 sec_exec_control;
|
|
|
|
|
|
|
|
+ /* Postpone execution until vmcs01 is the current VMCS. */
|
|
|
|
+ if (is_guest_mode(vcpu)) {
|
|
|
|
+ to_vmx(vcpu)->nested.change_vmcs01_virtual_x2apic_mode = true;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* There is not point to enable virtualize x2apic without enable
|
|
* There is not point to enable virtualize x2apic without enable
|
|
* apicv
|
|
* apicv
|
|
@@ -10749,6 +10756,12 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
|
|
vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL,
|
|
vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL,
|
|
PIN_BASED_VMX_PREEMPTION_TIMER);
|
|
PIN_BASED_VMX_PREEMPTION_TIMER);
|
|
|
|
|
|
|
|
+ if (vmx->nested.change_vmcs01_virtual_x2apic_mode) {
|
|
|
|
+ vmx->nested.change_vmcs01_virtual_x2apic_mode = false;
|
|
|
|
+ vmx_set_virtual_x2apic_mode(vcpu,
|
|
|
|
+ vcpu->arch.apic_base & X2APIC_ENABLE);
|
|
|
|
+ }
|
|
|
|
+
|
|
/* This is needed for same reason as it was needed in prepare_vmcs02 */
|
|
/* This is needed for same reason as it was needed in prepare_vmcs02 */
|
|
vmx->host_rsp = 0;
|
|
vmx->host_rsp = 0;
|
|
|
|
|