Skip to contentSkip to conversation

Add SSP/TSP power control and DRAM remap support for AST2700

PATCH Superseded Jamin Lin 4 participants 21 messages Jul 8 – Jul 22 Arm/Aspeed machine support

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Jamin Lin

author
#0 lore raw

v5 cover Add SSP/TSP power control and DRAM remap support for AST2700

This series improves AST2700 platform support by aligning SSP/TSP power and reset behavior with hardware, and enabling DRAM remapping required for proper firmware boot flow.

This series depends on:
[v2,0/8] Refactor AST2700 SCU preparation for coprocessors
https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/

v1:
1. The changes move DRAM/SDMC initialization earlier to support memory
aliasing, add DRAM aliases for SSP/TSP SDRAM remap, and implement SSP/TSP reset, power-on, and remap controls via SCU registers.
2. With these updates, SSP and TSP can be booted via PSP and load their
binaries from DRAM. Functional tests and documentation are updated accordingly.

v2:
Fix "make check" failure caused by both AST2700 and AST1700 realizing the same TYPE_AST2700_SCU model.

v3:
1. Drop "Move DRAM and SDMC initialization earlier to support memory aliasing"
2. Support SPI/FMC FIFO Mode
3. Add unimplemented devices

v4:
1. Introduce Aspeed2700SCU subclass and separate from generic SCU.
2. Add separate reset handler for AST2700 SCUIO
3. Add AST2700 SCUIO RNG control and data registers
4. Share single SCUIO instance across PSP, SSP, and TSP
5. Fix AST2700 FC hardware strap settings

v5:
1. To speed up the review process, move the following patches into a separate patch series, as they are not directly related to the main topic of this series:

[v4,01/21] hw/misc/aspeed_scu: Introduce Aspeed2700SCU subclass and separate from generic SCU [v4,02/21] hw/misc/aspeed_scu: Add separate reset handler for AST2700 SCUIO
[v4,11/21] hw/arm/ast27x0: Share FMC controller with SSP and TSP
[v4,12/21] hw/arm/aspeed_ast27x0: Add unimplemented Privilege Controller MMIO regions for SSP/TSP (Merged) [v4,13/21] hw/arm/aspeed_ast27x0: Add unimplemented OTP controller MMIO regions for SSP/TSP (Merged) [v4,14/21] hw/block/m25p80: Implement volatile status register write enable for Winbond [v4,15/21] hw/ssi/aspeed_smc: Add Data FIFO-based flash access support for AST2700 [v4,16/21] hw/misc/aspeed_scu: Drop noisy unhandled read logs for AST2700 SCU/SCUIO (Merged) [v4,17/21] hw/misc/aspeed_scu: Add AST2700 SCUIO RNG control and data registers (Merged) [v4,18/21] hw/arm/ast27x0: Share single SCUIO instance across PSP, SSP, and TSP [v4,19/21] hw/arm/aspeed_ast27x0-fc: Fix hardware strap settings (Merged)

2. Add memory_region_transaction_begin() and memory_region_transaction_commit() to protect the transaction.

Jamin Lin (10):
hw/arm/ast27x0: Start SSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Start TSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU
registers
hw/misc/aspeed_scu: Implement TSP reset and power-on control via SCU
registers
hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP
and load binaries from DRAM
docs: Add support vbootrom and update Manual boot for ast2700fc

 docs/system/arm/aspeed.rst                    |  42 ++-
 include/hw/misc/aspeed_scu.h                  |   5 +
 hw/arm/aspeed_ast27x0-fc.c                    |   4 +
 hw/arm/aspeed_ast27x0-ssp.c                   |  13 +
 hw/arm/aspeed_ast27x0-tsp.c                   |  10 +
 hw/arm/aspeed_ast27x0.c                       |   6 +
 hw/misc/aspeed_scu.c                          | 285 ++++++++++++++++++
 .../aarch64/test_aspeed_ast2700fc.py          |  29 +-
 8 files changed, 374 insertions(+), 20 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v5 1/10 hw/arm/ast27x0: Start SSP in powered-off state to match hardware behavior

In the previous design, both the PSP and SSP were started together during SoC initialization. However, on real hardware, the SSP begins in a powered-off state. The typical boot sequence involves the PSP powering up first, loading the SSP firmware binary into shared memory via DRAM remap, and then releasing the SSP reset and enabling it through SCU control registers.

To more accurately model this behavior in QEMU, this commit sets the "start-powered-off" property for the SSP's ARMv7M core. This change ensures the SSP remains off until explicitly enabled via the SCU, simulating the real-world flow where the PSP controls SSP boot through SCU interaction.

---
 hw/arm/aspeed_ast27x0-ssp.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/arm/aspeed_ast27x0-ssp.c +7 -0
index e03653086c..9c984d23cd 100644
@@ -192,6 +192,13 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
     qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
     object_property_set_link(OBJECT(&a->armv7m), "memory",
                              OBJECT(s->memory), &error_abort);
+    /*
+     * The SSP starts in a powered-down state and can be powered up
+     * by setting the SSP Control Register through the SCU
+     * (System Control Unit)
+     */
+    object_property_set_bool(OBJECT(&a->armv7m), "start-powered-off", true,
+                             &error_abort);
     sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
 
     /* SDRAM */
Signature · 1 line
2.43.0
Reviewed-by on v5 1/10
#2 lore raw

Re: [PATCH v5 01/10] hw/arm/ast27x0: Start SSP in powered-off state to match hardware behavior

Quoted 24 lines · Jamin Lin

In the previous design, both the PSP and SSP were started together during SoC initialization. However, on real hardware, the SSP begins in a powered-off state. The typical boot sequence involves the PSP powering up first, loading the SSP firmware binary into shared memory via DRAM remap, and then releasing the SSP reset and enabling it through SCU control registers.

To more accurately model this behavior in QEMU, this commit sets the "start-powered-off" property for the SSP's ARMv7M core. This change ensures the SSP remains off until explicitly enabled via the SCU, simulating the real-world flow where the PSP controls SSP boot through SCU interaction.

---
  hw/arm/aspeed_ast27x0-ssp.c | 7 +++++++
  1 file changed, 7 insertions(+)
hw/arm/aspeed_ast27x0-ssp.c +0 -0
index e03653086c..9c984d23cd 100644
@@ -192,6 +192,13 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
      qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
      object_property_set_link(OBJECT(&a->armv7m), "memory",
                               OBJECT(s->memory), &error_abort);

hw/arm/aspeed_ast27x0-ssp.c static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp) · line 204

Quoted 10 lines
hw/arm/aspeed_ast27x0-ssp.c +7 -0
+    /*
+     * The SSP starts in a powered-down state and can be powered up
+     * by setting the SSP Control Register through the SCU
+     * (System Control Unit)
+     */
+    object_property_set_bool(OBJECT(&a->armv7m), "start-powered-off", true,
+                             &error_abort);
      sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
 
      /* SDRAM */

Thanks,

C.

author
#3 lore raw

PATCH v5 2/10 hw/arm/ast27x0: Start TSP in powered-off state to match hardware behavior

In reply to Jamin Lin

In the previous design, both the PSP and TSP were started together during SoC initialization. However, on real hardware, the TSP begins in a powered-off state. The typical boot sequence involves the PSP powering up first, loading the TSP firmware binary into shared memory via DRAM remap, and then releasing the TSP reset and enabling it through SCU control registers.

To more accurately model this behavior in QEMU, this commit sets the "start-powered-off" property for the TSP's ARMv7M core. This change ensures the TSP remains off until explicitly enabled via the SCU, simulating the real-world flow where the PSP controls TSP boot through SCU interaction.

---
 hw/arm/aspeed_ast27x0-tsp.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/arm/aspeed_ast27x0-tsp.c +7 -0
index 39ba062a20..4212e7bd4c 100644
@@ -192,6 +192,13 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
     qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
     object_property_set_link(OBJECT(&a->armv7m), "memory",
                              OBJECT(s->memory), &error_abort);
+    /*
+     * The TSP starts in a powered-down state and can be powered up
+     * by setting the TSP Control Register through the SCU
+     * (System Control Unit)
+     */
+    object_property_set_bool(OBJECT(&a->armv7m), "start-powered-off", true,
+                             &error_abort);
     sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
 
     /* SDRAM */
Signature · 1 line
2.43.0
Reviewed-by on v5 2/10
#4 lore raw

Re: [PATCH v5 02/10] hw/arm/ast27x0: Start TSP in powered-off state to match hardware behavior

Quoted 24 lines · Jamin Lin

In the previous design, both the PSP and TSP were started together during SoC initialization. However, on real hardware, the TSP begins in a powered-off state. The typical boot sequence involves the PSP powering up first, loading the TSP firmware binary into shared memory via DRAM remap, and then releasing the TSP reset and enabling it through SCU control registers.

To more accurately model this behavior in QEMU, this commit sets the "start-powered-off" property for the TSP's ARMv7M core. This change ensures the TSP remains off until explicitly enabled via the SCU, simulating the real-world flow where the PSP controls TSP boot through SCU interaction.

---
  hw/arm/aspeed_ast27x0-tsp.c | 7 +++++++
  1 file changed, 7 insertions(+)
hw/arm/aspeed_ast27x0-tsp.c +0 -0
index 39ba062a20..4212e7bd4c 100644
@@ -192,6 +192,13 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
      qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
      object_property_set_link(OBJECT(&a->armv7m), "memory",
                               OBJECT(s->memory), &error_abort);

hw/arm/aspeed_ast27x0-tsp.c static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp) · line 204

Quoted 10 lines
hw/arm/aspeed_ast27x0-tsp.c +7 -0
+    /*
+     * The TSP starts in a powered-down state and can be powered up
+     * by setting the TSP Control Register through the SCU
+     * (System Control Unit)
+     */
+    object_property_set_bool(OBJECT(&a->armv7m), "start-powered-off", true,
+                             &error_abort);
      sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
 
      /* SDRAM */

Thanks,

C.

author
#5 lore raw

PATCH v5 3/10 hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap

In reply to Jamin Lin

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.

Set SSP CPUID 4.

---
 include/hw/misc/aspeed_scu.h |  4 ++++
 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         | 32 ++++++++++++++++++++++++++++++++
 5 files changed, 48 insertions(+)
include/hw/misc/aspeed_scu.h +4 -0
index 904549465f..ae49f6ab9a 100644
@@ -44,6 +44,10 @@ struct AspeedSCUState {
 
 struct Aspeed2700SCUState {
     AspeedSCUState parent_obj;
+
+    MemoryRegion dram_remap_alias[3];
+    MemoryRegion *dram;
+    int ssp_cpuid;
 };
 
 #define AST2400_A1_SILICON_REV   0x02010303U
hw/arm/aspeed_ast27x0-fc.c +2 -0
index 058cea42ed..ce245118af 100644
@@ -102,6 +102,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;
     }
hw/arm/aspeed_ast27x0-ssp.c +6 -0
index 9c984d23cd..778876a60e 100644
@@ -232,6 +232,12 @@ 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);
 
+    /* SDRAM remap alias used by PSP to access SSP SDRAM */
+    memory_region_add_subregion(&s->sdram, 0, &a->scu->dram_remap_alias[1]);
+    memory_region_add_subregion(&s->sdram,
+            memory_region_size(&a->scu->dram_remap_alias[1]),
+            &a->scu->dram_remap_alias[0]);
+
     /* INTC */
     if (!sysbus_realize(SYS_BUS_DEVICE(&a->intc[0]), errp)) {
         return;
hw/arm/aspeed_ast27x0.c +4 -0
index dd6dd0377c..10d3e35a9b 100644
@@ -442,6 +442,8 @@ static void aspeed_soc_ast2700_init(Object *obj)
                               "hw-strap1");
     object_property_add_alias(obj, "hw-prot-key", OBJECT(&a->scu),
                               "hw-prot-key");
+    object_property_add_alias(obj, "ssp-cpuid", OBJECT(&a->scu),
+                              "ssp-cpuid");
 
     object_initialize_child(obj, "scuio", &s->scuio, TYPE_ASPEED_2700_SCUIO);
     qdev_prop_set_uint32(DEVICE(&s->scuio), "silicon-rev",
@@ -808,6 +810,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
                                 sc->memmap[ASPEED_DEV_VBOOTROM], &s->vbootrom);
 
     /* SCU */
+    object_property_set_link(OBJECT(&a->scu), "dram", OBJECT(s->dram_mr),
+                             &error_abort);
     if (!sysbus_realize(SYS_BUS_DEVICE(&a->scu), errp)) {
         return;
     }
hw/misc/aspeed_scu.c +32 -0
index ca93c3699d..cc0aa3234a 100644
@@ -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)
 
@@ -932,9 +933,39 @@ static void aspeed_ast2700_scu_reset_hold(Object *obj, ResetType type)
 
 static void aspeed_2700_scu_realize(DeviceState *dev, Error **errp)
 {
+    Aspeed2700SCUState *a = ASPEED_2700_SCU(dev);
+
     aspeed_scu_realize(dev, errp);
+
+    if (a->ssp_cpuid > 0) {
+        if (!a->dram) {
+            error_setg(errp, TYPE_ASPEED_2700_SCU ": 'dram' link not set");
+            return;
+        }
+        /*
+         * 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: 0x1A77E000) to
+         *   SSP SDRAM offset 0x5880000
+         * - remap2 maps PSP DRAM at 0x42C000000 (size: 0x05880000) to
+         *   SSP SDRAM offset 0x0
+         */
+        memory_region_init_alias(&a->dram_remap_alias[0], OBJECT(a),
+                                 "ssp.dram.remap1", a->dram,
+                                 0, 0x1a77e000);
+        memory_region_init_alias(&a->dram_remap_alias[1], OBJECT(a),
+                                 "ssp.dram.remap2", a->dram,
+                                 0x2c000000, 0x05880000);
+    }
 }
 
+static const Property aspeed_2700_scu_properties[] = {
+    DEFINE_PROP_INT32("ssp-cpuid", Aspeed2700SCUState, ssp_cpuid, -1),
+    DEFINE_PROP_LINK("dram", Aspeed2700SCUState, dram, TYPE_MEMORY_REGION,
+                     MemoryRegion *),
+};
+
 static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -944,6 +975,7 @@ static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
     dc->desc = "ASPEED 2700 System Control Unit";
     dc->realize = aspeed_2700_scu_realize;
     rc->phases.hold = aspeed_ast2700_scu_reset_hold;
+    device_class_set_props(dc, aspeed_2700_scu_properties);
     asc->resets = ast2700_a0_resets;
     asc->calc_hpll = aspeed_2600_scu_calc_hpll;
     asc->get_apb = aspeed_2700_scu_get_apb_freq;
Signature · 1 line
2.43.0
author
#6 lore raw

PATCH v5 4/10 hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap

In reply to Jamin Lin

This commit adds a MemoryRegion alias to support PSP access to TSP SDRAM through shared memory remapping.

The TSP coprocessor exposes one DRAM alias:
- remap maps PSP DRAM at 0x42E000000 to TSP 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 TSP.

Set TSP CPUID 5.

---
 include/hw/misc/aspeed_scu.h |  1 +
 hw/arm/aspeed_ast27x0-fc.c   |  2 ++
 hw/arm/aspeed_ast27x0-tsp.c  |  3 +++
 hw/arm/aspeed_ast27x0.c      |  2 ++
 hw/misc/aspeed_scu.c         | 18 ++++++++++++++++++
 5 files changed, 26 insertions(+)
include/hw/misc/aspeed_scu.h +1 -0
index ae49f6ab9a..1c3a220d96 100644
@@ -48,6 +48,7 @@ struct Aspeed2700SCUState {
     MemoryRegion dram_remap_alias[3];
     MemoryRegion *dram;
     int ssp_cpuid;
+    int tsp_cpuid;
 };
 
 #define AST2400_A1_SILICON_REV   0x02010303U
hw/arm/aspeed_ast27x0-fc.c +2 -0
index ce245118af..113248b98e 100644
@@ -104,6 +104,8 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp)
                             sc->uarts_num, serial_hd(2));
     object_property_set_int(OBJECT(&s->ca35), "ssp-cpuid", 4,
                             &error_abort);
+    object_property_set_int(OBJECT(&s->ca35), "tsp-cpuid", 5,
+                            &error_abort);
     if (!qdev_realize(DEVICE(&s->ca35), NULL, errp)) {
         return false;
     }
hw/arm/aspeed_ast27x0-tsp.c +3 -0
index 4212e7bd4c..369576bde3 100644
@@ -232,6 +232,9 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
     memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SCUIO],
                                 &a->scuio_alias);
 
+    /* SDRAM remap alias used by PSP to access TSP SDRAM */
+    memory_region_add_subregion(&s->sdram, 0, &a->scu->dram_remap_alias[2]);
+
     /* INTC */
     if (!sysbus_realize(SYS_BUS_DEVICE(&a->intc[0]), errp)) {
         return;
hw/arm/aspeed_ast27x0.c +2 -0
index 10d3e35a9b..9c13efa3a6 100644
@@ -444,6 +444,8 @@ static void aspeed_soc_ast2700_init(Object *obj)
                               "hw-prot-key");
     object_property_add_alias(obj, "ssp-cpuid", OBJECT(&a->scu),
                               "ssp-cpuid");
+    object_property_add_alias(obj, "tsp-cpuid", OBJECT(&a->scu),
+                              "tsp-cpuid");
 
     object_initialize_child(obj, "scuio", &s->scuio, TYPE_ASPEED_2700_SCUIO);
     qdev_prop_set_uint32(DEVICE(&s->scuio), "silicon-rev",
hw/misc/aspeed_scu.c +18 -0
index cc0aa3234a..88c1a57299 100644
@@ -958,10 +958,28 @@ static void aspeed_2700_scu_realize(DeviceState *dev, Error **errp)
                                  "ssp.dram.remap2", a->dram,
                                  0x2c000000, 0x05880000);
     }
+
+    if (a->tsp_cpuid > 0) {
+        if (!a->dram) {
+            error_setg(errp, TYPE_ASPEED_2700_SCU ": 'dram' link not set");
+            return;
+        }
+        /*
+         * 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
+         */
+        memory_region_init_alias(&a->dram_remap_alias[2], OBJECT(a),
+                                 "tsp.dram.remap", a->dram,
+                                 0x2e000000, 32 * MiB);
+    }
 }
 
 static const Property aspeed_2700_scu_properties[] = {
     DEFINE_PROP_INT32("ssp-cpuid", Aspeed2700SCUState, ssp_cpuid, -1),
+    DEFINE_PROP_INT32("tsp-cpuid", Aspeed2700SCUState, tsp_cpuid, -1),
     DEFINE_PROP_LINK("dram", Aspeed2700SCUState, dram, TYPE_MEMORY_REGION,
                      MemoryRegion *),
 };
Signature · 1 line
2.43.0
author
#7 lore raw

PATCH v5 5/10 hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU registers

In reply to Jamin Lin

This patch implements SSP reset and power control logic in the SCU for AST2700. It introduces support for the following behavior:

1. SSP Reset Trigger (via SCU 0x200):
- SSP reset is triggered by writing 1 to bit 30 (RW1S) of SYS_RESET_CTRL_1.

2. SSP Reset State and Source Hold (via SCU 0x120):
- Upon reset, bit 8 (RST_RB) is set to indicate the SSP is in reset.
- Bit 10 (RST_SRC_RB) is set to indicate the reset was triggered by an external source.
- Bit 1 (RST) is a software-controlled bit used to request holding SSP in reset.
- If an external reset source is present and bit 1 is set, bit 9 (RST_HOLD_RB) will also be asserted to indicate the SSP is being held in reset.
- If bit 1 is cleared, RST_HOLD_RB will be deasserted accordingly.

3. Hold Release and Power-on:
- If RST_HOLD_RB is clear (0), SSP is powered on immediately after reset is deasserted.
- If RST_HOLD_RB is set (1), the user must write ENABLE (bit 0) to SSP_CTRL_0 to release the hold and power on SSP explicitly.
- Writing ENABLE (bit 0) is a one-shot operation and will auto-clear after execution.

4. Reset Status Clear (via SCU 0x204):
- The reset status can be cleared by writing 1 to bit 30 (RW1C) of SYS_RST_CLR_1, which will deassert RST_SRC_RB and potentially trigger power-on if no hold is active.

5. SSP Power Control Logic:
- handle_ssp_tsp_on() clears RST_SRC_RB and RST_RB (if not held), and invokes arm_set_cpu_on_and_reset(cpuid) to power on the SSP core (CPUID 4).
- handle_ssp_tsp_off() sets RST_RB and RST_SRC_RB; if RST is active, also asserts RST_HOLD_RB and invokes arm_set_cpu_off(cpuid).

6. Register Initialization and Definitions:
- Adds SCU register definitions for SSP_CTRL_0 (0x120), SYS_RST_CTRL_1 (0x200),

     and SYS_RST_CLR_1 (0x204).

- Updates the reset values for these registers during SCU initialization.

The default values are based on EVB (evaluation board) register dump observations. This patch enables proper modeling of SSP lifecycle management across reset, hold, and power-on states for the AST2700 SoC.

---
 hw/misc/aspeed_scu.c | 109 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
hw/misc/aspeed_scu.c +109 -0
index 88c1a57299..07901f2ab0 100644
@@ -21,6 +21,7 @@
 #include "qemu/module.h"
 #include "trace.h"
 #include "qemu/units.h"
+#include "target/arm/arm-powerctl.h"
 
 #define TO_REG(offset) ((offset) >> 2)
 
@@ -144,6 +145,17 @@
 #define AST2700_HW_STRAP1_SEC2    TO_REG(0x28)
 #define AST2700_HW_STRAP1_SEC3    TO_REG(0x2C)
 
+/* SSP TSP */
+#define AST2700_SCU_SSP_CTRL_0          TO_REG(0x120)
+#define AST2700_SSP_TSP_ENABLE          BIT(0)
+#define AST2700_SSP_TSP_RST             BIT(1)
+#define AST2700_SSP_TSP_RST_RB          BIT(8)
+#define AST2700_SSP_TSP_RST_HOLD_RB     BIT(9)
+#define AST2700_SSP_TSP_RST_SRC_RB      BIT(10)
+#define AST2700_SCU_SYS_RST_CTRL_1      TO_REG(0x200)
+#define AST2700_SCU_SYS_RST_CLR_1       TO_REG(0x204)
+#define AST2700_SCU_SYS_RST_SSP         BIT(30)
+
 #define AST2700_SCU_CLK_SEL_1       TO_REG(0x280)
 #define AST2700_SCU_HPLL_PARAM      TO_REG(0x300)
 #define AST2700_SCU_HPLL_EXT_PARAM  TO_REG(0x304)
@@ -842,6 +854,35 @@ static void aspeed_2600_scu_class_init(ObjectClass *klass, const void *data)
     asc->ops = &aspeed_ast2600_scu_ops;
 }
 
+static void handle_2700_ssp_tsp_on(struct AspeedSCUState *s, int cpuid,
+                                   int reg)
+{
+    uint32_t val = s->regs[reg];
+
+    val &= ~AST2700_SSP_TSP_RST_SRC_RB;
+    if (!(val & AST2700_SSP_TSP_RST_HOLD_RB)) {
+        val &= ~AST2700_SSP_TSP_RST_RB;
+        arm_set_cpu_on_and_reset(cpuid);
+    }
+
+    s->regs[reg] = val;
+}
+
+static void handle_2700_ssp_tsp_off(struct AspeedSCUState *s, int cpuid,
+                                    int reg)
+{
+    uint32_t val = s->regs[reg];
+
+    val |= AST2700_SSP_TSP_RST_RB;
+    val |= AST2700_SSP_TSP_RST_SRC_RB;
+    if (val & AST2700_SSP_TSP_RST) {
+        val |= AST2700_SSP_TSP_RST_HOLD_RB;
+    }
+    arm_set_cpu_off(cpuid);
+
+    s->regs[reg] = val;
+}
+
 static uint64_t aspeed_ast2700_scu_read(void *opaque, hwaddr offset,
                                         unsigned size)
 {
@@ -862,10 +903,14 @@ static uint64_t aspeed_ast2700_scu_read(void *opaque, hwaddr offset,
 static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
                                      uint64_t data64, unsigned size)
 {
+    Aspeed2700SCUState *a = ASPEED_2700_SCU(opaque);
     AspeedSCUState *s = ASPEED_SCU(opaque);
     int reg = TO_REG(offset);
     /* Truncate here so bitwise operations below behave as expected */
     uint32_t data = data64;
+    uint32_t active;
+    uint32_t oldval;
+    int cpuid;
 
     if (reg >= ASPEED_AST2700_SCU_NR_REGS) {
         qemu_log_mask(LOG_GUEST_ERROR,
@@ -877,6 +922,63 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
     trace_aspeed_ast2700_scu_write(offset, size, data);
 
     switch (reg) {
+    case AST2700_SCU_SSP_CTRL_0:
+        cpuid = a->ssp_cpuid;
+        if (cpuid < 0) {
+            return;
+        }
+        oldval = s->regs[reg];
+        data &= 0xff;
+        active = oldval ^ data;
+
+        /*
+         * If reset bit is being released (1 -> 0) and no other reset source
+         * is active, clear HOLD_RB and power on the corresponding CPU.
+         */
+        if ((active & AST2700_SSP_TSP_RST) && !(data & AST2700_SSP_TSP_RST)) {
+            s->regs[reg] &= ~AST2700_SSP_TSP_RST_HOLD_RB;
+            if ((oldval & AST2700_SSP_TSP_RST_RB) &&
+                !(oldval & AST2700_SSP_TSP_RST_SRC_RB)) {
+                handle_2700_ssp_tsp_on(s, cpuid, reg);
+            }
+        }
+
+        /*
+         * If ENABLE bit is newly set and reset state is ready,
+         * clear HOLD_RB and power on the corresponding CPU.
+         */
+        if ((active & AST2700_SSP_TSP_ENABLE) &&
+            (oldval & AST2700_SSP_TSP_RST_RB) &&
+            (oldval & AST2700_SSP_TSP_RST_HOLD_RB) &&
+            !(oldval & AST2700_SSP_TSP_RST_SRC_RB)) {
+                s->regs[reg] &= ~AST2700_SSP_TSP_RST_HOLD_RB;
+                handle_2700_ssp_tsp_on(s, cpuid, reg);
+        }
+
+        /* Auto-clear the ENABLE bit (one-shot behavior) */
+        data &= ~AST2700_SSP_TSP_ENABLE;
+        s->regs[reg] = (s->regs[reg] & ~0xff) | (data & 0xff);
+        return;
+    case AST2700_SCU_SYS_RST_CTRL_1:
+        if (a->ssp_cpuid < 0) {
+            return;
+        }
+        if (data & AST2700_SCU_SYS_RST_SSP) {
+            handle_2700_ssp_tsp_off(s, a->ssp_cpuid, AST2700_SCU_SSP_CTRL_0);
+        }
+        s->regs[reg] |= data;
+        return;
+    case AST2700_SCU_SYS_RST_CLR_1:
+        if (a->ssp_cpuid < 0) {
+            return;
+        }
+        oldval = s->regs[AST2700_SCU_SYS_RST_CTRL_1];
+        active = data & oldval;
+        if (active & AST2700_SCU_SYS_RST_SSP) {
+            handle_2700_ssp_tsp_on(s, a->ssp_cpuid, AST2700_SCU_SSP_CTRL_0);
+        }
+        s->regs[AST2700_SCU_SYS_RST_CTRL_1] &= ~active;
+        return;
     default:
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: Unhandled write at offset 0x%" HWADDR_PRIx "\n",
@@ -904,6 +1006,8 @@ static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS] = {
     [AST2700_HW_STRAP1_SEC1]        = 0x000000FF,
     [AST2700_HW_STRAP1_SEC2]        = 0x00000000,
     [AST2700_HW_STRAP1_SEC3]        = 0x1000408F,
+    [AST2700_SCU_SSP_CTRL_0]        = 0x000007FE,
+    [AST2700_SCU_SYS_RST_CTRL_1]    = 0xFFC37FDC,
     [AST2700_SCU_HPLL_PARAM]        = 0x0000009f,
     [AST2700_SCU_HPLL_EXT_PARAM]    = 0x8000004f,
     [AST2700_SCU_DPLL_PARAM]        = 0x0080009f,
@@ -923,12 +1027,17 @@ static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS] = {
 
 static void aspeed_ast2700_scu_reset_hold(Object *obj, ResetType type)
 {
+    Aspeed2700SCUState *a = ASPEED_2700_SCU(obj);
     AspeedSCUState *s = ASPEED_SCU(obj);
     AspeedSCUClass *asc = ASPEED_SCU_GET_CLASS(obj);
 
     memcpy(s->regs, asc->resets, asc->nr_regs * 4);
     s->regs[AST2700_SILICON_REV] = s->silicon_rev;
     s->regs[AST2700_HW_STRAP1] = s->hw_strap1;
+
+    if (a->ssp_cpuid > 0) {
+        arm_set_cpu_off(a->ssp_cpuid);
+    }
 }
 
 static void aspeed_2700_scu_realize(DeviceState *dev, Error **errp)
Signature · 1 line
2.43.0
author
#8 lore raw

PATCH v5 6/10 hw/misc/aspeed_scu: Implement TSP reset and power-on control via SCU registers

In reply to Jamin Lin

This patch implements TSP reset and power control logic in the SCU module for AST2700. It introduces support for the following behavior:

1. TSP Reset Trigger (via SCU 0x220):

- TSP reset is triggered by writing 1 to bit 9 (RW1S) of SYS_RESET_CTRL_2.

2. TSP Reset State and Source Hold (via SCU 0x160):

- Upon reset, bit 8 (RST_RB) is set to indicate the TSP is in reset.
- Bit 10 (RST_SRC_RB) is set to indicate the reset was triggered by an external source.
- Bit 1 (RST) is a software-controlled bit used to request holding TSP in reset.
- If an external reset source is present and bit 1 is set, bit 9 (RST_HOLD_RB) will also be asserted to indicate the TSP is being held in reset.
- If bit 1 is cleared, RST_HOLD_RB will be deasserted accordingly.

3. Hold Release and Power-on:

- If RST_HOLD_RB is clear (0), TSP is powered on immediately after reset is deasserted.
- If RST_HOLD_RB is set (1), the user must write ENABLE (bit 0) to TSP_CTRL_0 to release the hold and power on TSP explicitly.
- Writing ENABLE (bit 0) is a one-shot operation and will auto-clear after execution.

4. Reset Status Clear (via SCU 0x224):

- The reset status can be cleared by writing 1 to bit 9 (RW1C) of SYS_RST_CLR_2, which will deassert RST_SRC_RB and potentially trigger power-on if no hold is active.

5. TSP Power Control Logic:

- handle_ssp_tsp_on() clears RST_SRC_RB and RST_RB (if not held), and invokes arm_set_cpu_on_and_reset(cpuid) to power on the TSP core (CPUID 5).
- handle_ssp_tsp_off() sets RST_RB and RST_SRC_RB; if RST is active, also asserts RST_HOLD_RB and invokes arm_set_cpu_off(cpuid).

The default values are based on EVB (evaluation board) register dump observations. TSP reset control shares the same helper functions and register bit layout as SSP, with logic selected by cpuid and distinct external reset sources.

---
 hw/misc/aspeed_scu.c | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
hw/misc/aspeed_scu.c +36 -1
index 07901f2ab0..2a20253410 100644
@@ -147,6 +147,7 @@
 
 /* SSP TSP */
 #define AST2700_SCU_SSP_CTRL_0          TO_REG(0x120)
+#define AST2700_SCU_TSP_CTRL_0          TO_REG(0x160)
 #define AST2700_SSP_TSP_ENABLE          BIT(0)
 #define AST2700_SSP_TSP_RST             BIT(1)
 #define AST2700_SSP_TSP_RST_RB          BIT(8)
@@ -155,6 +156,9 @@
 #define AST2700_SCU_SYS_RST_CTRL_1      TO_REG(0x200)
 #define AST2700_SCU_SYS_RST_CLR_1       TO_REG(0x204)
 #define AST2700_SCU_SYS_RST_SSP         BIT(30)
+#define AST2700_SCU_SYS_RST_CTRL_2      TO_REG(0x220)
+#define AST2700_SCU_SYS_RST_CLR_2       TO_REG(0x224)
+#define AST2700_SCU_SYS_RST_TSP         BIT(9)
 
 #define AST2700_SCU_CLK_SEL_1       TO_REG(0x280)
 #define AST2700_SCU_HPLL_PARAM      TO_REG(0x300)
@@ -923,7 +927,10 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
 
     switch (reg) {
     case AST2700_SCU_SSP_CTRL_0:
-        cpuid = a->ssp_cpuid;
+    case AST2700_SCU_TSP_CTRL_0:
+        cpuid = (reg == AST2700_SCU_SSP_CTRL_0) ?
+                a->ssp_cpuid : a->tsp_cpuid;
+
         if (cpuid < 0) {
             return;
         }
@@ -979,6 +986,28 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
         }
         s->regs[AST2700_SCU_SYS_RST_CTRL_1] &= ~active;
         return;
+    case AST2700_SCU_SYS_RST_CTRL_2:
+        if (a->tsp_cpuid < 0) {
+            return;
+        }
+        data &= 0x00001fff;
+        if (data & AST2700_SCU_SYS_RST_TSP) {
+            handle_2700_ssp_tsp_off(s, a->tsp_cpuid, AST2700_SCU_TSP_CTRL_0);
+        }
+        s->regs[reg] |= data;
+        return;
+    case AST2700_SCU_SYS_RST_CLR_2:
+        if (a->tsp_cpuid < 0) {
+            return;
+        }
+        data &= 0x00001fff;
+        oldval = s->regs[AST2700_SCU_SYS_RST_CTRL_2];
+        active = data & oldval;
+        if (active & AST2700_SCU_SYS_RST_TSP) {
+            handle_2700_ssp_tsp_on(s, a->tsp_cpuid, AST2700_SCU_TSP_CTRL_0);
+        }
+        s->regs[AST2700_SCU_SYS_RST_CTRL_2] &= ~active;
+        return;
     default:
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: Unhandled write at offset 0x%" HWADDR_PRIx "\n",
@@ -1007,7 +1036,9 @@ static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS] = {
     [AST2700_HW_STRAP1_SEC2]        = 0x00000000,
     [AST2700_HW_STRAP1_SEC3]        = 0x1000408F,
     [AST2700_SCU_SSP_CTRL_0]        = 0x000007FE,
+    [AST2700_SCU_TSP_CTRL_0]        = 0x000007FE,
     [AST2700_SCU_SYS_RST_CTRL_1]    = 0xFFC37FDC,
+    [AST2700_SCU_SYS_RST_CTRL_2]    = 0x00001FFF,
     [AST2700_SCU_HPLL_PARAM]        = 0x0000009f,
     [AST2700_SCU_HPLL_EXT_PARAM]    = 0x8000004f,
     [AST2700_SCU_DPLL_PARAM]        = 0x0080009f,
@@ -1038,6 +1069,10 @@ static void aspeed_ast2700_scu_reset_hold(Object *obj, ResetType type)
     if (a->ssp_cpuid > 0) {
         arm_set_cpu_off(a->ssp_cpuid);
     }
+
+    if (a->tsp_cpuid > 0) {
+        arm_set_cpu_off(a->tsp_cpuid);
+    }
 }
 
 static void aspeed_2700_scu_realize(DeviceState *dev, Error **errp)
Signature · 1 line
2.43.0
author
#9 lore raw

PATCH v5 7/10 hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap

In reply to Jamin Lin

This commit adds SCU register support for SSP SDRAM remap control and runtime activation. It introduces logic for the PSP to dynamically configure the mapping of its own DRAM windows into SSP-visible SDRAM space, enabling shared memory communication via memory region aliases.

- coprocessor_sdram_remap[0]: maps PSP DRAM offset 0x400000000 (size: 0x1A77E000) to SSP SDRAM

    offset 0x5880000
- coprocessor_sdram_remap[1]: maps PSP DRAM offset 0x42C000000 (size: 0x05880000) to SSP SDRAM
    offset 0x0

The SCU registers AST2700_SCU_SSP_CTRL_1/2 and AST2700_SCU_SSP_REMAP_ADDR_{1,2} / REMAP_SIZE_{1,2} allow runtime reconfiguration of alias offset, base, and size.

|------------------------------------------|         |----------------------------|
|               PSP DRAM                   |         |        SSP SDRAM           |
|------------------------------------------|         |----------------------------|
| 0x4_0000_0000 (SCU_124 << 4)             |     --> | 0x0000_0000                |
|   remap1 base                            |---| |   |  - SCU_150: target addr    |
|   size: 0x1A77E000 (SCU_14C)             |   | |   |    remap2                  |
|------------------------------------------|   | |   |----------------------------|
|                                          |   | |   |                            |
| 0x4_2C00_0000 (SCU_128 << 4)             |-----|   | 0x5880000                  |
|   remap2 base                            |   |     |  - SCU_148: target addr    |
|   size: 0x05880000 (SCU_154)             |   |---> |    remap1                  |
|------------------------------------------|         |----------------------------|
---
 hw/misc/aspeed_scu.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
hw/misc/aspeed_scu.c +62 -0
index 2a20253410..6eeb1b12e1 100644
@@ -147,6 +147,14 @@
 
 /* SSP TSP */
 #define AST2700_SCU_SSP_CTRL_0          TO_REG(0x120)
+#define AST2700_SCU_SSP_CTRL_1          TO_REG(0x124)
+#define AST2700_SCU_SSP_CTRL_2          TO_REG(0x128)
+#define AST2700_SCU_SSP_REMAP_ADDR_0    TO_REG(0x140)
+#define AST2700_SCU_SSP_REMAP_SIZE_0    TO_REG(0x144)
+#define AST2700_SCU_SSP_REMAP_ADDR_1    TO_REG(0x148)
+#define AST2700_SCU_SSP_REMAP_SIZE_1    TO_REG(0x14C)
+#define AST2700_SCU_SSP_REMAP_ADDR_2    TO_REG(0x150)
+#define AST2700_SCU_SSP_REMAP_SIZE_2    TO_REG(0x154)
 #define AST2700_SCU_TSP_CTRL_0          TO_REG(0x160)
 #define AST2700_SSP_TSP_ENABLE          BIT(0)
 #define AST2700_SSP_TSP_RST             BIT(1)
@@ -909,6 +917,7 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
 {
     Aspeed2700SCUState *a = ASPEED_2700_SCU(opaque);
     AspeedSCUState *s = ASPEED_SCU(opaque);
+    MemoryRegion *mr = NULL;
     int reg = TO_REG(offset);
     /* Truncate here so bitwise operations below behave as expected */
     uint32_t data = data64;
@@ -966,6 +975,43 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
         data &= ~AST2700_SSP_TSP_ENABLE;
         s->regs[reg] = (s->regs[reg] & ~0xff) | (data & 0xff);
         return;
+    case AST2700_SCU_SSP_CTRL_1:
+    case AST2700_SCU_SSP_CTRL_2:
+        mr = (reg == AST2700_SCU_SSP_CTRL_1) ?
+            &a->dram_remap_alias[0] : &a->dram_remap_alias[1];
+        if (a->ssp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x7fffffff;
+        memory_region_transaction_begin();
+        memory_region_set_alias_offset(mr,
+                                       ((uint64_t) data << 4) & 0x3ffffffff);
+        memory_region_transaction_commit();
+        break;
+    case AST2700_SCU_SSP_REMAP_ADDR_1:
+    case AST2700_SCU_SSP_REMAP_ADDR_2:
+        mr = (reg == AST2700_SCU_SSP_REMAP_ADDR_1) ?
+            &a->dram_remap_alias[0] : &a->dram_remap_alias[1];
+        if (a->ssp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x3fffffff;
+        memory_region_transaction_begin();
+        memory_region_set_address(mr, data);
+        memory_region_transaction_commit();
+        break;
+    case AST2700_SCU_SSP_REMAP_SIZE_1:
+    case AST2700_SCU_SSP_REMAP_SIZE_2:
+        mr = (reg == AST2700_SCU_SSP_REMAP_SIZE_1) ?
+            &a->dram_remap_alias[0] : &a->dram_remap_alias[1];
+        if (a->ssp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x3fffffff;
+        memory_region_transaction_begin();
+        memory_region_set_size(mr, data);
+        memory_region_transaction_commit();
+        break;
     case AST2700_SCU_SYS_RST_CTRL_1:
         if (a->ssp_cpuid < 0) {
             return;
@@ -1036,6 +1082,14 @@ static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS] = {
     [AST2700_HW_STRAP1_SEC2]        = 0x00000000,
     [AST2700_HW_STRAP1_SEC3]        = 0x1000408F,
     [AST2700_SCU_SSP_CTRL_0]        = 0x000007FE,
+    [AST2700_SCU_SSP_CTRL_1]        = 0x40000000,
+    [AST2700_SCU_SSP_CTRL_2]        = 0x42C00000,
+    [AST2700_SCU_SSP_REMAP_ADDR_0]  = 0x1FFFE000,
+    [AST2700_SCU_SSP_REMAP_SIZE_0]  = 0x00002000,
+    [AST2700_SCU_SSP_REMAP_ADDR_1]  = 0x05880000,
+    [AST2700_SCU_SSP_REMAP_SIZE_1]  = 0x1A77E000,
+    [AST2700_SCU_SSP_REMAP_ADDR_2]  = 0x00000000,
+    [AST2700_SCU_SSP_REMAP_SIZE_2]  = 0x05880000,
     [AST2700_SCU_TSP_CTRL_0]        = 0x000007FE,
     [AST2700_SCU_SYS_RST_CTRL_1]    = 0xFFC37FDC,
     [AST2700_SCU_SYS_RST_CTRL_2]    = 0x00001FFF,
@@ -1068,6 +1122,14 @@ static void aspeed_ast2700_scu_reset_hold(Object *obj, ResetType type)
 
     if (a->ssp_cpuid > 0) {
         arm_set_cpu_off(a->ssp_cpuid);
+        memory_region_transaction_begin();
+        memory_region_set_address(&a->dram_remap_alias[0], 0x5880000);
+        memory_region_set_alias_offset(&a->dram_remap_alias[0], 0);
+        memory_region_set_size(&a->dram_remap_alias[0], 0x1a77e000);
+        memory_region_set_address(&a->dram_remap_alias[1], 0);
+        memory_region_set_alias_offset(&a->dram_remap_alias[1], 0x2c000000);
+        memory_region_set_size(&a->dram_remap_alias[1], 0x5880000);
+        memory_region_transaction_commit();
     }
 
     if (a->tsp_cpuid > 0) {
Signature · 1 line
2.43.0
author
#10 lore raw

PATCH v5 8/10 hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap

In reply to Jamin Lin

This commit adds SCU register support for TSP SDRAM remap control and runtime activation. Unlike SSP, the TSP does not support configurable target address remapping through SCU registers. It only supports setting the PSP DRAM base and size, which are then aliased into the TSP-visible SDRAM window.

coprocessor_sdram_remap[2]: maps PSP DRAM offset 0x42E000000 (size: 32MB) to TSP SDRAM

      offset 0x0

The SCU registers AST2700_SCU_TSP_CTRL_1 and
AST2700_SCU_TSP_REMAP_SIZE_2 allow runtime reconfiguration of the DRAM base (alias offset) and mapping size.

|------------------------------------------|         |----------------------------|
|               PSP DRAM                   |         |        TSP SDRAM           |
|------------------------------------------|         |----------------------------|
| 0x42E0_0000_0 (SCU_168 << 4)             |         | 0x0000_0000                |
|   remap base                             |------>  |  - fixed target addr       |
|   size: 32MB    (SCU_194)                |         |                            |
|------------------------------------------|         |----------------------------|
---
 hw/misc/aspeed_scu.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
hw/misc/aspeed_scu.c +29 -0
index 6eeb1b12e1..5c3f563dd5 100644
@@ -161,6 +161,8 @@
 #define AST2700_SSP_TSP_RST_RB          BIT(8)
 #define AST2700_SSP_TSP_RST_HOLD_RB     BIT(9)
 #define AST2700_SSP_TSP_RST_SRC_RB      BIT(10)
+#define AST2700_SCU_TSP_CTRL_1          TO_REG(0x168)
+#define AST2700_SCU_TSP_REMAP_SIZE_2    TO_REG(0x194)
 #define AST2700_SCU_SYS_RST_CTRL_1      TO_REG(0x200)
 #define AST2700_SCU_SYS_RST_CLR_1       TO_REG(0x204)
 #define AST2700_SCU_SYS_RST_SSP         BIT(30)
@@ -1012,6 +1014,27 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
         memory_region_set_size(mr, data);
         memory_region_transaction_commit();
         break;
+    case AST2700_SCU_TSP_CTRL_1:
+        mr = &a->dram_remap_alias[2];
+        if (a->tsp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x7fffffff;
+        memory_region_transaction_begin();
+        memory_region_set_alias_offset(mr,
+                                       ((uint64_t) data << 4) & 0x3ffffffff);
+        memory_region_transaction_commit();
+        break;
+    case AST2700_SCU_TSP_REMAP_SIZE_2:
+        mr = &a->dram_remap_alias[2];
+        if (a->tsp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x3fffffff;
+        memory_region_transaction_begin();
+        memory_region_set_size(mr, data);
+        memory_region_transaction_commit();
+        break;
     case AST2700_SCU_SYS_RST_CTRL_1:
         if (a->ssp_cpuid < 0) {
             return;
@@ -1091,6 +1114,8 @@ static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS] = {
     [AST2700_SCU_SSP_REMAP_ADDR_2]  = 0x00000000,
     [AST2700_SCU_SSP_REMAP_SIZE_2]  = 0x05880000,
     [AST2700_SCU_TSP_CTRL_0]        = 0x000007FE,
+    [AST2700_SCU_TSP_CTRL_1]        = 0x42E00000,
+    [AST2700_SCU_TSP_REMAP_SIZE_2]  = 0x02000000,
     [AST2700_SCU_SYS_RST_CTRL_1]    = 0xFFC37FDC,
     [AST2700_SCU_SYS_RST_CTRL_2]    = 0x00001FFF,
     [AST2700_SCU_HPLL_PARAM]        = 0x0000009f,
@@ -1134,6 +1159,10 @@ static void aspeed_ast2700_scu_reset_hold(Object *obj, ResetType type)
 
     if (a->tsp_cpuid > 0) {
         arm_set_cpu_off(a->tsp_cpuid);
+        memory_region_transaction_begin();
+        memory_region_set_alias_offset(&a->dram_remap_alias[2], 0x2e000000);
+        memory_region_set_size(&a->dram_remap_alias[2], 32 * MiB);
+        memory_region_transaction_commit();
     }
 }
 
Signature · 1 line
2.43.0
author
#11 lore raw

PATCH v5 9/10 tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP and load binaries from DRAM

In reply to Jamin Lin

SSP and TSP now boot in a powered-off state by default. Enabling them requires the PSP (Cortex-A35) to explicitly set SCU control registers at runtime. This behavior aligns with real hardware.

Update the AST2700 FC functional test to reflect this behavior by enabling SSP and TSP from the U-Boot shell before booting OpenBMC. The test now programs the required SCU registers, saves the environment, and boots the system so that SSP and TSP are powered on when the PSP starts.

Additionally, switch SSP and TSP loading from ELF-based CPU loaders to binary images loaded into PSP DRAM at fixed addresses, and remove the use of snapshot mode.

Changes include:
- Add enable_ast2700_ssp_tsp() to configure SCU registers via U-Boot
- Remove snapshot option from QEMU command line
- Load SSP binary at DRAM address 0x42C000000
- Load TSP binary at DRAM address 0x42E000000

---
 .../aarch64/test_aspeed_ast2700fc.py          | 29 ++++++++++---------
 1 file changed, 16 insertions(+), 13 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700fc.py +16 -13
index df889134ed..c0204ceb6c 100755
@@ -23,7 +23,7 @@ def do_test_aarch64_aspeed_sdk_start(self, image):
         self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2')
         self.vm.add_args('-netdev', 'user,id=net1')
         self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
-                         '-net', 'nic', '-net', 'user', '-snapshot')
+                         '-net', 'nic', '-net', 'user')
 
         self.vm.launch()
 
@@ -31,6 +31,12 @@ def disable_kernel_crypto_selftest(self):
          exec_command_and_wait_for_pattern(self,
             'setenv bootargs "${bootargs} cryptomgr.notests=1"', '=>')
 
+    def enable_ast2700_ssp_tsp(self):
+        exec_command_and_wait_for_pattern(self,
+            'setenv bootcmd "mw 12c02204 40000000; mw 12c02120 1; '
+            'mw 12c02224 00000200; mw 12c02160 1; run bootspi"', '=>')
+        exec_command_and_wait_for_pattern(self, 'saveenv', 'OK')
+
     def enable_ast2700_pcie2(self):
         exec_command_and_wait_for_pattern(self,
             'cp 100420000 403000000 900000', '=>')
@@ -48,6 +54,7 @@ def verify_openbmc_boot_and_login(self, name):
         wait_for_console_pattern(self, 'Hit any key to stop autoboot')
         exec_command_and_wait_for_pattern(self, '\012', '=>')
         self.disable_kernel_crypto_selftest()
+        self.enable_ast2700_ssp_tsp()
         self.enable_ast2700_pcie2()
         wait_for_console_pattern(self, 'Starting kernel ...')
 
@@ -55,16 +62,6 @@ def verify_openbmc_boot_and_login(self, name):
         exec_command_and_wait_for_pattern(self, 'root', 'Password:')
         exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#')
 
-    def load_ast2700fc_coprocessor(self, name):
-        load_elf_list = {
-            'ssp': self.scratch_file(name, 'zephyr-aspeed-ssp.elf'),
-            'tsp': self.scratch_file(name, 'zephyr-aspeed-tsp.elf')
-        }
-
-        for cpu_num, key in enumerate(load_elf_list, start=4):
-            file = load_elf_list[key]
-            self.vm.add_args('-device',
-                             f'loader,file={file},cpu-num={cpu_num}')
 
     ASSET_SDK_V1101_AST2700 = Asset(
             'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2700-default-image.tar.gz',
@@ -123,6 +120,14 @@ def start_ast2700fc_test(self, name):
                 'addr': '0x400000000',
                 'file': self.scratch_file(name, 'u-boot.bin')
             },
+            {
+                'addr': '0x42C000000',
+                'file': self.scratch_file(name, 'zephyr-aspeed-ssp.bin')
+            },
+            {
+                'addr': '0x42E000000',
+                'file': self.scratch_file(name, 'zephyr-aspeed-tsp.bin')
+            },
             {
                 'addr': '0x430000000',
                 'file': self.scratch_file(name, 'bl31.bin')
@@ -143,13 +148,11 @@ def start_ast2700fc_test(self, name):
             self.vm.add_args('-device',
                              f'loader,addr=0x430000000,cpu-num={i}')
 
-        self.load_ast2700fc_coprocessor(name)
         self.do_test_aarch64_aspeed_sdk_start(
                 self.scratch_file(name, 'image-bmc'))
 
     def start_ast2700fc_test_vbootrom(self, name):
         self.vm.add_args('-bios', 'ast27x0_bootrom.bin')
-        self.load_ast2700fc_coprocessor(name)
         self.do_test_aarch64_aspeed_sdk_start(
                 self.scratch_file(name, 'image-bmc'))
 
Signature · 1 line
2.43.0
author
#12 lore raw

PATCH v5 10/10 docs: Add support vbootrom and update Manual boot for ast2700fc

In reply to Jamin Lin
---
 docs/system/arm/aspeed.rst | 42 +++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 7 deletions(-)
docs/system/arm/aspeed.rst +35 -7
index 2d51ceeb84..b6dd757f6e 100644
@@ -386,18 +386,25 @@ Booting the ast2700fc machine
 AST2700 features four Cortex-A35 primary processors and two Cortex-M4 coprocessors.
 **ast2700-evb** machine focuses on emulating the four Cortex-A35 primary processors,
 **ast2700fc** machine extends **ast2700-evb** by adding support for the two Cortex-M4 coprocessors.
+There are two methods to boot the ast2700fc machine.
+
+Manual boot using ``-device loader``:
+
+In this approach, users manually load firmware and assign entry points via QEMU loader devices.
+By default, the PSP begins execution at address ``0x430000000``, the load address of the bl31
+firmware. The SSP and TSP start in the powered-off state and must be explicitly enabled by the
+PSP through writes to SCU registers.
 
 Steps to boot the AST2700fc machine:
 
-1. Ensure you have the following AST2700A1 binaries available in a directory
+1. Ensure you have the following AST2700 binaries available in a directory
 
- * u-boot-nodtb.bin
- * u-boot.dtb
+ * u-boot.bin
  * bl31.bin
  * optee/tee-raw.bin
  * image-bmc
- * zephyr-aspeed-ssp.elf (for SSP firmware, CPU 5)
- * zephyr-aspeed-tsp.elf (for TSP firmware, CPU 6)
+ * zephyr-aspeed-ssp.bin (for SSP firmware, CPU 5)
+ * zephyr-aspeed-tsp.bin (for TSP firmware, CPU 6)
 
 2. Execute the following command to start ``ast2700fc`` machine:
 
@@ -407,6 +414,8 @@ Steps to boot the AST2700fc machine:
 
   $ qemu-system-aarch64 -M ast2700fc \
        -device loader,force-raw=on,addr=0x400000000,file=${IMGDIR}/u-boot.bin \
+       -device loader,force-raw=on,addr=0x42C000000,file=${IMGDIR}/zephyr-aspeed-ssp.bin \
+       -device loader,force-raw=on,addr=0x42E000000,file=${IMGDIR}/zephyr-aspeed-tsp.bin \
        -device loader,force-raw=on,addr=0x430000000,file=${IMGDIR}/bl31.bin \
        -device loader,force-raw=on,addr=0x430080000,file=${IMGDIR}/optee/tee-raw.bin \
        -device loader,cpu-num=0,addr=0x430000000 \
@@ -414,12 +423,31 @@ Steps to boot the AST2700fc machine:
        -device loader,cpu-num=2,addr=0x430000000 \
        -device loader,cpu-num=3,addr=0x430000000 \
        -drive file=${IMGDIR}/image-bmc,if=mtd,format=raw \
-       -device loader,file=${IMGDIR}/zephyr-aspeed-ssp.elf,cpu-num=4 \
-       -device loader,file=${IMGDIR}/zephyr-aspeed-tsp.elf,cpu-num=5 \
        -serial pty -serial pty -serial pty \
        -snapshot \
        -S -nographic
 
+Boot using a virtual boot ROM (-bios):
+
+In this method, the virtual boot ROM (vbootrom) handles the full initialization sequence.
+It starts the PSP, which then enables the SSP and TSP by programming the appropriate SCU
+registers, following the hardware behavior.
+
+Execute the following command to start ``ast2700fc`` machine:
+
+.. code-block:: bash
+
+  IMGDIR=ast2700-default
+
+  $ qemu-system-aarch64 -M ast2700fc \
+      -bios ast27x0_bootrom.bin \
+      -drive file=${IMGDIR}/image-bmc,if=mtd,format=raw \
+      -serial pty -serial pty -serial pty \
+      -snapshot \
+      -S -nographic
+
+Serial Console Redirection:
+
 After launching QEMU, serial devices will be automatically redirected.
 Example output:
 
Signature · 1 line
2.43.0
#13 lore raw

Re: [PATCH v5 10/10] docs: Add support vbootrom and update Manual boot for ast2700fc

Hello,

Quoted 41 lines · Jamin Lin
---
  docs/system/arm/aspeed.rst | 42 +++++++++++++++++++++++++++++++-------
  1 file changed, 35 insertions(+), 7 deletions(-)
docs/system/arm/aspeed.rst +12 -5
index 2d51ceeb84..b6dd757f6e 100644
@@ -386,18 +386,25 @@ Booting the ast2700fc machine
  AST2700 features four Cortex-A35 primary processors and two Cortex-M4 coprocessors.
  **ast2700-evb** machine focuses on emulating the four Cortex-A35 primary processors,
  **ast2700fc** machine extends **ast2700-evb** by adding support for the two Cortex-M4 coprocessors.
+There are two methods to boot the ast2700fc machine.
+
+Manual boot using ``-device loader``:
+
+In this approach, users manually load firmware and assign entry points via QEMU loader devices.
+By default, the PSP begins execution at address ``0x430000000``, the load address of the bl31
+firmware. The SSP and TSP start in the powered-off state and must be explicitly enabled by the
+PSP through writes to SCU registers.
 
  Steps to boot the AST2700fc machine:
 
-1. Ensure you have the following AST2700A1 binaries available in a directory
+1. Ensure you have the following AST2700 binaries available in a directory
 
- * u-boot-nodtb.bin
- * u-boot.dtb
+ * u-boot.bin
   * bl31.bin
   * optee/tee-raw.bin
   * image-bmc
- * zephyr-aspeed-ssp.elf (for SSP firmware, CPU 5)
- * zephyr-aspeed-tsp.elf (for TSP firmware, CPU 6)
+ * zephyr-aspeed-ssp.bin (for SSP firmware, CPU 5)
+ * zephyr-aspeed-tsp.bin (for TSP firmware, CPU 6)
 
  2. Execute the following command to start ``ast2700fc`` machine:
 

docs/system/arm/aspeed.rst Steps to boot the AST2700fc machine: · line 421

Quoted 8 lines
docs/system/arm/aspeed.rst +2 -0
@@ -407,6 +414,8 @@ Steps to boot the AST2700fc machine:
 
    $ qemu-system-aarch64 -M ast2700fc \
         -device loader,force-raw=on,addr=0x400000000,file=${IMGDIR}/u-boot.bin \
+       -device loader,force-raw=on,addr=0x42C000000,file=${IMGDIR}/zephyr-aspeed-ssp.bin \
+       -device loader,force-raw=on,addr=0x42E000000,file=${IMGDIR}/zephyr-aspeed-tsp.bin \
         -device loader,force-raw=on,addr=0x430000000,file=${IMGDIR}/bl31.bin \
         -device loader,force-raw=on,addr=0x430080000,file=${IMGDIR}/optee/tee-raw.bin \
         -device loader,cpu-num=0,addr=0x430000000 \

Orthogonal to your work, I found this setup interesting to stress my work-in-progress 'split-accel' branch, running QEMU with HVF when possible, otherwise TCG.

I manually started the SSP & TSP first:

=> mw 12c02204 40000000
mw 12c02204 40000000
=> mw 12c02120 1
mw 12c02120 1
=> mw 12c02224 00000200
mw 12c02224 00000200
=> mw 12c02160 1
mw 12c02160 1

Surprisingly I could boot up to the guest login prompt spending most of the time using HVF

(qemu) info accel
36 transitions, 10943 SW and 86815 HW executions
Accelerator settings:
one-insn-per-tb: off

Translation buffer state:

gen code size       9098100/1072906240
TB count            16086
TB avg target size  14 max=468 bytes
TB avg host size    230 bytes (expansion ratio: 15.8)
cross page TB count 12 (0%)
direct jump count   8371 (52%) (2 jumps=5949 36%)
TB hash buckets     4813/8192 (58.75% head buckets used)
TB hash occupancy   21.05% avg chain occ. Histogram: [0,10)%|█▁▇▁ ▃▁▁▁▁|[90,100]%
TB hash avg chain   1.059 buckets. Histogram: 1|█▁|2

Statistics:
TB flush count 0
TB invalidate count 8796
TLB full flushes 0
TLB partial flushes 268
TLB elided flushes 53158
CPU#0: cortex-a35
HVF cumulative execution time: 7.020s
CPU#1: cortex-a35
HVF cumulative execution time: 6.000s
CPU#2: cortex-a35
HVF cumulative execution time: 6.805s
CPU#3: cortex-a35
HVF cumulative execution time: 7.656s
CPU#4: cortex-m4
HVF cumulative execution time: 0.000s
CPU#5: cortex-m4
HVF cumulative execution time: 0.000s
(qemu)

Over 10700 "SW executions" are the M-profiles running, only 162 correspond to A-profiles :)

Thanks for this motivating setup!

Phil.

Tested-by on the v5 series
#14 lore raw
In reply to Jamin Lin
Quoted 5 lines · Jamin Lin

This series improves AST2700 platform support by aligning SSP/TSP power and reset behavior with hardware, and enabling DRAM remapping required for proper firmware boot flow.

Quoted 16 lines

Jamin Lin (10):
hw/arm/ast27x0: Start SSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Start TSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU
registers
hw/misc/aspeed_scu: Implement TSP reset and power-on control via SCU
registers
hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP
and load binaries from DRAM
docs: Add support vbootrom and update Manual boot for ast2700fc

Series:

2 notes:

1/ I3C errors in dmesg:

[    8.151230]  14c20000.i3c0: MIPI I3C HCI v0.0 r00
[    8.151498]  14c20000.i3c0: unsupported HCI version
[    8.151761] mipi-i3c-hci 14c20000.i3c0: probe with driver mipi-i3c-hci failed with error -93
[    8.152250]  14c21000.i3c1: MIPI I3C HCI v0.0 r00
[    8.152518]  14c21000.i3c1: unsupported HCI version
[    8.152779] mipi-i3c-hci 14c21000.i3c1: probe with driver mipi-i3c-hci failed with error -93
[    8.153322]  14c22000.i3c2: MIPI I3C HCI v0.0 r00
[    8.153588]  14c22000.i3c2: unsupported HCI version
[    8.153853] mipi-i3c-hci 14c22000.i3c2: probe with driver mipi-i3c-hci failed with error -93

...

2/ shutdown not working

[  246.405297] systemd-shutdown[1]: Entering exitrd...

shutdown: poweroff --timeout=90000000us --log-level info --log-target=kmsg --log-color --exit-code=0 /shutdown: line 97: poweroff: not found
Execute poweroff -f if all unmounted ok, or exec /init
shutdown-sh#

author
#15 lore raw

Hi Philippe

Quoted 42 lines · Jamin Lin
Quoted 5 lines

This series improves AST2700 platform support by aligning SSP/TSP power and reset behavior with hardware, and enabling DRAM remapping required for proper firmware boot flow.

Quoted 10 lines

Jamin Lin (10):
hw/arm/ast27x0: Start SSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Start TSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU
registers
hw/misc/aspeed_scu: Implement TSP reset and power-on control via

SCU

Quoted 6 lines

registers
hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP
and load binaries from DRAM
docs: Add support vbootrom and update Manual boot for ast2700fc

Series:

2 notes:

1/ I3C errors in dmesg:

[    8.151230]  14c20000.i3c0: MIPI I3C HCI v0.0 r00
[    8.151498]  14c20000.i3c0: unsupported HCI version
[    8.151761] mipi-i3c-hci 14c20000.i3c0: probe with driver
mipi-i3c-hci failed with error -93
[    8.152250]  14c21000.i3c1: MIPI I3C HCI v0.0 r00
[    8.152518]  14c21000.i3c1: unsupported HCI version
[    8.152779] mipi-i3c-hci 14c21000.i3c1: probe with driver
mipi-i3c-hci failed with error -93
[    8.153322]  14c22000.i3c2: MIPI I3C HCI v0.0 r00
[    8.153588]  14c22000.i3c2: unsupported HCI version
[    8.153853] mipi-i3c-hci 14c22000.i3c2: probe with driver
Quoted 2 lines

mipi-i3c-hci failed with error -93
...

The AST2700 I3C controller implements the MIPI I3C HCI specification, which is not yet supported by QEMU. Currently, QEMU only provides an I3C model for the DesignWare controller used on the AST2600.

Quoted 8 lines

2/ shutdown not working

[  246.405297] systemd-shutdown[1]: Entering exitrd...

shutdown: poweroff --timeout=90000000us --log-level info --log-target=kmsg --log-color --exit-code=0
/shutdown: line 97: poweroff: not found
Execute poweroff -f if all unmounted ok, or exec /init shutdown-sh#

OpenBMC currently only supports reboot.
Invoking shutdown causes the system to return to the Linux initramfs instead of powering off.

Thanks,
Jamin

author
#16 lore raw

+ Joe(Google), Nabih(Google), Lucien(siemens)

*

Quoted 48 lines

Hi Philippe

Quoted 6 lines · Jamin Lin
Quoted 3 lines

This series improves AST2700 platform support by aligning SSP/TSP power and reset behavior with hardware, and enabling DRAM remapping required for proper firmware boot flow.

Quoted 8 lines
Quoted 8 lines

Jamin Lin (10):
hw/arm/ast27x0: Start SSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Start TSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap hw/misc/aspeed_scu: Implement SSP reset and power-on control via

SCU

Quoted 28 lines
Quoted 2 lines

registers
hw/misc/aspeed_scu: Implement TSP reset and power-on control via

SCU

Quoted 6 lines

registers
hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP
and load binaries from DRAM
docs: Add support vbootrom and update Manual boot for ast2700fc

Series:

2 notes:

1/ I3C errors in dmesg:

[    8.151230]  14c20000.i3c0: MIPI I3C HCI v0.0 r00
[    8.151498]  14c20000.i3c0: unsupported HCI version
[    8.151761] mipi-i3c-hci 14c20000.i3c0: probe with driver
mipi-i3c-hci failed with error -93
[    8.152250]  14c21000.i3c1: MIPI I3C HCI v0.0 r00
[    8.152518]  14c21000.i3c1: unsupported HCI version
[    8.152779] mipi-i3c-hci 14c21000.i3c1: probe with driver
mipi-i3c-hci failed with error -93
[    8.153322]  14c22000.i3c2: MIPI I3C HCI v0.0 r00
[    8.153588]  14c22000.i3c2: unsupported HCI version
[    8.153853] mipi-i3c-hci 14c22000.i3c2: probe with driver
Quoted 2 lines

mipi-i3c-hci failed with error -93
...

Quoted 5 lines

The AST2700 I3C controller implements the MIPI I3C HCI specification, which is not yet supported by QEMU.
Currently, QEMU only provides an I3C model for the DesignWare controller used on the AST2600.

Nabih, Joe, Lucien,

As far as I know, you have implemented support for the I3C HCI controller on the AST2700 platform, and it appears to work well in your local QEMU environment. Do you have any plans to upstream this work?
If you are planning to upstream the I3C HCI support, it would be greatly appreciated.

Thanks,
Jamin

Quoted 15 lines
Quoted 8 lines

2/ shutdown not working

[  246.405297] systemd-shutdown[1]: Entering exitrd...

shutdown: poweroff --timeout=90000000us --log-level info --log-target=kmsg --log-color --exit-code=0
/shutdown: line 97: poweroff: not found Execute poweroff -f if all unmounted ok, or exec /init shutdown-sh#

OpenBMC currently only supports reboot.
Invoking shutdown causes the system to return to the Linux initramfs instead of powering off.

Thanks,
Jamin

#17 lore raw

Hi Jamin,

Quoted 1 line

As far as I know, you have implemented support for the I3C HCI controller on the AST2700 platform, and it appears to work well in your local QEMU environment.

The model we wrote was against the Linux kernel drivers specific to the AST2700 kernel drivers we see and are not generic HCI versions.

We have discussed it but weren’t making a huge rush because of internal process of upstreaming from taking time.
If that’s useful and if these are ahead of others in this thread I can expedite the work of upstreaming - please le me know your priorities for that.

Cheers,
Luc

-----Original Message-----
From: Jamin Lin <[email protected]>
Sent: Thursday, July 9, 2026 10:11 AM
To: Philippe Mathieu-Daudé <[email protected]>; Cédric Le Goater <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Kane Chen <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; Pierrick Bouvier <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>; Nabih Estefan <[email protected]>; Joe Komlodi <[email protected]>; Murray-Pitts, Lucien (DI SW EDA HAV SLSPE) <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: RE: [PATCH v5 00/10] Add SSP/TSP power control and DRAM remap support for AST2700

+ Joe(Google), Nabih(Google), Lucien(siemens)

*

Quoted 50 lines

Hi Philippe

Quoted 6 lines · Jamin Lin
Quoted 3 lines

This series improves AST2700 platform support by aligning SSP/TSP power and reset behavior with hardware, and enabling DRAM remapping required for proper firmware boot flow.

Quoted 9 lines
Quoted 9 lines

Jamin Lin (10):
hw/arm/ast27x0: Start SSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Start TSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap hw/misc/aspeed_scu: Implement SSP reset and power-on control
via

SCU

Quoted 29 lines
Quoted 3 lines

registers
hw/misc/aspeed_scu: Implement TSP reset and power-on control
via

SCU

Quoted 6 lines

registers
hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP
and load binaries from DRAM
docs: Add support vbootrom and update Manual boot for ast2700fc

Series:

2 notes:

1/ I3C errors in dmesg:

[    8.151230]  14c20000.i3c0: MIPI I3C HCI v0.0 r00
[    8.151498]  14c20000.i3c0: unsupported HCI version
[    8.151761] mipi-i3c-hci 14c20000.i3c0: probe with driver
mipi-i3c-hci failed with error -93
[    8.152250]  14c21000.i3c1: MIPI I3C HCI v0.0 r00
[    8.152518]  14c21000.i3c1: unsupported HCI version
[    8.152779] mipi-i3c-hci 14c21000.i3c1: probe with driver
mipi-i3c-hci failed with error -93
[    8.153322]  14c22000.i3c2: MIPI I3C HCI v0.0 r00
[    8.153588]  14c22000.i3c2: unsupported HCI version
[    8.153853] mipi-i3c-hci 14c22000.i3c2: probe with driver
Quoted 2 lines

mipi-i3c-hci failed with error -93
...

Quoted 5 lines

The AST2700 I3C controller implements the MIPI I3C HCI specification, which is not yet supported by QEMU.
Currently, QEMU only provides an I3C model for the DesignWare controller used on the AST2600.

Nabih, Joe, Lucien,

As far as I know, you have implemented support for the I3C HCI controller on the AST2700 platform, and it appears to work well in your local QEMU environment. Do you have any plans to upstream this work?
If you are planning to upstream the I3C HCI support, it would be greatly appreciated.

Thanks,
Jamin

Quoted 15 lines
Quoted 8 lines

2/ shutdown not working

[  246.405297] systemd-shutdown[1]: Entering exitrd...

shutdown: poweroff --timeout=90000000us --log-level info --log-target=kmsg --log-color --exit-code=0
/shutdown: line 97: poweroff: not found Execute poweroff -f if all unmounted ok, or exec /init shutdown-sh#

OpenBMC currently only supports reboot.
Invoking shutdown causes the system to return to the Linux initramfs instead of powering off.

Thanks,
Jamin

author
#18 lore raw

Hi Lucien

Quoted 7 lines

Hi Jamin,

Quoted 1 line

As far as I know, you have implemented support for the I3C HCI controller on

the AST2700 platform, and it appears to work well in your local QEMU environment.

Quoted 8 lines

The model we wrote was against the Linux kernel drivers specific to the AST2700 kernel drivers we see and are not generic HCI versions.

We have discussed it but weren’t making a huge rush because of internal process of upstreaming from taking time.
If that’s useful and if these are ahead of others in this thread I can expedite the work of upstreaming - please le me know your priorities for that.

Thank you for your reply.

I'm currently investigating whether customers who have already implemented an I3C HCI model would be willing to upstream their work. We have also received inquiries from other customers asking about I3C HCI support.

If no existing implementation is expected to be upstreamed, I may consider working on this task and contributing it upstream myself.
This is not a top priority or an urgent task at the moment.
I'm simply trying to understand whether there are any plans to upstream an existing implementation so that we can decide whether ASPEED should invest effort in developing this model.

If your team is planning to upstream your implementation, I would greatly appreciate it.

Thanks,
Jamin

Quoted 105 lines

Cheers,
Luc

-----Original Message-----
From: Jamin Lin <[email protected]>
Sent: Thursday, July 9, 2026 10:11 AM
To: Philippe Mathieu-Daudé <[email protected]>; Cédric Le Goater <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Kane Chen <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; Pierrick Bouvier <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>; Nabih Estefan <[email protected]>; Joe Komlodi <[email protected]>; Murray-Pitts, Lucien (DI SW EDA HAV SLSPE) <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: RE: [PATCH v5 00/10] Add SSP/TSP power control and DRAM remap support for AST2700

+ Joe(Google), Nabih(Google), Lucien(siemens)

*

Quoted 17 lines

Hi Philippe

Quoted 6 lines · Jamin Lin
Quoted 3 lines

This series improves AST2700 platform support by aligning SSP/TSP power and reset behavior with hardware, and enabling DRAM remapping required for proper firmware boot flow.

Quoted 9 lines
Quoted 9 lines

Jamin Lin (10):
hw/arm/ast27x0: Start SSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Start TSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap hw/misc/aspeed_scu: Implement SSP reset and power-on control
via

Quoted 9 lines

SCU

Quoted 8 lines
Quoted 3 lines

registers
hw/misc/aspeed_scu: Implement TSP reset and power-on control
via

SCU

Quoted 4 lines

registers
hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via

PSP

Quoted 24 lines
Quoted 21 lines
Quoted 2 lines

and load binaries from DRAM
docs: Add support vbootrom and update Manual boot for ast2700fc

Series:

2 notes:

1/ I3C errors in dmesg:

[    8.151230]  14c20000.i3c0: MIPI I3C HCI v0.0 r00
[    8.151498]  14c20000.i3c0: unsupported HCI version
[    8.151761] mipi-i3c-hci 14c20000.i3c0: probe with driver
mipi-i3c-hci failed with error -93
[    8.152250]  14c21000.i3c1: MIPI I3C HCI v0.0 r00
[    8.152518]  14c21000.i3c1: unsupported HCI version
[    8.152779] mipi-i3c-hci 14c21000.i3c1: probe with driver
mipi-i3c-hci failed with error -93
[    8.153322]  14c22000.i3c2: MIPI I3C HCI v0.0 r00
[    8.153588]  14c22000.i3c2: unsupported HCI version
[    8.153853] mipi-i3c-hci 14c22000.i3c2: probe with driver
Quoted 2 lines

mipi-i3c-hci failed with error -93
...

Quoted 5 lines

The AST2700 I3C controller implements the MIPI I3C HCI specification, which is not yet supported by QEMU.
Currently, QEMU only provides an I3C model for the DesignWare controller used on the AST2600.

Nabih, Joe, Lucien,

As far as I know, you have implemented support for the I3C HCI controller on the AST2700 platform, and it appears to work well in your local QEMU environment.
Do you have any plans to upstream this work?
If you are planning to upstream the I3C HCI support, it would be greatly appreciated.

Thanks,
Jamin

Quoted 15 lines
Quoted 8 lines

2/ shutdown not working

[  246.405297] systemd-shutdown[1]: Entering exitrd...

shutdown: poweroff --timeout=90000000us --log-level info --log-target=kmsg --log-color --exit-code=0
/shutdown: line 97: poweroff: not found Execute poweroff -f if all unmounted ok, or exec /init shutdown-sh#

OpenBMC currently only supports reboot.
Invoking shutdown causes the system to return to the Linux initramfs instead of powering off.

Thanks,
Jamin

#19 lore raw
In reply to Jamin Lin

Hello Jamin,

Quoted 68 lines · Jamin Lin

This series improves AST2700 platform support by aligning SSP/TSP power and reset behavior with hardware, and enabling DRAM remapping required for proper firmware boot flow.

This series depends on:
[v2,0/8] Refactor AST2700 SCU preparation for coprocessors
https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/

v1:
1. The changes move DRAM/SDMC initialization earlier to support memory
aliasing, add DRAM aliases for SSP/TSP SDRAM remap, and implement SSP/TSP reset, power-on, and remap controls via SCU registers.
2. With these updates, SSP and TSP can be booted via PSP and load their
binaries from DRAM. Functional tests and documentation are updated accordingly.

v2:
Fix "make check" failure caused by both AST2700 and AST1700 realizing the same TYPE_AST2700_SCU model.

v3:
1. Drop "Move DRAM and SDMC initialization earlier to support memory aliasing"
2. Support SPI/FMC FIFO Mode
3. Add unimplemented devices

v4:
1. Introduce Aspeed2700SCU subclass and separate from generic SCU.
2. Add separate reset handler for AST2700 SCUIO
3. Add AST2700 SCUIO RNG control and data registers
4. Share single SCUIO instance across PSP, SSP, and TSP
5. Fix AST2700 FC hardware strap settings

v5:
1. To speed up the review process, move the following patches into a separate patch series, as they are not directly related to the main topic of this series:

[v4,01/21] hw/misc/aspeed_scu: Introduce Aspeed2700SCU subclass and separate from generic SCU [v4,02/21] hw/misc/aspeed_scu: Add separate reset handler for AST2700 SCUIO
[v4,11/21] hw/arm/ast27x0: Share FMC controller with SSP and TSP
[v4,12/21] hw/arm/aspeed_ast27x0: Add unimplemented Privilege Controller MMIO regions for SSP/TSP (Merged) [v4,13/21] hw/arm/aspeed_ast27x0: Add unimplemented OTP controller MMIO regions for SSP/TSP (Merged) [v4,14/21] hw/block/m25p80: Implement volatile status register write enable for Winbond [v4,15/21] hw/ssi/aspeed_smc: Add Data FIFO-based flash access support for AST2700 [v4,16/21] hw/misc/aspeed_scu: Drop noisy unhandled read logs for AST2700 SCU/SCUIO (Merged) [v4,17/21] hw/misc/aspeed_scu: Add AST2700 SCUIO RNG control and data registers (Merged) [v4,18/21] hw/arm/ast27x0: Share single SCUIO instance across PSP, SSP, and TSP [v4,19/21] hw/arm/aspeed_ast27x0-fc: Fix hardware strap settings (Merged)

2. Add memory_region_transaction_begin() and memory_region_transaction_commit() to protect the transaction.

Jamin Lin (10):
hw/arm/ast27x0: Start SSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Start TSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU
registers
hw/misc/aspeed_scu: Implement TSP reset and power-on control via SCU
registers
hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP
and load binaries from DRAM
docs: Add support vbootrom and update Manual boot for ast2700fc

Quoted 10 lines
  docs/system/arm/aspeed.rst                    |  42 ++-
  include/hw/misc/aspeed_scu.h                  |   5 +
  hw/arm/aspeed_ast27x0-fc.c                    |   4 +
  hw/arm/aspeed_ast27x0-ssp.c                   |  13 +
  hw/arm/aspeed_ast27x0-tsp.c                   |  10 +
  hw/arm/aspeed_ast27x0.c                       |   6 +
  hw/misc/aspeed_scu.c                          | 285 ++++++++++++++++++
  .../aarch64/test_aspeed_ast2700fc.py          |  29 +-
  8 files changed, 374 insertions(+), 20 deletions(-)

Here are some general comments on the design,

* Aspeed SCU Models

Aspeed2700SCUState is used by 3 instances:
- 1 PSP SCU, then linked in SSP and TSP
- 2 I/O expander SCUs (all aspeed.scu-ast2700)

AspeedSCUState (the parent) is used by SCUIO (aspeed.scuio-ast2700)

The I/O expander embeds Aspeed2700SCUState and gets the full dram_remap_alias[3], ssp_cpuid, tsp_cpuid, and dram link. none of which make sense for I/O.

Also, I doubt the whole register space is implemented for all SoCs. This model seems overused to me and The I/O expander would need a fix to separate the SCU type.

* remap Memory Regions

I think we need to reorganize the code.

The dram_remap Memory regions belong to the SSP and TSP coprocessor SoC states. Makes more sense to me. The only reason they are under SCU today is because it makes things easier for the memory region controls.

So :

include/hw/arm/aspeed_coprocessor.h:

  @@ -57,6 +57,8 @@ struct Aspeed27x0CoprocessorState {
       MemoryRegion scu_alias;
       MemoryRegion scuio_alias;
       MemoryRegion fmc_alias;
  +    MemoryRegion dram_remap[2];
  +    MemoryRegion *dram;
       Aspeed2700SCUState *scu;
       AspeedSCUState *scuio;
       AspeedSMCState *fmc;
  include/hw/misc/aspeed_scu.h:
  @@ -45,8 +45,8 @@ struct AspeedSCUState {
   struct Aspeed2700SCUState {
       AspeedSCUState parent_obj;

+ MemoryRegion *ssp_remap[2];
+ MemoryRegion *tsp_remap;

static const Property aspeed_2700_scu_properties[] = {
+ DEFINE_PROP_LINK("ssp-remap-0", Aspeed2700SCUState, ssp_remap[0],
+ TYPE_MEMORY_REGION, MemoryRegion *),
+ DEFINE_PROP_LINK("ssp-remap-1", Aspeed2700SCUState, ssp_remap[1],
+ TYPE_MEMORY_REGION, MemoryRegion *),
+ DEFINE_PROP_LINK("tsp-remap", Aspeed2700SCUState, tsp_remap,
+ TYPE_MEMORY_REGION, MemoryRegion *),

    };

The TSP and SSP models would initialize the alias(es) always :

hw/arm/aspeed_ast27x0-ssp.c:
+ /* DRAM remap aliases for PSP to access SSP SDRAM */
+ 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]);
+ object_property_set_link(OBJECT(a->scu), "ssp-remap-0",
+ OBJECT(&a->dram_remap[0]), &error_abort);
+ object_property_set_link(OBJECT(a->scu), "ssp-remap-1",
+ OBJECT(&a->dram_remap[1]), &error_abort);

       /* INTC */
       if (!sysbus_realize(SYS_BUS_DEVICE(&a->intc[0]), errp)) {

@@ -323,6 +330,8 @@ static const Property aspeed_27x0_coproc
TYPE_ASPEED_SCU, AspeedSCUState *),
DEFINE_PROP_LINK("fmc", Aspeed27x0CoprocessorState, fmc, TYPE_ASPEED_SMC,
AspeedSMCState *),
+ DEFINE_PROP_LINK("dram", Aspeed27x0CoprocessorState, dram,
+ TYPE_MEMORY_REGION, MemoryRegion *),
};

hw/arm/aspeed_ast27x0-fc.c:

       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",

In SCU, we can drop the aspeed_2700_scu_realize() changes and the control bits become :

  hw/misc/aspeed_scu.c:
       case AST2700_SCU_SSP_CTRL_1:
       case AST2700_SCU_SSP_CTRL_2:
  +        mr = (reg == AST2700_SCU_SSP_CTRL_1) ? a->ssp_remap[0] : a->ssp_remap[1];
           if (a->ssp_cpuid < 0 || mr == NULL) {
               return;
           }

* CPU index

As for the "tsp-cpuid" and "ssp-cpuid" properties, we have a chicken&egg issue because the shared SCU model needs to be realized and the SSP and TSP CPUs too.

I would be tempted to simply bypass QOM to avoid hardcoding cpu_index values:

hw/arm/aspeed_ast27x0-ssp.c:

        object_property_set_bool(OBJECT(&a->armv7m), "start-powered-off", true,
                                 &error_abort);
        sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);

+ a->scu->ssp_cpuid = CPU(a->armv7m.cpu)->cpu_index;

/* SDRAM */
sdram_name = g_strdup_printf("aspeed.sdram.%d",

hw/arm/aspeed_ast27x0-tsp.c:

        object_property_set_bool(OBJECT(&a->armv7m), "start-powered-off", true,
                                 &error_abort);
        sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);

+ a->scu->tsp_cpuid = CPU(a->armv7m.cpu)->cpu_index;

/* SDRAM */
sdram_name = g_strdup_printf("aspeed.sdram.%d",

Or keep it that way for now.

Thanks,

C.

author
#20 lore raw

Hi Cédric

Quoted 238 lines

Subject: Re: [PATCH v5 00/10] Add SSP/TSP power control and DRAM remap support for AST2700

Hello Jamin,

Quoted 17 lines · Jamin Lin

This series improves AST2700 platform support by aligning SSP/TSP power and reset behavior with hardware, and enabling DRAM remapping required for proper firmware boot flow.

This series depends on:
[v2,0/8] Refactor AST2700 SCU preparation for coprocessors
https://patchwork.kernel.org/project/qemu-devel/cover/20260707060919.3
[email protected]/

v1:
1. The changes move DRAM/SDMC initialization earlier to support
memory aliasing, add DRAM aliases for SSP/TSP SDRAM remap, and implement SSP/TSP reset, power-on, and remap controls via SCU registers.
2. With these updates, SSP and TSP can be booted via PSP and load
their binaries from DRAM. Functional tests and documentation are updated accordingly.

Quoted 2 lines

v2:
Fix "make check" failure caused by both AST2700 and AST1700 realizing

the same

Quoted 4 lines
   TYPE_AST2700_SCU model.

v3:
1. Drop "Move DRAM and SDMC initialization earlier to support memory

aliasing"

Quoted 10 lines

2. Support SPI/FMC FIFO Mode
3. Add unimplemented devices

v4:
1. Introduce Aspeed2700SCU subclass and separate from generic SCU.
2. Add separate reset handler for AST2700 SCUIO
3. Add AST2700 SCUIO RNG control and data registers
4. Share single SCUIO instance across PSP, SSP, and TSP
5. Fix AST2700 FC hardware strap settings

Quoted 2 lines

v5:
1. To speed up the review process, move the following patches into a

separate

Quoted 1 line

patch series, as they are not directly related to the main topic of this

series:

Quoted 2 lines
     [v4,01/21] hw/misc/aspeed_scu: Introduce Aspeed2700SCU subclass

and separate from generic SCU

Quoted 1 line

[v4,02/21] hw/misc/aspeed_scu: Add separate reset handler for

AST2700 SCUIO

Quoted 2 lines

[v4,11/21] hw/arm/ast27x0: Share FMC controller with SSP and TSP [v4,12/21] hw/arm/aspeed_ast27x0: Add unimplemented Privilege

Controller MMIO regions for SSP/TSP (Merged)

Quoted 1 line
     [v4,13/21] hw/arm/aspeed_ast27x0: Add unimplemented OTP

controller MMIO regions for SSP/TSP (Merged)

Quoted 1 line

[v4,14/21] hw/block/m25p80: Implement volatile status register write

enable for Winbond

Quoted 1 line

[v4,15/21] hw/ssi/aspeed_smc: Add Data FIFO-based flash access

support for AST2700

Quoted 1 line

[v4,16/21] hw/misc/aspeed_scu: Drop noisy unhandled read logs for

AST2700 SCU/SCUIO (Merged)

Quoted 1 line
     [v4,17/21] hw/misc/aspeed_scu: Add AST2700 SCUIO RNG control and

data registers (Merged)

Quoted 1 line

[v4,18/21] hw/arm/ast27x0: Share single SCUIO instance across PSP,

SSP, and TSP

Quoted 4 lines
     [v4,19/21] hw/arm/aspeed_ast27x0-fc: Fix hardware strap settings

(Merged)

2. Add memory_region_transaction_begin() and

memory_region_transaction_commit()

Quoted 12 lines

to protect the transaction.

Jamin Lin (10):
hw/arm/ast27x0: Start SSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Start TSP in powered-off state to match hardware
behavior
hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap hw/arm/ast27x0: Add DRAM alias for TSP SDRAM remap hw/misc/aspeed_scu: Implement SSP reset and power-on control via SCU
registers
hw/misc/aspeed_scu: Implement TSP reset and power-on control via

SCU

Quoted 7 lines

registers
hw/misc/aspeed_scu: Add SCU support for SSP SDRAM remap hw/misc/aspeed_scu: Add SCU support for TSP SDRAM remap tests/functional/aarch64/test_aspeed_ast2700fc: Boot SSP/TSP via PSP
and load binaries from DRAM
docs: Add support vbootrom and update Manual boot for ast2700fc

Quoted 7 lines
  docs/system/arm/aspeed.rst                    |  42 ++-
  include/hw/misc/aspeed_scu.h                  |   5 +
  hw/arm/aspeed_ast27x0-fc.c                    |   4 +
  hw/arm/aspeed_ast27x0-ssp.c                   |  13 +
  hw/arm/aspeed_ast27x0-tsp.c                   |  10 +
  hw/arm/aspeed_ast27x0.c                       |   6 +
  hw/misc/aspeed_scu.c                          | 285

++++++++++++++++++

Quoted 3 lines
  .../aarch64/test_aspeed_ast2700fc.py          |  29 +-
  8 files changed, 374 insertions(+), 20 deletions(-)

Here are some general comments on the design,

* Aspeed SCU Models

Aspeed2700SCUState is used by 3 instances:
- 1 PSP SCU, then linked in SSP and TSP
- 2 I/O expander SCUs (all aspeed.scu-ast2700)

AspeedSCUState (the parent) is used by SCUIO (aspeed.scuio-ast2700)

The I/O expander embeds Aspeed2700SCUState and gets the full dram_remap_alias[3], ssp_cpuid, tsp_cpuid, and dram link. none of which make sense for I/O.

Also, I doubt the whole register space is implemented for all SoCs. This model seems overused to me and The I/O expander would need a fix to separate the SCU type.

* remap Memory Regions

I think we need to reorganize the code.

The dram_remap Memory regions belong to the SSP and TSP coprocessor SoC states. Makes more sense to me. The only reason they are under SCU today is because it makes things easier for the memory region controls.

So :

   include/hw/arm/aspeed_coprocessor.h:
   @@ -57,6 +57,8 @@ struct Aspeed27x0CoprocessorState {
        MemoryRegion scu_alias;
        MemoryRegion scuio_alias;
        MemoryRegion fmc_alias;
   +    MemoryRegion dram_remap[2];
   +    MemoryRegion *dram;
        Aspeed2700SCUState *scu;
        AspeedSCUState *scuio;
        AspeedSMCState *fmc;

   include/hw/misc/aspeed_scu.h:
   @@ -45,8 +45,8 @@ struct AspeedSCUState {
    struct Aspeed2700SCUState {
        AspeedSCUState parent_obj;

   +    MemoryRegion *ssp_remap[2];
   +    MemoryRegion *tsp_remap;

    static const Property aspeed_2700_scu_properties[] = {
   +    DEFINE_PROP_LINK("ssp-remap-0", Aspeed2700SCUState,

ssp_remap[0],
+ TYPE_MEMORY_REGION, MemoryRegion *),
+ DEFINE_PROP_LINK("ssp-remap-1", Aspeed2700SCUState,
ssp_remap[1],
+ TYPE_MEMORY_REGION, MemoryRegion *),
+ DEFINE_PROP_LINK("tsp-remap", Aspeed2700SCUState, tsp_remap,
+ TYPE_MEMORY_REGION, MemoryRegion *),

     };

The TSP and SSP models would initialize the alias(es) always :

hw/arm/aspeed_ast27x0-ssp.c:
+ /* DRAM remap aliases for PSP to access SSP SDRAM */
+ 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]);
+ object_property_set_link(OBJECT(a->scu), "ssp-remap-0",
+ OBJECT(&a->dram_remap[0]),
&error_abort);
+ object_property_set_link(OBJECT(a->scu), "ssp-remap-1",
+ OBJECT(&a->dram_remap[1]),
&error_abort);

        /* INTC */
        if (!sysbus_realize(SYS_BUS_DEVICE(&a->intc[0]), errp)) {

@@ -323,6 +330,8 @@ static const Property aspeed_27x0_coproc
TYPE_ASPEED_SCU, AspeedSCUState *),
DEFINE_PROP_LINK("fmc", Aspeed27x0CoprocessorState, fmc,
TYPE_ASPEED_SMC,
AspeedSMCState *),
+ DEFINE_PROP_LINK("dram", Aspeed27x0CoprocessorState, dram,
+ TYPE_MEMORY_REGION, MemoryRegion *),

    };
   hw/arm/aspeed_ast27x0-fc.c:
        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",

In SCU, we can drop the aspeed_2700_scu_realize() changes and the control bits become :

   hw/misc/aspeed_scu.c:
        case AST2700_SCU_SSP_CTRL_1:
        case AST2700_SCU_SSP_CTRL_2:
   +        mr = (reg == AST2700_SCU_SSP_CTRL_1) ? a->ssp_remap[0] :
a->ssp_remap[1];
            if (a->ssp_cpuid < 0 || mr == NULL) {
                return;
            }

* CPU index

As for the "tsp-cpuid" and "ssp-cpuid" properties, we have a chicken&egg issue because the shared SCU model needs to be realized and the SSP and TSP CPUs too.

I would be tempted to simply bypass QOM to avoid hardcoding cpu_index values:

   hw/arm/aspeed_ast27x0-ssp.c:
         object_property_set_bool(OBJECT(&a->armv7m),
"start-powered-off", true,
                                  &error_abort);
         sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
    +    a->scu->ssp_cpuid = CPU(a->armv7m.cpu)->cpu_index;

         /* SDRAM */
         sdram_name = g_strdup_printf("aspeed.sdram.%d",
Quoted 10 lines
   hw/arm/aspeed_ast27x0-tsp.c:
         object_property_set_bool(OBJECT(&a->armv7m),
"start-powered-off", true,
                                  &error_abort);
         sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
    +    a->scu->tsp_cpuid = CPU(a->armv7m.cpu)->cpu_index;

         /* SDRAM */
         sdram_name = g_strdup_printf("aspeed.sdram.%d",

Thanks for the review and the helpful suggestions. I'll address them in the next revision.
I really appreciate your feedback and support.

Thanks,
Jamin

Quoted 6 lines

Or keep it that way for now.

Thanks,

C.