From patchwork Mon Feb 7 23:26:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 82234 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C4DB1B7198 for ; Tue, 8 Feb 2011 10:30:31 +1100 (EST) Received: from localhost ([127.0.0.1]:47485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmaXL-0004rW-BB for incoming@patchwork.ozlabs.org; Mon, 07 Feb 2011 18:30:27 -0500 Received: from [140.186.70.92] (port=51900 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmaTb-0003XH-JI for qemu-devel@nongnu.org; Mon, 07 Feb 2011 18:26:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmaTa-0002jM-88 for qemu-devel@nongnu.org; Mon, 07 Feb 2011 18:26:35 -0500 Received: from cantor.suse.de ([195.135.220.2]:42018 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmaTZ-0002jF-Ql for qemu-devel@nongnu.org; Mon, 07 Feb 2011 18:26:34 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 8DD9594608; Tue, 8 Feb 2011 00:26:32 +0100 (CET) From: Alexander Graf To: QEMU Developers Date: Tue, 8 Feb 2011 00:26:31 +0100 Message-Id: <1297121191-31245-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.2 Cc: Kevin Wolf , =?utf-8?q?Andreas=20F=C3=A4rber?= , Gerd Hoffmann , Aurelien Jarno Subject: [Qemu-devel] [RFC] prep: enable irq sharing on ide again X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The new ISA infrastructure checks for potential irq sharing bugs on interrupt lines, because usually irq lines on isa can't be shared. The PREP spec however mandates that the irq lines for both IDE ports are shared and according to Aurelien this also used to work just fine. So let's add a way to enable this sharing again, so we don't introduce unnecessary regressions over older versions of Qemu. Signed-off-by: Alexander Graf CC: Andreas Färber CC: Aurelien Jarno CC: Kevin Wolf CC: Gerd Hoffmann --- hw/ide/isa.c | 7 ++++++- hw/isa-bus.c | 13 +++++++++---- hw/isa.h | 3 +++ hw/ppc_prep.c | 5 +++-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/hw/ide/isa.c b/hw/ide/isa.c index 8c59c5a..2316826 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -66,10 +66,15 @@ static const VMStateDescription vmstate_ide_isa = { static int isa_ide_initfn(ISADevice *dev) { ISAIDEState *s = DO_UPCAST(ISAIDEState, dev, dev); + int irq = s->isairq; ide_bus_new(&s->bus, &s->dev.qdev, 0); ide_init_ioport(&s->bus, s->iobase, s->iobase2); - isa_init_irq(dev, &s->irq, s->isairq); + if (irq >= 0) { + isa_init_irq(dev, &s->irq, irq); + } else { + isa_init_irq_nocheck(dev, &s->irq, -irq); + } isa_init_ioport_range(dev, s->iobase, 8); isa_init_ioport(dev, s->iobase2); ide_init2(&s->bus, s->irq); diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 0cb1afb..84f9c81 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -79,18 +79,23 @@ qemu_irq isa_reserve_irq(int isairq) return isabus->irqs[isairq]; } -void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq) +void isa_init_irq_nocheck(ISADevice *dev, qemu_irq *p, int isairq) { assert(dev->nirqs < ARRAY_SIZE(dev->isairq)); - if (isabus->assigned & (1 << isairq)) { - hw_error("isa irq %d already assigned", isairq); - } isabus->assigned |= (1 << isairq); dev->isairq[dev->nirqs] = isairq; *p = isabus->irqs[isairq]; dev->nirqs++; } +void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq) +{ + if (isabus->assigned & (1 << isairq)) { + hw_error("isa irq %d already assigned", isairq); + } + isa_init_irq_nocheck(dev, p, isairq); +} + static void isa_init_ioport_one(ISADevice *dev, uint16_t ioport) { assert(dev->nioports < ARRAY_SIZE(dev->ioports)); diff --git a/hw/isa.h b/hw/isa.h index 19aa94c..031eed7 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -28,6 +28,9 @@ ISABus *isa_bus_new(DeviceState *dev); void isa_bus_irqs(qemu_irq *irqs); qemu_irq isa_reserve_irq(int isairq); void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); +/* version of init_irq without check for line sharing - only there for PREP + target */ +void isa_init_irq_nocheck(ISADevice *dev, qemu_irq *p, int isairq); void isa_init_ioport(ISADevice *dev, uint16_t ioport); void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length); void isa_qdev_register(ISADeviceInfo *info); diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index 6c1499a..e8d531a 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -75,7 +75,8 @@ qemu_log_mask(CPU_LOG_IOPORT, fmt, ## __VA_ARGS__) /* Constants for devices init */ static const int ide_iobase[2] = { 0x1f0, 0x170 }; static const int ide_iobase2[2] = { 0x3f6, 0x376 }; -static const int ide_irq[2] = { 13, 13 }; +/* negative numbers mean forced share enable */ +static const int ide_irq[2] = { -13, -13 }; #define NE2000_NB_MAX 6 @@ -690,7 +691,7 @@ static void ppc_prep_init (ram_addr_t ram_size, hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } - for(i = 0; i < 1/*MAX_IDE_BUS*/; i++) { + for(i = 0; i < MAX_IDE_BUS; i++) { isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[2 * i], hd[2 * i + 1]);