From patchwork Wed Mar 17 09:17:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 86281 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2H9IB5l031415 for ; Wed, 17 Mar 2010 09:18:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753855Ab0CQJSJ (ORCPT ); Wed, 17 Mar 2010 05:18:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28386 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753818Ab0CQJSI (ORCPT ); Wed, 17 Mar 2010 05:18:08 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2H9HwMV008727 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 Mar 2010 05:17:58 -0400 Received: from zweiblum.home.kraxel.org (vpn1-6-86.ams2.redhat.com [10.36.6.86]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2H9HsNm017640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 17 Mar 2010 05:17:56 -0400 Message-ID: <4BA09E41.7000300@redhat.com> Date: Wed, 17 Mar 2010 10:17:53 +0100 From: Gerd Hoffmann User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3 MIME-Version: 1.0 To: Michael Tokarev CC: KVM list , "qemu-devel@nongnu.org" Subject: Re: >2 serial ports? References: <4BA094FE.6020109@msgid.tls.msk.ru> In-Reply-To: <4BA094FE.6020109@msgid.tls.msk.ru> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 17 Mar 2010 09:18:12 +0000 (UTC) diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 4d489d2..bd2f69c 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -26,6 +26,7 @@ struct ISABus { BusState qbus; qemu_irq *irqs; uint32_t assigned; + DeviceInfo *irq_owner[16]; }; static ISABus *isabus; @@ -71,7 +72,9 @@ qemu_irq isa_reserve_irq(int isairq) exit(1); } if (isabus->assigned & (1 << isairq)) { - fprintf(stderr, "isa irq %d already assigned\n", isairq); + DeviceInfo *owner = isabus->irq_owner[isairq]; + fprintf(stderr, "isa irq %d already assigned (%s)\n", + isairq, owner ? owner->name : "unknown"); exit(1); } isabus->assigned |= (1 << isairq); @@ -82,10 +85,17 @@ void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq) { assert(dev->nirqs < ARRAY_SIZE(dev->isairq)); if (isabus->assigned & (1 << isairq)) { - fprintf(stderr, "isa irq %d already assigned\n", isairq); - exit(1); + DeviceInfo *owner = isabus->irq_owner[isairq]; + if (owner == dev->qdev.info) { + /* irq sharing is ok in case the same driver handles both */; + } else { + fprintf(stderr, "isa irq %d already assigned (%s)\n", + isairq, owner ? owner->name : "unknown"); + exit(1); + } } isabus->assigned |= (1 << isairq); + isabus->irq_owner[isairq] = dev->qdev.info; dev->isairq[dev->nirqs] = isairq; *p = isabus->irqs[isairq]; dev->nirqs++;