aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-07-07 08:58:33 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2016-07-11 04:07:49 -0400
commit8391ce447f18476273331399a7f5930e5494bf46 (patch)
tree778a5086653e55a2c1835457ecfadb6b79b2b62b /arch/x86
parent9314006db8b781715658cd6a28994d84ccce5dee (diff)
KVM: VMX: introduce vm_{entry,exit}_control_reset_shadow
There is no reason to read the entry/exit control fields of the VMCS and immediately write back the same value. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 8cda4449a60e..e51503063181 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1672,6 +1672,11 @@ static __always_inline void vmcs_set_bits(unsigned long field, u32 mask)
1672 __vmcs_writel(field, __vmcs_readl(field) | mask); 1672 __vmcs_writel(field, __vmcs_readl(field) | mask);
1673} 1673}
1674 1674
1675static inline void vm_entry_controls_reset_shadow(struct vcpu_vmx *vmx)
1676{
1677 vmx->vm_entry_controls_shadow = vmcs_read32(VM_ENTRY_CONTROLS);
1678}
1679
1675static inline void vm_entry_controls_init(struct vcpu_vmx *vmx, u32 val) 1680static inline void vm_entry_controls_init(struct vcpu_vmx *vmx, u32 val)
1676{ 1681{
1677 vmcs_write32(VM_ENTRY_CONTROLS, val); 1682 vmcs_write32(VM_ENTRY_CONTROLS, val);
@@ -1700,6 +1705,11 @@ static inline void vm_entry_controls_clearbit(struct vcpu_vmx *vmx, u32 val)
1700 vm_entry_controls_set(vmx, vm_entry_controls_get(vmx) & ~val); 1705 vm_entry_controls_set(vmx, vm_entry_controls_get(vmx) & ~val);
1701} 1706}
1702 1707
1708static inline void vm_exit_controls_reset_shadow(struct vcpu_vmx *vmx)
1709{
1710 vmx->vm_exit_controls_shadow = vmcs_read32(VM_EXIT_CONTROLS);
1711}
1712
1703static inline void vm_exit_controls_init(struct vcpu_vmx *vmx, u32 val) 1713static inline void vm_exit_controls_init(struct vcpu_vmx *vmx, u32 val)
1704{ 1714{
1705 vmcs_write32(VM_EXIT_CONTROLS, val); 1715 vmcs_write32(VM_EXIT_CONTROLS, val);
@@ -10722,8 +10732,8 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
10722 vmcs12->vm_exit_intr_error_code, 10732 vmcs12->vm_exit_intr_error_code,
10723 KVM_ISA_VMX); 10733 KVM_ISA_VMX);
10724 10734
10725 vm_entry_controls_init(vmx, vmcs_read32(VM_ENTRY_CONTROLS)); 10735 vm_entry_controls_reset_shadow(vmx);
10726 vm_exit_controls_init(vmx, vmcs_read32(VM_EXIT_CONTROLS)); 10736 vm_exit_controls_reset_shadow(vmx);
10727 vmx_segment_cache_clear(vmx); 10737 vmx_segment_cache_clear(vmx);
10728 10738
10729 /* if no vmcs02 cache requested, remove the one we used */ 10739 /* if no vmcs02 cache requested, remove the one we used */