From nobody Fri Oct 24 21:57:01 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 From nobody Fri Oct 24 21:57:01 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 1520374029412971.6397795962015; Tue, 6 Mar 2018 14:07:09 -0800 (PST) Received: from localhost ([::1]:58567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKjg-0004H8-LS for importer@patchew.org; Tue, 06 Mar 2018 17:07:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKf8-00007w-43 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 1etKf5-0006mc-Kb for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:22 -0500 Received: from chuckie.co.uk ([82.165.15.123]:43191 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-0006eP-Vv; Tue, 06 Mar 2018 17:02:19 -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 1etKfA-0007QL-Sv; Tue, 06 Mar 2018 22:02:26 +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:55 +0000 Message-Id: <20180306220159.4287-3-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 2/6] grackle: general tidy-up and QOMify 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" This is the first step towards removing the old-style pci_grackle_init() function. Following on from the previous commit we can now pass the heathrow device as an object link and wire up the heathrow IRQs via qdev GPIOs. Signed-off-by: Mark Cave-Ayland --- hw/pci-host/grackle.c | 96 +++++++++++++++++++++++++++++++++--------------= ---- hw/ppc/mac.h | 2 +- hw/ppc/mac_oldworld.c | 2 +- 3 files changed, 64 insertions(+), 36 deletions(-) diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c index 033588b7d2..f8935246c3 100644 --- a/hw/pci-host/grackle.c +++ b/hw/pci-host/grackle.c @@ -27,6 +27,8 @@ #include "hw/pci/pci_host.h" #include "hw/ppc/mac.h" #include "hw/pci/pci.h" +#include "hw/intc/heathrow_pic.h" +#include "qapi/error.h" #include "trace.h" =20 #define GRACKLE_PCI_HOST_BRIDGE(obj) \ @@ -35,6 +37,8 @@ typedef struct GrackleState { PCIHostState parent_obj; =20 + HeathrowState *pic; + qemu_irq irqs[4]; MemoryRegion pci_mmio; MemoryRegion pci_hole; } GrackleState; @@ -47,13 +51,22 @@ static int pci_grackle_map_irq(PCIDevice *pci_dev, int = irq_num) =20 static void pci_grackle_set_irq(void *opaque, int irq_num, int level) { - qemu_irq *pic =3D opaque; + GrackleState *s =3D opaque; =20 trace_grackle_set_irq(irq_num, level); - qemu_set_irq(pic[irq_num + 0x15], level); + qemu_set_irq(s->irqs[irq_num], level); } =20 -PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic, +static void grackle_init_irqs(GrackleState *s) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(s->irqs); i++) { + s->irqs[i] =3D qdev_get_gpio_in(DEVICE(s->pic), 0x15 + i); + } +} + +PCIBus *pci_grackle_init(uint32_t base, DeviceState *pic_dev, MemoryRegion *address_space_mem, MemoryRegion *address_space_io) { @@ -63,60 +76,75 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic, GrackleState *d; =20 dev =3D qdev_create(NULL, TYPE_GRACKLE_PCI_HOST_BRIDGE); + object_property_set_link(OBJECT(dev), OBJECT(pic_dev), "pic", + &error_abort); + qdev_init_nofail(dev); + s =3D SYS_BUS_DEVICE(dev); phb =3D PCI_HOST_BRIDGE(dev); d =3D GRACKLE_PCI_HOST_BRIDGE(dev); =20 - memory_region_init(&d->pci_mmio, OBJECT(s), "pci-mmio", 0x100000000ULL= ); - memory_region_init_alias(&d->pci_hole, OBJECT(s), "pci-hole", &d->pci_= mmio, - 0x80000000ULL, 0x7e000000ULL); memory_region_add_subregion(address_space_mem, 0x80000000ULL, &d->pci_hole); =20 + sysbus_mmio_map(s, 0, base); + sysbus_mmio_map(s, 1, base + 0x00200000); + + return phb->bus; +} + +static void grackle_realize(DeviceState *dev, Error **errp) +{ + GrackleState *s =3D GRACKLE_PCI_HOST_BRIDGE(dev); + PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); + phb->bus =3D pci_register_root_bus(dev, NULL, pci_grackle_set_irq, pci_grackle_map_irq, - pic, - &d->pci_mmio, - address_space_io, + s, + &s->pci_mmio, + get_system_io(), 0, 4, TYPE_PCI_BUS); =20 pci_create_simple(phb->bus, 0, "grackle"); - qdev_init_nofail(dev); - - sysbus_mmio_map(s, 0, base); - sysbus_mmio_map(s, 1, base + 0x00200000); - - return phb->bus; + grackle_init_irqs(s); } =20 -static int pci_grackle_init_device(SysBusDevice *dev) +static void grackle_init(Object *obj) { - PCIHostState *phb; + GrackleState *s =3D GRACKLE_PCI_HOST_BRIDGE(obj); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); + PCIHostState *phb =3D PCI_HOST_BRIDGE(obj); =20 - phb =3D PCI_HOST_BRIDGE(dev); + memory_region_init(&s->pci_mmio, OBJECT(s), "pci-mmio", 0x100000000ULL= ); + memory_region_init_alias(&s->pci_hole, OBJECT(s), "pci-hole", &s->pci_= mmio, + 0x80000000ULL, 0x7e000000ULL); =20 - memory_region_init_io(&phb->conf_mem, OBJECT(dev), &pci_host_conf_le_o= ps, - dev, "pci-conf-idx", 0x1000); - memory_region_init_io(&phb->data_mem, OBJECT(dev), &pci_host_data_le_o= ps, - dev, "pci-data-idx", 0x1000); - sysbus_init_mmio(dev, &phb->conf_mem); - sysbus_init_mmio(dev, &phb->data_mem); + memory_region_init_io(&phb->conf_mem, obj, &pci_host_conf_le_ops, + DEVICE(obj), "pci-conf-idx", 0x1000); + memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, + DEVICE(obj), "pci-data-idx", 0x1000); =20 - return 0; + object_property_add_link(obj, "pic", TYPE_HEATHROW, + (Object **) &s->pic, + qdev_prop_allow_set_link_before_realize, + 0, NULL); + + sysbus_init_mmio(sbd, &phb->conf_mem); + sysbus_init_mmio(sbd, &phb->data_mem); } =20 -static void grackle_pci_host_realize(PCIDevice *d, Error **errp) +static void grackle_pci_realize(PCIDevice *d, Error **errp) { d->config[0x09] =3D 0x01; } =20 static void grackle_pci_class_init(ObjectClass *klass, void *data) { - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); =20 - k->realize =3D grackle_pci_host_realize; + k->realize =3D grackle_pci_realize; k->vendor_id =3D PCI_VENDOR_ID_MOTOROLA; k->device_id =3D PCI_DEVICE_ID_MOTOROLA_MPC106; k->revision =3D 0x00; @@ -139,26 +167,26 @@ static const TypeInfo grackle_pci_info =3D { }, }; =20 -static void pci_grackle_class_init(ObjectClass *klass, void *data) +static void grackle_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *k =3D SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - k->init =3D pci_grackle_init_device; + dc->realize =3D grackle_realize; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); } =20 -static const TypeInfo grackle_pci_host_info =3D { +static const TypeInfo grackle_host_info =3D { .name =3D TYPE_GRACKLE_PCI_HOST_BRIDGE, .parent =3D TYPE_PCI_HOST_BRIDGE, .instance_size =3D sizeof(GrackleState), - .class_init =3D pci_grackle_class_init, + .instance_init =3D grackle_init, + .class_init =3D grackle_class_init, }; =20 static void grackle_register_types(void) { type_register_static(&grackle_pci_info); - type_register_static(&grackle_pci_host_info); + type_register_static(&grackle_host_info); } =20 type_init(grackle_register_types) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 424d20088b..2359deb1ec 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -77,7 +77,7 @@ void macio_init(PCIDevice *dev, =20 /* Grackle PCI */ #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" -PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic, +PCIBus *pci_grackle_init(uint32_t base, DeviceState *pic_dev, MemoryRegion *address_space_mem, MemoryRegion *address_space_io); =20 diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 62788a54c0..17711971e6 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -262,7 +262,7 @@ static void ppc_heathrow_init(MachineState *machine) exit(1); } =20 - pci_bus =3D pci_grackle_init(0xfec00000, pic, + pci_bus =3D pci_grackle_init(0xfec00000, pic_dev, get_system_memory(), get_system_io()); pci_vga_init(pci_bus); --=20 2.11.0 From nobody Fri Oct 24 21:57:01 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 1520373883978838.6322728696834; Tue, 6 Mar 2018 14:04:43 -0800 (PST) Received: from localhost ([::1]:58549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKhM-0001XX-8A for importer@patchew.org; Tue, 06 Mar 2018 17:04:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKf9-00008F-Jw for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etKf8-0006tJ-EH for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:23 -0500 Received: from chuckie.co.uk ([82.165.15.123]:43195 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 1etKf8-0006fI-5q; Tue, 06 Mar 2018 17:02:22 -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 1etKfC-0007QL-OK; Tue, 06 Mar 2018 22:02:28 +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:56 +0000 Message-Id: <20180306220159.4287-4-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 3/6] grackle: remove deprecated pci_grackle_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 the grackle device inside the Mac Old World machine. Signed-off-by: Mark Cave-Ayland --- hw/pci-host/grackle.c | 28 +--------------------------- hw/ppc/mac.h | 3 --- hw/ppc/mac_oldworld.c | 21 ++++++++++++++++++--- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c index f8935246c3..e4583d493b 100644 --- a/hw/pci-host/grackle.c +++ b/hw/pci-host/grackle.c @@ -66,33 +66,6 @@ static void grackle_init_irqs(GrackleState *s) } } =20 -PCIBus *pci_grackle_init(uint32_t base, DeviceState *pic_dev, - MemoryRegion *address_space_mem, - MemoryRegion *address_space_io) -{ - DeviceState *dev; - SysBusDevice *s; - PCIHostState *phb; - GrackleState *d; - - dev =3D qdev_create(NULL, TYPE_GRACKLE_PCI_HOST_BRIDGE); - object_property_set_link(OBJECT(dev), OBJECT(pic_dev), "pic", - &error_abort); - qdev_init_nofail(dev); - - s =3D SYS_BUS_DEVICE(dev); - phb =3D PCI_HOST_BRIDGE(dev); - d =3D GRACKLE_PCI_HOST_BRIDGE(dev); - - memory_region_add_subregion(address_space_mem, 0x80000000ULL, - &d->pci_hole); - - sysbus_mmio_map(s, 0, base); - sysbus_mmio_map(s, 1, base + 0x00200000); - - return phb->bus; -} - static void grackle_realize(DeviceState *dev, Error **errp) { GrackleState *s =3D GRACKLE_PCI_HOST_BRIDGE(dev); @@ -132,6 +105,7 @@ static void grackle_init(Object *obj) =20 sysbus_init_mmio(sbd, &phb->conf_mem); sysbus_init_mmio(sbd, &phb->data_mem); + sysbus_init_mmio(sbd, &s->pci_hole); } =20 static void grackle_pci_realize(PCIDevice *d, Error **errp) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 2359deb1ec..04568c2a22 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -77,9 +77,6 @@ void macio_init(PCIDevice *dev, =20 /* Grackle PCI */ #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" -PCIBus *pci_grackle_init(uint32_t base, DeviceState *pic_dev, - MemoryRegion *address_space_mem, - MemoryRegion *address_space_io); =20 /* UniNorth PCI */ PCIBus *pci_pmac_init(qemu_irq *pic, diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 17711971e6..b3c1f1bc1b 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -34,6 +34,7 @@ #include "net/net.h" #include "hw/isa/isa.h" #include "hw/pci/pci.h" +#include "hw/pci/pci_host.h" #include "hw/boards.h" #include "hw/nvram/fw_cfg.h" #include "hw/char/escc.h" @@ -56,6 +57,8 @@ =20 #define NDRV_VGA_FILENAME "qemu_vga.ndrv" =20 +#define GRACKLE_BASE 0xfec00000 + static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { @@ -95,6 +98,7 @@ static void ppc_heathrow_init(MachineState *machine) PCIBus *pci_bus; OldWorldMacIOState *macio; MACIOIDEState *macio_ide; + SysBusDevice *s; DeviceState *dev, *pic_dev; BusState *adb_bus; int bios_size, ndrv_size; @@ -262,9 +266,20 @@ static void ppc_heathrow_init(MachineState *machine) exit(1); } =20 - pci_bus =3D pci_grackle_init(0xfec00000, pic_dev, - get_system_memory(), - get_system_io()); + /* Grackle PCI host bridge */ + dev =3D qdev_create(NULL, TYPE_GRACKLE_PCI_HOST_BRIDGE); + object_property_set_link(OBJECT(dev), OBJECT(pic_dev), "pic", + &error_abort); + qdev_init_nofail(dev); + s =3D SYS_BUS_DEVICE(dev); + sysbus_mmio_map(s, 0, GRACKLE_BASE); + sysbus_mmio_map(s, 1, GRACKLE_BASE + 0x200000); + /* PCI hole */ + memory_region_add_subregion(get_system_memory(), 0x80000000ULL, + sysbus_mmio_get_region(s, 2)); + + pci_bus =3D PCI_HOST_BRIDGE(dev)->bus; + pci_vga_init(pci_bus); =20 for (i =3D 0; i < nb_nics; i++) { --=20 2.11.0 From nobody Fri Oct 24 21:57:01 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 1520374139502629.1950212146564; Tue, 6 Mar 2018 14:08:59 -0800 (PST) Received: from localhost ([::1]:58585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKlW-0005oy-Oj for importer@patchew.org; Tue, 06 Mar 2018 17:08:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKf9-00008N-T7 for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etKf8-0006u6-So for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:23 -0500 Received: from chuckie.co.uk ([82.165.15.123]:43197 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 1etKf8-0006fc-Jj; Tue, 06 Mar 2018 17:02:22 -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 1etKfE-0007QL-9g; Tue, 06 Mar 2018 22:02:30 +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:57 +0000 Message-Id: <20180306220159.4287-5-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 4/6] grackle: move PCI IO (ISA) memory region into the grackle device 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" This simplifies the Old World machine to simply mapping the ISA memory regi= on into the main address space. Signed-off-by: Mark Cave-Ayland --- hw/pci-host/grackle.c | 7 ++++++- hw/ppc/mac_oldworld.c | 9 +++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c index e4583d493b..4810a4de79 100644 --- a/hw/pci-host/grackle.c +++ b/hw/pci-host/grackle.c @@ -41,6 +41,7 @@ typedef struct GrackleState { qemu_irq irqs[4]; MemoryRegion pci_mmio; MemoryRegion pci_hole; + MemoryRegion pci_io; } GrackleState; =20 /* Don't know if this matches real hardware, but it agrees with OHW. */ @@ -76,7 +77,7 @@ static void grackle_realize(DeviceState *dev, Error **err= p) pci_grackle_map_irq, s, &s->pci_mmio, - get_system_io(), + &s->pci_io, 0, 4, TYPE_PCI_BUS); =20 pci_create_simple(phb->bus, 0, "grackle"); @@ -90,6 +91,9 @@ static void grackle_init(Object *obj) PCIHostState *phb =3D PCI_HOST_BRIDGE(obj); =20 memory_region_init(&s->pci_mmio, OBJECT(s), "pci-mmio", 0x100000000ULL= ); + memory_region_init_io(&s->pci_io, OBJECT(s), &unassigned_io_ops, obj, + "pci-isa-mmio", 0x00200000); + memory_region_init_alias(&s->pci_hole, OBJECT(s), "pci-hole", &s->pci_= mmio, 0x80000000ULL, 0x7e000000ULL); =20 @@ -106,6 +110,7 @@ static void grackle_init(Object *obj) sysbus_init_mmio(sbd, &phb->conf_mem); sysbus_init_mmio(sbd, &phb->data_mem); sysbus_init_mmio(sbd, &s->pci_hole); + sysbus_init_mmio(sbd, &s->pci_io); } =20 static void grackle_pci_realize(PCIDevice *d, Error **errp) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index b3c1f1bc1b..2bf70c4375 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -92,7 +92,6 @@ static void ppc_heathrow_init(MachineState *machine) int linux_boot, i; MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); - MemoryRegion *isa =3D g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base, cmdline_base =3D 0; int32_t kernel_size, initrd_size; PCIBus *pci_bus; @@ -226,11 +225,6 @@ static void ppc_heathrow_init(MachineState *machine) } } =20 - /* Register 2 MB of ISA IO space */ - memory_region_init_alias(isa, NULL, "isa_mmio", - get_system_io(), 0, 0x00200000); - memory_region_add_subregion(sysmem, 0xfe000000, isa); - /* XXX: we register only 1 output pin for heathrow PIC */ pic_dev =3D qdev_create(NULL, TYPE_HEATHROW); qdev_init_nofail(pic_dev); @@ -277,6 +271,9 @@ static void ppc_heathrow_init(MachineState *machine) /* PCI hole */ memory_region_add_subregion(get_system_memory(), 0x80000000ULL, sysbus_mmio_get_region(s, 2)); + /* Register 2 MB of ISA IO space */ + memory_region_add_subregion(get_system_memory(), 0xfe000000, + sysbus_mmio_get_region(s, 3)); =20 pci_bus =3D PCI_HOST_BRIDGE(dev)->bus; =20 --=20 2.11.0 From nobody Fri Oct 24 21:57:01 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 15203740229201006.1973086674155; Tue, 6 Mar 2018 14:07:02 -0800 (PST) Received: from localhost ([::1]:58566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKjd-0004GT-RX for importer@patchew.org; Tue, 06 Mar 2018 17:07:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKf8-00007v-3s 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-0006kh-SW for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:22 -0500 Received: from chuckie.co.uk ([82.165.15.123]:43199 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-0006i7-Lg; 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 1etKfG-0007QL-CY; Tue, 06 Mar 2018 22:02:31 +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:58 +0000 Message-Id: <20180306220159.4287-6-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 5/6] mac_oldworld: remove pics IRQ array and wire up macio to heathrow directly 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" Introduce constants for the pre-defined Old World IRQs to help keep things readable. Signed-off-by: Mark Cave-Ayland --- hw/ppc/mac.h | 8 ++++++++ hw/ppc/mac_oldworld.c | 27 ++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 04568c2a22..6f3603c21e 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -45,6 +45,14 @@ =20 #define ESCC_CLOCK 3686400 =20 +/* Old World IRQs */ +#define OLDWORLD_CUDA_IRQ 0x12 +#define OLDWORLD_ESCCB_IRQ 0x10 +#define OLDWORLD_ESCCA_IRQ 0xf +#define OLDWORLD_IDE0_IRQ 0xd +#define OLDWORLD_IDE0_DMA_IRQ 0x2 +#define OLDWORLD_IDE1_IRQ 0xe +#define OLDWORLD_IDE1_DMA_IRQ 0x3 =20 /* MacIO */ #define TYPE_MACIO_IDE "macio-ide" diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 2bf70c4375..048b0cea7e 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -88,7 +88,6 @@ static void ppc_heathrow_init(MachineState *machine) PowerPCCPU *cpu =3D NULL; CPUPPCState *env =3D NULL; char *filename; - qemu_irq *pic; int linux_boot, i; MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); @@ -242,11 +241,6 @@ 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(); @@ -288,13 +282,20 @@ static void ppc_heathrow_init(MachineState *machine) /* MacIO */ macio =3D OLDWORLD_MACIO(pci_create(pci_bus, -1, TYPE_OLDWORLD_MACIO)); dev =3D DEVICE(macio); - qdev_connect_gpio_out(dev, 0, pic[0x12]); /* CUDA */ - qdev_connect_gpio_out(dev, 1, pic[0x10]); /* ESCC-B */ - qdev_connect_gpio_out(dev, 2, pic[0x0F]); /* ESCC-A */ - qdev_connect_gpio_out(dev, 3, pic[0x0D]); /* IDE-0 */ - qdev_connect_gpio_out(dev, 4, pic[0x02]); /* IDE-0 DMA */ - qdev_connect_gpio_out(dev, 5, pic[0x0E]); /* IDE-1 */ - qdev_connect_gpio_out(dev, 6, pic[0x03]); /* IDE-1 DMA */ + qdev_connect_gpio_out(dev, 0, + qdev_get_gpio_in(pic_dev, OLDWORLD_CUDA_IRQ)); + qdev_connect_gpio_out(dev, 1, + qdev_get_gpio_in(pic_dev, OLDWORLD_ESCCB_IRQ)); + qdev_connect_gpio_out(dev, 2, + qdev_get_gpio_in(pic_dev, OLDWORLD_ESCCA_IRQ)); + qdev_connect_gpio_out(dev, 3, + qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_IRQ)); + qdev_connect_gpio_out(dev, 4, + qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_DMA_IRQ)); + qdev_connect_gpio_out(dev, 5, + qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_IRQ)); + qdev_connect_gpio_out(dev, 6, + qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_DMA_IRQ)); qdev_prop_set_uint64(dev, "frequency", tbfreq); object_property_set_link(OBJECT(macio), OBJECT(pic_dev), "pic", &error_abort); --=20 2.11.0 From nobody Fri Oct 24 21:57:01 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 1520373885027244.06339636100063; Tue, 6 Mar 2018 14:04:45 -0800 (PST) Received: from localhost ([::1]:58548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKhK-0001WG-Ch for importer@patchew.org; Tue, 06 Mar 2018 17:04:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etKf8-00007x-4M 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 1etKf6-0006of-Ea for qemu-devel@nongnu.org; Tue, 06 Mar 2018 17:02:22 -0500 Received: from chuckie.co.uk ([82.165.15.123]:43203 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 1etKf6-0006mV-8L; Tue, 06 Mar 2018 17:02:20 -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 1etKfH-0007QL-SE; Tue, 06 Mar 2018 22:02:33 +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:59 +0000 Message-Id: <20180306220159.4287-7-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 6/6] mac_oldworld: move wiring of macio IRQs to macio_oldworld_realize() 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" Since the macio device has a link to the PIC device, we can now wire up the IRQs directly via qdev GPIOs rather than having to use an intermediate arra= y. Signed-off-by: Mark Cave-Ayland --- hw/misc/macio/macio.c | 37 ++++++++++++++++++++++--------------- hw/ppc/mac_oldworld.c | 14 -------------- include/hw/misc/macio/macio.h | 1 - 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index af1bd46b4b..ea170c0649 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -145,10 +145,9 @@ static void macio_oldworld_realize(PCIDevice *d, Error= **errp) { MacIOState *s =3D MACIO(d); OldWorldMacIOState *os =3D OLDWORLD_MACIO(d); + DeviceState *pic_dev =3D DEVICE(os->pic); Error *err =3D NULL; SysBusDevice *sysbus_dev; - int i; - int cur_irq =3D 0; =20 macio_common_realize(d, &err); if (err) { @@ -157,11 +156,14 @@ static void macio_oldworld_realize(PCIDevice *d, Erro= r **errp) } =20 sysbus_dev =3D SYS_BUS_DEVICE(&s->cuda); - sysbus_connect_irq(sysbus_dev, 0, os->irqs[cur_irq++]); + sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev, + OLDWORLD_CUDA_IRQ)); =20 sysbus_dev =3D SYS_BUS_DEVICE(&s->escc); - sysbus_connect_irq(sysbus_dev, 0, os->irqs[cur_irq++]); - sysbus_connect_irq(sysbus_dev, 1, os->irqs[cur_irq++]); + sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev, + OLDWORLD_ESCCB_IRQ)= ); + sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev, + OLDWORLD_ESCCA_IRQ)= ); =20 object_property_set_bool(OBJECT(&os->nvram), true, "realized", &err); if (err) { @@ -179,15 +181,22 @@ static void macio_oldworld_realize(PCIDevice *d, Erro= r **errp) sysbus_mmio_get_region(sysbus_dev, 0)); =20 /* IDE buses */ - for (i =3D 0; i < ARRAY_SIZE(os->ide); i++) { - qemu_irq irq0 =3D os->irqs[cur_irq++]; - qemu_irq irq1 =3D os->irqs[cur_irq++]; + macio_realize_ide(s, &os->ide[0], + qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_IRQ), + qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_DMA_IRQ), + 0x16, &err); + if (err) { + error_propagate(errp, err); + return; + } =20 - macio_realize_ide(s, &os->ide[i], irq0, irq1, 0x16 + (i * 4), &err= ); - if (err) { - error_propagate(errp, err); - return; - } + macio_realize_ide(s, &os->ide[1], + qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_IRQ), + qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_DMA_IRQ), + 0x1a, &err); + if (err) { + error_propagate(errp, err); + return; } } =20 @@ -212,8 +221,6 @@ static void macio_oldworld_init(Object *obj) DeviceState *dev; int i; =20 - qdev_init_gpio_out(DEVICE(obj), os->irqs, ARRAY_SIZE(os->irqs)); - object_property_add_link(obj, "pic", TYPE_HEATHROW, (Object **) &os->pic, qdev_prop_allow_set_link_before_realize, diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 048b0cea7e..b3bd00a03d 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -282,20 +282,6 @@ static void ppc_heathrow_init(MachineState *machine) /* MacIO */ macio =3D OLDWORLD_MACIO(pci_create(pci_bus, -1, TYPE_OLDWORLD_MACIO)); dev =3D DEVICE(macio); - qdev_connect_gpio_out(dev, 0, - qdev_get_gpio_in(pic_dev, OLDWORLD_CUDA_IRQ)); - qdev_connect_gpio_out(dev, 1, - qdev_get_gpio_in(pic_dev, OLDWORLD_ESCCB_IRQ)); - qdev_connect_gpio_out(dev, 2, - qdev_get_gpio_in(pic_dev, OLDWORLD_ESCCA_IRQ)); - qdev_connect_gpio_out(dev, 3, - qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_IRQ)); - qdev_connect_gpio_out(dev, 4, - qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_DMA_IRQ)); - qdev_connect_gpio_out(dev, 5, - qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_IRQ)); - qdev_connect_gpio_out(dev, 6, - qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_DMA_IRQ)); qdev_prop_set_uint64(dev, "frequency", tbfreq); object_property_set_link(OBJECT(macio), OBJECT(pic_dev), "pic", &error_abort); diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 4528282b36..64a2584a77 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -56,7 +56,6 @@ typedef struct OldWorldMacIOState { /*< public >*/ =20 HeathrowState *pic; - qemu_irq irqs[7]; =20 MacIONVRAMState nvram; MACIOIDEState ide[2]; --=20 2.11.0