diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-11-17 09:55:47 -0500 |
---|---|---|
committer | Radim Krčmář <rkrcmar@redhat.com> | 2016-11-19 13:04:19 -0500 |
commit | a2b07739ff5ded8ca7e9c7ff0749ed6f0d36aee2 (patch) | |
tree | 627502d3b1c74b31bbc9f9d2dbce6202f82dde93 | |
parent | 7301d6abaea926d685832f7e1f0c37dd206b01f4 (diff) |
kvm: x86: merge kvm_arch_set_irq and kvm_arch_set_irq_inatomic
kvm_arch_set_irq is unused since commit b97e6de9c96. Merge
its functionality with kvm_arch_set_irq_inatomic.
Reported-by: Jiang Biao <jiang.biao2@zte.com.cn>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
-rw-r--r-- | arch/x86/kvm/irq_comm.c | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c index 25810b144b58..4da03030d5a7 100644 --- a/arch/x86/kvm/irq_comm.c +++ b/arch/x86/kvm/irq_comm.c | |||
@@ -156,6 +156,16 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, | |||
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | static int kvm_hv_set_sint(struct kvm_kernel_irq_routing_entry *e, | ||
160 | struct kvm *kvm, int irq_source_id, int level, | ||
161 | bool line_status) | ||
162 | { | ||
163 | if (!level) | ||
164 | return -1; | ||
165 | |||
166 | return kvm_hv_synic_set_irq(kvm, e->hv_sint.vcpu, e->hv_sint.sint); | ||
167 | } | ||
168 | |||
159 | int kvm_arch_set_irq_inatomic(struct kvm_kernel_irq_routing_entry *e, | 169 | int kvm_arch_set_irq_inatomic(struct kvm_kernel_irq_routing_entry *e, |
160 | struct kvm *kvm, int irq_source_id, int level, | 170 | struct kvm *kvm, int irq_source_id, int level, |
161 | bool line_status) | 171 | bool line_status) |
@@ -163,18 +173,26 @@ int kvm_arch_set_irq_inatomic(struct kvm_kernel_irq_routing_entry *e, | |||
163 | struct kvm_lapic_irq irq; | 173 | struct kvm_lapic_irq irq; |
164 | int r; | 174 | int r; |
165 | 175 | ||
166 | if (unlikely(e->type != KVM_IRQ_ROUTING_MSI)) | 176 | switch (e->type) { |
167 | return -EWOULDBLOCK; | 177 | case KVM_IRQ_ROUTING_HV_SINT: |
178 | return kvm_hv_set_sint(e, kvm, irq_source_id, level, | ||
179 | line_status); | ||
168 | 180 | ||
169 | if (kvm_msi_route_invalid(kvm, e)) | 181 | case KVM_IRQ_ROUTING_MSI: |
170 | return -EINVAL; | 182 | if (kvm_msi_route_invalid(kvm, e)) |
183 | return -EINVAL; | ||
171 | 184 | ||
172 | kvm_set_msi_irq(kvm, e, &irq); | 185 | kvm_set_msi_irq(kvm, e, &irq); |
173 | 186 | ||
174 | if (kvm_irq_delivery_to_apic_fast(kvm, NULL, &irq, &r, NULL)) | 187 | if (kvm_irq_delivery_to_apic_fast(kvm, NULL, &irq, &r, NULL)) |
175 | return r; | 188 | return r; |
176 | else | 189 | break; |
177 | return -EWOULDBLOCK; | 190 | |
191 | default: | ||
192 | break; | ||
193 | } | ||
194 | |||
195 | return -EWOULDBLOCK; | ||
178 | } | 196 | } |
179 | 197 | ||
180 | int kvm_request_irq_source_id(struct kvm *kvm) | 198 | int kvm_request_irq_source_id(struct kvm *kvm) |
@@ -254,16 +272,6 @@ void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, | |||
254 | srcu_read_unlock(&kvm->irq_srcu, idx); | 272 | srcu_read_unlock(&kvm->irq_srcu, idx); |
255 | } | 273 | } |
256 | 274 | ||
257 | static int kvm_hv_set_sint(struct kvm_kernel_irq_routing_entry *e, | ||
258 | struct kvm *kvm, int irq_source_id, int level, | ||
259 | bool line_status) | ||
260 | { | ||
261 | if (!level) | ||
262 | return -1; | ||
263 | |||
264 | return kvm_hv_synic_set_irq(kvm, e->hv_sint.vcpu, e->hv_sint.sint); | ||
265 | } | ||
266 | |||
267 | int kvm_set_routing_entry(struct kvm *kvm, | 275 | int kvm_set_routing_entry(struct kvm *kvm, |
268 | struct kvm_kernel_irq_routing_entry *e, | 276 | struct kvm_kernel_irq_routing_entry *e, |
269 | const struct kvm_irq_routing_entry *ue) | 277 | const struct kvm_irq_routing_entry *ue) |
@@ -423,18 +431,6 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu, | |||
423 | srcu_read_unlock(&kvm->irq_srcu, idx); | 431 | srcu_read_unlock(&kvm->irq_srcu, idx); |
424 | } | 432 | } |
425 | 433 | ||
426 | int kvm_arch_set_irq(struct kvm_kernel_irq_routing_entry *irq, struct kvm *kvm, | ||
427 | int irq_source_id, int level, bool line_status) | ||
428 | { | ||
429 | switch (irq->type) { | ||
430 | case KVM_IRQ_ROUTING_HV_SINT: | ||
431 | return kvm_hv_set_sint(irq, kvm, irq_source_id, level, | ||
432 | line_status); | ||
433 | default: | ||
434 | return -EWOULDBLOCK; | ||
435 | } | ||
436 | } | ||
437 | |||
438 | void kvm_arch_irq_routing_update(struct kvm *kvm) | 434 | void kvm_arch_irq_routing_update(struct kvm *kvm) |
439 | { | 435 | { |
440 | kvm_hv_irq_routing_update(kvm); | 436 | kvm_hv_irq_routing_update(kvm); |