From: Joerg Roedel Date: Wed, 16 Apr 2008 14:51:17 +0000 (+0200) Subject: KVM: SVM: sync V_TPR with LAPIC.TPR if CR8 write intercept is disabled X-Git-Tag: v2.6.26-rc1~1028^2~5 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d7bf8221a3037d0d0760a1ccf1833bda03213abf;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index f8ce36e6690..ee2ee83f3c4 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) { } +static inline void sync_cr8_to_lapic(struct kvm_vcpu *vcpu) +{ + struct vcpu_svm *svm = to_svm(vcpu); + + if (!(svm->vmcb->control.intercept_cr_write & INTERCEPT_CR8_MASK)) { + int cr8 = svm->vmcb->control.int_ctl & V_TPR_MASK; + kvm_lapic_set_tpr(vcpu, cr8); + } +} + static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu) { 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) stgi(); + sync_cr8_to_lapic(vcpu); + svm->next_rip = 0; }