diff options
author | Yang Zhang <yang.z.zhang@Intel.com> | 2013-04-11 19:25:15 +0800 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-04-16 16:32:40 -0300 |
commit | a20ed54d6e470bf0d28921b7aadb6ca0da0ff0c3 (patch) | |
tree | 14b3e8c9b4e686ec321967f5b517571e417b83a1 /arch/x86/kvm/lapic.c | |
parent | cf9e65b773394c5ad8fa7455c43268bc8ec2109f (diff) | |
download | linux-a20ed54d6e470bf0d28921b7aadb6ca0da0ff0c3.tar.gz linux-a20ed54d6e470bf0d28921b7aadb6ca0da0ff0c3.tar.bz2 linux-a20ed54d6e470bf0d28921b7aadb6ca0da0ff0c3.zip |
KVM: VMX: Add the deliver posted interrupt algorithm
Only deliver the posted interrupt when target vcpu is running
and there is no previous interrupt pending in pir.
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/lapic.c')
-rw-r--r-- | arch/x86/kvm/lapic.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index d197579435d0..dbf74c922aa1 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -318,6 +318,19 @@ static u8 count_vectors(void *bitmap) return count; } +void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir) +{ + u32 i, pir_val; + struct kvm_lapic *apic = vcpu->arch.apic; + + for (i = 0; i <= 7; i++) { + pir_val = xchg(&pir[i], 0); + if (pir_val) + *((u32 *)(apic->regs + APIC_IRR + i * 0x10)) |= pir_val; + } +} +EXPORT_SYMBOL_GPL(kvm_apic_update_irr); + static inline int apic_test_and_set_irr(int vec, struct kvm_lapic *apic) { apic->irr_pending = true; |