From nobody Tue Nov 18 07:49:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609265036; cv=none; d=zohomail.com; s=zohoarc; b=FSexkbchn5aN5Cc3xnsjWuYPgdiqv6cHTwz2AmcGlqbRdVvFmstVrK8LrIhQIh3M3tz4fpYmCcUkvI1pvqoJzzuBG15D+kDh1+vXseMjAvRz1cIvyRbECNHohGuiN7iiXYdxfcVcHZLmWzIfnq7MQadXTxnnrh5qZlglrFq3rNM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609265036; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=82EnYTCYsHkUjJd8A33T/t3IvLsdTVzYVDaeZQAQzzU=; b=CfWmPcoqPbqdhHihilkWeWjf6ILkes00wS+7PJvuQNWLJcpIDxV+zm/fLL3Oj9rPj/k7r6L8IjF1dlob4SLT+Xu/o0/9h1qkUt3XkCGztLy218uZTv80kO115j8kQLD0tUdgMDaVZRMzf/moMOlroMQe0M+qpsgf/teu4WTaG0w= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609265036344436.4189468300052; Tue, 29 Dec 2020 10:03:56 -0800 (PST) Received: from localhost ([::1]:39604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuJLe-0006v8-76 for importer@patchew.org; Tue, 29 Dec 2020 13:03:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEY-0006jR-IV; Tue, 29 Dec 2020 12:56:34 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49850 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEW-0004zs-Pd; Tue, 29 Dec 2020 12:56:34 -0500 Received: from host86-148-34-1.range86-148.btcentralplus.com ([86.148.34.1] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuJEU-0007wV-QD; Tue, 29 Dec 2020 17:56:35 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, thuth@redhat.com Date: Tue, 29 Dec 2020 17:56:13 +0000 Message-Id: <20201229175619.6051-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> References: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.148.34.1 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 1/7] mac_oldworld: remove duplicate bus check for PPC_INPUT(env) X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Type: text/plain; charset="utf-8" This condition will have already been caught when wiring the heathrow PIC IRQs to the CPU. Signed-off-by: Mark Cave-Ayland Reviewed-by: David Gibson --- hw/ppc/mac_oldworld.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 04f98a4d81..2ead34bdf1 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -251,12 +251,6 @@ static void ppc_heathrow_init(MachineState *machine) tbfreq =3D TBFREQ; } =20 - /* init basic PC hardware */ - if (PPC_INPUT(env) !=3D PPC_FLAGS_INPUT_6xx) { - error_report("Only 6xx bus is supported on heathrow machine"); - exit(1); - } - /* Grackle PCI host bridge */ dev =3D qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE); qdev_prop_set_uint32(dev, "ofw-addr", 0x80000000); --=20 2.20.1 From nobody Tue Nov 18 07:49:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609264671; cv=none; d=zohomail.com; s=zohoarc; b=dqDiDRUNLdrCR1ZrfpntVI3JrqAUfTiWQHnEXBoOuYy3avh+8wCOSO8qmAOUHqv0+HOLZcvsM+nYmchmg+5kNZsrm0JI/1dFxX4lv7yO66Y+If9FRvk48U6aOZdM5K5XSw9lc+QXhfOKaD2tfKNEgU9elQ+MmwjRhJXo3d8uxRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609264671; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HPpL3VB1Anjzx4KwVGSIHI0ePt0U93Kk33Wjciaxq30=; b=GsqNbGtX4ckx8Z+72ek0zkHlksktPLt6DxHGo+dTgPvOnxfi0DeIBBzS/g7axe1CdtqeLu+dZXBZ0VfxfLzgHremoRuP6BLruBBFxUX9/e+pNeOsviBIMpBltdvyMdctVmXVBx1eavSjnAqlskcBKAYHzrWGB+s3y6WC8QSEpMk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160926467104659.682347240728404; Tue, 29 Dec 2020 09:57:51 -0800 (PST) Received: from localhost ([::1]:53522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuJFl-00007Q-M0 for importer@patchew.org; Tue, 29 Dec 2020 12:57:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEd-0006tk-2t; Tue, 29 Dec 2020 12:56:39 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49858 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEb-00050n-IC; Tue, 29 Dec 2020 12:56:38 -0500 Received: from host86-148-34-1.range86-148.btcentralplus.com ([86.148.34.1] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuJEZ-0007wV-Nl; Tue, 29 Dec 2020 17:56:40 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, thuth@redhat.com Date: Tue, 29 Dec 2020 17:56:14 +0000 Message-Id: <20201229175619.6051-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> References: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.148.34.1 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 2/7] mac_oldworld: move initialisation of grackle before heathrow X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Type: text/plain; charset="utf-8" In order to move the heathrow PIC to the macio device, the PCI bus needs to= be initialised before the macio device and also before wiring the PIC IRQs. Signed-off-by: Mark Cave-Ayland Reviewed-by: David Gibson --- hw/ppc/mac_oldworld.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 2ead34bdf1..e58e0525fe 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -227,6 +227,21 @@ static void ppc_heathrow_init(MachineState *machine) } } =20 + /* Grackle PCI host bridge */ + dev =3D qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE); + qdev_prop_set_uint32(dev, "ofw-addr", 0x80000000); + s =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(s, &error_fatal); + + 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)); + /* Register 2 MB of ISA IO space */ + memory_region_add_subregion(get_system_memory(), 0xfe000000, + sysbus_mmio_get_region(s, 3)); + /* XXX: we register only 1 output pin for heathrow PIC */ pic_dev =3D qdev_new(TYPE_HEATHROW); sysbus_realize_and_unref(SYS_BUS_DEVICE(pic_dev), &error_fatal); @@ -251,21 +266,6 @@ static void ppc_heathrow_init(MachineState *machine) tbfreq =3D TBFREQ; } =20 - /* Grackle PCI host bridge */ - dev =3D qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE); - qdev_prop_set_uint32(dev, "ofw-addr", 0x80000000); - s =3D SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(s, &error_fatal); - - 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)); - /* Register 2 MB of ISA IO space */ - memory_region_add_subregion(get_system_memory(), 0xfe000000, - sysbus_mmio_get_region(s, 3)); - for (i =3D 0; i < 4; i++) { qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x15 + i)); } --=20 2.20.1 From nobody Tue Nov 18 07:49:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609265178; cv=none; d=zohomail.com; s=zohoarc; b=dzeMX4TOMsDrLjtx0FhFZZ4bbVxR9aM+xhg+8OW3LxMiKPPv3xDPWxGAbiegzrHJvUhrTjI9/6iERYN8A8oZBWKkypHkb/2VbjiGos4r2PXW41gyw8bbe0A7eiX7XFSvpSAv4icU3zqLzeUImiaNYZJLs7iU/RgZjreIEf2R9Ic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609265178; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ozvj00Fru0md2NqeawJ931tlcxyN/v7kJPpUG2phpNU=; b=enyBGwBKjy543il2orIBAS/dETwzBmOcSQrye/Q3s5lBXA8q9fDfhFUoIe37DK44swf4RdKfGngqAaPq6OYSmwfTaUAHoNXe5vyS4lfgcokCr/YKoh8wDmcBi9vSizj96CVSQ+m+je9EK11fT+Lba/Blq4ERqEc+kEBy5poiRmg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609265178400195.4381808654548; Tue, 29 Dec 2020 10:06:18 -0800 (PST) Received: from localhost ([::1]:43942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuJNx-0000O6-AX for importer@patchew.org; Tue, 29 Dec 2020 13:06:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEk-0007Dh-60; Tue, 29 Dec 2020 12:56:46 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49868 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEi-00051m-4I; Tue, 29 Dec 2020 12:56:45 -0500 Received: from host86-148-34-1.range86-148.btcentralplus.com ([86.148.34.1] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuJEe-0007wV-N3; Tue, 29 Dec 2020 17:56:46 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, thuth@redhat.com Date: Tue, 29 Dec 2020 17:56:15 +0000 Message-Id: <20201229175619.6051-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> References: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.148.34.1 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 3/7] macio: move heathrow PIC inside macio-oldworld device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Type: text/plain; charset="utf-8" The heathrow PIC is located within the macio device on real hardware so mak= e it a child of the macio-oldworld device. This also removes the need for settin= g and checking a separate PIC object property link on the macio-oldworld device w= hich currently causes the automated QOM introspection tests to fail. Signed-off-by: Mark Cave-Ayland Reviewed-by: David Gibson --- hw/misc/macio/macio.c | 20 +++++------ hw/ppc/mac_oldworld.c | 66 +++++++++++++++++------------------ include/hw/misc/macio/macio.h | 2 +- 3 files changed, 43 insertions(+), 45 deletions(-) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index bb601f782c..cfb87da6c9 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -140,7 +140,7 @@ 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); + DeviceState *pic_dev =3D DEVICE(&os->pic); Error *err =3D NULL; SysBusDevice *sysbus_dev; =20 @@ -150,6 +150,14 @@ static void macio_oldworld_realize(PCIDevice *d, Error= **errp) return; } =20 + /* Heathrow PIC */ + if (!qdev_realize(DEVICE(&os->pic), BUS(&s->macio_bus), errp)) { + return; + } + sysbus_dev =3D SYS_BUS_DEVICE(&os->pic); + memory_region_add_subregion(&s->bar, 0x0, + sysbus_mmio_get_region(sysbus_dev, 0)); + qdev_prop_set_uint64(DEVICE(&s->cuda), "timebase-frequency", s->frequency); if (!qdev_realize(DEVICE(&s->cuda), BUS(&s->macio_bus), errp)) { @@ -175,11 +183,6 @@ static void macio_oldworld_realize(PCIDevice *d, Error= **errp) sysbus_mmio_get_region(sysbus_dev, 0)); pmac_format_nvram_partition(&os->nvram, os->nvram.size); =20 - /* Heathrow PIC */ - sysbus_dev =3D SYS_BUS_DEVICE(os->pic); - memory_region_add_subregion(&s->bar, 0x0, - sysbus_mmio_get_region(sysbus_dev, 0)); - /* IDE buses */ macio_realize_ide(s, &os->ide[0], qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_IRQ), @@ -218,10 +221,7 @@ static void macio_oldworld_init(Object *obj) DeviceState *dev; int i; =20 - object_property_add_link(obj, "pic", TYPE_HEATHROW, - (Object **) &os->pic, - qdev_prop_allow_set_link_before_realize, - 0); + object_initialize_child(OBJECT(s), "pic", &os->pic, TYPE_HEATHROW); =20 object_initialize_child(OBJECT(s), "cuda", &s->cuda, TYPE_CUDA); =20 diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index e58e0525fe..44ee99be88 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -98,7 +98,7 @@ static void ppc_heathrow_init(MachineState *machine) MACIOIDEState *macio_ide; ESCCState *escc; SysBusDevice *s; - DeviceState *dev, *pic_dev; + DeviceState *dev, *pic_dev, *grackle_dev; BusState *adb_bus; uint64_t bios_addr; int bios_size; @@ -227,10 +227,17 @@ static void ppc_heathrow_init(MachineState *machine) } } =20 + /* Timebase Frequency */ + if (kvm_enabled()) { + tbfreq =3D kvmppc_get_tbfreq(); + } else { + tbfreq =3D TBFREQ; + } + /* Grackle PCI host bridge */ - dev =3D qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE); - qdev_prop_set_uint32(dev, "ofw-addr", 0x80000000); - s =3D SYS_BUS_DEVICE(dev); + grackle_dev =3D qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE); + qdev_prop_set_uint32(grackle_dev, "ofw-addr", 0x80000000); + s =3D SYS_BUS_DEVICE(grackle_dev); sysbus_realize_and_unref(s, &error_fatal); =20 sysbus_mmio_map(s, 0, GRACKLE_BASE); @@ -242,14 +249,30 @@ static void ppc_heathrow_init(MachineState *machine) memory_region_add_subregion(get_system_memory(), 0xfe000000, sysbus_mmio_get_region(s, 3)); =20 - /* XXX: we register only 1 output pin for heathrow PIC */ - pic_dev =3D qdev_new(TYPE_HEATHROW); - sysbus_realize_and_unref(SYS_BUS_DEVICE(pic_dev), &error_fatal); + pci_bus =3D PCI_HOST_BRIDGE(grackle_dev)->bus; + + /* MacIO */ + macio =3D pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO); + dev =3D DEVICE(macio); + qdev_prop_set_uint64(dev, "frequency", tbfreq); + + escc =3D ESCC(object_resolve_path_component(OBJECT(macio), "escc")); + qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0)); + qdev_prop_set_chr(DEVICE(escc), "chrB", serial_hd(1)); + + pci_realize_and_unref(macio, pci_bus, &error_fatal); + + pic_dev =3D DEVICE(object_resolve_path_component(OBJECT(macio), "pic")= ); + for (i =3D 0; i < 4; i++) { + qdev_connect_gpio_out(grackle_dev, i, + qdev_get_gpio_in(pic_dev, 0x15 + i)); + } =20 /* 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: + /* XXX: we register only 1 output pin for heathrow PIC */ qdev_connect_gpio_out(pic_dev, 0, ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]); break; @@ -259,40 +282,14 @@ static void ppc_heathrow_init(MachineState *machine) } } =20 - /* Timebase Frequency */ - if (kvm_enabled()) { - tbfreq =3D kvmppc_get_tbfreq(); - } else { - tbfreq =3D TBFREQ; - } - - for (i =3D 0; i < 4; i++) { - qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x15 + i)); - } - - pci_bus =3D PCI_HOST_BRIDGE(dev)->bus; - pci_vga_init(pci_bus); =20 for (i =3D 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); } =20 + /* MacIO IDE */ ide_drive_get(hd, ARRAY_SIZE(hd)); - - /* MacIO */ - macio =3D pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO); - dev =3D DEVICE(macio); - qdev_prop_set_uint64(dev, "frequency", tbfreq); - object_property_set_link(OBJECT(macio), "pic", OBJECT(pic_dev), - &error_abort); - - escc =3D ESCC(object_resolve_path_component(OBJECT(macio), "escc")); - qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0)); - qdev_prop_set_chr(DEVICE(escc), "chrB", serial_hd(1)); - - pci_realize_and_unref(macio, pci_bus, &error_fatal); - macio_ide =3D MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[0]")); macio_ide_init_drives(macio_ide, hd); @@ -301,6 +298,7 @@ static void ppc_heathrow_init(MachineState *machine) "ide[1]")); macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]); =20 + /* MacIO CUDA/ADB */ dev =3D DEVICE(object_resolve_path_component(OBJECT(macio), "cuda")); adb_bus =3D qdev_get_child_bus(dev, "adb.0"); dev =3D qdev_new(TYPE_ADB_KEYBOARD); diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 22b4e64b2c..707dfab50c 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -99,7 +99,7 @@ struct OldWorldMacIOState { MacIOState parent_obj; /*< public >*/ =20 - HeathrowState *pic; + HeathrowState pic; =20 MacIONVRAMState nvram; MACIOIDEState ide[2]; --=20 2.20.1 From nobody Tue Nov 18 07:49:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609264876; cv=none; d=zohomail.com; s=zohoarc; b=NbJ3vIn3jR6IsbPQ3ZpYD4nEAABwrRUpgfgyDGIPqWt6ydk6z6pc7w6q0YY2FRWhQARGj6Zn1PritYd8UrtI5IgxJ3JaH11mMjFJAGllz/I0dAK6SvMol6/erMOtM8jvYYZW7AW4AXoj/5OpbwPmkxtL8FxdXS6UIunJSTMX7Es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609264876; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MCQa6nzaidXhb7IaScia3briiJJLmgQcU2SBx90Yb5I=; b=aYmarpuwDEU42AN1rfM81x4lH8D5TKHPkj066VhwxRSQYgJgV1nPsfGzXQ6x9dZh32SrSUNvTlbC0mcUK+IctrkoPP5dw710zkCrvtf1dI+F/7htAzidcod52MaCeL4DXol7oVoMcIa5DVsNhn9KK+pnrt3DAFrZMl30WqLwUso= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609264876135772.8119409600963; Tue, 29 Dec 2020 10:01:16 -0800 (PST) Received: from localhost ([::1]:33900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuJJ3-0003zj-NI for importer@patchew.org; Tue, 29 Dec 2020 13:01:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEo-0007Hs-JK; Tue, 29 Dec 2020 12:56:51 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49874 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEm-00052f-Q0; Tue, 29 Dec 2020 12:56:50 -0500 Received: from host86-148-34-1.range86-148.btcentralplus.com ([86.148.34.1] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuJEl-0007wV-4D; Tue, 29 Dec 2020 17:56:51 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, thuth@redhat.com Date: Tue, 29 Dec 2020 17:56:16 +0000 Message-Id: <20201229175619.6051-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> References: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.148.34.1 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 4/7] mac_newworld: delay wiring of PCI IRQs in New World machine X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Type: text/plain; charset="utf-8" In order to move the OpenPIC device to the macio device, the PCI bus needs = to be initialised before the macio device and also before wiring the OpenPIC IRQs. Signed-off-by: Mark Cave-Ayland Reviewed-by: David Gibson --- hw/ppc/mac_newworld.c | 46 ++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index c0accda592..708bb2f1ab 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -139,6 +139,7 @@ static void ppc_core99_init(MachineState *machine) int machine_arch; SysBusDevice *s; DeviceState *dev, *pic_dev; + DeviceState *uninorth_internal_dev =3D NULL, *uninorth_agp_dev =3D NUL= L; hwaddr nvram_addr =3D 0xFFF04000; uint64_t tbfreq; unsigned int smp_cpus =3D machine->smp.cpus; @@ -320,35 +321,24 @@ static void ppc_core99_init(MachineState *machine) sysbus_mmio_map(s, 0, 0xf0800000); sysbus_mmio_map(s, 1, 0xf0c00000); =20 - for (i =3D 0; i < 4; i++) { - qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x1b += i)); - } - machine_arch =3D ARCH_MAC99_U3; } else { /* Use values found on a real PowerMac */ /* Uninorth AGP bus */ - dev =3D qdev_new(TYPE_UNI_NORTH_AGP_HOST_BRIDGE); - s =3D SYS_BUS_DEVICE(dev); + uninorth_agp_dev =3D qdev_new(TYPE_UNI_NORTH_AGP_HOST_BRIDGE); + s =3D SYS_BUS_DEVICE(uninorth_agp_dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_mmio_map(s, 0, 0xf0800000); sysbus_mmio_map(s, 1, 0xf0c00000); =20 - for (i =3D 0; i < 4; i++) { - qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x1b += i)); - } - /* Uninorth internal bus */ - dev =3D qdev_new(TYPE_UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE); - s =3D SYS_BUS_DEVICE(dev); + uninorth_internal_dev =3D qdev_new( + TYPE_UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE); + s =3D SYS_BUS_DEVICE(uninorth_internal_dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_mmio_map(s, 0, 0xf4800000); sysbus_mmio_map(s, 1, 0xf4c00000); =20 - for (i =3D 0; i < 4; i++) { - qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x1b += i)); - } - /* Uninorth main bus */ dev =3D qdev_new(TYPE_UNI_NORTH_PCI_HOST_BRIDGE); qdev_prop_set_uint32(dev, "ofw-addr", 0xf2000000); @@ -364,10 +354,6 @@ static void ppc_core99_init(MachineState *machine) sysbus_mmio_map(s, 0, 0xf2800000); sysbus_mmio_map(s, 1, 0xf2c00000); =20 - for (i =3D 0; i < 4; i++) { - qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x1b += i)); - } - machine_arch =3D ARCH_MAC99; } =20 @@ -401,6 +387,26 @@ static void ppc_core99_init(MachineState *machine) =20 pci_realize_and_unref(macio, pci_bus, &error_fatal); =20 + for (i =3D 0; i < 4; i++) { + qdev_connect_gpio_out(DEVICE(uninorth_pci), i, + qdev_get_gpio_in(pic_dev, 0x1b + i)); + } + + /* TODO: additional PCI buses only wired up for 32-bit machines */ + if (PPC_INPUT(env) !=3D PPC_FLAGS_INPUT_970) { + /* Uninorth AGP bus */ + for (i =3D 0; i < 4; i++) { + qdev_connect_gpio_out(uninorth_agp_dev, i, + qdev_get_gpio_in(pic_dev, 0x1b + i)); + } + + /* Uninorth internal bus */ + for (i =3D 0; i < 4; i++) { + qdev_connect_gpio_out(uninorth_internal_dev, i, + qdev_get_gpio_in(pic_dev, 0x1b + i)); + } + } + /* We only emulate 2 out of 3 IDE controllers for now */ ide_drive_get(hd, ARRAY_SIZE(hd)); =20 --=20 2.20.1 From nobody Tue Nov 18 07:49:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609264875; cv=none; d=zohomail.com; s=zohoarc; b=k0ER9mrwDjlcGgB7gBfK8vlg5SgTkypYVaXWxvplEQjqcMtEtjaR0ZeK+znOoz7RqNPGGY7FUbPWuHq6fw2kQW+MDKSdQRapx8Uh+CGFAyZThPDMXA5m20uWXnrKjIILxzC3gv0xMKvQSGakD6Fpu4+dRJxMyAaRhhse7NDP4O4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609264875; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PJIibq+5og4w7nk8cZfiB2mo5eXs+VMw6zdFVbihQ2Y=; b=QOjCuUz3mqrnHdIJ0MT8egO/Pd61DP7S16bvrS6VwZ+HvB7X3up5GSJuSkArSfaGaSr7KMfB9vQ3LEGW5dxVL/4gIwZeUAYovHxKRPAzd31568HpDlQKOuzuZzfGtEQSSO/FfKCz/pTajcdUCCZrhykEvxXkEgsZP3nQyutGE6k= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609264875943134.68443004891412; Tue, 29 Dec 2020 10:01:15 -0800 (PST) Received: from localhost ([::1]:33854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuJJ3-0003yT-RY for importer@patchew.org; Tue, 29 Dec 2020 13:01:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEw-0007On-Ul; Tue, 29 Dec 2020 12:56:59 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49882 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEt-00054T-Cj; Tue, 29 Dec 2020 12:56:58 -0500 Received: from host86-148-34-1.range86-148.btcentralplus.com ([86.148.34.1] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuJEp-0007wV-W6; Tue, 29 Dec 2020 17:56:56 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, thuth@redhat.com Date: Tue, 29 Dec 2020 17:56:17 +0000 Message-Id: <20201229175619.6051-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> References: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.148.34.1 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 5/7] macio: move OpenPIC inside macio-newworld device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Type: text/plain; charset="utf-8" The OpenPIC device is located within the macio device on real hardware so m= ake it a child of the macio-newworld device. This also removes the need for settin= g and checking a separate PIC object property link on the macio-newworld device w= hich currently causes the automated QOM introspection tests to fail. Signed-off-by: Mark Cave-Ayland Reviewed-by: David Gibson --- hw/misc/macio/macio.c | 19 +++++++++---------- hw/ppc/mac_newworld.c | 25 +++++++++++-------------- include/hw/misc/macio/macio.h | 2 +- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index cfb87da6c9..36be77cede 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -273,7 +273,7 @@ static void macio_newworld_realize(PCIDevice *d, Error = **errp) { MacIOState *s =3D MACIO(d); NewWorldMacIOState *ns =3D NEWWORLD_MACIO(d); - DeviceState *pic_dev =3D DEVICE(ns->pic); + DeviceState *pic_dev =3D DEVICE(&ns->pic); Error *err =3D NULL; SysBusDevice *sysbus_dev; MemoryRegion *timer_memory =3D NULL; @@ -284,17 +284,19 @@ static void macio_newworld_realize(PCIDevice *d, Erro= r **errp) return; } =20 + /* OpenPIC */ + qdev_prop_set_uint32(pic_dev, "model", OPENPIC_MODEL_KEYLARGO); + sysbus_dev =3D SYS_BUS_DEVICE(&ns->pic); + sysbus_realize_and_unref(sysbus_dev, &error_fatal); + memory_region_add_subregion(&s->bar, 0x40000, + sysbus_mmio_get_region(sysbus_dev, 0)); + sysbus_dev =3D SYS_BUS_DEVICE(&s->escc); sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev, NEWWORLD_ESCCB_IRQ)= ); sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev, NEWWORLD_ESCCA_IRQ)= ); =20 - /* OpenPIC */ - sysbus_dev =3D SYS_BUS_DEVICE(ns->pic); - memory_region_add_subregion(&s->bar, 0x40000, - sysbus_mmio_get_region(sysbus_dev, 0)); - /* IDE buses */ macio_realize_ide(s, &ns->ide[0], qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_IRQ), @@ -369,10 +371,7 @@ static void macio_newworld_init(Object *obj) NewWorldMacIOState *ns =3D NEWWORLD_MACIO(obj); int i; =20 - object_property_add_link(obj, "pic", TYPE_OPENPIC, - (Object **) &ns->pic, - qdev_prop_allow_set_link_before_realize, - 0); + object_initialize_child(OBJECT(s), "pic", &ns->pic, TYPE_OPENPIC); =20 object_initialize_child(OBJECT(s), "gpio", &ns->gpio, TYPE_MACIO_GPIO); =20 diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 708bb2f1ab..e991db4add 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -293,18 +293,6 @@ static void ppc_core99_init(MachineState *machine) } } =20 - pic_dev =3D qdev_new(TYPE_OPENPIC); - qdev_prop_set_uint32(pic_dev, "model", OPENPIC_MODEL_KEYLARGO); - s =3D SYS_BUS_DEVICE(pic_dev); - sysbus_realize_and_unref(s, &error_fatal); - k =3D 0; - for (i =3D 0; i < smp_cpus; i++) { - for (j =3D 0; j < OPENPIC_OUTPUT_NB; j++) { - sysbus_connect_irq(s, k++, openpic_irqs[i].irq[j]); - } - } - g_free(openpic_irqs); - if (PPC_INPUT(env) =3D=3D PPC_FLAGS_INPUT_970) { /* 970 gets a U3 bus */ /* Uninorth AGP bus */ @@ -378,8 +366,6 @@ static void ppc_core99_init(MachineState *machine) qdev_prop_set_uint64(dev, "frequency", tbfreq); qdev_prop_set_bit(dev, "has-pmu", has_pmu); qdev_prop_set_bit(dev, "has-adb", has_adb); - object_property_set_link(OBJECT(macio), "pic", OBJECT(pic_dev), - &error_abort); =20 escc =3D ESCC(object_resolve_path_component(OBJECT(macio), "escc")); qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0)); @@ -387,6 +373,7 @@ static void ppc_core99_init(MachineState *machine) =20 pci_realize_and_unref(macio, pci_bus, &error_fatal); =20 + pic_dev =3D DEVICE(object_resolve_path_component(OBJECT(macio), "pic")= ); for (i =3D 0; i < 4; i++) { qdev_connect_gpio_out(DEVICE(uninorth_pci), i, qdev_get_gpio_in(pic_dev, 0x1b + i)); @@ -407,6 +394,16 @@ static void ppc_core99_init(MachineState *machine) } } =20 + /* OpenPIC */ + s =3D SYS_BUS_DEVICE(pic_dev); + k =3D 0; + for (i =3D 0; i < smp_cpus; i++) { + for (j =3D 0; j < OPENPIC_OUTPUT_NB; j++) { + sysbus_connect_irq(s, k++, openpic_irqs[i].irq[j]); + } + } + g_free(openpic_irqs); + /* We only emulate 2 out of 3 IDE controllers for now */ ide_drive_get(hd, ARRAY_SIZE(hd)); =20 diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 707dfab50c..6c05f3bfd2 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -115,7 +115,7 @@ struct NewWorldMacIOState { =20 bool has_pmu; bool has_adb; - OpenPICState *pic; + OpenPICState pic; MACIOIDEState ide[2]; MacIOGPIOState gpio; }; --=20 2.20.1 From nobody Tue Nov 18 07:49:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609264738; cv=none; d=zohomail.com; s=zohoarc; b=KeYdLgw4WC+hexfW1mNHRO7NxCtj9GxJlQ5c5bjpSaYcVX1pdSDyFupzScaTvSEHe6mWdrnHEvnmUh9a+C0gl8rwTvUA+8k3XuZLJcSjhDU2t/GqJ1jdu9jII67xOO77FWA+zQ56tjVPJBtStz3WNvLkUNBERg7dkxxchm7ACbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609264738; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T/QLbofimy3AO/pPHY7/KEJu1wugBIVC0LB8zhG9uZU=; b=W6HnifCb9eWEQ9ixb9yqRxdSM3KAvsS1LNQ8AXD6HSmiIm/V7EBQk1xjpO2dBREc+kE5ab0XzQTc9rnVMKS8is49dXQm4ZLxC5xmpHiEQm2huFaA5EEENeGUeLNt/W+TQLHdWKZIYlYud3lsajvuogePUVe7PKugaH7m2rNrRVs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609264738228687.5724582008427; Tue, 29 Dec 2020 09:58:58 -0800 (PST) Received: from localhost ([::1]:57208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuJGr-0001et-7m for importer@patchew.org; Tue, 29 Dec 2020 12:58:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEy-0007S9-Vr; Tue, 29 Dec 2020 12:57:01 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49892 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJEx-00055k-Bu; Tue, 29 Dec 2020 12:57:00 -0500 Received: from host86-148-34-1.range86-148.btcentralplus.com ([86.148.34.1] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuJEv-0007wV-24; Tue, 29 Dec 2020 17:57:01 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, thuth@redhat.com Date: Tue, 29 Dec 2020 17:56:18 +0000 Message-Id: <20201229175619.6051-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> References: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.148.34.1 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 6/7] macio: wire macio GPIOs to OpenPIC using sysbus IRQs X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Type: text/plain; charset="utf-8" This both allows the wiring to be done as Ben suggested in his original com= ment in gpio.c and also enables the OpenPIC object property link to be removed. Signed-off-by: Mark Cave-Ayland --- hw/misc/macio/gpio.c | 24 +++++------------------- hw/misc/macio/macio.c | 12 +++++++----- include/hw/misc/macio/gpio.h | 2 -- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/hw/misc/macio/gpio.c b/hw/misc/macio/gpio.c index 0fef8fb335..b1bcf830c3 100644 --- a/hw/misc/macio/gpio.c +++ b/hw/misc/macio/gpio.c @@ -57,10 +57,7 @@ void macio_set_gpio(MacIOGPIOState *s, uint32_t gpio, bo= ol state) =20 s->gpio_regs[gpio] =3D new_reg; =20 - /* This is will work until we fix the binding between MacIO and - * the MPIC properly so we can route all GPIOs and avoid going - * via the top level platform code. - * + /* * Note that we probably need to get access to the MPIC config to * decode polarity since qemu always use "raise" regardless. * @@ -152,25 +149,15 @@ static const MemoryRegionOps macio_gpio_ops =3D { }, }; =20 -static void macio_gpio_realize(DeviceState *dev, Error **errp) -{ - MacIOGPIOState *s =3D MACIO_GPIO(dev); - - s->gpio_extirqs[1] =3D qdev_get_gpio_in(DEVICE(s->pic), - NEWWORLD_EXTING_GPIO1); - s->gpio_extirqs[9] =3D qdev_get_gpio_in(DEVICE(s->pic), - NEWWORLD_EXTING_GPIO9); -} - static void macio_gpio_init(Object *obj) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); MacIOGPIOState *s =3D MACIO_GPIO(obj); + int i; =20 - object_property_add_link(obj, "pic", TYPE_OPENPIC, - (Object **) &s->pic, - qdev_prop_allow_set_link_before_realize, - 0); + for (i =3D 0; i < 10; i++) { + sysbus_init_irq(sbd, &s->gpio_extirqs[i]); + } =20 memory_region_init_io(&s->gpiomem, OBJECT(s), &macio_gpio_ops, obj, "gpio", 0x30); @@ -207,7 +194,6 @@ static void macio_gpio_class_init(ObjectClass *oc, void= *data) DeviceClass *dc =3D DEVICE_CLASS(oc); NMIClass *nc =3D NMI_CLASS(oc); =20 - dc->realize =3D macio_gpio_realize; dc->reset =3D macio_gpio_reset; dc->vmsd =3D &vmstate_macio_gpio; nc->nmi_monitor_handler =3D macio_gpio_nmi; diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 36be77cede..d17cffd868 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -324,14 +324,16 @@ static void macio_newworld_realize(PCIDevice *d, Erro= r **errp) =20 if (ns->has_pmu) { /* GPIOs */ - sysbus_dev =3D SYS_BUS_DEVICE(&ns->gpio); - object_property_set_link(OBJECT(&ns->gpio), "pic", OBJECT(pic_dev), - &error_abort); - memory_region_add_subregion(&s->bar, 0x50, - sysbus_mmio_get_region(sysbus_dev, 0)); if (!qdev_realize(DEVICE(&ns->gpio), BUS(&s->macio_bus), errp)) { return; } + sysbus_dev =3D SYS_BUS_DEVICE(&ns->gpio); + sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev, + NEWWORLD_EXTING_GPIO1)); + sysbus_connect_irq(sysbus_dev, 9, qdev_get_gpio_in(pic_dev, + NEWWORLD_EXTING_GPIO9)); + memory_region_add_subregion(&s->bar, 0x50, + sysbus_mmio_get_region(sysbus_dev, 0)); =20 /* PMU */ object_initialize_child(OBJECT(s), "pmu", &s->pmu, TYPE_VIA_PMU); diff --git a/include/hw/misc/macio/gpio.h b/include/hw/misc/macio/gpio.h index 4dee09a9dd..7d2aa886c2 100644 --- a/include/hw/misc/macio/gpio.h +++ b/include/hw/misc/macio/gpio.h @@ -38,8 +38,6 @@ struct MacIOGPIOState { SysBusDevice parent; /*< public >*/ =20 - OpenPICState *pic; - MemoryRegion gpiomem; qemu_irq gpio_extirqs[10]; uint8_t gpio_levels[8]; --=20 2.20.1 From nobody Tue Nov 18 07:49:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609264969; cv=none; d=zohomail.com; s=zohoarc; b=dUzFdgDkNbY1XvuO/XPKd9VxjQiTL2RfCInoOh18HEXGUjdONcWv4niY/uOH/cJTKcRhXhViA0Bn2TAis6CVZIF4lvS3UxuP1q0YlC4kYJtcvcX0oWlCJ29eFuBh00/DbQB955Zajj0Bc5QqDBbL5cvlN+FiA8vY+hbBQwvbkLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609264969; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F0ptM3C0iRuWCK9atALJQ6aMGESnnr0blH/RRF4wwFI=; b=lckCcr7CBZfZE+Ni77zzyb35eUpXZAIq18ISDQXm5itVFINoIb07mQ65NLBCBvRGk9xMmXBIT61MH/XfifOjB9QWL51a25blnE8jcc3js8ysnDn1+Zgz1uRbesw/fH8ZPtRV9z9F1/shsw8G9yi024j0iZAEMVNvW64nL0t+VDw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609264969366424.64019161081785; Tue, 29 Dec 2020 10:02:49 -0800 (PST) Received: from localhost ([::1]:37644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuJKa-00064L-3t for importer@patchew.org; Tue, 29 Dec 2020 13:02:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJF4-0007YV-BP; Tue, 29 Dec 2020 12:57:06 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49898 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuJF1-00057z-Kb; Tue, 29 Dec 2020 12:57:06 -0500 Received: from host86-148-34-1.range86-148.btcentralplus.com ([86.148.34.1] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuJF0-0007wV-2A; Tue, 29 Dec 2020 17:57:06 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, thuth@redhat.com Date: Tue, 29 Dec 2020 17:56:19 +0000 Message-Id: <20201229175619.6051-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> References: <20201229175619.6051-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.148.34.1 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 7/7] macio: don't set user_creatable to false X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Type: text/plain; charset="utf-8" Now that all of the object property links to the heathrow PIC and OpenPIC h= ave been removed from the macio devices, it is safe to allow the macio-oldworld and macio-neworld devices to be marked as user_creatable. Signed-off-by: Mark Cave-Ayland --- hw/misc/macio/macio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index d17cffd868..e6eeb575d5 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -457,8 +457,6 @@ static void macio_class_init(ObjectClass *klass, void *= data) k->class_id =3D PCI_CLASS_OTHERS << 8; device_class_set_props(dc, macio_properties); set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - /* Reason: requires PIC property links to be set in macio_*_realize() = */ - dc->user_creatable =3D false; } =20 static const TypeInfo macio_bus_info =3D { --=20 2.20.1