qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 06/26] hw/arm/aspeed: add a 'execute-in-place' property to boot directly from CE0
Date: Thu, 30 Jan 2020 16:15:13 +0000	[thread overview]
Message-ID: <20200130161533.8180-7-peter.maydell@linaro.org> (raw)
In-Reply-To: <20200130161533.8180-1-peter.maydell@linaro.org>

From: Cédric Le Goater <clg@kaod.org>

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édric Le Goater <clg@kaod.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200114103433.30534-5-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 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 4423cd0cda7..18521484b90 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -19,6 +19,8 @@ typedef struct AspeedBoardState AspeedBoardState;
 
 typedef struct AspeedMachine {
     MachineState parent_obj;
+
+    bool mmio_exec;
 } AspeedMachine;
 
 #define ASPEED_MACHINE_CLASS(klass) \
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 8702256af1b..a17843f0d3b 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -261,11 +261,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_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",
+                                   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);
+        }
     }
 
     aspeed_board_binfo.ram_size = ram_size;
@@ -399,6 +406,30 @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc)
     /* Bus 11: TODO ucd90160@64 */
 }
 
+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 = value;
+}
+
+static void aspeed_machine_instance_init(Object *obj)
+{
+    ASPEED_MACHINE(obj)->mmio_exec = 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 = MACHINE_CLASS(oc);
@@ -408,6 +439,8 @@ static void aspeed_machine_class_init(ObjectClass *oc, void *data)
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_parallel = 1;
+
+    aspeed_machine_class_props_init(oc);
 }
 
 static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data)
@@ -550,6 +583,7 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = TYPE_ASPEED_MACHINE,
         .parent        = TYPE_MACHINE,
         .instance_size = sizeof(AspeedMachine),
+        .instance_init = aspeed_machine_instance_init,
         .class_size    = sizeof(AspeedMachineClass),
         .class_init    = aspeed_machine_class_init,
         .abstract      = true,
-- 
2.20.1



  parent reply	other threads:[~2020-01-30 16:19 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 16:15 [PULL 00/26] target-arm queue Peter Maydell
2020-01-30 16:15 ` [PULL 01/26] hw/core/or-irq: Fix incorrect assert forbidding num-lines == MAX_OR_LINES Peter Maydell
2020-01-30 16:15 ` [PULL 02/26] target/arm/arm-semi: Don't let the guest close stdin/stdout/stderr Peter Maydell
2020-01-30 16:15 ` [PULL 03/26] hw/sd: Configure number of slots exposed by the ASPEED SDHCI model Peter Maydell
2020-01-30 16:15 ` [PULL 04/26] hw/arm: ast2600: Wire up the eMMC controller Peter Maydell
2020-01-30 16:15 ` [PULL 05/26] ftgmac100: check RX and TX buffer alignment Peter Maydell
2020-01-30 16:15 ` Peter Maydell [this message]
2020-01-30 16:15 ` [PULL 07/26] misc/pca9552: Add qom set and get Peter Maydell
2020-01-30 16:15 ` [PULL 08/26] hw/arm/raspi: Remove obsolete use of -smp to set the soc 'enabled-cpus' Peter Maydell
2020-01-30 16:15 ` [PULL 09/26] add device_legacy_reset function to prepare for reset api change Peter Maydell
2020-01-30 16:15 ` [PULL 10/26] hw/core/qdev: add trace events to help with resettable transition Peter Maydell
2020-01-30 16:15 ` [PULL 11/26] hw/core: create Resettable QOM interface Peter Maydell
2020-01-30 16:15 ` [PULL 12/26] hw/core: add Resettable support to BusClass and DeviceClass Peter Maydell
2020-01-30 16:15 ` [PULL 13/26] hw/core/resettable: add support for changing parent Peter Maydell
2020-01-30 16:15 ` [PULL 14/26] hw/core/qdev: handle parent bus change regarding resettable Peter Maydell
2020-01-30 16:15 ` [PULL 15/26] hw/core/qdev: update hotplug reset " Peter Maydell
2020-01-30 16:15 ` [PULL 16/26] hw/core: deprecate old reset functions and introduce new ones Peter Maydell
2020-01-30 16:15 ` [PULL 17/26] docs/devel/reset.rst: add doc about Resettable interface Peter Maydell
2020-01-30 16:15 ` [PULL 18/26] vl: replace deprecated qbus_reset_all registration Peter Maydell
2020-01-30 16:15 ` [PULL 19/26] hw/s390x/ipl: replace deprecated qdev_reset_all registration Peter Maydell
2020-01-30 16:15 ` [PULL 20/26] hw/intc/arm_gicv3_kvm: Stop wrongly programming GICR_PENDBASER.PTZ bit Peter Maydell
2020-01-30 16:15 ` [PULL 21/26] target/arm/kvm: trivial: Clean up header documentation Peter Maydell
2020-01-30 16:15 ` [PULL 22/26] hw/arm/virt: Add missing 5.0 options call to 4.2 options Peter Maydell
2020-01-30 16:15 ` [PULL 23/26] target/arm/kvm64: kvm64 cpus have timer registers Peter Maydell
2020-01-30 16:15 ` [PULL 24/26] tests/arm-cpu-features: Check feature default values Peter Maydell
2020-01-30 16:15 ` [PULL 25/26] target/arm/kvm: Implement virtual time adjustment Peter Maydell
2020-01-30 16:15 ` [PULL 26/26] target/arm/cpu: Add the kvm-no-adjvtime CPU property Peter Maydell
2020-01-30 19:05 ` [PULL 00/26] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200130161533.8180-7-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).