Received: by 2002:ac2:5f6a:0:0:0:0:0 with SMTP id c10csp1527428lfc; Tue, 12 Oct 2021 00:48:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNB6HEV9w5SSiN4dtbXnSAkeaCCXz7Xx62FKKRgd0K8Q5mzDa260EeOn/7q/dsWwGuyJDE X-Received: by 2002:a25:5044:: with SMTP id e65mr23920850ybb.57.1634024934697; Tue, 12 Oct 2021 00:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634024934; cv=none; d=google.com; s=arc-20160816; b=I4GipOsihtKmRnJVb+BDE4UIE7hlZrkEthuYlEy47pOZMdqzAinGRQ42cbNiPkV7nt DPQIYBhEGyGt7bx+2TMyphGLwoe/dc4Ja32xYZ4omv6KGQxpEGDyhSomrifoAAiDFO6M LclKt5J3KxYOSWroy428E/YBMjzr1qVEYjvtf3ozozWi+EILwE2I+h+00jHLvG6hUA11 87bs6YOPAWsLFowDJfOzlImMU7nDqafvYMDeRRStpP9P0el3C5boVeUSzLPVYqUttz8M ocFUoAFxzzAYiBXfgFaoagf8Os7yeD79YulElaFOVyfXN+jbr1I5mbB4Cz7PUpsyPKOh osFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=EJhp10D7CdEJAFDx4iA+2k3Ho966tZ8BD/+gwnJ9sI4=; b=YstTUGDleMo03tfsZBzz4eKzLIpQzIiU7anzMZ1AzTUhUD5ZDRhgguIlpS98JsRZQ4 48QY9tk40X/RouVyLveoTsDcRKeyGi4MSyapOCaAEvFLVWCxNavldgCRlQkFHHArtyr9 nsyqKubEJdN9mID/VKjC8JAHlG86B7l20qGGixRkSg3cvdwVhRCblj3oied8pVTUGLjc ZnNql/tj2lVHwj4oGOeaOvPMCVVkeK/BXiG5A3fS4aVOckMbUTaUGrHZMRSeCpBMeL3L sA5/HmnuJ+Nv7uLNIKwuypXnjV87eXNZsJVfu5ro7g984cQE2wdETUniMcwio9WoGiXs QxGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n125si12914604ybb.8.2021.10.12.00.48.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Oct 2021 00:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1]:36202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maCWs-0004ti-2v for alex.bennee@linaro.org; Tue, 12 Oct 2021 03:48:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maCMD-0000WN-KU for qemu-arm@nongnu.org; Tue, 12 Oct 2021 03:37:53 -0400 Received: from smtpout2.mo529.mail-out.ovh.net ([79.137.123.220]:55975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maCM8-0004z0-7v for qemu-arm@nongnu.org; Tue, 12 Oct 2021 03:37:53 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.2]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id B188EC407CF0; Tue, 12 Oct 2021 09:37:34 +0200 (CEST) Received: from kaod.org (37.59.142.106) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Tue, 12 Oct 2021 09:37:33 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-106R0067c6d1e2c-086b-4ce8-8b67-dba6e00694ee, B93E5558764F88B003587FF4B0B721A638511A69) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Subject: [PULL 06/18] aspeed/smc: Remove the 'size' attribute from AspeedSMCFlash Date: Tue, 12 Oct 2021 09:37:16 +0200 Message-ID: <20211012073728.257748-7-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211012073728.257748-1-clg@kaod.org> References: <20211012073728.257748-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [37.59.142.106] X-ClientProxiedBy: DAG7EX2.mxp5.local (172.16.2.62) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 4681cbb4-3182-42e6-88ea-8baaf2f6c829 X-Ovh-Tracer-Id: 4268568024385948521 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtjedguddvtdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddtieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg Received-SPF: pass client-ip=79.137.123.220; envelope-from=clg@kaod.org; helo=smtpout2.mo529.mail-out.ovh.net 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: ezWs6Qh5GTRS AspeedSMCFlash::size is only used to compute the initial size of the boot_rom region. Not very useful, so directly call memory_region_size() instead. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Cédric Le Goater --- include/hw/ssi/aspeed_smc.h | 1 - hw/arm/aspeed.c | 7 ++++--- hw/ssi/aspeed_smc.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h index f32f66f9a838..097bb6aaf5f8 100644 --- a/include/hw/ssi/aspeed_smc.h +++ b/include/hw/ssi/aspeed_smc.h @@ -34,7 +34,6 @@ typedef struct AspeedSMCFlash { struct AspeedSMCState *controller; uint8_t id; - uint32_t size; MemoryRegion mmio; } AspeedSMCFlash; diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 854413594d9e..f5916e81262e 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -376,6 +376,7 @@ static void aspeed_machine_init(MachineState *machine) if (drive0) { AspeedSMCFlash *fl = &bmc->soc.fmc.flashes[0]; MemoryRegion *boot_rom = g_new(MemoryRegion, 1); + uint64_t size = memory_region_size(&fl->mmio); /* * create a ROM region using the default mapping window size of @@ -385,15 +386,15 @@ static void aspeed_machine_init(MachineState *machine) */ if (ASPEED_MACHINE(machine)->mmio_exec) { memory_region_init_alias(boot_rom, NULL, "aspeed.boot_rom", - &fl->mmio, 0, fl->size); + &fl->mmio, 0, size); memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR, boot_rom); } else { memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom", - fl->size, &error_abort); + size, &error_abort); memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR, boot_rom); - write_boot_rom(drive0, FIRMWARE_ADDR, fl->size, &error_abort); + write_boot_rom(drive0, FIRMWARE_ADDR, size, &error_abort); } } diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index 5466be631719..3e4221311a6d 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -1186,11 +1186,10 @@ static void aspeed_smc_realize(DeviceState *dev, Error **errp) fl->id = i; fl->controller = s; - fl->size = asc->segments[i].size; memory_region_init_io(&fl->mmio, OBJECT(s), &aspeed_smc_flash_ops, - fl, name, fl->size); + fl, name, asc->segments[i].size); memory_region_add_subregion(&s->mmio_flash, offset, &fl->mmio); - offset += fl->size; + offset += asc->segments[i].size; } /* DMA support */ -- 2.31.1