aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/vmx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r--drivers/kvm/vmx.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index f1e80a95b69d..19676b5a6719 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1369,6 +1369,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
1369 int i; 1369 int i;
1370 int ret = 0; 1370 int ret = 0;
1371 unsigned long kvm_vmx_return; 1371 unsigned long kvm_vmx_return;
1372 u64 msr;
1372 1373
1373 if (!init_rmode_tss(vmx->vcpu.kvm)) { 1374 if (!init_rmode_tss(vmx->vcpu.kvm)) {
1374 ret = -ENOMEM; 1375 ret = -ENOMEM;
@@ -1376,10 +1377,11 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
1376 } 1377 }
1377 1378
1378 vmx->vcpu.regs[VCPU_REGS_RDX] = get_rdx_init_val(); 1379 vmx->vcpu.regs[VCPU_REGS_RDX] = get_rdx_init_val();
1379 vmx->vcpu.cr8 = 0; 1380 set_cr8(&vmx->vcpu, 0);
1380 vmx->vcpu.apic_base = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; 1381 msr = 0xfee00000 | MSR_IA32_APICBASE_ENABLE;
1381 if (vmx->vcpu.vcpu_id == 0) 1382 if (vmx->vcpu.vcpu_id == 0)
1382 vmx->vcpu.apic_base |= MSR_IA32_APICBASE_BSP; 1383 msr |= MSR_IA32_APICBASE_BSP;
1384 kvm_set_apic_base(&vmx->vcpu, msr);
1383 1385
1384 fx_init(&vmx->vcpu); 1386 fx_init(&vmx->vcpu);
1385 1387
@@ -1860,7 +1862,7 @@ static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1860 return 1; 1862 return 1;
1861 case 8: 1863 case 8:
1862 vcpu_load_rsp_rip(vcpu); 1864 vcpu_load_rsp_rip(vcpu);
1863 vcpu->regs[reg] = vcpu->cr8; 1865 vcpu->regs[reg] = get_cr8(vcpu);
1864 vcpu_put_rsp_rip(vcpu); 1866 vcpu_put_rsp_rip(vcpu);
1865 skip_emulated_instruction(vcpu); 1867 skip_emulated_instruction(vcpu);
1866 return 1; 1868 return 1;
@@ -1957,8 +1959,8 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu,
1957 struct kvm_run *kvm_run) 1959 struct kvm_run *kvm_run)
1958{ 1960{
1959 kvm_run->if_flag = (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) != 0; 1961 kvm_run->if_flag = (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) != 0;
1960 kvm_run->cr8 = vcpu->cr8; 1962 kvm_run->cr8 = get_cr8(vcpu);
1961 kvm_run->apic_base = vcpu->apic_base; 1963 kvm_run->apic_base = kvm_get_apic_base(vcpu);
1962 kvm_run->ready_for_interrupt_injection = (vcpu->interrupt_window_open && 1964 kvm_run->ready_for_interrupt_injection = (vcpu->interrupt_window_open &&
1963 vcpu->irq_summary == 0); 1965 vcpu->irq_summary == 0);
1964} 1966}