From: Jamin Lin via <qemu-arm@nongnu.org>
To: "Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Troy Lee" <leetroy@gmail.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: <jamin_lin@aspeedtech.com>, <troy_lee@aspeedtech.com>,
<kane_chen@aspeedtech.com>
Subject: [PATCH v1 04/11] hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap
Date: Tue, 20 Jan 2026 17:29:29 +0800 [thread overview]
Message-ID: <20260120092939.2708302-5-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20260120092939.2708302-1-jamin_lin@aspeedtech.com>
This commit adds two MemoryRegion aliases to support PSP access to
SSP SDRAM through shared memory remapping, as defined by the default SCU
configuration.
The SSP exposes two DRAM aliases:
- remap1 maps PSP DRAM at 0x400000000 (32MB) to SSP SDRAM offset 0x2000000
- remap2 maps PSP DRAM at 0x42c000000 (32MB) to SSP SDRAM offset 0x0
These regions correspond to the default SCU register values, which control
the mapping between PSP and coprocessor memory windows.
Set SSP CPUID 4 and bumps the SCU VMState version to 3.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
include/hw/misc/aspeed_scu.h | 5 +++++
hw/arm/aspeed_ast27x0-fc.c | 2 ++
hw/arm/aspeed_ast27x0-ssp.c | 6 ++++++
hw/arm/aspeed_ast27x0.c | 4 ++++
hw/misc/aspeed_scu.c | 38 ++++++++++++++++++++++++++++++++++--
5 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h
index 9e28bd4d2e..6f7f7d2766 100644
--- a/include/hw/misc/aspeed_scu.h
+++ b/include/hw/misc/aspeed_scu.h
@@ -39,6 +39,10 @@ struct AspeedSCUState {
uint32_t hw_strap1;
uint32_t hw_strap2;
uint32_t hw_prot_key;
+
+ MemoryRegion dram_remap_alias[3];
+ MemoryRegion *dram;
+ int ssp_cpuid;
};
#define AST2400_A0_SILICON_REV 0x02000303U
@@ -73,6 +77,7 @@ struct AspeedSCUClass {
uint32_t nr_regs;
bool clkin_25Mhz;
const MemoryRegionOps *ops;
+ void (*dram_remap)(AspeedSCUState *s);
};
#define ASPEED_SCU_PROT_KEY 0x1688A8A8
diff --git a/hw/arm/aspeed_ast27x0-fc.c b/hw/arm/aspeed_ast27x0-fc.c
index 0502a137f3..b788e6ca2a 100644
--- a/hw/arm/aspeed_ast27x0-fc.c
+++ b/hw/arm/aspeed_ast27x0-fc.c
@@ -101,6 +101,8 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp)
sc->uarts_num, serial_hd(1));
aspeed_soc_uart_set_chr(soc->uart, ASPEED_DEV_UART7, sc->uarts_base,
sc->uarts_num, serial_hd(2));
+ object_property_set_int(OBJECT(&s->ca35), "ssp-cpuid", 4,
+ &error_abort);
if (!qdev_realize(DEVICE(&s->ca35), NULL, errp)) {
return false;
}
diff --git a/hw/arm/aspeed_ast27x0-ssp.c b/hw/arm/aspeed_ast27x0-ssp.c
index cba59ae11a..cf1339e2c7 100644
--- a/hw/arm/aspeed_ast27x0-ssp.c
+++ b/hw/arm/aspeed_ast27x0-ssp.c
@@ -198,6 +198,12 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SCU],
&s->scu_alias);
+ /* SDRAM remap alias used by PSP to access SSP SDRAM */
+ memory_region_add_subregion(&s->sdram, 0, &s->scu->dram_remap_alias[1]);
+ memory_region_add_subregion(&s->sdram,
+ memory_region_size(&s->scu->dram_remap_alias[1]),
+ &s->scu->dram_remap_alias[0]);
+
/* INTC */
if (!sysbus_realize(SYS_BUS_DEVICE(&a->intc[0]), errp)) {
return;
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index 74a004adca..ae8b22fc1c 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -389,6 +389,8 @@ static void aspeed_soc_ast2700_init(Object *obj)
"hw-strap1");
object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu),
"hw-prot-key");
+ object_property_add_alias(obj, "ssp-cpuid", OBJECT(&s->scu),
+ "ssp-cpuid");
object_initialize_child(obj, "scuio", &s->scuio, TYPE_ASPEED_2700_SCUIO);
qdev_prop_set_uint32(DEVICE(&s->scuio), "silicon-rev",
@@ -740,6 +742,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
sc->memmap[ASPEED_DEV_VBOOTROM], &s->vbootrom);
/* SCU */
+ object_property_set_link(OBJECT(&s->scu), "dram", OBJECT(s->dram_mr),
+ &error_abort);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
return;
}
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index 6829efa2dc..4b74e5adcb 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -20,6 +20,7 @@
#include "qemu/guest-random.h"
#include "qemu/module.h"
#include "trace.h"
+#include "qemu/units.h"
#define TO_REG(offset) ((offset) >> 2)
@@ -602,12 +603,20 @@ static void aspeed_scu_realize(DeviceState *dev, Error **errp)
TYPE_ASPEED_SCU, SCU_IO_REGION_SIZE);
sysbus_init_mmio(sbd, &s->iomem);
+
+ if (asc->dram_remap) {
+ if (!s->dram) {
+ error_setg(errp, TYPE_ASPEED_SCU ": 'dram' link not set");
+ return;
+ }
+ asc->dram_remap(s);
+ }
}
static const VMStateDescription vmstate_aspeed_scu = {
.name = "aspeed.scu",
- .version_id = 2,
- .minimum_version_id = 2,
+ .version_id = 3,
+ .minimum_version_id = 3,
.fields = (const VMStateField[]) {
VMSTATE_UINT32_ARRAY(regs, AspeedSCUState, ASPEED_AST2600_SCU_NR_REGS),
VMSTATE_END_OF_LIST()
@@ -619,6 +628,9 @@ static const Property aspeed_scu_properties[] = {
DEFINE_PROP_UINT32("hw-strap1", AspeedSCUState, hw_strap1, 0),
DEFINE_PROP_UINT32("hw-strap2", AspeedSCUState, hw_strap2, 0),
DEFINE_PROP_UINT32("hw-prot-key", AspeedSCUState, hw_prot_key, 0),
+ DEFINE_PROP_INT32("ssp-cpuid", AspeedSCUState, ssp_cpuid, -1),
+ DEFINE_PROP_LINK("dram", AspeedSCUState, dram, TYPE_MEMORY_REGION,
+ MemoryRegion *),
};
static void aspeed_scu_class_init(ObjectClass *klass, const void *data)
@@ -872,6 +884,27 @@ static const TypeInfo aspeed_2600_scu_info = {
.class_init = aspeed_2600_scu_class_init,
};
+static void aspeed_2700_scu_dram_remap_alias_init(AspeedSCUState *s)
+{
+ if (s->ssp_cpuid > 0) {
+ /*
+ * The SSP coprocessor uses two memory aliases (remap1 and remap2)
+ * to access shared memory regions in the PSP DRAM:
+ *
+ * - remap1 maps PSP DRAM at 0x400000000 (size: 32MB) to SSP SDRAM
+ * offset 0x2000000
+ * - remap2 maps PSP DRAM at 0x42c000000 (size: 32MB) to SSP SDRAM
+ * offset 0x0
+ */
+ memory_region_init_alias(&s->dram_remap_alias[0], OBJECT(s),
+ "ssp.dram.remap1", s->dram,
+ 0, 32 * MiB);
+ memory_region_init_alias(&s->dram_remap_alias[1], OBJECT(s),
+ "ssp.dram.remap2", s->dram,
+ 0x2c000000, 32 * MiB);
+ }
+}
+
static uint64_t aspeed_ast2700_scu_read(void *opaque, hwaddr offset,
unsigned size)
{
@@ -982,6 +1015,7 @@ static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
asc->nr_regs = ASPEED_AST2700_SCU_NR_REGS;
asc->clkin_25Mhz = true;
asc->ops = &aspeed_ast2700_scu_ops;
+ asc->dram_remap = aspeed_2700_scu_dram_remap_alias_init;
}
static uint64_t aspeed_ast2700_scuio_read(void *opaque, hwaddr offset,
--
2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: Jamin Lin via qemu development <qemu-devel@nongnu.org>
To: "Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Troy Lee" <leetroy@gmail.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: <jamin_lin@aspeedtech.com>, <troy_lee@aspeedtech.com>,
<kane_chen@aspeedtech.com>
Subject: [PATCH v1 04/11] hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap
Date: Tue, 20 Jan 2026 17:29:29 +0800 [thread overview]
Message-ID: <20260120092939.2708302-5-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20260120092939.2708302-1-jamin_lin@aspeedtech.com>
This commit adds two MemoryRegion aliases to support PSP access to
SSP SDRAM through shared memory remapping, as defined by the default SCU
configuration.
The SSP exposes two DRAM aliases:
- remap1 maps PSP DRAM at 0x400000000 (32MB) to SSP SDRAM offset 0x2000000
- remap2 maps PSP DRAM at 0x42c000000 (32MB) to SSP SDRAM offset 0x0
These regions correspond to the default SCU register values, which control
the mapping between PSP and coprocessor memory windows.
Set SSP CPUID 4 and bumps the SCU VMState version to 3.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
include/hw/misc/aspeed_scu.h | 5 +++++
hw/arm/aspeed_ast27x0-fc.c | 2 ++
hw/arm/aspeed_ast27x0-ssp.c | 6 ++++++
hw/arm/aspeed_ast27x0.c | 4 ++++
hw/misc/aspeed_scu.c | 38 ++++++++++++++++++++++++++++++++++--
5 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h
index 9e28bd4d2e..6f7f7d2766 100644
--- a/include/hw/misc/aspeed_scu.h
+++ b/include/hw/misc/aspeed_scu.h
@@ -39,6 +39,10 @@ struct AspeedSCUState {
uint32_t hw_strap1;
uint32_t hw_strap2;
uint32_t hw_prot_key;
+
+ MemoryRegion dram_remap_alias[3];
+ MemoryRegion *dram;
+ int ssp_cpuid;
};
#define AST2400_A0_SILICON_REV 0x02000303U
@@ -73,6 +77,7 @@ struct AspeedSCUClass {
uint32_t nr_regs;
bool clkin_25Mhz;
const MemoryRegionOps *ops;
+ void (*dram_remap)(AspeedSCUState *s);
};
#define ASPEED_SCU_PROT_KEY 0x1688A8A8
diff --git a/hw/arm/aspeed_ast27x0-fc.c b/hw/arm/aspeed_ast27x0-fc.c
index 0502a137f3..b788e6ca2a 100644
--- a/hw/arm/aspeed_ast27x0-fc.c
+++ b/hw/arm/aspeed_ast27x0-fc.c
@@ -101,6 +101,8 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp)
sc->uarts_num, serial_hd(1));
aspeed_soc_uart_set_chr(soc->uart, ASPEED_DEV_UART7, sc->uarts_base,
sc->uarts_num, serial_hd(2));
+ object_property_set_int(OBJECT(&s->ca35), "ssp-cpuid", 4,
+ &error_abort);
if (!qdev_realize(DEVICE(&s->ca35), NULL, errp)) {
return false;
}
diff --git a/hw/arm/aspeed_ast27x0-ssp.c b/hw/arm/aspeed_ast27x0-ssp.c
index cba59ae11a..cf1339e2c7 100644
--- a/hw/arm/aspeed_ast27x0-ssp.c
+++ b/hw/arm/aspeed_ast27x0-ssp.c
@@ -198,6 +198,12 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SCU],
&s->scu_alias);
+ /* SDRAM remap alias used by PSP to access SSP SDRAM */
+ memory_region_add_subregion(&s->sdram, 0, &s->scu->dram_remap_alias[1]);
+ memory_region_add_subregion(&s->sdram,
+ memory_region_size(&s->scu->dram_remap_alias[1]),
+ &s->scu->dram_remap_alias[0]);
+
/* INTC */
if (!sysbus_realize(SYS_BUS_DEVICE(&a->intc[0]), errp)) {
return;
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index 74a004adca..ae8b22fc1c 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -389,6 +389,8 @@ static void aspeed_soc_ast2700_init(Object *obj)
"hw-strap1");
object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu),
"hw-prot-key");
+ object_property_add_alias(obj, "ssp-cpuid", OBJECT(&s->scu),
+ "ssp-cpuid");
object_initialize_child(obj, "scuio", &s->scuio, TYPE_ASPEED_2700_SCUIO);
qdev_prop_set_uint32(DEVICE(&s->scuio), "silicon-rev",
@@ -740,6 +742,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
sc->memmap[ASPEED_DEV_VBOOTROM], &s->vbootrom);
/* SCU */
+ object_property_set_link(OBJECT(&s->scu), "dram", OBJECT(s->dram_mr),
+ &error_abort);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
return;
}
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index 6829efa2dc..4b74e5adcb 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -20,6 +20,7 @@
#include "qemu/guest-random.h"
#include "qemu/module.h"
#include "trace.h"
+#include "qemu/units.h"
#define TO_REG(offset) ((offset) >> 2)
@@ -602,12 +603,20 @@ static void aspeed_scu_realize(DeviceState *dev, Error **errp)
TYPE_ASPEED_SCU, SCU_IO_REGION_SIZE);
sysbus_init_mmio(sbd, &s->iomem);
+
+ if (asc->dram_remap) {
+ if (!s->dram) {
+ error_setg(errp, TYPE_ASPEED_SCU ": 'dram' link not set");
+ return;
+ }
+ asc->dram_remap(s);
+ }
}
static const VMStateDescription vmstate_aspeed_scu = {
.name = "aspeed.scu",
- .version_id = 2,
- .minimum_version_id = 2,
+ .version_id = 3,
+ .minimum_version_id = 3,
.fields = (const VMStateField[]) {
VMSTATE_UINT32_ARRAY(regs, AspeedSCUState, ASPEED_AST2600_SCU_NR_REGS),
VMSTATE_END_OF_LIST()
@@ -619,6 +628,9 @@ static const Property aspeed_scu_properties[] = {
DEFINE_PROP_UINT32("hw-strap1", AspeedSCUState, hw_strap1, 0),
DEFINE_PROP_UINT32("hw-strap2", AspeedSCUState, hw_strap2, 0),
DEFINE_PROP_UINT32("hw-prot-key", AspeedSCUState, hw_prot_key, 0),
+ DEFINE_PROP_INT32("ssp-cpuid", AspeedSCUState, ssp_cpuid, -1),
+ DEFINE_PROP_LINK("dram", AspeedSCUState, dram, TYPE_MEMORY_REGION,
+ MemoryRegion *),
};
static void aspeed_scu_class_init(ObjectClass *klass, const void *data)
@@ -872,6 +884,27 @@ static const TypeInfo aspeed_2600_scu_info = {
.class_init = aspeed_2600_scu_class_init,
};
+static void aspeed_2700_scu_dram_remap_alias_init(AspeedSCUState *s)
+{
+ if (s->ssp_cpuid > 0) {
+ /*
+ * The SSP coprocessor uses two memory aliases (remap1 and remap2)
+ * to access shared memory regions in the PSP DRAM:
+ *
+ * - remap1 maps PSP DRAM at 0x400000000 (size: 32MB) to SSP SDRAM
+ * offset 0x2000000
+ * - remap2 maps PSP DRAM at 0x42c000000 (size: 32MB) to SSP SDRAM
+ * offset 0x0
+ */
+ memory_region_init_alias(&s->dram_remap_alias[0], OBJECT(s),
+ "ssp.dram.remap1", s->dram,
+ 0, 32 * MiB);
+ memory_region_init_alias(&s->dram_remap_alias[1], OBJECT(s),
+ "ssp.dram.remap2", s->dram,
+ 0x2c000000, 32 * MiB);
+ }
+}
+
static uint64_t aspeed_ast2700_scu_read(void *opaque, hwaddr offset,
unsigned size)
{
@@ -982,6 +1015,7 @@ static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
asc->nr_regs = ASPEED_AST2700_SCU_NR_REGS;
asc->clkin_25Mhz = true;
asc->ops = &aspeed_ast2700_scu_ops;
+ asc->dram_remap = aspeed_2700_scu_dram_remap_alias_init;
}
static uint64_t aspeed_ast2700_scuio_read(void *opaque, hwaddr offset,
--
2.43.0
next prev parent reply other threads:[~2026-01-20 9:30 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 9:29 [PATCH v1 00/11] Add SSP/TSP power control and DRAM remap support for AST2700 Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 01/11] hw/arm/ast27x0: Move DRAM and SDMC initialization earlier to support memory aliasing Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 02/11] hw/arm/ast27x0: Start SSP in powered-off state to match hardware behavior Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 03/11] hw/arm/ast27x0: Start TSP " Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` Jamin Lin via [this message]
2026-01-20 9:29 ` [PATCH v1 04/11] hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap Jamin Lin via qemu development
2026-01-26 9:01 ` Cédric Le Goater
2026-01-27 5:07 ` Jamin Lin
2026-01-27 6:09 ` Jamin Lin
2026-01-27 9:48 ` Jamin Lin
2026-02-02 6:57 ` Kane Chen
2026-02-02 9:33 ` Cédric Le Goater
2026-02-02 9:46 ` Kane Chen
2026-02-02 10:48 ` Cédric Le Goater
2026-02-03 10:23 ` Kane Chen
2026-02-03 12:56 ` Cédric Le Goater
2026-02-04 7:42 ` Kane Chen
2026-01-20 9:29 ` [PATCH v1 05/11] hw/arm/ast27x0: Add DRAM alias for TSP " Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 06/11] hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU registers Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 07/11] hw/misc/aspeed_scu: Implement TSP " Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 08/11] hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 09/11] hw/misc/aspeed_scu: Add SCU support for TSP " Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 10/11] tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP and load binaries from DRAM Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
2026-01-20 9:29 ` [PATCH v1 11/11] docs: Add support vbootrom and update Manual boot for ast2700fc Jamin Lin via
2026-01-20 9:29 ` Jamin Lin via qemu development
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=20260120092939.2708302-5-jamin_lin@aspeedtech.com \
--to=qemu-arm@nongnu.org \
--cc=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=kane_chen@aspeedtech.com \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--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.