From nobody Tue Feb 10 00:59:48 2026 Delivered-To: importer@patchew.org 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; 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=1578383756; cv=none; d=zohomail.com; s=zohoarc; b=ble/yh/uOw4DbJJM0Mzlo2SoGM7MFTNonh95LGXrVheN9j9JzLLI+YWnMCmc3D66NOPX9mNm89rFhVXRl1ebgJ6Lb1hycI+gCTuXiMwDt/D848NZqihhK0znUHIBBpgyQU7B8qfSH/VKLmjcDpP0t6P1KjaoWcHgFcgsX1pNaLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578383756; 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=H/+X/2t6+qpdfdsDUYD6ndvp0a9z7CjTN633jnMPi5Q=; b=misPTe56V6UzjOCEmchWPUmb8Kg+i7jqhxWvWGLEL/SZavgR6oO3l21PbdwyudnWtb2x2dUBg10ifRXl6Q4n5sCNBYOFaHTYnIo+m//XBn6pQbRFSg/FWLkERb/S7H9PyY0FLQb57VQK7svbmZ7D2ubRkDAqOAxUfvfEVu4DA4U= 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 1578383756546927.2967875891277; Mon, 6 Jan 2020 23:55:56 -0800 (PST) Received: from localhost ([::1]:44186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iojiS-0001DH-Sd for importer@patchew.org; Tue, 07 Jan 2020 02:55:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51484) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iojOK-0002xD-5p for qemu-devel@nongnu.org; Tue, 07 Jan 2020 02:35:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iojOI-0006vh-LK for qemu-devel@nongnu.org; Tue, 07 Jan 2020 02:35:03 -0500 Received: from 5.mo7.mail-out.ovh.net ([178.32.120.239]:43801) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iojOI-0006u7-FC for qemu-devel@nongnu.org; Tue, 07 Jan 2020 02:35:02 -0500 Received: from player755.ha.ovh.net (unknown [10.109.146.32]) by mo7.mail-out.ovh.net (Postfix) with ESMTP id F3CF5149DA8 for ; Tue, 7 Jan 2020 08:35:00 +0100 (CET) Received: from kaod.org (lfbn-tou-1-1227-223.w90-76.abo.wanadoo.fr [90.76.50.223]) (Authenticated sender: clg@kaod.org) by player755.ha.ovh.net (Postfix) with ESMTPSA id 5DBC5DFE0DC6; Tue, 7 Jan 2020 07:34:54 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Subject: [PATCH 4/5] hw/arm/aspeed: add a 'execute-in-place' property to boot directly from CE0 Date: Tue, 7 Jan 2020 08:34:22 +0100 Message-Id: <20200107073423.30043-5-clg@kaod.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200107073423.30043-1-clg@kaod.org> References: <20200107073423.30043-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 3793156788121013009 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdehuddguddtlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeehhedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.120.239 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: Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-arm@nongnu.org, Joel Stanley , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The overhead for the OpenBMC firmware images using the a custom U-Boot is around 2 seconds, which is fine, but with a U-Boot from mainline, it takes an extra 50 seconds or so to reach Linux. A quick survey on the number of reads performed on the flash memory region gives the following figures : OpenBMC U-Boot 922478 (~ 3.5 MBytes) Mainline U-Boot 20569977 (~ 80 MBytes) QEMU must be trashing the TCG TBs and reloading text very often. Some addresses are read more than 250.000 times. Until we find a solution to improve boot time, execution from MMIO is not activated by default. Setting this option also breaks migration compatibility. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/arm/aspeed.h | 2 ++ hw/arm/aspeed.c | 44 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index 4423cd0cda71..18521484b90e 100644 --- a/include/hw/arm/aspeed.h +++ b/include/hw/arm/aspeed.h @@ -19,6 +19,8 @@ typedef struct AspeedBoardState AspeedBoardState; =20 typedef struct AspeedMachine { MachineState parent_obj; + + bool mmio_exec; } AspeedMachine; =20 #define ASPEED_MACHINE_CLASS(klass) \ diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 0a7dfd29868b..bf23579fa53d 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -260,11 +260,18 @@ static void aspeed_machine_init(MachineState *machine) * SoC and 128MB for the AST2500 SoC, which is twice as big as * needed by the flash modules of the Aspeed machines. */ - memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_rom", - fl->size, &error_abort); - memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR, - boot_rom); - write_boot_rom(drive0, FIRMWARE_ADDR, fl->size, &error_abort); + if (ASPEED_MACHINE(machine)->mmio_exec) { + memory_region_init_alias(boot_rom, OBJECT(bmc), "aspeed.boot_r= om", + &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= ", + fl->size, &error_abort); + memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR, + boot_rom); + write_boot_rom(drive0, FIRMWARE_ADDR, fl->size, &error_abort); + } } =20 aspeed_board_binfo.ram_size =3D ram_size; @@ -398,6 +405,30 @@ static void witherspoon_bmc_i2c_init(AspeedBoardState = *bmc) /* Bus 11: TODO ucd90160@64 */ } =20 +static bool aspeed_get_mmio_exec(Object *obj, Error **errp) +{ + return ASPEED_MACHINE(obj)->mmio_exec; +} + +static void aspeed_set_mmio_exec(Object *obj, bool value, Error **errp) +{ + ASPEED_MACHINE(obj)->mmio_exec =3D value; +} + +static void aspeed_machine_instance_init(Object *obj) +{ + ASPEED_MACHINE(obj)->mmio_exec =3D false; +} + +static void aspeed_machine_class_props_init(ObjectClass *oc) +{ + object_class_property_add_bool(oc, "execute-in-place", + aspeed_get_mmio_exec, + aspeed_set_mmio_exec, &error_abort); + object_class_property_set_description(oc, "execute-in-place", + "boot directly from CE0 flash device", &error_a= bort); +} + static void aspeed_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -407,6 +438,8 @@ static void aspeed_machine_class_init(ObjectClass *oc, = void *data) mc->no_floppy =3D 1; mc->no_cdrom =3D 1; mc->no_parallel =3D 1; + + aspeed_machine_class_props_init(oc); } =20 static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data) @@ -549,6 +582,7 @@ static const TypeInfo aspeed_machine_types[] =3D { .name =3D TYPE_ASPEED_MACHINE, .parent =3D TYPE_MACHINE, .instance_size =3D sizeof(AspeedMachine), + .instance_init =3D aspeed_machine_instance_init, .class_size =3D sizeof(AspeedMachineClass), .class_init =3D aspeed_machine_class_init, .abstract =3D true, --=20 2.21.1