From nobody Fri Apr 4 17:32:44 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656588958728201.17465281120417; Thu, 30 Jun 2022 04:35:58 -0700 (PDT) Received: from localhost ([::1]:37666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6sSj-0007HO-Lu for importer@patchew.org; Thu, 30 Jun 2022 07:35:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6sI6-00089X-Hr; Thu, 30 Jun 2022 07:24:58 -0400 Received: from gandalf.ozlabs.org ([150.107.74.76]:42991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6sHw-00024n-Kz; Thu, 30 Jun 2022 07:24:58 -0400 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4LYbb34Zxyz4xXD; Thu, 30 Jun 2022 21:24:47 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4LYbb14MRxz4xD5; Thu, 30 Jun 2022 21:24:45 +1000 (AEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , Peter Delevoryas , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 11/27] aspeed: Map unimplemented devices in SoC memory Date: Thu, 30 Jun 2022 13:23:55 +0200 Message-Id: <20220630112411.1474431-12-clg@kaod.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220630112411.1474431-1-clg@kaod.org> References: <20220630112411.1474431-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=150.107.74.76; envelope-from=SRS0=N4Bw=XF=kaod.org=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1656588959125100001 From: Peter Delevoryas Signed-off-by: Peter Delevoryas Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20220624003701.1363500-5-pdel@fb.com> Signed-off-by: C=C3=A9dric Le Goater --- include/hw/arm/aspeed_soc.h | 9 +++++++++ hw/arm/aspeed_ast10x0.c | 16 ++++++++++------ hw/arm/aspeed_ast2600.c | 27 ++++++++++++++++++--------- hw/arm/aspeed_soc.c | 23 +++++++++++++++++++---- 4 files changed, 56 insertions(+), 19 deletions(-) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 1ab328d00cc5..6cfc0639852e 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -34,6 +34,7 @@ #include "hw/usb/hcd-ehci.h" #include "qom/object.h" #include "hw/misc/aspeed_lpc.h" +#include "hw/misc/unimp.h" =20 #define ASPEED_SPIS_NUM 2 #define ASPEED_EHCIS_NUM 2 @@ -66,6 +67,7 @@ struct AspeedSoCState { AspeedSMCState spi[ASPEED_SPIS_NUM]; EHCISysBusState ehci[ASPEED_EHCIS_NUM]; AspeedSBCState sbc; + UnimplementedDeviceState sbc_unimplemented; AspeedSDMCState sdmc; AspeedWDTState wdt[ASPEED_WDTS_NUM]; FTGMAC100State ftgmac100[ASPEED_MACS_NUM]; @@ -77,6 +79,10 @@ struct AspeedSoCState { AspeedLPCState lpc; uint32_t uart_default; Clock *sysclk; + UnimplementedDeviceState iomem; + UnimplementedDeviceState video; + UnimplementedDeviceState emmc_boot_controller; + UnimplementedDeviceState dpmcu; }; =20 #define TYPE_ASPEED_SOC "aspeed-soc" @@ -169,5 +175,8 @@ qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev); void aspeed_soc_uart_init(AspeedSoCState *s); bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp); void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr a= ddr); +void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev, + const char *name, hwaddr addr, + uint64_t size); =20 #endif /* ASPEED_SOC_H */ diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index f8f321374a69..d34c06db1699 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -142,6 +142,10 @@ static void aspeed_soc_ast1030_init(Object *obj) =20 snprintf(typename, sizeof(typename), "aspeed.gpio-%s", socname); object_initialize_child(obj, "gpio", &s->gpio, typename); + + object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DE= VICE); + object_initialize_child(obj, "sbc-unimplemented", &s->sbc_unimplemente= d, + TYPE_UNIMPLEMENTED_DEVICE); } =20 static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) @@ -158,12 +162,12 @@ static void aspeed_soc_ast1030_realize(DeviceState *d= ev_soc, Error **errp) } =20 /* General I/O memory space to catch all unimplemented device */ - create_unimplemented_device("aspeed.sbc", - sc->memmap[ASPEED_DEV_SBC], - 0x40000); - create_unimplemented_device("aspeed.io", - sc->memmap[ASPEED_DEV_IOMEM], - ASPEED_SOC_IOMEM_SIZE); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io= ", + sc->memmap[ASPEED_DEV_IOMEM], + ASPEED_SOC_IOMEM_SIZE); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->sbc_unimplemented), + "aspeed.sbc", sc->memmap[ASPEED_DEV_SBC], + 0x40000); =20 /* AST1030 CPU Core */ armv7m =3D DEVICE(&s->armv7m); diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index f8c640e7fda1..dbb4a2e838f9 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -246,6 +246,13 @@ static void aspeed_soc_ast2600_init(Object *obj) object_initialize_child(obj, "i3c", &s->i3c, TYPE_ASPEED_I3C); =20 object_initialize_child(obj, "sbc", &s->sbc, TYPE_ASPEED_SBC); + + object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DE= VICE); + object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DE= VICE); + object_initialize_child(obj, "dpmcu", &s->dpmcu, TYPE_UNIMPLEMENTED_DE= VICE); + object_initialize_child(obj, "emmc-boot-controller", + &s->emmc_boot_controller, + TYPE_UNIMPLEMENTED_DEVICE); } =20 /* @@ -267,17 +274,18 @@ static void aspeed_soc_ast2600_realize(DeviceState *d= ev, Error **errp) qemu_irq irq; =20 /* IO space */ - create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOM= EM], - ASPEED_SOC_IOMEM_SIZE); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io= ", + sc->memmap[ASPEED_DEV_IOMEM], + ASPEED_SOC_IOMEM_SIZE); =20 /* Video engine stub */ - create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDE= O], - 0x1000); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->video), "aspeed.vi= deo", + sc->memmap[ASPEED_DEV_VIDEO], 0x1000); =20 /* eMMC Boot Controller stub */ - create_unimplemented_device("aspeed.emmc-boot-controller", - sc->memmap[ASPEED_DEV_EMMC_BC], - 0x1000); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->emmc_boot_controll= er), + "aspeed.emmc-boot-controller", + sc->memmap[ASPEED_DEV_EMMC_BC], 0x1000); =20 /* CPU */ for (i =3D 0; i < sc->num_cpus; i++) { @@ -333,8 +341,9 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev= , Error **errp) sc->memmap[ASPEED_DEV_SRAM], &s->sram); =20 /* DPMCU */ - create_unimplemented_device("aspeed.dpmcu", sc->memmap[ASPEED_DEV_DPMC= U], - ASPEED_SOC_DPMCU_SIZE); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->dpmcu), "aspeed.dp= mcu", + sc->memmap[ASPEED_DEV_DPMCU], + ASPEED_SOC_DPMCU_SIZE); =20 /* SCU */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) { diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index 500cfda724ae..369c59a0100d 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -223,6 +223,9 @@ static void aspeed_soc_init(Object *obj) =20 snprintf(typename, sizeof(typename), "aspeed.hace-%s", socname); object_initialize_child(obj, "hace", &s->hace, typename); + + object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DE= VICE); + object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DE= VICE); } =20 static void aspeed_soc_realize(DeviceState *dev, Error **errp) @@ -233,12 +236,13 @@ static void aspeed_soc_realize(DeviceState *dev, Erro= r **errp) Error *err =3D NULL; =20 /* IO space */ - create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOM= EM], - ASPEED_SOC_IOMEM_SIZE); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io= ", + sc->memmap[ASPEED_DEV_IOMEM], + ASPEED_SOC_IOMEM_SIZE); =20 /* Video engine stub */ - create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDE= O], - 0x1000); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->video), "aspeed.vi= deo", + sc->memmap[ASPEED_DEV_VIDEO], 0x1000); =20 /* CPU */ for (i =3D 0; i < sc->num_cpus; i++) { @@ -619,3 +623,14 @@ void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *= dev, int n, hwaddr addr) memory_region_add_subregion(s->memory, addr, sysbus_mmio_get_region(dev, n)); } + +void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev, + const char *name, hwaddr addr, uint64_t= size) +{ + qdev_prop_set_string(DEVICE(dev), "name", name); + qdev_prop_set_uint64(DEVICE(dev), "size", size); + sysbus_realize(dev, &error_abort); + + memory_region_add_subregion_overlap(s->memory, addr, + sysbus_mmio_get_region(dev, 0), -1= 000); +} --=20 2.35.3