aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/irq.c22
-rw-r--r--arch/x86/kvm/irq.h5
-rw-r--r--include/asm-x86/kvm_host.h7
3 files changed, 34 insertions, 0 deletions
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 0d9e55275af1..90911958d853 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -111,3 +111,25 @@ void kvm_set_irq(struct kvm *kvm, int irq, int level)
111 kvm_ioapic_set_irq(kvm->arch.vioapic, irq, level); 111 kvm_ioapic_set_irq(kvm->arch.vioapic, irq, level);
112 kvm_pic_set_irq(pic_irqchip(kvm), irq, level); 112 kvm_pic_set_irq(pic_irqchip(kvm), irq, level);
113} 113}
114
115void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi)
116{
117 struct kvm_irq_ack_notifier *kian;
118 struct hlist_node *n;
119
120 hlist_for_each_entry(kian, n, &kvm->arch.irq_ack_notifier_list, link)
121 if (kian->gsi == gsi)
122 kian->irq_acked(kian);
123}
124
125void kvm_register_irq_ack_notifier(struct kvm *kvm,
126 struct kvm_irq_ack_notifier *kian)
127{
128 hlist_add_head(&kian->link, &kvm->arch.irq_ack_notifier_list);
129}
130
131void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
132 struct kvm_irq_ack_notifier *kian)
133{
134 hlist_del(&kian->link);
135}
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index 07ff2aef0c13..95fe718e3abc 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -83,6 +83,11 @@ static inline int irqchip_in_kernel(struct kvm *kvm)
83void kvm_pic_reset(struct kvm_kpic_state *s); 83void kvm_pic_reset(struct kvm_kpic_state *s);
84 84
85void kvm_set_irq(struct kvm *kvm, int irq, int level); 85void kvm_set_irq(struct kvm *kvm, int irq, int level);
86void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi);
87void kvm_register_irq_ack_notifier(struct kvm *kvm,
88 struct kvm_irq_ack_notifier *kian);
89void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
90 struct kvm_irq_ack_notifier *kian);
86 91
87void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec); 92void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
88void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); 93void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index 83afa10c77f5..d451928fc841 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -321,6 +321,12 @@ struct kvm_mem_alias {
321 gfn_t target_gfn; 321 gfn_t target_gfn;
322}; 322};
323 323
324struct kvm_irq_ack_notifier {
325 struct hlist_node link;
326 unsigned gsi;
327 void (*irq_acked)(struct kvm_irq_ack_notifier *kian);
328};
329
324struct kvm_arch{ 330struct kvm_arch{
325 int naliases; 331 int naliases;
326 struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS]; 332 struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS];
@@ -336,6 +342,7 @@ struct kvm_arch{
336 struct kvm_pic *vpic; 342 struct kvm_pic *vpic;
337 struct kvm_ioapic *vioapic; 343 struct kvm_ioapic *vioapic;
338 struct kvm_pit *vpit; 344 struct kvm_pit *vpit;
345 struct hlist_head irq_ack_notifier_list;
339 346
340 int round_robin_prev_vcpu; 347 int round_robin_prev_vcpu;
341 unsigned int tss_addr; 348 unsigned int tss_addr;