On 3/12/21 7:28 PM, Philippe Mathieu-Daudé wrote: > The RAM container is exposed as an AddressSpace. > AddressSpaces root MemoryRegion must not be mapped into other > MemoryRegion, therefore map the RAM container using an alias. > > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> > --- > hw/arm/aspeed.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c > index a17b75f4940..daeef5b32a2 100644 > --- a/hw/arm/aspeed.c > +++ b/hw/arm/aspeed.c > @@ -40,6 +40,7 @@ struct AspeedMachineState { > > AspeedSoCState soc; > MemoryRegion ram_container; > + MemoryRegion ram_container_alias; > MemoryRegion max_ram; > bool mmio_exec; > char *fmc_model; > @@ -339,9 +340,12 @@ static void aspeed_machine_init(MachineState *machine) > } > qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort); > > + memory_region_init_alias(&bmc->ram_container_alias, NULL, > + "ram-container-alias", &bmc->ram_container, 0, > + memory_region_size(&bmc->ram_container)); > memory_region_add_subregion(get_system_memory(), > sc->memmap[ASPEED_DEV_SDRAM], > - &bmc->ram_container); > + &bmc->ram_container_alias); > > max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), > "max-ram-size", > &error_abort); >
RAM is now initialized before the SoC. So we should be able to use machine->ram instead of the bmc->ram_container MR and simplify the Aspeed SMC model below the SoC. Thanks, C.