diff options
-rw-r--r-- | arch/x86/kvm/vmx.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1cdfb5d7580a..7b27af9a14d8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -355,6 +355,7 @@ struct nested_vmx { | |||
355 | /* The host-usable pointer to the above */ | 355 | /* The host-usable pointer to the above */ |
356 | struct page *current_vmcs12_page; | 356 | struct page *current_vmcs12_page; |
357 | struct vmcs12 *current_vmcs12; | 357 | struct vmcs12 *current_vmcs12; |
358 | struct vmcs *current_shadow_vmcs; | ||
358 | 359 | ||
359 | /* vmcs02_list cache of VMCSs recently used to run L2 guests */ | 360 | /* vmcs02_list cache of VMCSs recently used to run L2 guests */ |
360 | struct list_head vmcs02_pool; | 361 | struct list_head vmcs02_pool; |
@@ -5527,6 +5528,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu) | |||
5527 | { | 5528 | { |
5528 | struct kvm_segment cs; | 5529 | struct kvm_segment cs; |
5529 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 5530 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
5531 | struct vmcs *shadow_vmcs; | ||
5530 | 5532 | ||
5531 | /* The Intel VMX Instruction Reference lists a bunch of bits that | 5533 | /* The Intel VMX Instruction Reference lists a bunch of bits that |
5532 | * are prerequisite to running VMXON, most notably cr4.VMXE must be | 5534 | * are prerequisite to running VMXON, most notably cr4.VMXE must be |
@@ -5555,6 +5557,16 @@ static int handle_vmon(struct kvm_vcpu *vcpu) | |||
5555 | skip_emulated_instruction(vcpu); | 5557 | skip_emulated_instruction(vcpu); |
5556 | return 1; | 5558 | return 1; |
5557 | } | 5559 | } |
5560 | if (enable_shadow_vmcs) { | ||
5561 | shadow_vmcs = alloc_vmcs(); | ||
5562 | if (!shadow_vmcs) | ||
5563 | return -ENOMEM; | ||
5564 | /* mark vmcs as shadow */ | ||
5565 | shadow_vmcs->revision_id |= (1u << 31); | ||
5566 | /* init shadow vmcs */ | ||
5567 | vmcs_clear(shadow_vmcs); | ||
5568 | vmx->nested.current_shadow_vmcs = shadow_vmcs; | ||
5569 | } | ||
5558 | 5570 | ||
5559 | INIT_LIST_HEAD(&(vmx->nested.vmcs02_pool)); | 5571 | INIT_LIST_HEAD(&(vmx->nested.vmcs02_pool)); |
5560 | vmx->nested.vmcs02_num = 0; | 5572 | vmx->nested.vmcs02_num = 0; |