[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/5] hw/arm/aspeed: Do not directly map ram container onto ma
From: |
Cédric Le Goater |
Subject: |
Re: [PATCH 1/5] hw/arm/aspeed: Do not directly map ram container onto main address bus |
Date: |
Wed, 17 Mar 2021 18:15:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 |
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é <f4bug@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.