提交 71450f78 编写于 作者: G Gleb Natapov 提交者: Avi Kivity

KVM: Report IRQ injection status for MSI delivered interrupts

Return number of CPUs interrupt was successfully injected into or -1 if
none.
Signed-off-by: NGleb Natapov <gleb@redhat.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 c5bc2242
...@@ -48,7 +48,7 @@ static int kvm_set_ioapic_irq(struct kvm_kernel_irq_routing_entry *e, ...@@ -48,7 +48,7 @@ static int kvm_set_ioapic_irq(struct kvm_kernel_irq_routing_entry *e,
static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
struct kvm *kvm, int level) struct kvm *kvm, int level)
{ {
int vcpu_id; int vcpu_id, r = -1;
struct kvm_vcpu *vcpu; struct kvm_vcpu *vcpu;
struct kvm_ioapic *ioapic = ioapic_irqchip(kvm); struct kvm_ioapic *ioapic = ioapic_irqchip(kvm);
int dest_id = (e->msi.address_lo & MSI_ADDR_DEST_ID_MASK) int dest_id = (e->msi.address_lo & MSI_ADDR_DEST_ID_MASK)
...@@ -73,7 +73,7 @@ static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, ...@@ -73,7 +73,7 @@ static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vector, vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vector,
deliver_bitmask); deliver_bitmask);
if (vcpu != NULL) if (vcpu != NULL)
kvm_apic_set_irq(vcpu, vector, trig_mode); r = kvm_apic_set_irq(vcpu, vector, trig_mode);
else else
printk(KERN_INFO "kvm: null lowest priority vcpu!\n"); printk(KERN_INFO "kvm: null lowest priority vcpu!\n");
break; break;
...@@ -83,14 +83,17 @@ static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, ...@@ -83,14 +83,17 @@ static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
continue; continue;
deliver_bitmask &= ~(1 << vcpu_id); deliver_bitmask &= ~(1 << vcpu_id);
vcpu = ioapic->kvm->vcpus[vcpu_id]; vcpu = ioapic->kvm->vcpus[vcpu_id];
if (vcpu) if (vcpu) {
kvm_apic_set_irq(vcpu, vector, trig_mode); if (r < 0)
r = 0;
r += kvm_apic_set_irq(vcpu, vector, trig_mode);
}
} }
break; break;
default: default:
break; break;
} }
return 1; return r;
} }
/* This should be called with the kvm->lock mutex held /* This should be called with the kvm->lock mutex held
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册