This commit adds a MemoryRegion alias to support PSP access to TSP SDRAM through shared memory remapping, as defined by the default SCU configuration.
The TSP coprocessor exposes one DRAM alias: - remap maps PSP DRAM at 0x42e000000 (32MB) to TSP SDRAM offset 0x0 This region corresponds to the default SCU register value, which controls the mapping between PSP and coprocessor memory windows. To ensure correctness, the alias is initialized early in aspeed_soc_ast2700_realize(), before SCU and coprocessor realization. This allows TSP to reference the alias region during its SDRAM setup. Signed-off-by: Jamin Lin <jamin_...@aspeedtech.com> --- include/hw/arm/aspeed_soc.h | 1 + hw/arm/aspeed_ast27x0-tsp.c | 2 ++ hw/arm/aspeed_ast27x0.c | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index d628a189c1..83e07582d2 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -153,6 +153,7 @@ struct Aspeed27x0TSPSoCState { MemoryRegion memory; MemoryRegion sram_mr_alias; MemoryRegion scu_mr_alias; + MemoryRegion sdram_remap_alias; ARMv7MState armv7m; }; diff --git a/hw/arm/aspeed_ast27x0-tsp.c b/hw/arm/aspeed_ast27x0-tsp.c index 6b035e2612..4c3b18695e 100644 --- a/hw/arm/aspeed_ast27x0-tsp.c +++ b/hw/arm/aspeed_ast27x0-tsp.c @@ -187,6 +187,8 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp) AST2700_TSP_SDRAM_SIZE, errp)) { return; } + /* SDRAM remap alias used by PSP to access TSP SDRAM */ + memory_region_add_subregion(&s->dram_container, 0, &a->sdram_remap_alias); memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SDRAM], &s->dram_container); diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c index be130db5e2..0f988eaa4d 100644 --- a/hw/arm/aspeed_ast27x0.c +++ b/hw/arm/aspeed_ast27x0.c @@ -812,6 +812,12 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) * - remap2 maps PSP DRAM at 0x42c000000 (size: 32MB) to SSP SDRAM * offset 0x0 * + * The TSP coprocessor uses one memory alias (remap) to access a shared + * region in the PSP DRAM: + * + * - remap maps PSP DRAM at 0x42e000000 (size: 32MB) to TSP SDRAM + * offset 0x0 + * * These mappings correspond to the default values of the SCU registers: * * This configuration enables shared memory communication between the PSP @@ -824,6 +830,9 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) memory_region_init_alias(&a->ssp.sdram_remap2_alias, OBJECT(a), "ssp.sdram.remap2", s->memory, 0x42c000000ULL, 32 * MiB); + memory_region_init_alias(&a->tsp.sdram_remap_alias, OBJECT(a), + "tsp.sdram.remap", s->memory, + 0x42e000000, 32 * MiB); } if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) { return; -- 2.43.0