aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorXiantao Zhang <xiantao.zhang@intel.com>2008-10-06 01:48:45 -0400
committerAvi Kivity <avi@redhat.com>2008-10-15 08:25:35 -0400
commit3de42dc094ecd313dc7d551e007a134b52f8663d (patch)
treecba836b4cd719e6a98f640fecec41ce5d23d9ce7 /arch
parentc77fb9dc7a0383c86eabef30272a763a482403e1 (diff)
KVM: Separate irq ack notification out of arch/x86/kvm/irq.c
Moving irq ack notification logic as common, and make it shared with ia64 side. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/include/asm/kvm_host.h4
-rw-r--r--arch/ia64/kvm/Makefile2
-rw-r--r--arch/ia64/kvm/irq.h5
-rw-r--r--arch/x86/kvm/Makefile2
-rw-r--r--arch/x86/kvm/irq.c33
-rw-r--r--arch/x86/kvm/irq.h8
6 files changed, 6 insertions, 48 deletions
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 1efe513a9941..da579a33db12 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -413,6 +413,10 @@ struct kvm_arch {
413 struct kvm_ioapic *vioapic; 413 struct kvm_ioapic *vioapic;
414 struct kvm_vm_stat stat; 414 struct kvm_vm_stat stat;
415 struct kvm_sal_data rdv_sal_data; 415 struct kvm_sal_data rdv_sal_data;
416
417 struct list_head assigned_dev_head;
418 struct dmar_domain *intel_iommu_domain;
419 struct hlist_head irq_ack_notifier_list;
416}; 420};
417 421
418union cpuid3_t { 422union cpuid3_t {
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile
index bf22fb9e6dcf..3b1a1c156ef9 100644
--- a/arch/ia64/kvm/Makefile
+++ b/arch/ia64/kvm/Makefile
@@ -44,7 +44,7 @@ EXTRA_CFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/
44EXTRA_AFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/ 44EXTRA_AFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/
45 45
46common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ 46common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
47 coalesced_mmio.o) 47 coalesced_mmio.o irq_comm.o)
48 48
49kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o 49kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o
50obj-$(CONFIG_KVM) += kvm.o 50obj-$(CONFIG_KVM) += kvm.o
diff --git a/arch/ia64/kvm/irq.h b/arch/ia64/kvm/irq.h
index f2e6545debf4..604329ac3c99 100644
--- a/arch/ia64/kvm/irq.h
+++ b/arch/ia64/kvm/irq.h
@@ -23,10 +23,5 @@
23#ifndef __IRQ_H 23#ifndef __IRQ_H
24#define __IRQ_H 24#define __IRQ_H
25 25
26struct kvm;
27
28static inline void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi)
29{
30}
31 26
32#endif 27#endif
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index 7dce593b9c66..c02343594b4d 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ 5common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
6 coalesced_mmio.o) 6 coalesced_mmio.o irq_comm.o)
7ifeq ($(CONFIG_KVM_TRACE),y) 7ifeq ($(CONFIG_KVM_TRACE),y)
8common-objs += $(addprefix ../../../virt/kvm/, kvm_trace.o) 8common-objs += $(addprefix ../../../virt/kvm/, kvm_trace.o)
9endif 9endif
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 8c1b9c5def78..c019b8edcdb7 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -99,36 +99,3 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
99 __kvm_migrate_apic_timer(vcpu); 99 __kvm_migrate_apic_timer(vcpu);
100 __kvm_migrate_pit_timer(vcpu); 100 __kvm_migrate_pit_timer(vcpu);
101} 101}
102
103/* This should be called with the kvm->lock mutex held */
104void kvm_set_irq(struct kvm *kvm, int irq, int level)
105{
106 /* Not possible to detect if the guest uses the PIC or the
107 * IOAPIC. So set the bit in both. The guest will ignore
108 * writes to the unused one.
109 */
110 kvm_ioapic_set_irq(kvm->arch.vioapic, irq, level);
111 kvm_pic_set_irq(pic_irqchip(kvm), irq, level);
112}
113
114void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi)
115{
116 struct kvm_irq_ack_notifier *kian;
117 struct hlist_node *n;
118
119 hlist_for_each_entry(kian, n, &kvm->arch.irq_ack_notifier_list, link)
120 if (kian->gsi == gsi)
121 kian->irq_acked(kian);
122}
123
124void kvm_register_irq_ack_notifier(struct kvm *kvm,
125 struct kvm_irq_ack_notifier *kian)
126{
127 hlist_add_head(&kian->link, &kvm->arch.irq_ack_notifier_list);
128}
129
130void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
131 struct kvm_irq_ack_notifier *kian)
132{
133 hlist_del(&kian->link);
134}
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index 4748532fd1da..f17c8f5bbf31 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -68,7 +68,6 @@ struct kvm_pic {
68}; 68};
69 69
70struct kvm_pic *kvm_create_pic(struct kvm *kvm); 70struct kvm_pic *kvm_create_pic(struct kvm *kvm);
71void kvm_pic_set_irq(void *opaque, int irq, int level);
72int kvm_pic_read_irq(struct kvm *kvm); 71int kvm_pic_read_irq(struct kvm *kvm);
73void kvm_pic_update_irq(struct kvm_pic *s); 72void kvm_pic_update_irq(struct kvm_pic *s);
74void kvm_pic_clear_isr_ack(struct kvm *kvm); 73void kvm_pic_clear_isr_ack(struct kvm *kvm);
@@ -85,13 +84,6 @@ static inline int irqchip_in_kernel(struct kvm *kvm)
85 84
86void kvm_pic_reset(struct kvm_kpic_state *s); 85void kvm_pic_reset(struct kvm_kpic_state *s);
87 86
88void kvm_set_irq(struct kvm *kvm, int irq, int level);
89void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi);
90void kvm_register_irq_ack_notifier(struct kvm *kvm,
91 struct kvm_irq_ack_notifier *kian);
92void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
93 struct kvm_irq_ack_notifier *kian);
94
95void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec); 87void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
96void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); 88void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
97void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); 89void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);