From nobody Sat Oct 25 08:57:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520373883979286.90027890629835; Tue, 6 Mar 2018 14:04:43 -0800 (PST) Received: from localhost ([::1]:58547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKhJ-0001SY-Il for importer@patchew.org; Tue, 06 Mar 2018 17:04:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKf8-00007t-3m for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etKf4-0006kk-SU for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:22 -0500 Received: from chuckie.co.uk ([82.165.15.123]:43188 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etKf4-0006cv-Lt; Tue, 06 Mar 2018 17:02:18 -0500 Received: from host86-138-240-5.range86-138.btcentralplus.com ([86.138.240.5] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1etKf9-0007QL-8t; Tue, 06 Mar 2018 22:02:24 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Tue, 6 Mar 2018 22:01:54 +0000 Message-Id: <20180306220159.4287-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180306220159.4287-1-mark.cave-ayland@ilande.co.uk> References: <20180306220159.4287-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.138.240.5 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 1/6] heathrow: remove obsolete heathow_init() function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead wire up heathrow to the CPU and grackle PCI host using qdev GPIOs. Signed-off-by: Mark Cave-Ayland --- hw/intc/heathrow_pic.c | 23 +++++------------------ hw/ppc/mac.h | 4 ---- hw/ppc/mac_oldworld.c | 20 ++++++++++++-------- include/hw/intc/heathrow_pic.h | 2 +- 4 files changed, 18 insertions(+), 31 deletions(-) diff --git a/hw/intc/heathrow_pic.c b/hw/intc/heathrow_pic.c index 393fdd7326..b8b997deca 100644 --- a/hw/intc/heathrow_pic.c +++ b/hw/intc/heathrow_pic.c @@ -172,27 +172,14 @@ static void heathrow_init(Object *obj) HeathrowState *s =3D HEATHROW(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); =20 - memory_region_init_io(&s->mem, OBJECT(s), &heathrow_ops, s, - "heathrow-pic", 0x1000); - sysbus_init_mmio(sbd, &s->mem); -} - -DeviceState *heathrow_pic_init(int nb_cpus, qemu_irq **irqs, - qemu_irq **pic_irqs) -{ - DeviceState *d; - HeathrowState *s; - - d =3D qdev_create(NULL, TYPE_HEATHROW); - qdev_init_nofail(d); - - s =3D HEATHROW(d); /* only 1 CPU */ - s->irqs =3D irqs[0]; + qdev_init_gpio_out(DEVICE(obj), s->irqs, 1); =20 - *pic_irqs =3D qemu_allocate_irqs(heathrow_set_irq, s, HEATHROW_NUM_IRQ= S); + qdev_init_gpio_in(DEVICE(obj), heathrow_set_irq, HEATHROW_NUM_IRQS); =20 - return d; + memory_region_init_io(&s->mem, OBJECT(s), &heathrow_ops, s, + "heathrow-pic", 0x1000); + sysbus_init_mmio(sbd, &s->mem); } =20 static void heathrow_class_init(ObjectClass *oc, void *data) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index a02f797598..424d20088b 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -75,10 +75,6 @@ void macio_ide_register_dma(MACIOIDEState *ide); void macio_init(PCIDevice *dev, MemoryRegion *pic_mem); =20 -/* Heathrow PIC */ -DeviceState *heathrow_pic_init(int nb_cpus, qemu_irq **irqs, - qemu_irq **pic_irqs); - /* Grackle PCI */ #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic, diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 935493c966..62788a54c0 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -85,7 +85,7 @@ static void ppc_heathrow_init(MachineState *machine) PowerPCCPU *cpu =3D NULL; CPUPPCState *env =3D NULL; char *filename; - qemu_irq *pic, **heathrow_irqs; + qemu_irq *pic; int linux_boot, i; MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); @@ -228,16 +228,15 @@ static void ppc_heathrow_init(MachineState *machine) memory_region_add_subregion(sysmem, 0xfe000000, isa); =20 /* XXX: we register only 1 output pin for heathrow PIC */ - heathrow_irqs =3D g_malloc0(smp_cpus * sizeof(qemu_irq *)); - heathrow_irqs[0] =3D - g_malloc0(smp_cpus * sizeof(qemu_irq) * 1); + pic_dev =3D qdev_create(NULL, TYPE_HEATHROW); + qdev_init_nofail(pic_dev); + /* Connect the heathrow PIC outputs to the 6xx bus */ for (i =3D 0; i < smp_cpus; i++) { switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: - heathrow_irqs[i] =3D heathrow_irqs[0] + (i * 1); - heathrow_irqs[i][0] =3D - ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; + qdev_connect_gpio_out(pic_dev, 0, + ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]); break; default: error_report("Bus model not supported on OldWorld Mac machine"= ); @@ -245,6 +244,11 @@ static void ppc_heathrow_init(MachineState *machine) } } =20 + pic =3D g_new0(qemu_irq, HEATHROW_NUM_IRQS); + for (i =3D 0; i < HEATHROW_NUM_IRQS; i++) { + pic[i] =3D qdev_get_gpio_in(pic_dev, i); + } + /* Timebase Frequency */ if (kvm_enabled()) { tbfreq =3D kvmppc_get_tbfreq(); @@ -257,7 +261,7 @@ static void ppc_heathrow_init(MachineState *machine) error_report("Only 6xx bus is supported on heathrow machine"); exit(1); } - pic_dev =3D heathrow_pic_init(1, heathrow_irqs, &pic); + pci_bus =3D pci_grackle_init(0xfec00000, pic, get_system_memory(), get_system_io()); diff --git a/include/hw/intc/heathrow_pic.h b/include/hw/intc/heathrow_pic.h index bc3ffaab87..56c2ef339f 100644 --- a/include/hw/intc/heathrow_pic.h +++ b/include/hw/intc/heathrow_pic.h @@ -41,7 +41,7 @@ typedef struct HeathrowState { =20 MemoryRegion mem; HeathrowPICState pics[2]; - qemu_irq *irqs; + qemu_irq irqs[1]; } HeathrowState; =20 #define HEATHROW_NUM_IRQS 64 --=20 2.11.0