From nobody Thu Apr 18 23:47:29 2024 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=1610554382; cv=none; d=zohomail.com; s=zohoarc; b=CuP8qL9kd1Ldy0fwYTjypsRLpUJeXB0HLEbq6qt8wUptQ4NfCboib6dIfBYZVjnjL1mhoSLRql8lHqqv7R1Tg62+tvqiyF+2O6OkfpgMZLMe25L4v/DfQk31iAQxKnmDz5BO3SZs7upFCwAyFonqctoAFGBVlyd/58INZp0p2JA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610554382; 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=A7S3tyran8DiB/T8TuJeVMQs48SBc52w46DDhRAlY9Y=; b=hTVDC4ras7rnUBEPn+liCFtFsv7rEEA8mMxk9SuIgepVlahCRL+B5mZUpnEa3HmU11MYB0VjBE6ELX7io/ZBcCoAgj1MZKAgdgq8mdRXOVxEYUrStU+C7HV+9Hg0MCOrKWBOlNLi4c+pEcybDOVpNKu+onwXS2WrkDA42hsNyiU= 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 1610554382311997.296195546461; Wed, 13 Jan 2021 08:13:02 -0800 (PST) Received: from localhost ([::1]:44094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzilZ-0004qm-2H for importer@patchew.org; Wed, 13 Jan 2021 11:13:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzikL-00038l-1s; Wed, 13 Jan 2021 11:11:45 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:39942 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 1kzikJ-0001OW-FY; Wed, 13 Jan 2021 11:11:44 -0500 Received: from host109-146-177-189.range109-146.btcentralplus.com ([109.146.177.189] 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 1kzikN-0001mR-MZ; Wed, 13 Jan 2021 16:11:53 +0000 From: Mark Cave-Ayland To: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Wed, 13 Jan 2021 16:11:22 +0000 Message-Id: <20210113161128.3156-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> References: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.146.177.189 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PULL 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 Message-Id: <20201229175619.6051-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland --- 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 Thu Apr 18 23:47:29 2024 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=1610554627; cv=none; d=zohomail.com; s=zohoarc; b=Opxl2zpMF4w52p0F/PY1cFbfqjdhYhQBLbQvrf2fNz4Yanw43Ez9Aw0FIXGzr5Qp4wW51ldF5yxd/hxyul2PfvPE5LJ17B2oT6NFeYQhZ6fR1lBIWocyf1qWlPBeXNMXHq9D+INMxYUzT7KVGC36LWVftRn8hRnhJp5vHet8f9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610554627; 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=rZWo/DVtAwMYvfh8Z/cw2nmWr3J7KUSnDzGkjSBmB1U=; b=fBpirrKodRYWnsOeiaoiRjwsXoygpzdMp6GECNV23p8+Qxh1pI15mWOgt2MofvmuxU7urayhQwnl2tTwC0lUV2h0zSVL1Cm1nmEu5M9k1eKXK/yQSLGUY4ywpqaGUFajnNLaT8c6xcAxo4Qj+O3Kmrh51xiPZ3GCBtda6l2M2Ag= 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 161055462782817.143968518959696; Wed, 13 Jan 2021 08:17:07 -0800 (PST) Received: from localhost ([::1]:52438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzipW-0000Dv-LY for importer@patchew.org; Wed, 13 Jan 2021 11:17:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzikO-0003Hj-QR; Wed, 13 Jan 2021 11:11:48 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:39950 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 1kzikN-0001QX-68; Wed, 13 Jan 2021 11:11:48 -0500 Received: from host109-146-177-189.range109-146.btcentralplus.com ([109.146.177.189] 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 1kzikT-0001mR-GN; Wed, 13 Jan 2021 16:11:57 +0000 From: Mark Cave-Ayland To: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Wed, 13 Jan 2021 16:11:23 +0000 Message-Id: <20210113161128.3156-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> References: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.146.177.189 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PULL 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 Message-Id: <20201229175619.6051-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland --- 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 Thu Apr 18 23:47:29 2024 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=1610554622; cv=none; d=zohomail.com; s=zohoarc; b=hMCe887M1t0l5FM7m5HsxI+E3Sbhu+Bwz9OsEC1U17xV7CbeCG2WbsZT3/SlLHvjRc7aLSHupY4jeELDfYmNk63A2VuqZ6AMyJDaNKEMjHNMGCGmN6Ym//qSF/dKAHFYZKo20Nbwo6SJJJhYv8mYcbCwfIYiiUQIWed5x4g2JBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610554622; 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=HTkbkVZ4UdHWPlOIAiFV1wjq74hrobpQ8QKDWRfueyI=; b=CuaIXtD+tS1Mm7Z+hapBW3d1XKudNbX/BPQrnB6DN9lnBC+aLdysuuVQPAkEfzQ3tRWj3CToj0FbzjPNWlt11HQjNgNvVetJ8jDfWhTPnb30g/AMHCrEzbXafCYhW1vGgz3DAQi98BQKYQaNgb3aptEpe1R26nxr/voj0mMp/7I= 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 1610554622785236.14799323894783; Wed, 13 Jan 2021 08:17:02 -0800 (PST) Received: from localhost ([::1]:51990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzipR-0008Sd-Hm for importer@patchew.org; Wed, 13 Jan 2021 11:17:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzikV-0003PD-8O; Wed, 13 Jan 2021 11:11:55 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:39956 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 1kzikP-0001RN-Pa; Wed, 13 Jan 2021 11:11:55 -0500 Received: from host109-146-177-189.range109-146.btcentralplus.com ([109.146.177.189] 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 1kzikX-0001mR-Dj; Wed, 13 Jan 2021 16:11:59 +0000 From: Mark Cave-Ayland To: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Wed, 13 Jan 2021 16:11:24 +0000 Message-Id: <20210113161128.3156-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> References: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.146.177.189 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PULL 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 Message-Id: <20201229175619.6051-4-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland --- 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 Thu Apr 18 23:47:29 2024 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=1610554737; cv=none; d=zohomail.com; s=zohoarc; b=bHeAJ7zfKfyWsncDDToDoDhK6ZTem636PEHiS0vKrX2Z/ML1BoBE1Vh3zKBuWQGc8ZWTV0lYKD1MfU2SCyWyWvJfAF7U/angjKvDf8fuwC3DWU78b13cCrpiuQuCOl6BBJwL2y7VtGy5vkxwfbSo07GsLVPsZk17S7yQeHIeJhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610554737; 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=/faYYJH3Atq13glSn3CF6XHyPrhd3/xobgwLmaa+wLg=; b=dKt6ERHyDb9X00IYhcro93NFe0+mk/i5628ZQViLQAF5UOU5xxRXldl3hPUP+4P7JbVhMcyYLKnYzl1SwBM5mPvYD8Z5wuXFnDNZ7l5mchxI1pwS99tzsyvDQIN0pMyQIEmChG65SxXt4IYH+jV78xwvgIx09uL3PXycccQXQ8o= 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 1610554737285912.9429911481941; Wed, 13 Jan 2021 08:18:57 -0800 (PST) Received: from localhost ([::1]:58228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzirH-0002kg-TW for importer@patchew.org; Wed, 13 Jan 2021 11:18:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzikY-0003We-2P; Wed, 13 Jan 2021 11:11:58 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:39964 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 1kzikV-0001Sr-9I; Wed, 13 Jan 2021 11:11:57 -0500 Received: from host109-146-177-189.range109-146.btcentralplus.com ([109.146.177.189] 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 1kzika-0001mR-0g; Wed, 13 Jan 2021 16:12:04 +0000 From: Mark Cave-Ayland To: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Wed, 13 Jan 2021 16:11:25 +0000 Message-Id: <20210113161128.3156-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> References: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.146.177.189 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PULL 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 Message-Id: <20201229175619.6051-5-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland --- 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 Thu Apr 18 23:47:29 2024 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=1610554431; cv=none; d=zohomail.com; s=zohoarc; b=esYHqBg7OBlmXoUnRj6yfwo8sa0nKutC0s98dCn/1WVJujuBSAvvCMGpoUT8IIzSt9Xya0gak9o32YEz1aK+7QQ1oRpiTiSJuU6+Mxq1bcufqML+8t25T75rjkJwyZWFtSQbsLhJLg2JhEnc59NBWKwSYu8gZ0ALHYudALSSafk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610554431; 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=1A48YXmd3zzmScOVg32m69byxU7AlLXPPg5VrTTs3bI=; b=kIW0YsjwFIRn/80tlCxlLkN66qpOb+gP08jZVPrERLHxz0ezVSGiJdGwcbilRcs4ZIZo9ds4KueoQIeY6uBkBRl+abk8h1I3zGy2ugewgPEWXdpGJuzytyxrLPAW8idKE2FSWYaHUcq85QUfCu1ncG87FMjndyLLcb1KOHJJzu4= 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 161055443109168.78235527042796; Wed, 13 Jan 2021 08:13:51 -0800 (PST) Received: from localhost ([::1]:45296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzimM-0005M6-0m for importer@patchew.org; Wed, 13 Jan 2021 11:13:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzikb-0003dd-QS; Wed, 13 Jan 2021 11:12:01 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:39970 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 1kzikZ-0001V6-8q; Wed, 13 Jan 2021 11:12:01 -0500 Received: from host109-146-177-189.range109-146.btcentralplus.com ([109.146.177.189] 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 1kzike-0001mR-R5; Wed, 13 Jan 2021 16:12:09 +0000 From: Mark Cave-Ayland To: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Wed, 13 Jan 2021 16:11:26 +0000 Message-Id: <20210113161128.3156-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> References: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.146.177.189 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PULL 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 Message-Id: <20201229175619.6051-6-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland --- 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 Thu Apr 18 23:47:29 2024 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=1610554465; cv=none; d=zohomail.com; s=zohoarc; b=cQO+LqMJjm1qURUq4ohZCqqt3qJOaVrQP6KKdhkedmLBF652u463t2wDlyEg3zmOakRj7SqRQFiES0TBLo+WAhTGMWtDwCfCfhb/7UToauWRXDyO76iJl6btHk2xtY79k/CJY1fDeK9UZBZNSsg799eoe+oANCf3+pOiVrn4YzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610554465; 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=BzfFruceqpIFuHpbpsYGXf6C3ajpfobNpAqspKKTo2g=; b=aChbObP2E8wRAEchvEKA6S9nv4eL9GMEa1djq4LvgsKigRUn7yRqzYCgfwHp1XBPhk2is8Je90yUN9k4Ozftt8wveJKReRJDB1tW6iA/PxjJYxv4eC+EVA3lEdQPTNNlgVPAf6QhNq12dMEaACHjnFWsna/w4HdoOKmIMtld0wM= 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 1610554465161826.4182773041931; Wed, 13 Jan 2021 08:14:25 -0800 (PST) Received: from localhost ([::1]:45928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzimt-0005c6-Tc for importer@patchew.org; Wed, 13 Jan 2021 11:14:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzikk-0003jX-MA; Wed, 13 Jan 2021 11:12:10 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:39978 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 1kzike-0001XC-Le; Wed, 13 Jan 2021 11:12:10 -0500 Received: from host109-146-177-189.range109-146.btcentralplus.com ([109.146.177.189] 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 1kzikj-0001mR-M7; Wed, 13 Jan 2021 16:12:14 +0000 From: Mark Cave-Ayland To: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Wed, 13 Jan 2021 16:11:27 +0000 Message-Id: <20210113161128.3156-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> References: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.146.177.189 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PULL 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 Message-Id: <20201229175619.6051-7-mark.cave-ayland@ilande.co.uk> 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 Thu Apr 18 23:47:29 2024 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=1610554654; cv=none; d=zohomail.com; s=zohoarc; b=e0Q1Sc6YxosRqMJq8WDaEhJL8KERquZprMfjrJam9yjWU6PLtf+uJpffS9eY4oNLpqhXudJGuQuBQrhsEZeDqr3X695MI4sbr93EjdWe24QLR3NC1XbmcEWFgLgqQeNIjvIOJCWzMF8/ErWQl04P3aJQ8xNxS3kOnNrpZqJQAqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610554654; 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=DyeS08QWHZ6xDIxkxiuVDR4PjwjcoVVmSCNqSPKp8VM=; b=Kcvm3Gb5SHtekJCubUWnEMHLgrdr7lYOHLJs9N/tll3Q9FgPc2iviOidjBHOokc4bdQZ1Diujj1DTVbCNNnDXBRJpXt+H4BKUkMmCxH6VTuc2ub9aU1bpMqEuGcEMOBuOiQulgx69T52j/00aqAPGSWHP2SR6P+rmTEpEtTB7lI= 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 1610554654748743.7934228082988; Wed, 13 Jan 2021 08:17:34 -0800 (PST) Received: from localhost ([::1]:53376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzipx-0000e8-Kp for importer@patchew.org; Wed, 13 Jan 2021 11:17:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzikm-0003oJ-KJ; Wed, 13 Jan 2021 11:12:12 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:39982 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 1kzikk-0001ZH-Cw; Wed, 13 Jan 2021 11:12:12 -0500 Received: from host109-146-177-189.range109-146.btcentralplus.com ([109.146.177.189] 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 1kziko-0001mR-MN; Wed, 13 Jan 2021 16:12:17 +0000 From: Mark Cave-Ayland To: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Wed, 13 Jan 2021 16:11:28 +0000 Message-Id: <20210113161128.3156-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> References: <20210113161128.3156-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.146.177.189 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PULL 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 Message-Id: <20201229175619.6051-8-mark.cave-ayland@ilande.co.uk> 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