Skip to contentSkip to conversation

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

PATCH Superseded Jamin Lin 2 participants 18 messages Feb 24 – Apr 15 Arm/Aspeed machine support

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Jamin Lin

author
#0 lore raw

v3 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.

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

Jamin Lin (15):
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 hw/arm/ast27x0: Share FMC controller with SSP and TSP hw/arm/aspeed_ast27x0: Add unimplemented Privilege Controller MMIO
regions for SSP/TSP
hw/arm/aspeed_ast27x0: Add unimplemented OTP controller MMIO regions
for SSP/TSP
hw/block/m25p80: Implement volatile status register write enable for
Winbond
hw/ssi/aspeed_smc: Add Data FIFO-based flash access support for

    AST2700

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                    |  37 ++-
 include/hw/arm/aspeed_coprocessor.h           |   5 +-
 include/hw/arm/aspeed_soc.h                   |   3 +
 include/hw/misc/aspeed_scu.h                  |   6 +
 include/hw/ssi/aspeed_smc.h                   |   3 +-
 hw/arm/aspeed_ast27x0-fc.c                    |   8 +
 hw/arm/aspeed_ast27x0-ssp.c                   |  39 +++
 hw/arm/aspeed_ast27x0-tsp.c                   |  36 +++
 hw/arm/aspeed_ast27x0.c                       |   6 +
 hw/arm/aspeed_coprocessor_common.c            |   2 +
 hw/block/m25p80.c                             |  36 ++-
 hw/misc/aspeed_scu.c                          | 272 +++++++++++++++++-
 hw/ssi/aspeed_smc.c                           | 111 ++++++-
 .../aarch64/test_aspeed_ast2700fc.py          |  34 +--
 14 files changed, 563 insertions(+), 35 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v3 1/15 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 9b12ba6743..437fff3311 100644
@@ -165,6 +165,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
author
#2 lore raw

PATCH v3 2/15 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 e39d1dc171..b99b18bc6e 100644
@@ -165,6 +165,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
author
#3 lore raw

PATCH v3 3/15 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, 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.

---
 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         | 42 ++++++++++++++++++++++++++++++++++--
 5 files changed, 57 insertions(+), 2 deletions(-)
include/hw/misc/aspeed_scu.h +5 -0
index d003955428..9c29ca217d 100644
@@ -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_A1_SILICON_REV   0x02010303U
@@ -64,6 +68,7 @@ struct AspeedSCUClass {
     uint32_t nr_regs;
     bool clkin_25Mhz;
     const MemoryRegionOps *ops;
+    void (*dram_remap)(AspeedSCUState *s, Error **errp);
 };
 
 #define ASPEED_SCU_PROT_KEY      0x1688A8A8
hw/arm/aspeed_ast27x0-fc.c +2 -0
index 5eb6680da9..77ce312591 100644
@@ -100,6 +100,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 437fff3311..4a9c8c1406 100644
@@ -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;
hw/arm/aspeed_ast27x0.c +4 -0
index 87dcb82e1b..b914c01825 100644
@@ -432,6 +432,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",
@@ -794,6 +796,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;
     }
hw/misc/aspeed_scu.c +40 -2

76 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH v3 03/15] hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap

Quoted 139 lines · Jamin Lin

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.

---
  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         | 42 ++++++++++++++++++++++++++++++++++--
  5 files changed, 57 insertions(+), 2 deletions(-)
include/hw/misc/aspeed_scu.h +5 -0
index d003955428..9c29ca217d 100644
@@ -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_A1_SILICON_REV   0x02010303U
@@ -64,6 +68,7 @@ struct AspeedSCUClass {
      uint32_t nr_regs;
      bool clkin_25Mhz;
      const MemoryRegionOps *ops;
+    void (*dram_remap)(AspeedSCUState *s, Error **errp);
  };
 
  #define ASPEED_SCU_PROT_KEY      0x1688A8A8
hw/arm/aspeed_ast27x0-fc.c +2 -0
index 5eb6680da9..77ce312591 100644
@@ -100,6 +100,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 437fff3311..4a9c8c1406 100644
@@ -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;
hw/arm/aspeed_ast27x0.c +4 -0
index 87dcb82e1b..b914c01825 100644
@@ -432,6 +432,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",
@@ -794,6 +796,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;
      }
hw/misc/aspeed_scu.c +10 -2
index e4160356e4..84fe88e58b 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)
 
@@ -593,12 +594,16 @@ 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) {
+        asc->dram_remap(s, errp);
+    }
  }
 
  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()
@@ -610,6 +615,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)

hw/misc/aspeed_scu.c static const TypeInfo aspeed_2600_scu_info = { · line 877

Quoted 7 lines
hw/misc/aspeed_scu.c +4 -0
@@ -863,6 +871,35 @@ 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,
+                                                  Error **errp)
+{
+    if (s->ssp_cpuid > 0) {

why not introduce new Aspeed SCU subclasses with custom realize and reset handlers instead ?

Quoted 36 lines
hw/misc/aspeed_scu.c +26 -0
+        if (!s->dram) {
+            error_setg(errp, TYPE_ASPEED_2700_SCU ": 'dram' link not set");
+            return;
+        }
+    }
+
+    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)
  {
@@ -973,6 +1010,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,
author
#5 lore raw

RE: [PATCH v3 03/15] hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap

Hi Cédric

Quoted 165 lines

Subject: Re: [PATCH v3 03/15] hw/arm/ast27x0: Add DRAM alias for SSP SDRAM remap

Quoted 6 lines · Jamin Lin

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

Quoted 8 lines

- 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.

Quoted 7 lines
---
  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         | 42

++++++++++++++++++++++++++++++++++--

hw/arm/aspeed_ast27x0-fc.c static bool ast2700fc_ca35_init(MachineState

Quoted 30 lines
  5 files changed, 57 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/include/hw/misc/aspeed_scu.h index d003955428..9c29ca217d 100644

include/hw/misc/aspeed_scu.h +5 -0
@@ -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_A1_SILICON_REV   0x02010303U
@@ -64,6 +68,7 @@ struct AspeedSCUClass {
      uint32_t nr_regs;
      bool clkin_25Mhz;
      const MemoryRegionOps *ops;
+    void (*dram_remap)(AspeedSCUState *s, Error **errp);
  };
 
  #define ASPEED_SCU_PROT_KEY      0x1688A8A8
hw/arm/aspeed_ast27x0-fc.c +0 -0
index 5eb6680da9..77ce312591 100644
@@ -100,6 +100,8 @@ static bool ast2700fc_ca35_init(MachineState

*machine, Error **errp)

hw/arm/aspeed_ast27x0-fc.c static bool ast2700fc_ca35_init(MachineState · line 101

Quoted 2 lines
hw/arm/aspeed_ast27x0-fc.c +0 -0
                              sc->uarts_num, serial_hd(1));
      aspeed_soc_uart_set_chr(soc->uart, ASPEED_DEV_UART7,

sc->uarts_base,

hw/arm/aspeed_ast27x0-ssp.c static void

Quoted 11 lines
hw/arm/aspeed_ast27x0-fc.c +2 -0
                              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 +0 -0
index 437fff3311..4a9c8c1406 100644
@@ -198,6 +198,12 @@ static void

aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)

hw/arm/aspeed_ast27x0-ssp.c static void · line 198

Quoted 1 line
hw/arm/aspeed_ast27x0-ssp.c +0 -0
      memory_region_add_subregion(s->memory,

sc->memmap[ASPEED_DEV_SCU],

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

Quoted 4 lines
hw/arm/aspeed_ast27x0-ssp.c +2 -0
                                  &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]);

Quoted 12 lines
hw/arm/aspeed_ast27x0-ssp.c +4 -0
+    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;
hw/arm/aspeed_ast27x0.c index renamed from hw/arm/aspeed_ast27x0.c +0 -0

87dcb82e1b..b914c01825 100644

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_init(Object *obj) · line 438

Quoted 7 lines
hw/arm/aspeed_ast27x0.c +2 -0
@@ -432,6 +432,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);

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_init(Object *obj)

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +1 -0
      qdev_prop_set_uint32(DEVICE(&s->scuio), "silicon-rev", @@ -794,6
+796,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error

**errp)

Quoted 1 line

sc->memmap[ASPEED_DEV_VBOOTROM],

Quoted 4 lines

&s->vbootrom);

      /* SCU */

+ object_property_set_link(OBJECT(&s->scu), "dram",

OBJECT(s->dram_mr),

hw/misc/aspeed_scu.c static void aspeed_scu_realize(DeviceState *dev,

Quoted 17 lines
hw/arm/aspeed_ast27x0.c +1 -0
+                             &error_abort);
      if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
          return;
      }
hw/misc/aspeed_scu.c index renamed from hw/misc/aspeed_scu.c +0 -0

e4160356e4..84fe88e58b 100644

hw/misc/aspeed_scu.c +1 -0
@@ -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)
 
@@ -593,12 +594,16 @@ static void aspeed_scu_realize(DeviceState *dev,

Error **errp)

hw/misc/aspeed_scu.c static void aspeed_scu_realize(DeviceState *dev, · line 594

Quoted 1 line
hw/misc/aspeed_scu.c +0 -0
                            TYPE_ASPEED_SCU,

SCU_IO_REGION_SIZE);

Quoted 6 lines
hw/misc/aspeed_scu.c +4 -0
      sysbus_init_mmio(sbd, &s->iomem);
+
+    if (asc->dram_remap) {
+        asc->dram_remap(s, errp);
+    }

hw/misc/aspeed_scu.c static void aspeed_scu_realize(DeviceState *dev, Error **errp)

Quoted 10 lines
hw/misc/aspeed_scu.c +2 -2
  }
 
  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),

hw/misc/aspeed_scu.c static const Property aspeed_scu_properties[] = { · line 620

Quoted 8 lines
hw/misc/aspeed_scu.c +2 -0
          VMSTATE_END_OF_LIST()
@@ -610,6 +615,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,

Quoted 5 lines
hw/misc/aspeed_scu.c +1 -0
+                     MemoryRegion *),
  };
 

static void aspeed_scu_class_init(ObjectClass *klass, const void
*data) @@ -863,6 +871,35 @@ static const TypeInfo aspeed_2600_scu_info

= {

Quoted 3 lines
      .class_init = aspeed_2600_scu_class_init,

};

Quoted 9 lines

hw/misc/aspeed_scu.c static const TypeInfo aspeed_2600_scu_info = { · line 875

Quoted 2 lines
hw/misc/aspeed_scu.c +2 -0
+static void aspeed_2700_scu_dram_remap_alias_init(AspeedSCUState *s,
+                                                  Error **errp)

{

Quoted 1 line

+ if (s->ssp_cpuid > 0) {

why not introduce new Aspeed SCU subclasses with custom realize and reset handlers instead ?

Thanks for the review and suggestion.
Will do.

Jamin

Quoted 42 lines

hw/misc/aspeed_scu.c

Quoted 2 lines
hw/misc/aspeed_scu.c +2 -0
+        if (!s->dram) {
+            error_setg(errp, TYPE_ASPEED_2700_SCU ": 'dram' link not

set");

hw/misc/aspeed_scu.c static const TypeInfo aspeed_2600_scu_info = {

Quoted 7 lines
hw/misc/aspeed_scu.c +7 -0
+            return;
+        }
+    }
+
+    if (s->ssp_cpuid > 0) {
+        /*
+         * The SSP coprocessor uses two memory aliases (remap1 and

remap2)

hw/misc/aspeed_scu.c static const TypeInfo aspeed_2600_scu_info = {

Quoted 3 lines
hw/misc/aspeed_scu.c +3 -0
+         * to access shared memory regions in the PSP DRAM:
+         *
+         * - remap1 maps PSP DRAM at 0x400000000 (size: 32MB) to SSP

SDRAM

hw/misc/aspeed_scu.c

Quoted 2 lines
hw/misc/aspeed_scu.c +2 -0
+         *   offset 0x2000000
+         * - remap2 maps PSP DRAM at 0x42c000000 (size: 32MB) to SSP

SDRAM

hw/misc/aspeed_scu.c static void aspeed_2700_scu_class_init(ObjectClass

Quoted 15 lines
hw/misc/aspeed_scu.c +11 -0
+         *   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)
  {
@@ -973,6 +1010,7 @@ static void aspeed_2700_scu_class_init(ObjectClass

*klass, const void *data)

Quoted 8 lines
hw/misc/aspeed_scu.c +1 -0
      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,

author
#6 lore raw

PATCH v3 4/15 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, as defined by the default SCU configuration.

The TSP coprocessor exposes one DRAM alias:
- remap maps PSP DRAM at 0x42e000000 (32MB) to TSP SDRAM offset 0x0

This region corresponds to the default SCU register value, which controls the mapping between PSP and coprocessor memory windows.

Set TSP CPUID 5. SCU VMState version remains at 3, as it was already bumped in a previous commit.

---
 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         | 17 ++++++++++++++++-
 5 files changed, 24 insertions(+), 1 deletion(-)
include/hw/misc/aspeed_scu.h +1 -0
index 9c29ca217d..58fef73159 100644
@@ -43,6 +43,7 @@ struct AspeedSCUState {
     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 77ce312591..38c5d06077 100644
@@ -102,6 +102,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 b99b18bc6e..6c0f166a34 100644
@@ -198,6 +198,9 @@ static void aspeed_soc_ast27x0tsp_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 TSP SDRAM */
+    memory_region_add_subregion(&s->sdram, 0, &s->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 b914c01825..52cd2bcbe7 100644
@@ -434,6 +434,8 @@ static void aspeed_soc_ast2700_init(Object *obj)
                               "hw-prot-key");
     object_property_add_alias(obj, "ssp-cpuid", OBJECT(&s->scu),
                               "ssp-cpuid");
+    object_property_add_alias(obj, "tsp-cpuid", OBJECT(&s->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 +16 -1
index 84fe88e58b..9bfe132840 100644
@@ -616,6 +616,7 @@ static const Property aspeed_scu_properties[] = {
     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_INT32("tsp-cpuid", AspeedSCUState, tsp_cpuid, -1),
     DEFINE_PROP_LINK("dram", AspeedSCUState, dram, TYPE_MEMORY_REGION,
                      MemoryRegion *),
 };
@@ -874,7 +875,7 @@ static const TypeInfo aspeed_2600_scu_info = {
 static void aspeed_2700_scu_dram_remap_alias_init(AspeedSCUState *s,
                                                   Error **errp)
 {
-    if (s->ssp_cpuid > 0) {
+    if (s->ssp_cpuid > 0 || s->tsp_cpuid > 0) {
         if (!s->dram) {
             error_setg(errp, TYPE_ASPEED_2700_SCU ": 'dram' link not set");
             return;
@@ -898,6 +899,20 @@ static void aspeed_2700_scu_dram_remap_alias_init(AspeedSCUState *s,
                                  "ssp.dram.remap2", s->dram,
                                  0x2c000000, 32 * MiB);
     }
+
+    if (s->tsp_cpuid > 0) {
+        /*
+         * 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(&s->dram_remap_alias[2], OBJECT(s),
+                                 "tsp.dram.remap", s->dram,
+                                 0x2e000000, 32 * MiB);
+    }
 }
 
 static uint64_t aspeed_ast2700_scu_read(void *opaque, hwaddr offset,
Signature · 1 line
2.43.0
author
#7 lore raw

PATCH v3 5/15 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 | 107 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)
hw/misc/aspeed_scu.c +107 -0
index 9bfe132840..56f7e214b9 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)
@@ -915,6 +927,35 @@ static void aspeed_2700_scu_dram_remap_alias_init(AspeedSCUState *s,
     }
 }
 
+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)
 {
@@ -946,6 +987,9 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
     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,
@@ -957,6 +1001,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 = s->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 (s->ssp_cpuid < 0) {
+            return;
+        }
+        if (data & AST2700_SCU_SYS_RST_SSP) {
+            handle_2700_ssp_tsp_off(s, s->ssp_cpuid, AST2700_SCU_SSP_CTRL_0);
+        }
+        s->regs[reg] |= data;
+        return;
+    case AST2700_SCU_SYS_RST_CLR_1:
+        if (s->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, s->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",
@@ -984,6 +1085,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,
@@ -1009,6 +1112,10 @@ static void aspeed_ast2700_scu_reset(DeviceState *dev)
     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 (s->ssp_cpuid > 0) {
+        arm_set_cpu_off(s->ssp_cpuid);
+    }
 }
 
 static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
Signature · 1 line
2.43.0
author
#8 lore raw

PATCH v3 6/15 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 56f7e214b9..15c8b06487 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)
@@ -1002,7 +1006,10 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
 
     switch (reg) {
     case AST2700_SCU_SSP_CTRL_0:
-        cpuid = s->ssp_cpuid;
+    case AST2700_SCU_TSP_CTRL_0:
+        cpuid = (reg == AST2700_SCU_SSP_CTRL_0) ?
+                s->ssp_cpuid : s->tsp_cpuid;
+
         if (cpuid < 0) {
             return;
         }
@@ -1058,6 +1065,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 (s->tsp_cpuid < 0) {
+            return;
+        }
+        data &= 0x00001fff;
+        if (data & AST2700_SCU_SYS_RST_TSP) {
+            handle_2700_ssp_tsp_off(s, s->tsp_cpuid, AST2700_SCU_TSP_CTRL_0);
+        }
+        s->regs[reg] |= data;
+        return;
+    case AST2700_SCU_SYS_RST_CLR_2:
+        if (s->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, s->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",
@@ -1086,7 +1115,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,
@@ -1116,6 +1147,10 @@ static void aspeed_ast2700_scu_reset(DeviceState *dev)
     if (s->ssp_cpuid > 0) {
         arm_set_cpu_off(s->ssp_cpuid);
     }
+
+    if (s->tsp_cpuid > 0) {
+        arm_set_cpu_off(s->tsp_cpuid);
+    }
 }
 
 static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
Signature · 1 line
2.43.0
author
#9 lore raw

PATCH v3 7/15 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: 32MB) to SSP SDRAM

    offset 0x2000000
- coprocessor_sdram_remap[0]: maps PSP DRAM offset 0x42c000000 (size: 32MB) 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: 32MB    (SCU_14C)                |   | |   |    remap2                  |
|------------------------------------------|   | |   |----------------------------|
|                                          |   | |   |                            |
| 0x4_2C00_0000 (SCU_128 << 4)             |-----|   | 0x0200_0000                |
|   remap2 base                            |   |     |  - SCU_148: target addr    |
|   size: 32MB    (SCU_154)                |   |---> |    remap1                  |
|------------------------------------------|         |----------------------------|
---
 hw/misc/aspeed_scu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
hw/misc/aspeed_scu.c +50 -0
index 15c8b06487..e806b95935 100644
@@ -147,6 +147,12 @@
 
 /* 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_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)
@@ -988,6 +994,7 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
                                      uint64_t data64, unsigned size)
 {
     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;
@@ -1045,6 +1052,37 @@ 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) ?
+            &s->dram_remap_alias[0] : &s->dram_remap_alias[1];
+        if (s->ssp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x7fffffff;
+        memory_region_set_alias_offset(mr,
+                                       ((uint64_t) data << 4) & 0x3ffffffff);
+        break;
+    case AST2700_SCU_SSP_REMAP_ADDR_1:
+    case AST2700_SCU_SSP_REMAP_ADDR_2:
+        mr = (reg == AST2700_SCU_SSP_REMAP_ADDR_1) ?
+            &s->dram_remap_alias[0] : &s->dram_remap_alias[1];
+        if (s->ssp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x3fffffff;
+        memory_region_set_address(mr, data);
+        break;
+    case AST2700_SCU_SSP_REMAP_SIZE_1:
+    case AST2700_SCU_SSP_REMAP_SIZE_2:
+        mr = (reg == AST2700_SCU_SSP_REMAP_SIZE_1) ?
+            &s->dram_remap_alias[0] : &s->dram_remap_alias[1];
+        if (s->ssp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x3fffffff;
+        memory_region_set_size(mr, data);
+        break;
     case AST2700_SCU_SYS_RST_CTRL_1:
         if (s->ssp_cpuid < 0) {
             return;
@@ -1115,6 +1153,12 @@ 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_1]  = 0x02000000,
+    [AST2700_SCU_SSP_REMAP_SIZE_1]  = 0x02000000,
+    [AST2700_SCU_SSP_REMAP_ADDR_2]  = 0x00000000,
+    [AST2700_SCU_SSP_REMAP_SIZE_2]  = 0x02000000,
     [AST2700_SCU_TSP_CTRL_0]        = 0x000007FE,
     [AST2700_SCU_SYS_RST_CTRL_1]    = 0xFFC37FDC,
     [AST2700_SCU_SYS_RST_CTRL_2]    = 0x00001FFF,
@@ -1146,6 +1190,12 @@ static void aspeed_ast2700_scu_reset(DeviceState *dev)
 
     if (s->ssp_cpuid > 0) {
         arm_set_cpu_off(s->ssp_cpuid);
+        memory_region_set_address(&s->dram_remap_alias[0], 32 * MiB);
+        memory_region_set_alias_offset(&s->dram_remap_alias[0], 0);
+        memory_region_set_size(&s->dram_remap_alias[0], 32 * MiB);
+        memory_region_set_address(&s->dram_remap_alias[1], 0);
+        memory_region_set_alias_offset(&s->dram_remap_alias[1], 0x2c000000);
+        memory_region_set_size(&s->dram_remap_alias[1], 32 * MiB);
     }
 
     if (s->tsp_cpuid > 0) {
Signature · 1 line
2.43.0
author
#10 lore raw

PATCH v3 8/15 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 | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
hw/misc/aspeed_scu.c +23 -0
index e806b95935..df435016ea 100644
@@ -159,6 +159,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)
@@ -1083,6 +1085,23 @@ static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset,
         data &= 0x3fffffff;
         memory_region_set_size(mr, data);
         break;
+    case AST2700_SCU_TSP_CTRL_1:
+        mr = &s->dram_remap_alias[2];
+        if (s->tsp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x7fffffff;
+        memory_region_set_alias_offset(mr,
+                                       ((uint64_t) data << 4) & 0x3ffffffff);
+        break;
+    case AST2700_SCU_TSP_REMAP_SIZE_2:
+        mr = &s->dram_remap_alias[2];
+        if (s->tsp_cpuid < 0 || mr == NULL) {
+            return;
+        }
+        data &= 0x3fffffff;
+        memory_region_set_size(mr, data);
+        break;
     case AST2700_SCU_SYS_RST_CTRL_1:
         if (s->ssp_cpuid < 0) {
             return;
@@ -1160,6 +1179,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]  = 0x02000000,
     [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,
@@ -1200,6 +1221,8 @@ static void aspeed_ast2700_scu_reset(DeviceState *dev)
 
     if (s->tsp_cpuid > 0) {
         arm_set_cpu_off(s->tsp_cpuid);
+        memory_region_set_alias_offset(&s->dram_remap_alias[2], 0x2e000000);
+        memory_region_set_size(&s->dram_remap_alias[2], 32 * MiB);
     }
 }
 
Signature · 1 line
2.43.0
author
#11 lore raw

PATCH v3 9/15 hw/arm/ast27x0: Share FMC controller with SSP and TSP

In reply to Jamin Lin

AST2700 provides a single FMC controller shared by the main CA35 processor (PSP) and the SSP/TSP coprocessors.

From the PSP perspective, the FMC controller is memory-mapped at 0x14000000–0x140000FF. The SSP and TSP access the same controller through a different address window at 0x74000000–0x740000FF.

This change allows the SSP and TSP SoC models to reference the existing PSP FMC instance instead of creating independent controllers. An MMIO alias is added in the SSP and TSP address spaces to map their FMC access window to the shared FMC device.

This ensures consistent FMC state across PSP, SSP, and TSP and matches the AST2700 hardware design.

---
 include/hw/arm/aspeed_coprocessor.h | 2 ++
 hw/arm/aspeed_ast27x0-fc.c          | 4 ++++
 hw/arm/aspeed_ast27x0-ssp.c         | 8 ++++++++
 hw/arm/aspeed_ast27x0-tsp.c         | 8 ++++++++
 hw/arm/aspeed_coprocessor_common.c  | 2 ++
 5 files changed, 24 insertions(+)
include/hw/arm/aspeed_coprocessor.h +2 -0
index 4a50f688ec..8d45c0b9bc 100644
@@ -21,11 +21,13 @@ struct AspeedCoprocessorState {
     MemoryRegion sram_alias;
     MemoryRegion uart_alias;
     MemoryRegion scu_alias;
+    MemoryRegion fmc_alias;
     Clock *sysclk;
 
     AspeedSCUState *scu;
     AspeedSCUState scuio;
     AspeedTimerCtrlState timerctrl;
+    AspeedSMCState *fmc;
     SerialMM *uart;
     int uart_dev;
 };
hw/arm/aspeed_ast27x0-fc.c +4 -0
index 38c5d06077..12bbefa825 100644
@@ -161,6 +161,8 @@ static bool ast2700fc_ssp_init(MachineState *machine, Error **errp)
                              OBJECT(&psp->sram), &error_abort);
     object_property_set_link(OBJECT(&s->ssp), "scu",
                              OBJECT(&psp->scu), &error_abort);
+    object_property_set_link(OBJECT(&s->ssp), "fmc",
+                             OBJECT(&psp->fmc), &error_abort);
     if (!qdev_realize(DEVICE(&s->ssp), NULL, errp)) {
         return false;
     }
@@ -193,6 +195,8 @@ static bool ast2700fc_tsp_init(MachineState *machine, Error **errp)
                              OBJECT(&psp->sram), &error_abort);
     object_property_set_link(OBJECT(&s->tsp), "scu",
                              OBJECT(&psp->scu), &error_abort);
+    object_property_set_link(OBJECT(&s->tsp), "fmc",
+                             OBJECT(&psp->fmc), &error_abort);
     if (!qdev_realize(DEVICE(&s->tsp), NULL, errp)) {
         return false;
     }
hw/arm/aspeed_ast27x0-ssp.c +8 -0
index 4a9c8c1406..8efaaacb8f 100644
@@ -26,6 +26,7 @@ static const hwaddr aspeed_soc_ast27x0ssp_memmap[] = {
     [ASPEED_DEV_TIMER1]    =  0x72C10000,
     [ASPEED_DEV_UART4]     =  0x72C1A000,
     [ASPEED_DEV_IPC0]      =  0x72C1C000,
+    [ASPEED_DEV_FMC]       =  0x74000000,
     [ASPEED_DEV_SCUIO]     =  0x74C02000,
     [ASPEED_DEV_INTCIO]    =  0x74C18000,
     [ASPEED_DEV_UART0]     =  0x74C33000,
@@ -255,6 +256,13 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
     sysbus_connect_irq(SYS_BUS_DEVICE(s->uart), 0,
                        aspeed_soc_ast27x0ssp_get_irq(s, s->uart_dev));
 
+    /* FMC */
+    memory_region_init_alias(&s->fmc_alias, OBJECT(s), "fmc.alias",
+                             &s->fmc->mmio, 0,
+                             memory_region_size(&s->fmc->mmio));
+    memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_FMC],
+                                &s->fmc_alias);
+
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->timerctrl),
                                   "aspeed.timerctrl",
                                   sc->memmap[ASPEED_DEV_TIMER1], 0x200);
hw/arm/aspeed_ast27x0-tsp.c +8 -0
index 6c0f166a34..b7ad828528 100644
@@ -26,6 +26,7 @@ static const hwaddr aspeed_soc_ast27x0tsp_memmap[] = {
     [ASPEED_DEV_TIMER1]    =  0x72C10000,
     [ASPEED_DEV_UART4]     =  0x72C1A000,
     [ASPEED_DEV_IPC0]      =  0x72C1C000,
+    [ASPEED_DEV_FMC]       =  0x74000000,
     [ASPEED_DEV_SCUIO]     =  0x74C02000,
     [ASPEED_DEV_INTCIO]    =  0x74C18000,
     [ASPEED_DEV_UART0]     =  0x74C33000,
@@ -252,6 +253,13 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
     sysbus_connect_irq(SYS_BUS_DEVICE(s->uart), 0,
                        aspeed_soc_ast27x0tsp_get_irq(s, s->uart_dev));
 
+    /* FMC */
+    memory_region_init_alias(&s->fmc_alias, OBJECT(s), "fmc.alias",
+                             &s->fmc->mmio, 0,
+                             memory_region_size(&s->fmc->mmio));
+    memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_FMC],
+                                &s->fmc_alias);
+
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->timerctrl),
                                   "aspeed.timerctrl",
                                   sc->memmap[ASPEED_DEV_TIMER1], 0x200);
hw/arm/aspeed_coprocessor_common.c +2 -0
index a0a4c73d08..c57fae86a4 100644
@@ -32,6 +32,8 @@ static const Property aspeed_coprocessor_properties[] = {
     DEFINE_PROP_LINK("uart", AspeedCoprocessorState, uart, TYPE_SERIAL_MM,
                      SerialMM *),
     DEFINE_PROP_INT32("uart-dev", AspeedCoprocessorState, uart_dev, 0),
+    DEFINE_PROP_LINK("fmc", AspeedCoprocessorState, fmc, TYPE_ASPEED_SMC,
+                     AspeedSMCState *),
 };
 
 static void aspeed_coprocessor_class_init(ObjectClass *oc, const void *data)
Signature · 1 line
2.43.0
author
#12 lore raw

PATCH v3 10/15 hw/arm/aspeed_ast27x0: Add unimplemented Privilege Controller MMIO regions for SSP/TSP

In reply to Jamin Lin

The AST2700 SSP/TSP firmware accesses Privilege Controller MMIO regions that are not yet implemented in QEMU.

This change adds unimplemented MMIO devices for the Privilege Controller blocks and maps them to their corresponding physical addresses in the SSP/TSP address space. These stub devices allow QEMU to safely handle firmware accesses and prevent spurious exceptions, while accurately reflecting the hardware memory map.

No functional changes.

---
 include/hw/arm/aspeed_coprocessor.h |  2 +-
 include/hw/arm/aspeed_soc.h         |  2 ++
 hw/arm/aspeed_ast27x0-ssp.c         | 12 ++++++++++++
 hw/arm/aspeed_ast27x0-tsp.c         | 12 ++++++++++++
 4 files changed, 27 insertions(+), 1 deletion(-)
include/hw/arm/aspeed_coprocessor.h +1 -1
index 8d45c0b9bc..94b5cd257c 100644
@@ -50,7 +50,7 @@ struct Aspeed27x0CoprocessorState {
     AspeedINTCState intc[2];
     UnimplementedDeviceState ipc[2];
     UnimplementedDeviceState scuio;
-
+    UnimplementedDeviceState pric[2];
     ARMv7MState armv7m;
 };
 
include/hw/arm/aspeed_soc.h +2 -0
index b185b04186..5b208a979f 100644
@@ -296,6 +296,8 @@ enum {
     ASPEED_DEV_IOEXP1_INTCIO,
     ASPEED_DEV_IOEXP0_I3C,
     ASPEED_DEV_IOEXP1_I3C,
+    ASPEED_DEV_PRIC0,
+    ASPEED_DEV_PRIC1,
 };
 
 const char *aspeed_soc_cpu_type(const char * const *valid_cpu_types);
hw/arm/aspeed_ast27x0-ssp.c +12 -0
index 8efaaacb8f..8a748b42a4 100644
@@ -22,11 +22,13 @@ static const hwaddr aspeed_soc_ast27x0ssp_memmap[] = {
     [ASPEED_DEV_SDRAM]     =  0x00000000,
     [ASPEED_DEV_SRAM]      =  0x70000000,
     [ASPEED_DEV_INTC]      =  0x72100000,
+    [ASPEED_DEV_PRIC0]     =  0x72140000,
     [ASPEED_DEV_SCU]       =  0x72C02000,
     [ASPEED_DEV_TIMER1]    =  0x72C10000,
     [ASPEED_DEV_UART4]     =  0x72C1A000,
     [ASPEED_DEV_IPC0]      =  0x72C1C000,
     [ASPEED_DEV_FMC]       =  0x74000000,
+    [ASPEED_DEV_PRIC1]     =  0x74100000,
     [ASPEED_DEV_SCUIO]     =  0x74C02000,
     [ASPEED_DEV_INTCIO]    =  0x74C18000,
     [ASPEED_DEV_UART0]     =  0x74C33000,
@@ -142,6 +144,10 @@ static void aspeed_soc_ast27x0ssp_init(Object *obj)
                             TYPE_UNIMPLEMENTED_DEVICE);
     object_initialize_child(obj, "scuio", &a->scuio,
                             TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "pric0", &a->pric[0],
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "pric1", &a->pric[1],
+                            TYPE_UNIMPLEMENTED_DEVICE);
 }
 
 static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
@@ -275,6 +281,12 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->scuio),
                                   "aspeed.scuio",
                                   sc->memmap[ASPEED_DEV_SCUIO], 0x1000);
+    aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->pric[0]),
+                                  "aspeed.pric0",
+                                  sc->memmap[ASPEED_DEV_PRIC0], 0x1000);
+    aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->pric[1]),
+                                  "aspeed.pric1",
+                                  sc->memmap[ASPEED_DEV_PRIC1], 0x1000);
 }
 
 static void aspeed_soc_ast27x0ssp_class_init(ObjectClass *klass,
hw/arm/aspeed_ast27x0-tsp.c +12 -0
index b7ad828528..5037276f20 100644
@@ -22,11 +22,13 @@ static const hwaddr aspeed_soc_ast27x0tsp_memmap[] = {
     [ASPEED_DEV_SDRAM]     =  0x00000000,
     [ASPEED_DEV_SRAM]      =  0x70000000,
     [ASPEED_DEV_INTC]      =  0x72100000,
+    [ASPEED_DEV_PRIC0]     =  0x72140000,
     [ASPEED_DEV_SCU]       =  0x72C02000,
     [ASPEED_DEV_TIMER1]    =  0x72C10000,
     [ASPEED_DEV_UART4]     =  0x72C1A000,
     [ASPEED_DEV_IPC0]      =  0x72C1C000,
     [ASPEED_DEV_FMC]       =  0x74000000,
+    [ASPEED_DEV_PRIC1]     =  0x74100000,
     [ASPEED_DEV_SCUIO]     =  0x74C02000,
     [ASPEED_DEV_INTCIO]    =  0x74C18000,
     [ASPEED_DEV_UART0]     =  0x74C33000,
@@ -142,6 +144,10 @@ static void aspeed_soc_ast27x0tsp_init(Object *obj)
                             TYPE_UNIMPLEMENTED_DEVICE);
     object_initialize_child(obj, "scuio", &a->scuio,
                             TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "pric0", &a->pric[0],
+                            TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "pric1", &a->pric[1],
+                            TYPE_UNIMPLEMENTED_DEVICE);
 }
 
 static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
@@ -272,6 +278,12 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->scuio),
                                   "aspeed.scuio",
                                   sc->memmap[ASPEED_DEV_SCUIO], 0x1000);
+    aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->pric[0]),
+                                  "aspeed.pric0",
+                                  sc->memmap[ASPEED_DEV_PRIC0], 0x1000);
+    aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->pric[1]),
+                                  "aspeed.pric1",
+                                  sc->memmap[ASPEED_DEV_PRIC1], 0x1000);
 }
 
 static void aspeed_soc_ast27x0tsp_class_init(ObjectClass *klass,
Signature · 1 line
2.43.0
author
#13 lore raw

PATCH v3 11/15 hw/arm/aspeed_ast27x0: Add unimplemented OTP controller MMIO regions for SSP/TSP

In reply to Jamin Lin

The AST2700 SSP/TSP firmware accesses OTP MMIO regions that are not yet implemented in QEMU.

This change adds unimplemented MMIO devices for the OTP and maps them to their corresponding physical addresses in the SSP/TSP address space. These stub devices allow QEMU to safely handle firmware accesses and prevent spurious exceptions, while accurately reflecting the hardware memory map.

No functional changes.

---
 include/hw/arm/aspeed_coprocessor.h | 1 +
 include/hw/arm/aspeed_soc.h         | 1 +
 hw/arm/aspeed_ast27x0-ssp.c         | 6 ++++++
 hw/arm/aspeed_ast27x0-tsp.c         | 6 ++++++
 4 files changed, 14 insertions(+)
include/hw/arm/aspeed_coprocessor.h +1 -0
index 94b5cd257c..4a5a2a6151 100644
@@ -51,6 +51,7 @@ struct Aspeed27x0CoprocessorState {
     UnimplementedDeviceState ipc[2];
     UnimplementedDeviceState scuio;
     UnimplementedDeviceState pric[2];
+    UnimplementedDeviceState otp;
     ARMv7MState armv7m;
 };
 
include/hw/arm/aspeed_soc.h +1 -0
index 5b208a979f..10c1d626ef 100644
@@ -298,6 +298,7 @@ enum {
     ASPEED_DEV_IOEXP1_I3C,
     ASPEED_DEV_PRIC0,
     ASPEED_DEV_PRIC1,
+    ASPEED_DEV_OTP,
 };
 
 const char *aspeed_soc_cpu_type(const char * const *valid_cpu_types);
hw/arm/aspeed_ast27x0-ssp.c +6 -0
index 8a748b42a4..d4e9cdab32 100644
@@ -30,6 +30,7 @@ static const hwaddr aspeed_soc_ast27x0ssp_memmap[] = {
     [ASPEED_DEV_FMC]       =  0x74000000,
     [ASPEED_DEV_PRIC1]     =  0x74100000,
     [ASPEED_DEV_SCUIO]     =  0x74C02000,
+    [ASPEED_DEV_OTP]       =  0x74C07000,
     [ASPEED_DEV_INTCIO]    =  0x74C18000,
     [ASPEED_DEV_UART0]     =  0x74C33000,
     [ASPEED_DEV_UART1]     =  0x74C33100,
@@ -148,6 +149,8 @@ static void aspeed_soc_ast27x0ssp_init(Object *obj)
                             TYPE_UNIMPLEMENTED_DEVICE);
     object_initialize_child(obj, "pric1", &a->pric[1],
                             TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "otp", &a->otp,
+                            TYPE_UNIMPLEMENTED_DEVICE);
 }
 
 static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
@@ -287,6 +290,9 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->pric[1]),
                                   "aspeed.pric1",
                                   sc->memmap[ASPEED_DEV_PRIC1], 0x1000);
+    aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->otp),
+                                  "aspeed.otp",
+                                  sc->memmap[ASPEED_DEV_OTP], 0x800);
 }
 
 static void aspeed_soc_ast27x0ssp_class_init(ObjectClass *klass,
hw/arm/aspeed_ast27x0-tsp.c +6 -0
index 5037276f20..d335d01472 100644
@@ -30,6 +30,7 @@ static const hwaddr aspeed_soc_ast27x0tsp_memmap[] = {
     [ASPEED_DEV_FMC]       =  0x74000000,
     [ASPEED_DEV_PRIC1]     =  0x74100000,
     [ASPEED_DEV_SCUIO]     =  0x74C02000,
+    [ASPEED_DEV_OTP]       =  0x74C07000,
     [ASPEED_DEV_INTCIO]    =  0x74C18000,
     [ASPEED_DEV_UART0]     =  0x74C33000,
     [ASPEED_DEV_UART1]     =  0x74C33100,
@@ -148,6 +149,8 @@ static void aspeed_soc_ast27x0tsp_init(Object *obj)
                             TYPE_UNIMPLEMENTED_DEVICE);
     object_initialize_child(obj, "pric1", &a->pric[1],
                             TYPE_UNIMPLEMENTED_DEVICE);
+    object_initialize_child(obj, "otp", &a->otp,
+                            TYPE_UNIMPLEMENTED_DEVICE);
 }
 
 static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
@@ -284,6 +287,9 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->pric[1]),
                                   "aspeed.pric1",
                                   sc->memmap[ASPEED_DEV_PRIC1], 0x1000);
+    aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&a->otp),
+                                  "aspeed.otp",
+                                  sc->memmap[ASPEED_DEV_OTP], 0x800);
 }
 
 static void aspeed_soc_ast27x0tsp_class_init(ObjectClass *klass,
Signature · 1 line
2.43.0
author
#14 lore raw

PATCH v3 12/15 hw/block/m25p80: Implement volatile status register write enable for Winbond

In reply to Jamin Lin

Winbond SPI NOR flashes require the Volatile Status Register Write Enable (VSR WREN, opcode 0x50) command to be issued before updating volatile status register bits, such as those accessed via the WRSR2 command.

Currently, WRSR2 handling only checks the standard write enable latch, which does not fully model Winbond hardware behavior.

Add support for the volatile write enable mechanism by introducing a separate volatile_write_enable flag. For Winbond devices, WRSR2 writes that update volatile status register bits are gated by the VSR WREN command. If the volatile write enable latch is not set, such writes are rejected.

---
 hw/block/m25p80.c | 36 ++++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)
hw/block/m25p80.c +32 -4
index b8a2543c0b..5bb8b8efa9 100644
@@ -438,6 +438,11 @@ typedef enum {
      */
     WRSR2 = 0x31,
 
+    /*
+     * Winbond: 0x50 - Write Enable for Volatile Status Register
+     */
+    VSR_WREN = 0x50,
+
     RNVCR = 0xB5,
     WNVCR = 0xB1,
 
@@ -510,6 +515,7 @@ struct Flash {
     uint8_t spansion_cr4v;
     bool wp_level;
     bool write_enable;
+    bool volatile_write_enable;
     bool four_bytes_address_mode;
     bool reset_enable;
     bool quad_enable;
@@ -897,6 +903,7 @@ static void reset_memory(Flash *s)
     s->pos = 0;
     s->state = STATE_IDLE;
     s->write_enable = false;
+    s->volatile_write_enable = false;
     s->reset_enable = false;
     s->quad_enable = false;
     s->aai_enable = false;
@@ -1305,8 +1312,7 @@ static void decode_new_cmd(Flash *s, uint32_t value)
          * combinations of the two states are called "software protected mode"
          * (SPM), and status register writes are permitted.
          */
-        if ((s->wp_level == 0 && s->status_register_write_disabled)
-            || !s->write_enable) {
+        if (s->wp_level == 0 && s->status_register_write_disabled) {
             qemu_log_mask(LOG_GUEST_ERROR,
                           "M25P80: Status register 2 write is disabled!\n");
             break;
@@ -1314,6 +1320,17 @@ static void decode_new_cmd(Flash *s, uint32_t value)
 
         switch (get_man(s)) {
         case MAN_WINBOND:
+            /*
+             * Winbond requires VSR WREN (0x50) prior to updating volatile
+             * status register bits. VSR WREN does not set WEL.
+             *
+             * Accept either standard WEL (0x06) or VSR WREN (0x50).
+             */
+            if (!s->write_enable && !s->volatile_write_enable) {
+                qemu_log_mask(LOG_GUEST_ERROR,
+                              "M25P80: Status register 2 write is disabled!\n");
+                break;
+            }
             s->needed_bytes = 1;
             s->state = STATE_COLLECTING_DATA;
             s->pos = 0;
@@ -1332,6 +1349,16 @@ static void decode_new_cmd(Flash *s, uint32_t value)
         s->write_enable = true;
         break;
 
+    case VSR_WREN:
+        switch (get_man(s)) {
+        case MAN_WINBOND:
+            s->volatile_write_enable = true;
+            break;
+        default:
+            break;
+        }
+        break;
+
     case RDSR:
         s->data[0] = (!!s->write_enable) << 1;
         s->data[0] |= (!!s->status_register_write_disabled) << 7;
@@ -1824,8 +1851,8 @@ static const VMStateDescription vmstate_m25p80_block_protect = {
 
 static const VMStateDescription vmstate_m25p80 = {
     .name = "m25p80",
-    .version_id = 0,
-    .minimum_version_id = 0,
+    .version_id = 1,
+    .minimum_version_id = 1,
     .pre_save = m25p80_pre_save,
     .pre_load = m25p80_pre_load,
     .fields = (const VMStateField[]) {
@@ -1837,6 +1864,7 @@ static const VMStateDescription vmstate_m25p80 = {
         VMSTATE_UINT8(cmd_in_progress, Flash),
         VMSTATE_UINT32(cur_addr, Flash),
         VMSTATE_BOOL(write_enable, Flash),
+        VMSTATE_BOOL(volatile_write_enable, Flash),
         VMSTATE_BOOL(reset_enable, Flash),
         VMSTATE_UINT8(ear, Flash),
         VMSTATE_BOOL(four_bytes_address_mode, Flash),
Signature · 1 line
2.43.0
author
#15 lore raw

PATCH v3 13/15 hw/ssi/aspeed_smc: Add Data FIFO-based flash access support for AST2700

In reply to Jamin Lin

AST2700 supports a Data FIFO mode where flash accesses can be performed directly through Data FIFO MMIO offsets. The Data FIFO start offset increments by one for every 16MB of flash address space, allowing the chip select (CS) to be decoded from the Data FIFO offset.

This change adds Data FIFO support to the Aspeed SMC model and introduces a class callback to translate Data FIFO offsets into CS indices. For AST2700, the Data FIFO offset is matched against the segment start address of each CS to determine the target flash device.

The SMC register region size (nregs) is also extended dynamically based on the number of supported chip selects to cover all possible Data FIFO regions.

---
 include/hw/ssi/aspeed_smc.h |   3 +-
 hw/ssi/aspeed_smc.c         | 111 +++++++++++++++++++++++++++++++++---
 2 files changed, 105 insertions(+), 9 deletions(-)
include/hw/ssi/aspeed_smc.h +2 -1
index 76831422c6..640efade94 100644
@@ -47,7 +47,7 @@ struct AspeedSMCFlash {
 #define TYPE_ASPEED_SMC "aspeed.smc"
 OBJECT_DECLARE_TYPE(AspeedSMCState, AspeedSMCClass, ASPEED_SMC)
 
-#define ASPEED_SMC_R_MAX        (0x100 / 4)
+#define ASPEED_SMC_R_MAX        (0x300 / 4)
 #define ASPEED_SMC_CS_MAX       5
 
 struct AspeedSMCState {
@@ -116,6 +116,7 @@ struct AspeedSMCClass {
                            AspeedSegments *seg);
     void (*dma_ctrl)(AspeedSMCState *s, uint32_t value);
     int (*addr_width)(const AspeedSMCState *s);
+    int (*data_fifo_offset_to_cs)(const AspeedSMCState *s, uint32_t offset);
     const MemoryRegionOps *reg_ops;
 };
 
hw/ssi/aspeed_smc.c +103 -8

207 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#16 lore raw

PATCH v3 14/15 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          | 34 ++++++++++---------
 1 file changed, 18 insertions(+), 16 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700fc.py +18 -16
index 51ee8bc787..3b68f37b63 100755
@@ -23,13 +23,17 @@ 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()
 
+    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):
-        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
-        exec_command_and_wait_for_pattern(self, '\012', '=>')
         exec_command_and_wait_for_pattern(self,
             'cp 100420000 403000000 900000', '=>')
         exec_command_and_wait_for_pattern(self,
@@ -43,6 +47,9 @@ def enable_ast2700_pcie2(self):
 
     def verify_openbmc_boot_and_login(self, name):
         wait_for_console_pattern(self, 'U-Boot 2023.10')
+        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
+        exec_command_and_wait_for_pattern(self, '\012', '=>')
+        self.enable_ast2700_ssp_tsp()
         self.enable_ast2700_pcie2()
         wait_for_console_pattern(self, 'Starting kernel ...')
 
@@ -50,17 +57,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_V1100_AST2700 = Asset(
             'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2700-default-obmc.tar.gz',
             'e2b8f043fe8063dd3b6ded93422e38bd41914dc9c3202199507652df024de4dc')
@@ -118,6 +114,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')
@@ -138,13 +142,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
#17 lore raw

PATCH v3 15/15 docs: Add support vbootrom and update Manual boot for ast2700fc

In reply to Jamin Lin
---
 docs/system/arm/aspeed.rst | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)
docs/system/arm/aspeed.rst +34 -3
index d0054a7dbb..0f83189e67 100644
@@ -389,18 +389,26 @@ 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
  * 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:
 
@@ -410,6 +418,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 \
@@ -423,6 +433,27 @@ Steps to boot the AST2700fc machine:
        -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