aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-04-16 10:51:17 -0400
committerAvi Kivity <avi@qumranet.com>2008-04-27 11:21:42 -0400
commitd7bf8221a3037d0d0760a1ccf1833bda03213abf (patch)
tree04735d97c44d77f39e874e55b814e88ad9fb612c /arch/x86/kvm
parentec7cf6903ffced20098e2bcc27a184172836dfb9 (diff)
KVM: SVM: sync V_TPR with LAPIC.TPR if CR8 write intercept is disabled
If the CR8 write intercept is disabled the V_TPR field of the VMCB needs to be synced with the TPR field in the local apic. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/svm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index f8ce36e6690c..ee2ee83f3c48 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1620,6 +1620,16 @@ static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu)
1620{ 1620{
1621} 1621}
1622 1622
1623static inline void sync_cr8_to_lapic(struct kvm_vcpu *vcpu)
1624{
1625 struct vcpu_svm *svm = to_svm(vcpu);
1626
1627 if (!(svm->vmcb->control.intercept_cr_write & INTERCEPT_CR8_MASK)) {
1628 int cr8 = svm->vmcb->control.int_ctl & V_TPR_MASK;
1629 kvm_lapic_set_tpr(vcpu, cr8);
1630 }
1631}
1632
1623static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu) 1633static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu)
1624{ 1634{
1625 struct vcpu_svm *svm = to_svm(vcpu); 1635 struct vcpu_svm *svm = to_svm(vcpu);
@@ -1791,6 +1801,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1791 1801
1792 stgi(); 1802 stgi();
1793 1803
1804 sync_cr8_to_lapic(vcpu);
1805
1794 svm->next_rip = 0; 1806 svm->next_rip = 0;
1795} 1807}
1796 1808