From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: [PATCH] device-assignment: fix failure to exit on shared IRQ Date: Wed, 12 May 2010 05:12:10 -0400 Message-ID: <20100512091210.3097.57000.stgit@virtlab9.virt.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: alex.williamson@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:12602 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756470Ab0ELRNj (ORCPT ); Wed, 12 May 2010 13:13:39 -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 o4CHDcTA029990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 12 May 2010 13:13:38 -0400 Sender: kvm-owner@vger.kernel.org List-ID: Since c1699988, piix config space isn't programmed until the first system reset. This means that when we call assign_irq() from assigned_initfn(), we're going to get back an irq of 0x0, which unfortunately matches our initialization value, so we don't bother to call kvm_assign_irq(). Switch to a -1 initializer so we can test whether kvm_assign_irq() is going to succeed and allow the process to exit if it doesn't. The guest irq will get reset to a more appropriate value on system reset anyway. Signed-off-by: Alex Williamson --- hw/device-assignment.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index b9cc06f..eb31c78 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -1346,7 +1346,7 @@ static int assigned_initfn(struct PCIDevice *pci_dev) e_intx = dev->dev.config[0x3d] - 1; dev->intpin = e_intx; dev->run = 0; - dev->girq = 0; + dev->girq = -1; dev->h_segnr = dev->host.seg; dev->h_busnr = dev->host.bus; dev->h_devfn = PCI_DEVFN(dev->host.dev, dev->host.func);