From patchwork Sat Feb 28 01:41:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 9285 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1S1hQUv024365 for ; Sat, 28 Feb 2009 01:43:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757222AbZB1BnG (ORCPT ); Fri, 27 Feb 2009 20:43:06 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754380AbZB1BnE (ORCPT ); Fri, 27 Feb 2009 20:43:04 -0500 Received: from mx2.redhat.com ([66.187.237.31]:41776 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754653AbZB1Bl6 (ORCPT ); Fri, 27 Feb 2009 20:41:58 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n1S1fvP0004388; Fri, 27 Feb 2009 20:41:57 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n1S1furG020144; Fri, 27 Feb 2009 20:41:56 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n1S1fsXw032702; Fri, 27 Feb 2009 20:41:56 -0500 Received: from localhost.localdomain (cleopatra.tlv.redhat.com [10.35.255.11]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 56419A0184; Sat, 28 Feb 2009 03:41:50 +0200 (IST) From: Avi Kivity To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 21/30] KVM: Report IRQ injection status for MSI delivered interrupts Date: Sat, 28 Feb 2009 03:41:40 +0200 Message-Id: <1235785309-12835-22-git-send-email-avi@redhat.com> In-Reply-To: <1235785309-12835-1-git-send-email-avi@redhat.com> References: <1235785309-12835-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Gleb Natapov Return number of CPUs interrupt was successfully injected into or -1 if none. Signed-off-by: Gleb Natapov Signed-off-by: Avi Kivity --- virt/kvm/irq_comm.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c index be8aba7..c516d61 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c @@ -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, struct kvm *kvm, int level) { - int vcpu_id; + int vcpu_id, r = -1; struct kvm_vcpu *vcpu; struct kvm_ioapic *ioapic = ioapic_irqchip(kvm); 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, vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vector, deliver_bitmask); if (vcpu != NULL) - kvm_apic_set_irq(vcpu, vector, trig_mode); + r = kvm_apic_set_irq(vcpu, vector, trig_mode); else printk(KERN_INFO "kvm: null lowest priority vcpu!\n"); break; @@ -83,14 +83,17 @@ static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, continue; deliver_bitmask &= ~(1 << vcpu_id); vcpu = ioapic->kvm->vcpus[vcpu_id]; - if (vcpu) - kvm_apic_set_irq(vcpu, vector, trig_mode); + if (vcpu) { + if (r < 0) + r = 0; + r += kvm_apic_set_irq(vcpu, vector, trig_mode); + } } break; default: break; } - return 1; + return r; } /* This should be called with the kvm->lock mutex held