diff options
author | Yang, Sheng <sheng.yang@intel.com> | 2007-09-12 18:03:11 +0800 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 10:18:26 +0200 |
commit | 6e5d865c0b9679b00b5e5f0754c9fc2b6b9894d6 (patch) | |
tree | 1b8133926578a16f8849143da5a7d5a6d9e67b24 /drivers/kvm/lapic.c | |
parent | 2a8067f17b8442ecce0b14e134823020ff33b4fa (diff) | |
download | op-kernel-dev-6e5d865c0b9679b00b5e5f0754c9fc2b6b9894d6.zip op-kernel-dev-6e5d865c0b9679b00b5e5f0754c9fc2b6b9894d6.tar.gz |
KVM: VMX: Use shadow TPR/cr8 for 64-bits guests
This patch enables TPR shadow of VMX on CR8 access. 64bit Windows using
CR8 access TPR frequently. The TPR shadow can improve the performance of
access TPR by not causing vmexit.
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/lapic.c')
-rw-r--r-- | drivers/kvm/lapic.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c index df636bf..68bbbb3 100644 --- a/drivers/kvm/lapic.c +++ b/drivers/kvm/lapic.c @@ -170,6 +170,19 @@ static inline int apic_find_highest_irr(struct kvm_lapic *apic) return result; } +int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu) +{ + struct kvm_lapic *apic = (struct kvm_lapic *)vcpu->apic; + int highest_irr; + + if (!apic) + return 0; + highest_irr = apic_find_highest_irr(apic); + + return highest_irr; +} +EXPORT_SYMBOL_GPL(kvm_lapic_find_highest_irr); + int kvm_apic_set_irq(struct kvm_lapic *apic, u8 vec, u8 trig) { if (!apic_test_and_set_irr(vec, apic)) { @@ -483,6 +496,7 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset) break; default: + apic_update_ppr(apic); val = apic_get_reg(apic, offset); break; } @@ -723,6 +737,7 @@ u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu) return (tpr & 0xf0) >> 4; } +EXPORT_SYMBOL_GPL(kvm_lapic_get_cr8); void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) { @@ -809,6 +824,7 @@ int kvm_lapic_enabled(struct kvm_vcpu *vcpu) return ret; } +EXPORT_SYMBOL_GPL(kvm_lapic_enabled); /* *---------------------------------------------------------------------- @@ -911,6 +927,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu) if (!apic || !apic_enabled(apic)) return -1; + apic_update_ppr(apic); highest_irr = apic_find_highest_irr(apic); if ((highest_irr == -1) || ((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI))) |