From patchwork Mon Oct 5 10:59:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 51723 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 n95B6fAg016009 for ; Mon, 5 Oct 2009 11:06:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932659AbZJELAM (ORCPT ); Mon, 5 Oct 2009 07:00:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932645AbZJELAM (ORCPT ); Mon, 5 Oct 2009 07:00:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43733 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932657AbZJELAK (ORCPT ); Mon, 5 Oct 2009 07:00:10 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n95Axhe9006522; Mon, 5 Oct 2009 06:59:44 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n95AxgJX024456; Mon, 5 Oct 2009 06:59:43 -0400 Received: from balrog.qumranet.com (dhcp-1-197.tlv.redhat.com [10.35.1.197]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 85084A011C; Mon, 5 Oct 2009 12:59:41 +0200 (IST) Message-ID: <4AC9D19D.7020505@redhat.com> Date: Mon, 05 Oct 2009 12:59:41 +0200 From: Avi Kivity User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 MIME-Version: 1.0 To: "Xu, Jiajun" CC: "'kvm-devel'" Subject: Re: Biweekly KVM Test report, kernel 94252... qemu 5cc3c... References: <0463F45F3606F4428ED35AC8C709F92E089B6598F7@pdsmsx502.ccr.corp.intel.com> In-Reply-To: <0463F45F3606F4428ED35AC8C709F92E089B6598F7@pdsmsx502.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index fd9c097..91b3d99 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -142,7 +142,8 @@ static void deassign_guest_irq(struct kvm *kvm, kvm_unregister_irq_ack_notifier(kvm, &assigned_dev->ack_notifier); assigned_dev->ack_notifier.gsi = -1; - if (assigned_dev->irq_source_id != -1) + if (assigned_dev->irq_source_id != -1 + && assigned_dev->irq_source_id != KVM_USERSPACE_IRQ_SOURCE_ID) kvm_free_irq_source_id(kvm, assigned_dev->irq_source_id); assigned_dev->irq_source_id = -1; assigned_dev->irq_requested_type &= ~(KVM_DEV_IRQ_GUEST_MASK); @@ -396,20 +397,17 @@ static int assign_guest_irq(struct kvm *kvm, struct kvm_assigned_irq *irq, unsigned long guest_irq_type) { - int id; + int id = KVM_USERSPACE_IRQ_SOURCE_ID; int r = -EEXIST; if (dev->irq_requested_type & KVM_DEV_IRQ_GUEST_MASK) return r; - id = kvm_request_irq_source_id(kvm); - if (id < 0) - return id; - - dev->irq_source_id = id; - switch (guest_irq_type) { case KVM_DEV_IRQ_GUEST_INTX: + id = kvm_request_irq_source_id(kvm); + if (id < 0) + return id; r = assigned_device_enable_guest_intx(kvm, dev, irq); break; #ifdef __KVM_HAVE_MSI @@ -426,11 +424,15 @@ static int assign_guest_irq(struct kvm *kvm, r = -EINVAL; } + dev->irq_source_id = id; + if (!r) { dev->irq_requested_type |= guest_irq_type; kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier); - } else - kvm_free_irq_source_id(kvm, dev->irq_source_id); + } else { + if (dev->irq_source_id != KVM_USERSPACE_IRQ_SOURCE_ID) + kvm_free_irq_source_id(kvm, dev->irq_source_id); + } return r; }