summaryrefslogtreecommitdiffstats
path: root/hw/arm/aspeed_ast10x0.c
diff options
context:
space:
mode:
authorPeter Delevoryas2022-07-14 16:24:38 +0200
committerCédric Le Goater2022-07-14 16:24:38 +0200
commit72a7c47393b41e406492e257a85589a75476b385 (patch)
tree277b1e93a19fdf7d2d6c5019b922491132c8140d /hw/arm/aspeed_ast10x0.c
parenthw/sensor: Add Renesas ISL69259 device model (diff)
downloadqemu-72a7c47393b41e406492e257a85589a75476b385.tar.gz
qemu-72a7c47393b41e406492e257a85589a75476b385.tar.xz
qemu-72a7c47393b41e406492e257a85589a75476b385.zip
aspeed: Create SRAM name from first CPU index
To support multiple SoC's running simultaneously, we need a unique name for each RAM region. DRAM is created by the machine, but SRAM is created by the SoC, since in hardware it is part of the SoC's internals. We need a way to uniquely identify each SRAM region though, for VM migration. Since each of the SoC's CPU's has an index which identifies it uniquely from other CPU's in the machine, we can use the index of any of the CPU's in the SoC to uniquely identify differentiate the SRAM name from other SoC SRAM's. In this change, I just elected to use the index of the first CPU in each SoC. Signed-off-by: Peter Delevoryas <peter@pjd.dev> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20220705191400.41632-3-peter@pjd.dev> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'hw/arm/aspeed_ast10x0.c')
-rw-r--r--hw/arm/aspeed_ast10x0.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
index 33ef331771..677699e54c 100644
--- a/hw/arm/aspeed_ast10x0.c
+++ b/hw/arm/aspeed_ast10x0.c
@@ -159,6 +159,7 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
DeviceState *armv7m;
Error *err = NULL;
int i;
+ g_autofree char *sram_name = NULL;
if (!clock_has_source(s->sysclk)) {
error_setg(errp, "sysclk clock must be wired up by the board code");
@@ -183,7 +184,9 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
sysbus_realize(SYS_BUS_DEVICE(&s->armv7m), &error_abort);
/* Internal SRAM */
- memory_region_init_ram(&s->sram, NULL, "aspeed.sram", sc->sram_size, &err);
+ sram_name = g_strdup_printf("aspeed.sram.%d",
+ CPU(s->armv7m.cpu)->cpu_index);
+ memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);
if (err != NULL) {
error_propagate(errp, err);
return;