aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/ioapic.h3
-rw-r--r--virt/kvm/irq_comm.c19
2 files changed, 12 insertions, 10 deletions
diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioapic.h
index d996c7abc466..e7bc92d895ff 100644
--- a/virt/kvm/ioapic.h
+++ b/virt/kvm/ioapic.h
@@ -64,10 +64,9 @@ static inline struct kvm_ioapic *ioapic_irqchip(struct kvm *kvm)
64 return kvm->arch.vioapic; 64 return kvm->arch.vioapic;
65} 65}
66 66
67struct kvm_vcpu *kvm_get_lowest_prio_vcpu(struct kvm *kvm, u8 vector,
68 unsigned long *bitmap);
69int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, 67int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source,
70 int short_hand, int dest, int dest_mode); 68 int short_hand, int dest, int dest_mode);
69int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2);
71void kvm_ioapic_update_eoi(struct kvm *kvm, int vector, int trigger_mode); 70void kvm_ioapic_update_eoi(struct kvm *kvm, int vector, int trigger_mode);
72int kvm_ioapic_init(struct kvm *kvm); 71int kvm_ioapic_init(struct kvm *kvm);
73int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level); 72int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level);
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index e43701c0a5c4..f5e059b67cd4 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -47,7 +47,7 @@ void kvm_get_intr_delivery_bitmask(struct kvm *kvm, struct kvm_lapic *src,
47 int dest_id, int dest_mode, bool low_prio, int short_hand, 47 int dest_id, int dest_mode, bool low_prio, int short_hand,
48 unsigned long *deliver_bitmask) 48 unsigned long *deliver_bitmask)
49{ 49{
50 int i; 50 int i, lowest = -1;
51 struct kvm_vcpu *vcpu; 51 struct kvm_vcpu *vcpu;
52 52
53 if (dest_mode == 0 && dest_id == 0xff && low_prio) 53 if (dest_mode == 0 && dest_id == 0xff && low_prio)
@@ -64,15 +64,18 @@ void kvm_get_intr_delivery_bitmask(struct kvm *kvm, struct kvm_lapic *src,
64 dest_mode)) 64 dest_mode))
65 continue; 65 continue;
66 66
67 __set_bit(i, deliver_bitmask); 67 if (!low_prio) {
68 __set_bit(i, deliver_bitmask);
69 } else {
70 if (lowest < 0)
71 lowest = i;
72 if (kvm_apic_compare_prio(vcpu, kvm->vcpus[lowest]) < 0)
73 lowest = i;
74 }
68 } 75 }
69 76
70 if (low_prio) { 77 if (lowest != -1)
71 vcpu = kvm_get_lowest_prio_vcpu(kvm, 0, deliver_bitmask); 78 __set_bit(lowest, deliver_bitmask);
72 bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS);
73 if (vcpu)
74 __set_bit(vcpu->vcpu_id, deliver_bitmask);
75 }
76} 79}
77 80
78static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, 81static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,