aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-04-16 10:51:15 -0400
committerAvi Kivity <avi@qumranet.com>2008-04-27 11:21:40 -0400
commit649d68643ebf02f31859ffbb16676aa44c72e6e9 (patch)
treedf28701a2ea2854765d41ba54ae8b3cb56ad0b47 /arch
parentbbf45ba57eaec56569918a8bab96ab653bd45ec1 (diff)
KVM: SVM: sync TPR value to V_TPR field in the VMCB
This patch adds syncing of the lapic.tpr field to the V_TPR field of the VMCB. With this change we can safely remove the CR8 read intercept. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch')
-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();