aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@Intel.com>2013-04-11 07:21:37 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2013-04-15 22:20:34 -0400
commitb4f2225c07dd4d8eef7aa7f5b36a3b72c3cbbe5b (patch)
tree47cecd1a3cec51c6dee70e8558aa749b744ca0e9 /virt
parent8dc6aade5bdc9d436d4ab8328cb15f0adbbc47bf (diff)
KVM: Return destination vcpu on interrupt injection
Add a new parameter to know vcpus who received the interrupt. 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 'virt')
-rw-r--r--virt/kvm/ioapic.c2
-rw-r--r--virt/kvm/ioapic.h2
-rw-r--r--virt/kvm/irq_comm.c12
3 files changed, 8 insertions, 8 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 1d8906d39214..27ae8dd64e29 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -217,7 +217,7 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
217 irqe.level = 1; 217 irqe.level = 1;
218 irqe.shorthand = 0; 218 irqe.shorthand = 0;
219 219
220 return kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe); 220 return kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe, NULL);
221} 221}
222 222
223int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id, 223int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id,
diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioapic.h
index 87cd94bae372..761e5b57099e 100644
--- a/virt/kvm/ioapic.h
+++ b/virt/kvm/ioapic.h
@@ -92,7 +92,7 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id,
92void kvm_ioapic_clear_all(struct kvm_ioapic *ioapic, int irq_source_id); 92void kvm_ioapic_clear_all(struct kvm_ioapic *ioapic, int irq_source_id);
93void kvm_ioapic_reset(struct kvm_ioapic *ioapic); 93void kvm_ioapic_reset(struct kvm_ioapic *ioapic);
94int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, 94int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
95 struct kvm_lapic_irq *irq); 95 struct kvm_lapic_irq *irq, unsigned long *dest_map);
96int kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state); 96int kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state);
97int kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state); 97int kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state);
98void kvm_ioapic_make_eoibitmap_request(struct kvm *kvm); 98void kvm_ioapic_make_eoibitmap_request(struct kvm *kvm);
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index e9073cf4d040..2f07d2e59a2d 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -63,7 +63,7 @@ inline static bool kvm_is_dm_lowest_prio(struct kvm_lapic_irq *irq)
63} 63}
64 64
65int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, 65int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
66 struct kvm_lapic_irq *irq) 66 struct kvm_lapic_irq *irq, unsigned long *dest_map)
67{ 67{
68 int i, r = -1; 68 int i, r = -1;
69 struct kvm_vcpu *vcpu, *lowest = NULL; 69 struct kvm_vcpu *vcpu, *lowest = NULL;
@@ -74,7 +74,7 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
74 irq->delivery_mode = APIC_DM_FIXED; 74 irq->delivery_mode = APIC_DM_FIXED;
75 } 75 }
76 76
77 if (kvm_irq_delivery_to_apic_fast(kvm, src, irq, &r)) 77 if (kvm_irq_delivery_to_apic_fast(kvm, src, irq, &r, dest_map))
78 return r; 78 return r;
79 79
80 kvm_for_each_vcpu(i, vcpu, kvm) { 80 kvm_for_each_vcpu(i, vcpu, kvm) {
@@ -88,7 +88,7 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
88 if (!kvm_is_dm_lowest_prio(irq)) { 88 if (!kvm_is_dm_lowest_prio(irq)) {
89 if (r < 0) 89 if (r < 0)
90 r = 0; 90 r = 0;
91 r += kvm_apic_set_irq(vcpu, irq); 91 r += kvm_apic_set_irq(vcpu, irq, dest_map);
92 } else if (kvm_lapic_enabled(vcpu)) { 92 } else if (kvm_lapic_enabled(vcpu)) {
93 if (!lowest) 93 if (!lowest)
94 lowest = vcpu; 94 lowest = vcpu;
@@ -98,7 +98,7 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
98 } 98 }
99 99
100 if (lowest) 100 if (lowest)
101 r = kvm_apic_set_irq(lowest, irq); 101 r = kvm_apic_set_irq(lowest, irq, dest_map);
102 102
103 return r; 103 return r;
104} 104}
@@ -130,7 +130,7 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
130 130
131 kvm_set_msi_irq(e, &irq); 131 kvm_set_msi_irq(e, &irq);
132 132
133 return kvm_irq_delivery_to_apic(kvm, NULL, &irq); 133 return kvm_irq_delivery_to_apic(kvm, NULL, &irq, NULL);
134} 134}
135 135
136 136
@@ -142,7 +142,7 @@ static int kvm_set_msi_inatomic(struct kvm_kernel_irq_routing_entry *e,
142 142
143 kvm_set_msi_irq(e, &irq); 143 kvm_set_msi_irq(e, &irq);
144 144
145 if (kvm_irq_delivery_to_apic_fast(kvm, NULL, &irq, &r)) 145 if (kvm_irq_delivery_to_apic_fast(kvm, NULL, &irq, &r, NULL))
146 return r; 146 return r;
147 else 147 else
148 return -EWOULDBLOCK; 148 return -EWOULDBLOCK;