Received: by 2002:a19:c345:0:0:0:0:0 with SMTP id t66csp24329466lff; Mon, 6 Jan 2020 23:50:21 -0800 (PST) X-Google-Smtp-Source: APXvYqz8RsSlBWEqlU+vDMekHwZCSYdr2y7kwZr0Rexq064Dv6AsFMcUshBTERnQzKjvx8gUyvDt X-Received: by 2002:a17:906:5210:: with SMTP id g16mr105345227ejm.305.1578383421532; Mon, 06 Jan 2020 23:50:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578383421; cv=none; d=google.com; s=arc-20160816; b=eOajVQho9ShKPK8f4qJf/CFfvt1z8wBhpnet3rmxZQ/zqenmNestE6TFMaMHH4hiP1 PAJ0tAZhZMWwMwji1HyiNSNki5Lvt02yFpgcleJcJTd0RqR0rotFT324nyFGbR9N6i+a kj4m2e5mnZNSVN6g6aYwPJxtIkz7v//ffmpEZKxSh9RtZMtMkYvk2joGbuBJN3XvvGGM cJ3KoPr5dypWKWkkEK7ocMopS/rYEIHXbHXQ6M/CIV0cPuDpVbvOnl8vBI0z+pIz9TP1 8Wq5fqUm8HoVqJ2HaZWt3VLFq5jkq3XfSvc/SYruGomYTgOrCDKSsMhMw26I8zhjbUS2 PG2g== 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=H/+X/2t6+qpdfdsDUYD6ndvp0a9z7CjTN633jnMPi5Q=; b=WL8BC3eDhDJCrTTo436Mp3/j7Y+0QEfvpAVk1GqcBK46SPONlrYkbmdFiLMEG+DWnJ DXLZTmEZAHb30AijTQDpYw7CIIV2KyRsqIrD2BFsIIERTBPISKmZFhXKFZO1qdQjRa4d +p08PAtaIAKeJph29BjG8T2dgPPqSDNc9W84MMdwmVjr9DXQEP19RRTEzjSOMLrmodk0 YcdjCqLY6/BNhz8Ut4hh9bPg9Zlbwbr9BrHKy9nns2UzeTBwNkBChGyo6oQDA/ab+KjG Rphw1WA8AOeHJ4tn+RJMD4Wr8RtCmxNNyYgiSmklw3glAiGS0No1Ee5NkYiBtNufZDKw aH6A== 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 h13si45561491ejb.253.2020.01.06.23.50.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Jan 2020 23:50:21 -0800 (PST) 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]:44144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iojd4-0001fa-9T for alex.bennee@linaro.org; Tue, 07 Jan 2020 02:50:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51485) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iojOK-0002xk-94 for qemu-arm@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-0006vq-N5 for qemu-arm@nongnu.org; Tue, 07 Jan 2020 02:35:03 -0500 Received: from 5.mo69.mail-out.ovh.net ([46.105.43.105]:48987) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iojOI-0006uS-Hf for qemu-arm@nongnu.org; Tue, 07 Jan 2020 02:35:02 -0500 Received: from player755.ha.ovh.net (unknown [10.108.42.75]) by mo69.mail-out.ovh.net (Postfix) with ESMTP id 0BE6A7B0F2 for ; Tue, 7 Jan 2020 08:35:01 +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 Content-Type: text/plain; charset=UTF-8 X-Ovh-Tracer-Id: 3793156788121013009 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdehuddguddtlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeehhedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdqrghrmhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepfe 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: 46.105.43.105 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?C=C3=A9dric=20Le=20Goater?= , qemu-arm@nongnu.org, Joel Stanley , qemu-devel@nongnu.org Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: VvdZMAPEm9MD 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 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 *machi= ne) * 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= _rom", + &fl->mmio, 0, fl->size); + memory_region_add_subregion(get_system_memory(), FIRMWARE_AD= DR, + boot_rom); + } else { + memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_r= om", + fl->size, &error_abort); + memory_region_add_subregion(get_system_memory(), FIRMWARE_AD= DR, + 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(AspeedBoardStat= e *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= _abort); +} + 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 *da= ta) @@ -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