aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/svm.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 3379e13d9b2c..f8ce36e6690c 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -486,8 +486,7 @@ static void init_vmcb(struct vcpu_svm *svm)
486 486
487 control->intercept_cr_read = INTERCEPT_CR0_MASK | 487 control->intercept_cr_read = INTERCEPT_CR0_MASK |
488 INTERCEPT_CR3_MASK | 488 INTERCEPT_CR3_MASK |
489 INTERCEPT_CR4_MASK | 489 INTERCEPT_CR4_MASK;
490 INTERCEPT_CR8_MASK;
491 490
492 control->intercept_cr_write = INTERCEPT_CR0_MASK | 491 control->intercept_cr_write = INTERCEPT_CR0_MASK |
493 INTERCEPT_CR3_MASK | 492 INTERCEPT_CR3_MASK |
@@ -1621,6 +1620,19 @@ static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu)
1621{ 1620{
1622} 1621}
1623 1622
1623static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu)
1624{
1625 struct vcpu_svm *svm = to_svm(vcpu);
1626 u64 cr8;
1627
1628 if (!irqchip_in_kernel(vcpu->kvm))
1629 return;
1630
1631 cr8 = kvm_get_cr8(vcpu);
1632 svm->vmcb->control.int_ctl &= ~V_TPR_MASK;
1633 svm->vmcb->control.int_ctl |= cr8 & V_TPR_MASK;
1634}
1635
1624static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1636static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1625{ 1637{
1626 struct vcpu_svm *svm = to_svm(vcpu); 1638 struct vcpu_svm *svm = to_svm(vcpu);
@@ -1630,6 +1642,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1630 1642
1631 pre_svm_run(svm); 1643 pre_svm_run(svm);
1632 1644
1645 sync_lapic_to_cr8(vcpu);
1646
1633 save_host_msrs(vcpu); 1647 save_host_msrs(vcpu);
1634 fs_selector = read_fs(); 1648 fs_selector = read_fs();
1635 gs_selector = read_gs(); 1649 gs_selector = read_gs();