From nobody Wed May 1 17:10:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1592896961; cv=none; d=zohomail.com; s=zohoarc; b=bv/Rr8/uzvRK4pkLkOXkHJ1sOxsymDPuzpbiDb3fTNpfmwhBfVkDhN2VKdHW0uFeoctuSByZP7a9LTGzyx2YBUcWj/MfrLpiI5xroFEc26d3qdiXLB1BvQbLZvVVcpStbhgKxb1nD+ak77WR8KGS0cCwHQe6zElC1JsVX/P1JxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592896961; h=Content-Type:Content-Transfer-Encoding:Cc: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=RMpBNhc9DgLKSQexvXdiyWq7znNYqzLKh6dEFIwERf0=; b=HmT8eOG1RIFZo+lWL4ru1tXtjoqnbq/ecV2EB+tBH7vUe5yirYkoQNOSgEtdE23x9Mp57FHnr2eAwi8zDvTxiXfpe6D3GYzG++NskUuuEMA1aym3EVJKwN8IuojE4fkPCJXYn9+RsalxsHWeaKjz3C3+sn6lxttUswqqsnBZ+t4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592896961799700.677369121305; Tue, 23 Jun 2020 00:22:41 -0700 (PDT) Received: from localhost ([::1]:53948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jndGS-0001DZ-E8 for importer@patchew.org; Tue, 23 Jun 2020 03:22:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jndFT-0007Xu-9m; Tue, 23 Jun 2020 03:21:39 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jndFR-0003E6-OU; Tue, 23 Jun 2020 03:21:39 -0400 Received: by mail-wm1-x342.google.com with SMTP id o8so199764wmh.4; Tue, 23 Jun 2020 00:21:37 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id x13sm21877236wre.83.2020.06.23.00.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 00:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RMpBNhc9DgLKSQexvXdiyWq7znNYqzLKh6dEFIwERf0=; b=ibDcSytHesvRHcej6SkOn0MRHhZjM0DrQHKLAZ0pywqwKj6jUh04vK0uygLi2ZHgpe pZQMphv5aTWUpo2gdYGoURXyJzhg4HJ2ulGDgdFClvoFS/2+BIAgnbb+smkEh04rkqSf 4phyGxd9W914t5X8RBcOr17qdOcsK2OuQC5A/y55U9U8G1odoQZ8WK/k28pd7YiT7jgB kZmmfBDgqXBrPp9INDHOWOnIcZPsGZbKj8/+901ZS+pZKDLf93WJ+pg+PT9/l7oSiEUA iO2m1ubh92MOsfwvG1kfBRieB/0dWbvkLTGQSQBBRQPDf+e2U0y4Ha8tRsyh3BkXVbc9 2JLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=RMpBNhc9DgLKSQexvXdiyWq7znNYqzLKh6dEFIwERf0=; b=QTQnTT1muwcGuv3G4sV2VIMplEyvxCpxQVaBULeswnO+i90WdC3z40AmWVpr39/RYX 3Tpuk5Vs3T1ecfcoqI0kV3chFS31+tmOvALM7pvAbSKKOmLv5HL5molpjdw9KDnKMug4 T77xNb13PNfNyg1Pq/flyfh/ShHPW0p2RlyAfcC9X7WrYzm/xv4tfHNnYMCOMTiinDy4 kT8Q33cGWJOhNHi8/SLQfJ/h7cCXVPE1IM0S7SnZCJloHuDdh+YRIbkvW2vH1lp9vocS uGu636Q0zzJU83EhUNne8t8Tz/G62HD4XWbarfDNUDVcS9WPi2FyVaLrpNKRfLPv8deK ZvCw== X-Gm-Message-State: AOAM532bcrdI0YQZi1vy82knv8nzEpuJl+qrLBBXc2ZqfA0LznM0aBnh vj/mscJp1/m7QqZDN8SfR4pGm5zm X-Google-Smtp-Source: ABdhPJygLfr+DKpBDsMp4dRfA2EDmkaC1b0eKKbFDSpNIFyPPSla5hx1wJUg+NiR9dwXUYIyAtyWog== X-Received: by 2002:a1c:e914:: with SMTP id q20mr21877978wmc.145.1592896895769; Tue, 23 Jun 2020 00:21:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 1/3] hw/arm/aspeed: Remove extraneous MemoryRegion object owner Date: Tue, 23 Jun 2020 09:21:30 +0200 Message-Id: <20200623072132.2868-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200623072132.2868-1-f4bug@amsat.org> References: <20200623072132.2868-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::342; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: , Cc: Peter Maydell , Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) I'm confused by this code, 'bmc' is created as: bmc =3D g_new0(AspeedBoardState, 1); Then we use it as QOM owner for different MemoryRegion objects. But looking at memory_region_init_ram (similarly for ROM): void memory_region_init_ram(MemoryRegion *mr, struct Object *owner, const char *name, uint64_t size, Error **errp) { DeviceState *owner_dev; Error *err =3D NULL; memory_region_init_ram_nomigrate(mr, owner, name, size, &err); if (err) { error_propagate(errp, err); return; } /* This will assert if owner is neither NULL nor a DeviceState. * We only want the owner here for the purposes of defining a * unique name for migration. TODO: Ideally we should implement * a naming scheme for Objects which are not DeviceStates, in * which case we can relax this restriction. */ owner_dev =3D DEVICE(owner); vmstate_register_ram(mr, owner_dev); } The expected assertion is not triggered ('bmc' is not NULL neither a DeviceState). 'bmc' structure is defined as: struct AspeedBoardState { AspeedSoCState soc; MemoryRegion ram_container; MemoryRegion max_ram; }; What happens is when using 'OBJECT(bmc)', the QOM macros cast the memory pointed by bmc, which first member is 'soc', which is initialized ...: object_initialize_child(OBJECT(machine), "soc", &bmc->soc, amc->soc_name); The 'soc' object is indeed a DeviceState, so the assertion passes. Since this is fragile and only happens to work by luck, remove the dangerous OBJECT(bmc) owner argument. Note, this probably breaks migration for this machine. Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/aspeed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 0ad08a2b4c..31765792a2 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -329,12 +329,12 @@ static void aspeed_machine_init(MachineState *machine) * needed by the flash modules of the Aspeed machines. */ if (ASPEED_MACHINE(machine)->mmio_exec) { - memory_region_init_alias(boot_rom, OBJECT(bmc), "aspeed.boot_r= om", + memory_region_init_alias(boot_rom, NULL, "aspeed.boot_rom", &fl->mmio, 0, fl->size); memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR, boot_rom); } else { - memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_rom= ", + memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom", fl->size, &error_abort); memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR, boot_rom); @@ -345,7 +345,7 @@ static void aspeed_machine_init(MachineState *machine) if (machine->kernel_filename && sc->num_cpus > 1) { /* With no u-boot we must set up a boot stub for the secondary CPU= */ MemoryRegion *smpboot =3D g_new(MemoryRegion, 1); - memory_region_init_ram(smpboot, OBJECT(bmc), "aspeed.smpboot", + memory_region_init_ram(smpboot, NULL, "aspeed.smpboot", 0x80, &error_abort); memory_region_add_subregion(get_system_memory(), AST_SMP_MAILBOX_BASE, smpboot); --=20 2.21.3 From nobody Wed May 1 17:10:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=1592896985; cv=none; d=zohomail.com; s=zohoarc; b=K1zN24yPPnePOuucLhjRiPSH0fevBK/Bgi7FGijtQyxcd8YXxuH5T3X86Lpk1TJeUAtHziTj7Bnqs3noKkTAkGRHdx8Dudc1oZkSQs6dajLwhI1d9iEGevndWSNE1WtYuRh2AH4WGgvwgZcJorlj6E531p/yYX9S1PLyWFbSAow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592896985; h=Content-Type:Content-Transfer-Encoding:Cc: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=dd/Qy10e7uzdwPtNIyee34OCbZGBAytVsTY9nRrII0k=; b=BO0+N15DbVuQ2ko/QbcZ8Lk/7MEi2QJswKmRhmBjMHXTVmPALlekjnjmLhfyG4AvRgEZ1SjUjGcWSaP0Recg+OHRvUtcMPGO32soQ+BUrxoMwDlS0vK0K7gZOCf/uawYOBI6EKAw0hjpEEZh6DMc9yksRG0v/y6U22qhSfgQXUg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1592896985993180.9163849255741; Tue, 23 Jun 2020 00:23:05 -0700 (PDT) Received: from localhost ([::1]:55430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jndGq-0001pI-Ox for importer@patchew.org; Tue, 23 Jun 2020 03:23:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jndFU-0007ao-Hk; Tue, 23 Jun 2020 03:21:40 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:42086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jndFT-0003En-0G; Tue, 23 Jun 2020 03:21:40 -0400 Received: by mail-wr1-x429.google.com with SMTP id o11so11634922wrv.9; Tue, 23 Jun 2020 00:21:38 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id x13sm21877236wre.83.2020.06.23.00.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 00:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dd/Qy10e7uzdwPtNIyee34OCbZGBAytVsTY9nRrII0k=; b=nlbodbLnP0O6rZ1E7sjQ0qNOyOHkjOCfihgu7mKNTIJVKymgaPIwIpBqqX5fw1ZLTb 04B4jNwsbSYdqlD1iEvZU+yaCZtHQpHGC6UGH2bXO9KMOAfc+WgCtl9SOJct2hl6dnOA nsoUKE0f+akX5N5aTStNqcX45WsFYhBmoawq3w2YyBwwQfAYcTieuB7oC8g19atiyBuc pNWT1FD81QzrJA0onU6qIMEBkQF+pqiDFT98RmS1s1Ktj7tj+A6+u1RRHLKqh9gzPzDH Xb+ZfMIj3yojD7tceC3nmKg+hYYiuoQQttCFgZDnXuLWKW6XJvua/qCPBC3Rut2+545t W9Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dd/Qy10e7uzdwPtNIyee34OCbZGBAytVsTY9nRrII0k=; b=unydSbgt7br++zXtx1+dSR+y95mfjVdb0YmBjpf1ud2NGa8asfHCi2Sr+/OeUUnXag 2M9pm67jyD7ziDN+oSYM/A5gVB1l71G77ouB+tlftu3Q74RmYLTBBLy2Nz7DPEhYafq3 a9CYGCdDa6D6wl8p1cv8OSSMnHfIeP9zA2vgMnr0e6/1CxY7yN1HiOrLr1uYgYuFj4Fy nbRmq3QC9V9NjYmVkC1n17EOe3Axoh8D+eU407yWAB6UZJWu5YvGwn7CM8HXwfiAhtf3 d5BN5YHUv296uBa3cbhgZsQcNjOt0ctpm2B49y/FPmGmAfxu53a4U7PcF2ncOvUmTa3S O1Yw== X-Gm-Message-State: AOAM533o6y7LC6raLGOHq5hX5Tq/kCVqlwoQhBTkliAp9G2ibNTu1JXm QxAiF6nzscgu5I1aTCQXw9mZFVbi X-Google-Smtp-Source: ABdhPJyYo2DW714pagJWSomnKpw8bW/3/JYs+yLN+mJYXuygctJe8jMKhdpDDEBh+d5Rp/mAMdVsuw== X-Received: by 2002:a5d:40cb:: with SMTP id b11mr11854640wrq.263.1592896897105; Tue, 23 Jun 2020 00:21:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/3] hw/arm/aspeed: Rename AspeedBoardState as AspeedMachineState Date: Tue, 23 Jun 2020 09:21:31 +0200 Message-Id: <20200623072132.2868-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200623072132.2868-1-f4bug@amsat.org> References: <20200623072132.2868-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::429; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x429.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: , Cc: Peter Maydell , Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) To have a more consistent naming, rename AspeedBoardState as AspeedMachineState. Suggested-by: C=C3=A9dric Le Goater Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater --- include/hw/arm/aspeed.h | 4 ++-- hw/arm/aspeed.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index 95b4daece8..5114ba0bd4 100644 --- a/include/hw/arm/aspeed.h +++ b/include/hw/arm/aspeed.h @@ -11,7 +11,7 @@ =20 #include "hw/boards.h" =20 -typedef struct AspeedBoardState AspeedBoardState; +typedef struct AspeedMachineState AspeedMachineState; =20 #define TYPE_ASPEED_MACHINE MACHINE_TYPE_NAME("aspeed") #define ASPEED_MACHINE(obj) \ @@ -45,7 +45,7 @@ typedef struct AspeedMachineClass { const char *spi_model; uint32_t num_cs; uint32_t macs_mask; - void (*i2c_init)(AspeedBoardState *bmc); + void (*i2c_init)(AspeedMachineState *bmc); } AspeedMachineClass; =20 =20 diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 31765792a2..680345beca 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -32,7 +32,7 @@ static struct arm_boot_info aspeed_board_binfo =3D { .board_id =3D -1, /* device-tree-only board */ }; =20 -struct AspeedBoardState { +struct AspeedMachineState { AspeedSoCState soc; MemoryRegion ram_container; MemoryRegion max_ram; @@ -253,7 +253,7 @@ static void sdhci_attach_drive(SDHCIState *sdhci, Drive= Info *dinfo) =20 static void aspeed_machine_init(MachineState *machine) { - AspeedBoardState *bmc; + AspeedMachineState *bmc; AspeedMachineClass *amc =3D ASPEED_MACHINE_GET_CLASS(machine); AspeedSoCClass *sc; DriveInfo *drive0 =3D drive_get(IF_MTD, 0, 0); @@ -261,7 +261,7 @@ static void aspeed_machine_init(MachineState *machine) int i; NICInfo *nd =3D &nd_table[0]; =20 - bmc =3D g_new0(AspeedBoardState, 1); + bmc =3D g_new0(AspeedMachineState, 1); =20 memory_region_init(&bmc->ram_container, NULL, "aspeed-ram-container", 4 * GiB); @@ -374,7 +374,7 @@ static void aspeed_machine_init(MachineState *machine) arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo); } =20 -static void palmetto_bmc_i2c_init(AspeedBoardState *bmc) +static void palmetto_bmc_i2c_init(AspeedMachineState *bmc) { AspeedSoCState *soc =3D &bmc->soc; DeviceState *dev; @@ -396,7 +396,7 @@ static void palmetto_bmc_i2c_init(AspeedBoardState *bmc) object_property_set_int(OBJECT(dev), 110000, "temperature3", &error_ab= ort); } =20 -static void ast2500_evb_i2c_init(AspeedBoardState *bmc) +static void ast2500_evb_i2c_init(AspeedMachineState *bmc) { AspeedSoCState *soc =3D &bmc->soc; uint8_t *eeprom_buf =3D g_malloc0(8 * 1024); @@ -413,13 +413,13 @@ static void ast2500_evb_i2c_init(AspeedBoardState *bm= c) i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", = 0x32); } =20 -static void ast2600_evb_i2c_init(AspeedBoardState *bmc) +static void ast2600_evb_i2c_init(AspeedMachineState *bmc) { /* Start with some devices on our I2C busses */ ast2500_evb_i2c_init(bmc); } =20 -static void romulus_bmc_i2c_init(AspeedBoardState *bmc) +static void romulus_bmc_i2c_init(AspeedMachineState *bmc) { AspeedSoCState *soc =3D &bmc->soc; =20 @@ -428,7 +428,7 @@ static void romulus_bmc_i2c_init(AspeedBoardState *bmc) i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", = 0x32); } =20 -static void swift_bmc_i2c_init(AspeedBoardState *bmc) +static void swift_bmc_i2c_init(AspeedMachineState *bmc) { AspeedSoCState *soc =3D &bmc->soc; =20 @@ -457,7 +457,7 @@ static void swift_bmc_i2c_init(AspeedBoardState *bmc) i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 12), "tmp105", = 0x4a); } =20 -static void sonorapass_bmc_i2c_init(AspeedBoardState *bmc) +static void sonorapass_bmc_i2c_init(AspeedMachineState *bmc) { AspeedSoCState *soc =3D &bmc->soc; =20 @@ -501,7 +501,7 @@ static void sonorapass_bmc_i2c_init(AspeedBoardState *b= mc) =20 } =20 -static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) +static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc) { AspeedSoCState *soc =3D &bmc->soc; uint8_t *eeprom_buf =3D g_malloc0(8 * 1024); --=20 2.21.3 From nobody Wed May 1 17:10:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=1592897063; cv=none; d=zohomail.com; s=zohoarc; b=nSkhKWgIaLtZukxMB93jGSL2fTDYVlXYBds9cKS6tct57LhI//qj+F1u+uDKozlMzUdz8rGe6E0CE6RilC+3p62lmWtLX+SH3DaP/bhvSx6HElN1Ucl82xTyf4mhc2nfvYpz5jvnUcrkNmcwNrxK1jx8TTy/RBuXhqsurdMqSH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592897063; h=Content-Type:Content-Transfer-Encoding:Cc: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=ZzgsyFKQ+0jPZU1EMlN0VKvlb6aohKF8k/McGbTdz6k=; b=ThPbgO5ZjN7IQulaUCz9GPpLJyORArxAZ+PPDFtMCnT3LaLYwAAVKY8KROf2/sOURc10GtuylaviSOIQb6kAT1ip4NvGiE55Pmh2c+VbvTjVfgisT2nr3gxzxBbF2Ln0no6tzDlJFmzhnW0Fxw4DPUXEwWGzqsl5e9stkNpZWL4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 15928970638346.11312935374508; Tue, 23 Jun 2020 00:24:23 -0700 (PDT) Received: from localhost ([::1]:60434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jndI6-0003nM-IQ for importer@patchew.org; Tue, 23 Jun 2020 03:24:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jndFV-0007eL-V4; Tue, 23 Jun 2020 03:21:41 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:52183) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jndFU-0003FN-Cm; Tue, 23 Jun 2020 03:21:41 -0400 Received: by mail-wm1-x341.google.com with SMTP id 22so1090837wmg.1; Tue, 23 Jun 2020 00:21:39 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id x13sm21877236wre.83.2020.06.23.00.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 00:21:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZzgsyFKQ+0jPZU1EMlN0VKvlb6aohKF8k/McGbTdz6k=; b=c9oXLHvCoSj113SCvh5uXN7SSau0tvSh07arZdET1KzoCQbd2YzZhIxFT08WYYeGQV +OfHKjt5FDQWJ4zVBm/1jyqzxBzV1HitH/1g8UM+wbIHtOb2WnHo32t9e4dh/o60I83F R4lWMzoLFbEtCdwkLjle7jUa+zbjCDXsxI6Y/20vqHumm3ecc6QGEajEQy3eaxmzSPSz WU10r5sahqBFWlgS+6sYtEsyVMd/E9BoItLiS0yz2yqgYgMRxqLFm8CKnwg2G8MnK/fG TAv4sbNpsMAMwMSRV6ULP20Kh16sq12ki+giB/wlqqQsZIUYZee55ieGqyJS/wnwx8mB IzvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ZzgsyFKQ+0jPZU1EMlN0VKvlb6aohKF8k/McGbTdz6k=; b=ogANjFFWBNwaq+mlVzNYxb8S/If0ws1Eb1aSKqUp5KjSWCxORTF6eTctezwIZBRqy7 j5XjIGWexFSS1JX5Dw645WUY8t8PVsiCDnhz2NC2BATK28xxs5XjmttyizKJSxjg5ns/ MdrrGOzxM7NB3xmF0cLJ3bIzBAD4B/qAjNVOG2BGLGCyl1KASCxs03+nb0DAORccgPwW BrdN2dfboPVUeVF3Unt1EvQFSq+IpoKMLsVI4XinYdauJCQHwp0ewk3qDRmTHGofSR3m jNfqe6VnJ3mhPViMLA3zVlsBHIuBPuAQwGiWhb9tLS2+reP/8qtokaAfMbexC5UXfOWE zjtg== X-Gm-Message-State: AOAM531ckaQKyNscWaDSItGIQwWkBtPvmke3bASV/9X8Z6EzsJcBbYby gvuyV8QOVAILhg792vtfWDrn2BSL X-Google-Smtp-Source: ABdhPJz/gzgzur3L68NzRoUqOPZtKRp4snJxyEVg2JF6+RXsEbp496oqKbXD7IEdxzZeleYpbszR7A== X-Received: by 2002:a1c:9687:: with SMTP id y129mr22520132wmd.30.1592896898479; Tue, 23 Jun 2020 00:21:38 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 3/3] hw/arm/aspeed: QOM'ify AspeedMachineState Date: Tue, 23 Jun 2020 09:21:32 +0200 Message-Id: <20200623072132.2868-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200623072132.2868-1-f4bug@amsat.org> References: <20200623072132.2868-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::341; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: , Cc: Peter Maydell , Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) AspeedMachineState seems crippled. We use incorrectly 2 different structures to do the same thing. Merge them altogether: - Move AspeedMachine fields to AspeedMachineState - AspeedMachineState is now QOM - Remove unused AspeedMachine structure Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater --- include/hw/arm/aspeed.h | 8 +------- hw/arm/aspeed.c | 11 +++++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index 5114ba0bd4..09da9d9acc 100644 --- a/include/hw/arm/aspeed.h +++ b/include/hw/arm/aspeed.h @@ -15,13 +15,7 @@ typedef struct AspeedMachineState AspeedMachineState; =20 #define TYPE_ASPEED_MACHINE MACHINE_TYPE_NAME("aspeed") #define ASPEED_MACHINE(obj) \ - OBJECT_CHECK(AspeedMachine, (obj), TYPE_ASPEED_MACHINE) - -typedef struct AspeedMachine { - MachineState parent_obj; - - bool mmio_exec; -} AspeedMachine; + OBJECT_CHECK(AspeedMachineState, (obj), TYPE_ASPEED_MACHINE) =20 #define ASPEED_MAC0_ON (1 << 0) #define ASPEED_MAC1_ON (1 << 1) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 680345beca..ccf127b328 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -33,9 +33,14 @@ static struct arm_boot_info aspeed_board_binfo =3D { }; =20 struct AspeedMachineState { + /* Private */ + MachineState parent_obj; + /* Public */ + AspeedSoCState soc; MemoryRegion ram_container; MemoryRegion max_ram; + bool mmio_exec; }; =20 /* Palmetto hardware value: 0x120CE416 */ @@ -253,7 +258,7 @@ static void sdhci_attach_drive(SDHCIState *sdhci, Drive= Info *dinfo) =20 static void aspeed_machine_init(MachineState *machine) { - AspeedMachineState *bmc; + AspeedMachineState *bmc =3D ASPEED_MACHINE(machine); AspeedMachineClass *amc =3D ASPEED_MACHINE_GET_CLASS(machine); AspeedSoCClass *sc; DriveInfo *drive0 =3D drive_get(IF_MTD, 0, 0); @@ -261,8 +266,6 @@ static void aspeed_machine_init(MachineState *machine) int i; NICInfo *nd =3D &nd_table[0]; =20 - bmc =3D g_new0(AspeedMachineState, 1); - memory_region_init(&bmc->ram_container, NULL, "aspeed-ram-container", 4 * GiB); memory_region_add_subregion(&bmc->ram_container, 0, machine->ram); @@ -751,7 +754,7 @@ static const TypeInfo aspeed_machine_types[] =3D { }, { .name =3D TYPE_ASPEED_MACHINE, .parent =3D TYPE_MACHINE, - .instance_size =3D sizeof(AspeedMachine), + .instance_size =3D sizeof(AspeedMachineState), .instance_init =3D aspeed_machine_instance_init, .class_size =3D sizeof(AspeedMachineClass), .class_init =3D aspeed_machine_class_init, --=20 2.21.3