diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-12-03 09:49:56 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-12-16 12:49:46 -0500 |
commit | f35310546399eb77f03d37e760320e021f9a8568 (patch) | |
tree | 2a19d7a473e2d0658512de4c7b31baf2b3c85b6e | |
parent | 0bcf261cc86d082923082f79febe2d13c055f217 (diff) |
KVM: VMX: fix read/write sizes of VMCS fields
In theory this should have broken EPT on 32-bit kernels (due to
reading the high part of natural-width field GUEST_CR3). Not sure
if no one noticed or the processor behaves differently from the
documentation.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/vmx.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c39737ff0581..b1af1e48070b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4868,7 +4868,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) | |||
4868 | 4868 | ||
4869 | seg_setup(VCPU_SREG_CS); | 4869 | seg_setup(VCPU_SREG_CS); |
4870 | vmcs_write16(GUEST_CS_SELECTOR, 0xf000); | 4870 | vmcs_write16(GUEST_CS_SELECTOR, 0xf000); |
4871 | vmcs_write32(GUEST_CS_BASE, 0xffff0000); | 4871 | vmcs_writel(GUEST_CS_BASE, 0xffff0000ul); |
4872 | 4872 | ||
4873 | seg_setup(VCPU_SREG_DS); | 4873 | seg_setup(VCPU_SREG_DS); |
4874 | seg_setup(VCPU_SREG_ES); | 4874 | seg_setup(VCPU_SREG_ES); |
@@ -4904,7 +4904,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) | |||
4904 | 4904 | ||
4905 | vmcs_write32(GUEST_ACTIVITY_STATE, GUEST_ACTIVITY_ACTIVE); | 4905 | vmcs_write32(GUEST_ACTIVITY_STATE, GUEST_ACTIVITY_ACTIVE); |
4906 | vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, 0); | 4906 | vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, 0); |
4907 | vmcs_write32(GUEST_PENDING_DBG_EXCEPTIONS, 0); | 4907 | vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, 0); |
4908 | 4908 | ||
4909 | setup_msrs(vmx); | 4909 | setup_msrs(vmx); |
4910 | 4910 | ||
@@ -7893,7 +7893,7 @@ static void dump_vmcs(void) | |||
7893 | u32 pin_based_exec_ctrl = vmcs_read32(PIN_BASED_VM_EXEC_CONTROL); | 7893 | u32 pin_based_exec_ctrl = vmcs_read32(PIN_BASED_VM_EXEC_CONTROL); |
7894 | u32 secondary_exec_control = 0; | 7894 | u32 secondary_exec_control = 0; |
7895 | unsigned long cr4 = vmcs_readl(GUEST_CR4); | 7895 | unsigned long cr4 = vmcs_readl(GUEST_CR4); |
7896 | u64 efer = vmcs_readl(GUEST_IA32_EFER); | 7896 | u64 efer = vmcs_read64(GUEST_IA32_EFER); |
7897 | int i, n; | 7897 | int i, n; |
7898 | 7898 | ||
7899 | if (cpu_has_secondary_exec_ctrls()) | 7899 | if (cpu_has_secondary_exec_ctrls()) |
@@ -10159,7 +10159,7 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, | |||
10159 | * Additionally, restore L2's PDPTR to vmcs12. | 10159 | * Additionally, restore L2's PDPTR to vmcs12. |
10160 | */ | 10160 | */ |
10161 | if (enable_ept) { | 10161 | if (enable_ept) { |
10162 | vmcs12->guest_cr3 = vmcs_read64(GUEST_CR3); | 10162 | vmcs12->guest_cr3 = vmcs_readl(GUEST_CR3); |
10163 | vmcs12->guest_pdptr0 = vmcs_read64(GUEST_PDPTR0); | 10163 | vmcs12->guest_pdptr0 = vmcs_read64(GUEST_PDPTR0); |
10164 | vmcs12->guest_pdptr1 = vmcs_read64(GUEST_PDPTR1); | 10164 | vmcs12->guest_pdptr1 = vmcs_read64(GUEST_PDPTR1); |
10165 | vmcs12->guest_pdptr2 = vmcs_read64(GUEST_PDPTR2); | 10165 | vmcs12->guest_pdptr2 = vmcs_read64(GUEST_PDPTR2); |