[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH 04/11] hw/arm/aspeed: add a 'mmio-exec' property to bo
From: |
Cédric Le Goater |
Subject: |
[Qemu-arm] [PATCH 04/11] hw/arm/aspeed: add a 'mmio-exec' property to boot from the FMC flash module |
Date: |
Fri, 31 Aug 2018 12:38:11 +0200 |
Now that MMIO execution is supported, introduce a 'mmio-exec' property
to boot directly from CE0 of the FMC controller using a memory region
alias.
The overhead for the current firmware images using 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. This might be related
to the fact that a device tree is used.
MMIO execution is not activated by default because until boot time is
improved.
Signed-off-by: Cédric Le Goater <address@hidden>
---
include/hw/arm/aspeed.h | 2 ++
hw/arm/aspeed.c | 43 ++++++++++++++++++++++++++++++++++++-----
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 2b77f8d2b3c8..d079f4d6e5db 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -30,6 +30,8 @@ typedef struct AspeedBoardConfig {
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 6b33ecd5aa43..3a66c2dedc3e 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_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.kernel_filename = machine->kernel_filename;
@@ -313,6 +320,29 @@ static void aspeed_machine_init(MachineState *machine)
aspeed_board_init(machine, amc->board);
}
+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, "mmio-exec", aspeed_get_mmio_exec,
+ aspeed_set_mmio_exec, &error_abort);
+ object_class_property_set_description(oc, "mmio-exec",
+ "boot using MMIO execution", &error_abort);
+}
+
static void aspeed_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -327,6 +357,8 @@ static void aspeed_machine_class_init(ObjectClass *oc, void
*data)
mc->no_cdrom = 1;
mc->no_parallel = 1;
amc->board = board;
+
+ aspeed_machine_class_props_init(oc);
}
static const TypeInfo aspeed_machine_type = {
@@ -334,6 +366,7 @@ static const TypeInfo aspeed_machine_type = {
.parent = TYPE_MACHINE,
.instance_size = sizeof(AspeedMachine),
.class_size = sizeof(AspeedMachineClass),
+ .instance_init = aspeed_machine_instance_init,
.abstract = true,
};
--
2.17.1
- [Qemu-arm] [PATCH 00/11] aspeed: misc fixes and enhancements (SMC), Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 01/11] aspeed/timer: fix compile breakage with clang 3.4.2, Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 02/11] hw/arm/aspeed: change the FMC flash model of the AST2500 evb, Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 03/11] hw/arm/aspeed: Add an Aspeed machine class, Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 04/11] hw/arm/aspeed: add a 'mmio-exec' property to boot from the FMC flash module,
Cédric Le Goater <=
- [Qemu-arm] [PATCH 05/11] aspeed/smc: fix some alignment issues, Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 06/11] aspeed/smc: fix default read value, Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 07/11] aspeed/smc: add a 'sdram_base' and 'max-ram-size' properties, Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 08/11] aspeed/smc: add support for DMAs, Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 09/11] aspeed/smc: add DMA calibration settings, Cédric Le Goater, 2018/08/31
- [Qemu-arm] [PATCH 10/11] aspeed/smc: inject errors in DMA checksum, Cédric Le Goater, 2018/08/31
- Re: [Qemu-arm] [PATCH 00/11] aspeed: misc fixes and enhancements (SMC), Joel Stanley, 2018/08/31