From: Jamin Lin <jamin_lin@aspeedtech.com>
To: "Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Kane Chen" <kane_chen@aspeedtech.com>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: "Jamin Lin" <jamin_lin@aspeedtech.com>,
"Troy Lee" <troy_lee@aspeedtech.com>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [PATCH v7 04/11] hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap
Date: Tue, 24 Nov 2026 05:51:55 +0000 [thread overview]
Message-ID: <20261124055150.1328856-5-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20261124055150.1328856-1-jamin_lin@aspeedtech.com>
This commit adds two MemoryRegion aliases to support PSP access to
SSP SDRAM through shared memory remapping.
The SSP exposes two DRAM aliases:
- remap1 maps PSP DRAM at 0x400000000 to SSP SDRAM offset 0x5880000
- remap2 maps PSP DRAM at 0x42C000000 to SSP SDRAM offset 0x0
These mappings follow the default SCU register configuration used by
the ASPEED SDK firmware, which defines the memory window mapping
between PSP and the SSP.
The alias MemoryRegions belong to the SSP coprocessor state itself
(Aspeed27x0CoprocessorState), since that is what they represent; the
SCU only holds pointers to them (ssp_remap[0]/ssp_remap[1]) so its
control registers can reposition/resize the aliases at runtime. The
pointers are exposed as the SCU's "ssp-remap0"/"ssp-remap1" link
properties and are wired up by the board once the SSP is realized, so
the SSP does not need to reach into the shared SCU.
The SSP cpu_index is only known once the SSP's armv7m core is
realized, so the board also sets it in the SCU at that point. Its
"not wired up" default of -1 is set in the SCU's instance_init().
Since the default is no longer set in realize(), the AST2700 SCU's
realize handler only forwards to aspeed_scu_realize(). Drop it and
inherit realize from the parent class, like the other SCU models.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Tested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/hw/arm/aspeed_coprocessor.h | 2 ++
include/hw/misc/aspeed_scu.h | 3 +++
hw/arm/aspeed_ast27x0-fc.c | 9 +++++++++
hw/arm/aspeed_ast27x0-ssp.c | 24 ++++++++++++++++++++++++
hw/misc/aspeed_scu.c | 15 ++++++++++++---
5 files changed, 50 insertions(+), 3 deletions(-)
diff --git a/include/hw/arm/aspeed_coprocessor.h b/include/hw/arm/aspeed_coprocessor.h
index b0d72f9163..2939ac1b1c 100644
--- a/include/hw/arm/aspeed_coprocessor.h
+++ b/include/hw/arm/aspeed_coprocessor.h
@@ -54,6 +54,8 @@ struct Aspeed27x0CoprocessorState {
MemoryRegion scu_alias;
MemoryRegion scuio_alias;
MemoryRegion fmc_alias;
+ MemoryRegion dram_remap[2];
+ MemoryRegion *dram;
Aspeed2700SCUState *scu;
AspeedSCUState *scuio;
AspeedSMCState *fmc;
diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h
index a7014e43f2..d4a5fa43d0 100644
--- a/include/hw/misc/aspeed_scu.h
+++ b/include/hw/misc/aspeed_scu.h
@@ -44,6 +44,9 @@ struct AspeedSCUState {
struct Aspeed2700SCUState {
AspeedSCUState parent_obj;
+
+ MemoryRegion *ssp_remap[2];
+ int ssp_cpuid;
};
#define AST2400_A1_SILICON_REV 0x02010303U
diff --git a/hw/arm/aspeed_ast27x0-fc.c b/hw/arm/aspeed_ast27x0-fc.c
index 73362b60d2..2ad1ad39f3 100644
--- a/hw/arm/aspeed_ast27x0-fc.c
+++ b/hw/arm/aspeed_ast27x0-fc.c
@@ -153,6 +153,8 @@ static bool ast2700fc_ssp_init(Ast2700FCState *s, AspeedSoCState *psp,
&error_abort);
object_property_set_link(OBJECT(&s->ssp), "sram",
OBJECT(&psp->sram), &error_abort);
+ object_property_set_link(OBJECT(&s->ssp), "dram",
+ OBJECT(psp->dram_mr), &error_abort);
object_property_set_link(OBJECT(&s->ssp), "scu",
OBJECT(&s->ca35.scu), &error_abort);
object_property_set_link(OBJECT(&s->ssp), "scuio",
@@ -163,6 +165,13 @@ static bool ast2700fc_ssp_init(Ast2700FCState *s, AspeedSoCState *psp,
return false;
}
+ /* The remap aliases and cpu_index only exist once the SSP is realized. */
+ object_property_set_link(OBJECT(&s->ca35.scu), "ssp-remap0",
+ OBJECT(&s->ssp.dram_remap[0]), &error_abort);
+ object_property_set_link(OBJECT(&s->ca35.scu), "ssp-remap1",
+ OBJECT(&s->ssp.dram_remap[1]), &error_abort);
+ s->ca35.scu.ssp_cpuid = CPU(s->ssp.armv7m.cpu)->cpu_index;
+
return true;
}
diff --git a/hw/arm/aspeed_ast27x0-ssp.c b/hw/arm/aspeed_ast27x0-ssp.c
index 8d333ef3c1..db296ad9dc 100644
--- a/hw/arm/aspeed_ast27x0-ssp.c
+++ b/hw/arm/aspeed_ast27x0-ssp.c
@@ -181,6 +181,12 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
return;
}
+ if (!a->dram) {
+ error_setg(errp, TYPE_ASPEED27X0SSP_COPROCESSOR
+ ": 'dram' link is not set");
+ return;
+ }
+
/* AST27X0 SSP Core */
armv7m = DEVICE(&a->armv7m);
qdev_prop_set_uint32(armv7m, "num-irq", 256);
@@ -229,6 +235,22 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SCUIO],
&a->scuio_alias);
+ /*
+ * DRAM remap aliases used by PSP to access SSP SDRAM:
+ * - remap[0] maps PSP DRAM at 0x400000000 (size: 0x1A77E000) to
+ * SSP SDRAM offset 0x5880000
+ * - remap[1] maps PSP DRAM at 0x42C000000 (size: 0x05880000) to
+ * SSP SDRAM offset 0x0
+ */
+ memory_region_init_alias(&a->dram_remap[0], OBJECT(a), "ssp.dram.remap1",
+ a->dram, 0, 0x1a77e000);
+ memory_region_init_alias(&a->dram_remap[1], OBJECT(a), "ssp.dram.remap2",
+ a->dram, 0x2c000000, 0x05880000);
+ memory_region_add_subregion(&s->sdram, 0, &a->dram_remap[1]);
+ memory_region_add_subregion(&s->sdram,
+ memory_region_size(&a->dram_remap[1]),
+ &a->dram_remap[0]);
+
/* INTC */
if (!sysbus_realize(SYS_BUS_DEVICE(&a->intc[0]), errp)) {
return;
@@ -298,6 +320,8 @@ static const Property aspeed_27x0_coprocessor_properties[] = {
TYPE_ASPEED_SCU, AspeedSCUState *),
DEFINE_PROP_LINK("fmc", Aspeed27x0CoprocessorState, fmc, TYPE_ASPEED_SMC,
AspeedSMCState *),
+ DEFINE_PROP_LINK("dram", Aspeed27x0CoprocessorState, dram,
+ TYPE_MEMORY_REGION, MemoryRegion *),
};
static void aspeed_soc_ast27x0ssp_class_init(ObjectClass *klass,
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index df26dd0ef4..1568b74964 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -947,9 +947,18 @@ static void aspeed_ast2700_scu_reset_hold(Object *obj, ResetType type)
s->regs[AST2700_HW_STRAP1] = s->hw_strap1;
}
-static void aspeed_2700_scu_realize(DeviceState *dev, Error **errp)
+static void aspeed_2700_scu_instance_init(Object *obj)
{
- aspeed_scu_realize(dev, errp);
+ Aspeed2700SCUState *a = ASPEED_2700_SCU(obj);
+
+ a->ssp_cpuid = -1;
+
+ object_property_add_link(obj, "ssp-remap0", TYPE_MEMORY_REGION,
+ (Object **)&a->ssp_remap[0],
+ object_property_allow_set_link, 0);
+ object_property_add_link(obj, "ssp-remap1", TYPE_MEMORY_REGION,
+ (Object **)&a->ssp_remap[1],
+ object_property_allow_set_link, 0);
}
static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
@@ -959,7 +968,6 @@ static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
AspeedSCUClass *asc = ASPEED_SCU_CLASS(klass);
dc->desc = "ASPEED 2700 System Control Unit";
- dc->realize = aspeed_2700_scu_realize;
rc->phases.hold = aspeed_ast2700_scu_reset_hold;
asc->resets = ast2700_a0_resets;
asc->calc_hpll = aspeed_2600_scu_calc_hpll;
@@ -1196,6 +1204,7 @@ static const TypeInfo aspeed_scu_types[] = {
.name = TYPE_ASPEED_2700_SCU,
.parent = TYPE_ASPEED_SCU,
.instance_size = sizeof(Aspeed2700SCUState),
+ .instance_init = aspeed_2700_scu_instance_init,
.class_init = aspeed_2700_scu_class_init,
},
{
--
2.53.0
next prev parent reply other threads:[~2026-11-24 5:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 5:51 [PATCH v7 00/11] Add SSP/TSP power control and DRAM remap support for AST2700 Jamin Lin
2026-11-24 5:51 ` [PATCH v7 01/11] hw/arm/aspeed_ast1700: Correct AST2700 SCU to SCUIO Jamin Lin
2026-11-24 5:51 ` [PATCH v7 02/11] hw/arm/ast27x0: Start SSP in powered-off state to match hardware behavior Jamin Lin
2026-11-24 5:51 ` [PATCH v7 03/11] hw/arm/ast27x0: Start TSP " Jamin Lin
2026-11-24 5:51 ` Jamin Lin [this message]
2026-11-24 5:51 ` [PATCH v7 05/11] hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap Jamin Lin
2026-11-24 5:51 ` [PATCH v7 06/11] hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU registers Jamin Lin
2026-11-24 5:51 ` [PATCH v7 07/11] hw/misc/aspeed_scu: Implement TSP " Jamin Lin
2026-11-24 5:52 ` [PATCH v7 08/11] hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap Jamin Lin
2026-11-24 5:52 ` [PATCH v7 09/11] hw/misc/aspeed_scu: Add SCU support for TSP " Jamin Lin
2026-11-24 5:52 ` [PATCH v7 10/11] tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP and load binaries from DRAM Jamin Lin
2026-11-24 5:52 ` [PATCH v7 11/11] docs: Add support vbootrom and update Manual boot for ast2700fc Jamin Lin
2026-11-24 10:35 ` [PATCH v7 00/11] Add SSP/TSP power control and DRAM remap support for AST2700 Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124055150.1328856-5-jamin_lin@aspeedtech.com \
--to=jamin_lin@aspeedtech.com \
--cc=clg@kaod.org \
--cc=kane_chen@aspeedtech.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=troy_lee@aspeedtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.