From nobody Wed Nov 5 16:36:55 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537547045518126.4297740917865; Fri, 21 Sep 2018 09:24:05 -0700 (PDT) Received: from localhost ([::1]:56436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3ODr-0006hU-I1 for importer@patchew.org; Fri, 21 Sep 2018 12:24:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3OAa-0004CF-AB for qemu-devel@nongnu.org; Fri, 21 Sep 2018 12:20:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3OAW-00043A-J0 for qemu-devel@nongnu.org; Fri, 21 Sep 2018 12:20:40 -0400 Received: from 4.mo179.mail-out.ovh.net ([46.105.36.149]:34310) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g3OAW-00042j-A0 for qemu-devel@nongnu.org; Fri, 21 Sep 2018 12:20:36 -0400 Received: from player799.ha.ovh.net (unknown [10.109.143.201]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 05B0A10003D for ; Fri, 21 Sep 2018 18:20:34 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-10605-110.w90-89.abo.wanadoo.fr [90.89.196.110]) (Authenticated sender: clg@kaod.org) by player799.ha.ovh.net (Postfix) with ESMTPSA id 956395200B3; Fri, 21 Sep 2018 18:20:25 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 18:19:32 +0200 Message-Id: <20180921161939.822-5-clg@kaod.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921161939.822-1-clg@kaod.org> References: <20180921161939.822-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1896578393404181312 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtjedrledvgddutddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.105.36.149 Subject: [Qemu-devel] [PATCH v2 04/11] hw/arm/aspeed: add a 'execute-in-place' property to boot directly from CE0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Peter Crosthwaite , Andrew Jeffery , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 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 --- 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 325c091d09e4..b67f633ddbd1 100644 --- a/include/hw/arm/aspeed.h +++ b/include/hw/arm/aspeed.h @@ -30,6 +30,8 @@ typedef struct AspeedBoardConfig { =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 6b33ecd5aa43..e7b87e355f12 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -216,11 +216,18 @@ static void aspeed_board_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.kernel_filename =3D machine->kernel_filename; @@ -313,6 +320,30 @@ static void aspeed_machine_init(MachineState *machine) aspeed_board_init(machine, amc->board); } =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); @@ -327,6 +358,8 @@ static void aspeed_machine_class_init(ObjectClass *oc, = void *data) mc->no_cdrom =3D 1; mc->no_parallel =3D 1; amc->board =3D board; + + aspeed_machine_class_props_init(oc); } =20 static const TypeInfo aspeed_machine_type =3D { @@ -334,6 +367,7 @@ static const TypeInfo aspeed_machine_type =3D { .parent =3D TYPE_MACHINE, .instance_size =3D sizeof(AspeedMachine), .class_size =3D sizeof(AspeedMachineClass), + .instance_init =3D aspeed_machine_instance_init, .abstract =3D true, }; =20 --=20 2.17.1