diff options
Diffstat (limited to 'kernel/arch/x86/kvm/irq.h')
-rw-r--r-- | kernel/arch/x86/kvm/irq.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/kernel/arch/x86/kvm/irq.h b/kernel/arch/x86/kvm/irq.h index ad68c7300..ae5c78f23 100644 --- a/kernel/arch/x86/kvm/irq.h +++ b/kernel/arch/x86/kvm/irq.h @@ -74,7 +74,7 @@ struct kvm_pic { }; struct kvm_pic *kvm_create_pic(struct kvm *kvm); -void kvm_destroy_pic(struct kvm *kvm); +void kvm_destroy_pic(struct kvm_pic *vpic); int kvm_pic_read_irq(struct kvm *kvm); void kvm_pic_update_irq(struct kvm_pic *s); @@ -83,15 +83,40 @@ static inline struct kvm_pic *pic_irqchip(struct kvm *kvm) return kvm->arch.vpic; } -static inline int irqchip_in_kernel(struct kvm *kvm) +static inline int pic_in_kernel(struct kvm *kvm) { int ret; ret = (pic_irqchip(kvm) != NULL); + return ret; +} + +static inline int irqchip_split(struct kvm *kvm) +{ + return kvm->arch.irqchip_split; +} + +static inline int irqchip_in_kernel(struct kvm *kvm) +{ + struct kvm_pic *vpic = pic_irqchip(kvm); + bool ret; + + ret = (vpic != NULL); + ret |= irqchip_split(kvm); + + /* Read vpic before kvm->irq_routing. */ smp_rmb(); return ret; } +static inline int lapic_in_kernel(struct kvm_vcpu *vcpu) +{ + /* Same as irqchip_in_kernel(vcpu->kvm), but with less + * pointer chasing and no unnecessary memory barriers. + */ + return vcpu->arch.apic != NULL; +} + void kvm_pic_reset(struct kvm_kpic_state *s); void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); |