diff options
author | Yang, Sheng <sheng.yang@intel.com> | 2007-09-12 06:03:11 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:26 -0400 |
commit | 6e5d865c0b9679b00b5e5f0754c9fc2b6b9894d6 (patch) | |
tree | 1b8133926578a16f8849143da5a7d5a6d9e67b24 /drivers/kvm/lapic.c | |
parent | 2a8067f17b8442ecce0b14e134823020ff33b4fa (diff) |
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 df636bf19798..68bbbb38edad 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) | |||
170 | return result; | 170 | return result; |
171 | } | 171 | } |
172 | 172 | ||
173 | int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu) | ||
174 | { | ||
175 | struct kvm_lapic *apic = (struct kvm_lapic *)vcpu->apic; | ||
176 | int highest_irr; | ||
177 | |||
178 | if (!apic) | ||
179 | return 0; | ||
180 | highest_irr = apic_find_highest_irr(apic); | ||
181 | |||
182 | return highest_irr; | ||
183 | } | ||
184 | EXPORT_SYMBOL_GPL(kvm_lapic_find_highest_irr); | ||
185 | |||
173 | int kvm_apic_set_irq(struct kvm_lapic *apic, u8 vec, u8 trig) | 186 | int kvm_apic_set_irq(struct kvm_lapic *apic, u8 vec, u8 trig) |
174 | { | 187 | { |
175 | if (!apic_test_and_set_irr(vec, apic)) { | 188 | if (!apic_test_and_set_irr(vec, apic)) { |
@@ -483,6 +496,7 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset) | |||
483 | break; | 496 | break; |
484 | 497 | ||
485 | default: | 498 | default: |
499 | apic_update_ppr(apic); | ||
486 | val = apic_get_reg(apic, offset); | 500 | val = apic_get_reg(apic, offset); |
487 | break; | 501 | break; |
488 | } | 502 | } |
@@ -723,6 +737,7 @@ u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu) | |||
723 | 737 | ||
724 | return (tpr & 0xf0) >> 4; | 738 | return (tpr & 0xf0) >> 4; |
725 | } | 739 | } |
740 | EXPORT_SYMBOL_GPL(kvm_lapic_get_cr8); | ||
726 | 741 | ||
727 | void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) | 742 | void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) |
728 | { | 743 | { |
@@ -809,6 +824,7 @@ int kvm_lapic_enabled(struct kvm_vcpu *vcpu) | |||
809 | 824 | ||
810 | return ret; | 825 | return ret; |
811 | } | 826 | } |
827 | EXPORT_SYMBOL_GPL(kvm_lapic_enabled); | ||
812 | 828 | ||
813 | /* | 829 | /* |
814 | *---------------------------------------------------------------------- | 830 | *---------------------------------------------------------------------- |
@@ -911,6 +927,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu) | |||
911 | if (!apic || !apic_enabled(apic)) | 927 | if (!apic || !apic_enabled(apic)) |
912 | return -1; | 928 | return -1; |
913 | 929 | ||
930 | apic_update_ppr(apic); | ||
914 | highest_irr = apic_find_highest_irr(apic); | 931 | highest_irr = apic_find_highest_irr(apic); |
915 | if ((highest_irr == -1) || | 932 | if ((highest_irr == -1) || |
916 | ((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI))) | 933 | ((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI))) |