Coprocessor and memory mapping improvements for AST2700
cover Coprocessor and memory mapping improvements for AST2700
v1:
1. Improved memory mapping
2. Added SRAM support and increased SDRAM size to 512MB to fix coprocessor crash observed in SDK v09.08
3. Updated coprocessor functional tests for SDK v09.08
4. Added VBOOTROM support
5. Shared a single SCU instance among PSP, SSP, and TSP
6. Shared UART set among PSP, SSP, and TSP
Jamin Lin (12):
hw/arm/aspeed_ast27x0-ssp: Add SDRAM region and fix naming and size to
512MB
hw/arm/aspeed_ast27x0-tsp: Add SDRAM region and fix naming and size to
512MB hw/arm/ast27x0: Add SRAM link and alias mapping for SSP coprocessor hw/arm/ast27x0: Add SRAM link and alias mapping for TSP coprocessor hw/arm/ast27x0: Share single SCU instance across PSP, SSP, and TSP hw/arm/ast27x0: Share single UART set across PSP, SSP, and TSP hw/arm/aspeed_ast27x0-fc: Map FMC0 flash contents into CA35 boot ROM hw/arm/aspeed_ast27x0-fc: Add VBOOTROM support tests/functional/aarch64/ast2700fc: Update test ASPEED SDK v09.08 tests/functional/aarch64/ast2700fc: Add eth2 network interface check
in PCIe test
tests/functional/aarch64/ast2700fc: Move coprocessor image loading to
common function
tests/functional/aarch64/ast2700fc: Add vbootrom test
include/hw/arm/aspeed_coprocessor.h | 14 ++-- hw/arm/aspeed_ast27x0-fc.c | 55 +++++++++++---- hw/arm/aspeed_ast27x0-ssp.c | 69 +++++++++---------- hw/arm/aspeed_ast27x0-tsp.c | 69 +++++++++---------- hw/arm/aspeed_coprocessor_common.c | 7 ++ .../aarch64/test_aspeed_ast2700fc.py | 51 ++++++++++---- 6 files changed, 160 insertions(+), 105 deletions(-)
Signature · 1 line
2.43.0
PATCH 2/12 hw/arm/aspeed_ast27x0-tsp: Add SDRAM region and fix naming and size to 512MB
Previously, the TSP memory was incorrectly modeled as "SRAM" with a 32 MB size. Rename from SRAM to SDRAM and correct size from 32MB to 512MB to match hardware.
--- hw/arm/aspeed_ast27x0-tsp.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
hw/arm/aspeed_ast27x0-tsp.c +10 -10
@@ -16,10 +16,10 @@#include "hw/arm/aspeed_soc.h" #include "hw/arm/aspeed_coprocessor.h" -#define AST2700_TSP_RAM_SIZE (32 * MiB) +#define AST2700_TSP_SDRAM_SIZE (512 * MiB)static const hwaddr aspeed_soc_ast27x0tsp_memmap[] = { - [ASPEED_DEV_SRAM ] =0x00000000 , + [ASPEED_DEV_SDRAM ] =0x00000000 , [ASPEED_DEV_INTC ] =0x72100000 , [ASPEED_DEV_SCU ] =0x72C02000 , [ASPEED_DEV_SCUIO ] =0x74C02000 ,
@@ -165,7 +165,7 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)AspeedCoprocessorState *s =ASPEED_COPROCESSOR (dev_soc);AspeedCoprocessorClass *sc =ASPEED_COPROCESSOR_GET_CLASS (s);DeviceState *armv7m; - g_autofree char *sram_name = NULL; + g_autofree char *sdram_name = NULL;int uart;int i;
@@ -184,16 +184,16 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp) OBJECT(s->memory), &error_abort);sysbus_realize (SYS_BUS_DEVICE (&a->armv7m), &error_abort); - sram_name =g_strdup_printf ("aspeed.dram.%d" , -CPU (a->armv7m.cpu)->cpu_index); - -if (!memory_region_init_ram (&s->sram,OBJECT (s), sram_name, -AST2700_TSP_RAM_SIZE , errp)) { +/* SDRAM */ + sdram_name =g_strdup_printf ("aspeed.sdram.%d" , +CPU (a->armv7m.cpu)->cpu_index); +if (!memory_region_init_ram (&s->sdram,OBJECT (s), sdram_name, +AST2700_TSP_SDRAM_SIZE , errp)) {return ; }memory_region_add_subregion (s->memory, - sc->memmap[ASPEED_DEV_SRAM ], - &s->sram); + sc->memmap[ASPEED_DEV_SDRAM ], + &s->sdram);/* SCU */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {
Signature · 1 line
2.43.0
PATCH 1/12 hw/arm/aspeed_ast27x0-ssp: Add SDRAM region and fix naming and size to 512MB
In reply to Jamin Lin viaPreviously, the SSP memory was incorrectly modeled as "SRAM" with a 32 MB size. This change introduces a new sdram field in AspeedCoprocessorState and updates the realization logic accordingly. Rename from SRAM to SDRAM and correct size from 32MB to 512MB to match hardware.
--- include/hw/arm/aspeed_coprocessor.h | 1 + hw/arm/aspeed_ast27x0-ssp.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-)
include/hw/arm/aspeed_coprocessor.h +1 -0
@@ -16,6 +16,7 @@ struct AspeedCoprocessorState {DeviceState parent;MemoryRegion *memory; +MemoryRegion sdram;MemoryRegion sram;Clock *sysclk;
hw/arm/aspeed_ast27x0-ssp.c +10 -10
@@ -16,10 +16,10 @@#include "hw/arm/aspeed_soc.h" #include "hw/arm/aspeed_coprocessor.h" -#define AST2700_SSP_RAM_SIZE (32 * MiB) +#define AST2700_SSP_SDRAM_SIZE (512 * MiB)static const hwaddr aspeed_soc_ast27x0ssp_memmap[] = { - [ASPEED_DEV_SRAM ] =0x00000000 , + [ASPEED_DEV_SDRAM ] =0x00000000 , [ASPEED_DEV_INTC ] =0x72100000 , [ASPEED_DEV_SCU ] =0x72C02000 , [ASPEED_DEV_SCUIO ] =0x74C02000 ,
@@ -165,7 +165,7 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)AspeedCoprocessorState *s =ASPEED_COPROCESSOR (dev_soc);AspeedCoprocessorClass *sc =ASPEED_COPROCESSOR_GET_CLASS (s);DeviceState *armv7m; - g_autofree char *sram_name = NULL; + g_autofree char *sdram_name = NULL;int uart;int i;
@@ -184,16 +184,16 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp) OBJECT(s->memory), &error_abort);sysbus_realize (SYS_BUS_DEVICE (&a->armv7m), &error_abort); - sram_name =g_strdup_printf ("aspeed.dram.%d" , -CPU (a->armv7m.cpu)->cpu_index); - -if (!memory_region_init_ram (&s->sram,OBJECT (s), sram_name, -AST2700_SSP_RAM_SIZE , errp)) { +/* SDRAM */ + sdram_name =g_strdup_printf ("aspeed.sdram.%d" , +CPU (a->armv7m.cpu)->cpu_index); +if (!memory_region_init_ram (&s->sdram,OBJECT (s), sdram_name, +AST2700_SSP_SDRAM_SIZE , errp)) {return ; }memory_region_add_subregion (s->memory, - sc->memmap[ASPEED_DEV_SRAM ], - &s->sram); + sc->memmap[ASPEED_DEV_SDRAM ], + &s->sdram);/* SCU */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {
Signature · 1 line
2.43.0
PATCH 4/12 hw/arm/ast27x0: Add SRAM link and alias mapping for TSP coprocessor
In reply to Jamin Lin viaAST2700 has a 128KB SRAM, physically mapped at 0x10000000–0x1001FFFF for the PSP (CA35) processor. The TSP coprocessor shares this same SRAM but accesses it through a different address window at 0x70000000–0x7001FFFF.
To model this shared-memory behavior in QEMU, this commit introduces a linked SRAM property and alias mapping between the PSP and TSP subsystems.
Changes include:
- Add the SRAM alias mapping at 0x70000000 in aspeed_ast27x0-tsp.c.
- In aspeed_ast27x0-fc.c, connect the TSP coprocessor’s "sram" link to the PSP’s SRAM region.
- Ensure the alias region is initialized during TSP SoC realization so the TSP can correctly access shared SRAM through its own address space.
This ensures that the TSP and PSP share the same physical SRAM backing.
--- hw/arm/aspeed_ast27x0-fc.c | 4 ++++ hw/arm/aspeed_ast27x0-tsp.c | 7 +++++++ 2 files changed, 11 insertions(+)
hw/arm/aspeed_ast27x0-fc.c +4 -0
@@ -150,6 +150,8 @@ static bool ast2700fc_tsp_init(MachineState *machine, Error **errp)AspeedCoprocessorState *soc;AspeedCoprocessorClass *sc;Ast2700FCState *s =AST2700A1FC (machine); +AspeedSoCState *psp =ASPEED_SOC (&s->ca35); + s->tsp_sysclk =clock_new (OBJECT (s),"TSP_SYSCLK" );clock_set_hz (s->tsp_sysclk,200000000ULL );
@@ -166,6 +168,8 @@ static bool ast2700fc_tsp_init(MachineState *machine, Error **errp) sc =ASPEED_COPROCESSOR_GET_CLASS (soc);aspeed_soc_uart_set_chr (soc->uart,ASPEED_DEV_UART7 , sc->uarts_base, sc->uarts_num,serial_hd (2 )); +object_property_set_link (OBJECT (&s->tsp),"sram" , +OBJECT (&psp->sram), &error_abort);if (!qdev_realize (DEVICE (&s->tsp),NULL , errp)) {return false; }
hw/arm/aspeed_ast27x0-tsp.c +7 -0
@@ -20,6 +20,7 @@static const hwaddr aspeed_soc_ast27x0tsp_memmap[] = { [ASPEED_DEV_SDRAM ] =0x00000000 , + [ASPEED_DEV_SRAM ] =0x70000000 , [ASPEED_DEV_INTC ] =0x72100000 , [ASPEED_DEV_SCU ] =0x72C02000 , [ASPEED_DEV_SCUIO ] =0x74C02000 ,
@@ -195,6 +196,12 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp) sc->memmap[ASPEED_DEV_SDRAM ], &s->sdram); +/* SRAM */ +memory_region_init_alias (&s->sram_alias,OBJECT (s),"sram.alias" , + s->sram,0 ,memory_region_size (s->sram)); +memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SRAM ], + &s->sram_alias); +/* SCU */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {return ;
Signature · 1 line
2.43.0
PATCH 7/12 hw/arm/aspeed_ast27x0-fc: Map FMC0 flash contents into CA35 boot ROM
In reply to Jamin Lin viaThis patch introduces a dedicated ca35_boot_rom memory region and copies the FMC0 flash data into it.
The motivation is to support the upcoming vbootrom. The vbootrom replaces the existing BOOTMCU (RISC-V 32 SPL) flow, which currently reads the "image-bmc" from FMC_CS0 and loads the following components into DRAM:
- Trusted Firmware-A
- OP-TEE OS
- u-boot-nodtb.bin
- u-boot.dtb
After loading, BOOTMCU releases the CA35 reset so that CA35 can start executing Trusted Firmware-A.
The vbootrom follows the same sequence: CA35 fetches "image-bmc" from FMC0 flash at the SPI boot ROM base address (0x100000000), parses the FIT image, loads each component into its designated DRAM location, and then jumps to Trusted Firmware-A.
--- hw/arm/aspeed_ast27x0-fc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
hw/arm/aspeed_ast27x0-fc.c +12 -2
@@ -35,6 +35,7 @@ struct Ast2700FCState {MemoryRegion ca35_memory;MemoryRegion ca35_dram; +MemoryRegion ca35_boot_rom;MemoryRegion ssp_memory;MemoryRegion tsp_memory;
@@ -44,8 +45,6 @@ struct Ast2700FCState {Aspeed27x0SoCState ca35;Aspeed27x0CoprocessorState ssp;Aspeed27x0CoprocessorState tsp; - -bool mmio_exec; };#define AST2700FC_BMC_RAM_SIZE (1 * GiB)
@@ -61,6 +60,9 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp)Ast2700FCState *s =AST2700A1FC (machine);AspeedSoCState *soc;AspeedSoCClass *sc; +BlockBackend *fmc0 =NULL ; +DeviceState *dev =NULL ; +uint64_t rom_size;object_initialize_child (OBJECT (s),"ca35" , &s->ca35,"ast2700-a1" ); soc =ASPEED_SOC (&s->ca35);
@@ -112,6 +114,14 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp) ast2700fc_board_info.ram_size = machine->ram_size; ast2700fc_board_info.loader_start = sc->memmap[ASPEED_DEV_SDRAM ]; + dev =ssi_get_cs (soc->fmc.spi,0 ); + fmc0 = dev ?m25p80_get_blk (dev) :NULL ; + +if (fmc0) { + rom_size =memory_region_size (&soc->spi_boot); +aspeed_install_boot_rom (soc, fmc0, &s->ca35_boot_rom, rom_size); + } +arm_load_kernel (ARM_CPU (first_cpu), machine, &ast2700fc_board_info);return true;
Signature · 1 line
2.43.0
PATCH 5/12 hw/arm/ast27x0: Share single SCU instance across PSP, SSP, and TSP
In reply to Jamin Lin viaAST2700 has a single SCU hardware block, memory-mapped at 0x12C02000–0x12C03FFF from the perspective of the main CA35 processor (PSP). The SSP and TSP coprocessors access this same SCU block at different
addresses: 0x72C02000–0x72C03FFF.
Previously, each subsystem (PSP, SSP, and TSP) instantiated its own SCU device, resulting in three independent SCU instances in the QEMU model. In real hardware, however, only a single SCU exists and is shared among all processors.
This commit reworks the SCU model to correctly reflect the hardware behavior by allowing SSP and TSP to reference the PSP’s SCU instance. The following changes are introduced:
- Add a scu property to AspeedCoprocessorState for linking the coprocessor to the PSP’s SCU instance.
- Replace per-coprocessor SCU instantiation with a shared SCU link.
- Add "MemoryRegion scu_alias" to model address remapping for SSP and TSP.
- Create SCU alias regions in both SSP and TSP coprocessors and map them at 0x72C02000 to mirror the PSP’s SCU registers.
- Ensure the SCU device in PSP is realized before SSP/TSP alias setup.
With this change, PSP, SSP, and TSP now share a consistent SCU state, matching the single-SCU hardware design of AST2700.
--- include/hw/arm/aspeed_coprocessor.h | 4 ++-- hw/arm/aspeed_ast27x0-fc.c | 4 ++++ hw/arm/aspeed_ast27x0-ssp.c | 13 +++++-------- hw/arm/aspeed_ast27x0-tsp.c | 13 +++++-------- hw/arm/aspeed_coprocessor_common.c | 2 ++ 5 files changed, 18 insertions(+), 18 deletions(-)
include/hw/arm/aspeed_coprocessor.h +2 -2
@@ -19,9 +19,10 @@ struct AspeedCoprocessorState {MemoryRegion sdram;MemoryRegion *sram;MemoryRegion sram_alias; +MemoryRegion scu_alias;Clock *sysclk; -AspeedSCUState scu; +AspeedSCUState *scu;AspeedSCUState scuio;AspeedTimerCtrlState timerctrl;SerialMM uart[ASPEED_UARTS_NUM ];
@@ -36,7 +37,6 @@ struct AspeedCoprocessorClass {/** valid_cpu_types: NULL terminated array of a single CPU type. */ const char *const *valid_cpu_types; -uint32_t silicon_rev;const hwaddr *memmap;const int *irqmap;int uarts_base;
hw/arm/aspeed_ast27x0-fc.c +4 -0
@@ -138,6 +138,8 @@ static bool ast2700fc_ssp_init(MachineState *machine, Error **errp) sc->uarts_num, serial_hd(1));object_property_set_link (OBJECT (&s->ssp),"sram" ,OBJECT (&psp->sram), &error_abort); +object_property_set_link (OBJECT (&s->ssp),"scu" , +OBJECT (&psp->scu), &error_abort);if (!qdev_realize (DEVICE (&s->ssp),NULL , errp)) {return false; }
@@ -170,6 +172,8 @@ static bool ast2700fc_tsp_init(MachineState *machine, Error **errp) sc->uarts_num, serial_hd(2));object_property_set_link (OBJECT (&s->tsp),"sram" ,OBJECT (&psp->sram), &error_abort); +object_property_set_link (OBJECT (&s->tsp),"scu" , +OBJECT (&psp->scu), &error_abort);if (!qdev_realize (DEVICE (&s->tsp),NULL , errp)) {return false; }
hw/arm/aspeed_ast27x0-ssp.c +5 -8
@@ -137,9 +137,7 @@ static void aspeed_soc_ast27x0ssp_init(Object *obj)int i;object_initialize_child (obj,"armv7m" , &a->armv7m,TYPE_ARMV7M ); -object_initialize_child (obj,"scu" , &s->scu,TYPE_ASPEED_2700_SCU ); s->sysclk =qdev_init_clock_in (DEVICE (s),"sysclk" ,NULL ,NULL ,0 ); -qdev_prop_set_uint32 (DEVICE (&s->scu),"silicon-rev" , sc->silicon_rev);for (i =0 ; i < sc->uarts_num; i++) {object_initialize_child (obj,"uart[*]" , &s->uart[i],TYPE_SERIAL_MM );
@@ -203,11 +201,11 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp) &s->sram_alias);/* SCU */ -if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) { -return ; - } -aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&s->scu),0 , - sc->memmap[ASPEED_DEV_SCU ]); +memory_region_init_alias (&s->scu_alias,OBJECT (s),"scu.alias" , + &s->scu->iomem,0 , +memory_region_size (&s->scu->iomem)); +memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SCU ], + &s->scu_alias);/* INTC */ if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[0 ]), errp)) {
@@ -285,7 +283,6 @@ static void aspeed_soc_ast27x0ssp_class_init(ObjectClass *klass, dc->realize = aspeed_soc_ast27x0ssp_realize; sc->valid_cpu_types = valid_cpu_types; - sc->silicon_rev =AST2700_A1_SILICON_REV ; sc->uarts_num =13 ; sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast27x0ssp_irqmap;
hw/arm/aspeed_ast27x0-tsp.c +5 -8
@@ -137,9 +137,7 @@ static void aspeed_soc_ast27x0tsp_init(Object *obj)int i;object_initialize_child (obj,"armv7m" , &a->armv7m,TYPE_ARMV7M ); -object_initialize_child (obj,"scu" , &s->scu,TYPE_ASPEED_2700_SCU ); s->sysclk =qdev_init_clock_in (DEVICE (s),"sysclk" ,NULL ,NULL ,0 ); -qdev_prop_set_uint32 (DEVICE (&s->scu),"silicon-rev" , sc->silicon_rev);for (i =0 ; i < sc->uarts_num; i++) {object_initialize_child (obj,"uart[*]" , &s->uart[i],TYPE_SERIAL_MM );
@@ -203,11 +201,11 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp) &s->sram_alias);/* SCU */ -if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) { -return ; - } -aspeed_mmio_map (s->memory,SYS_BUS_DEVICE (&s->scu),0 , - sc->memmap[ASPEED_DEV_SCU ]); +memory_region_init_alias (&s->scu_alias,OBJECT (s),"scu.alias" , + &s->scu->iomem,0 , +memory_region_size (&s->scu->iomem)); +memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SCU ], + &s->scu_alias);/* INTC */ if (!sysbus_realize (SYS_BUS_DEVICE (&a->intc[0 ]), errp)) {
@@ -285,7 +283,6 @@ static void aspeed_soc_ast27x0tsp_class_init(ObjectClass *klass, dc->realize = aspeed_soc_ast27x0tsp_realize; sc->valid_cpu_types = valid_cpu_types; - sc->silicon_rev =AST2700_A1_SILICON_REV ; sc->uarts_num =13 ; sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast27x0tsp_irqmap;
hw/arm/aspeed_coprocessor_common.c +2 -0
@@ -27,6 +27,8 @@ static const Property aspeed_coprocessor_properties[] = { TYPE_MEMORY_REGION, MemoryRegion *),DEFINE_PROP_LINK ("sram" , AspeedCoprocessorState, sram,TYPE_MEMORY_REGION , MemoryRegion *), +DEFINE_PROP_LINK ("scu" , AspeedCoprocessorState, scu,TYPE_ASPEED_SCU , + AspeedSCUState *), };static void aspeed_coprocessor_class_init (ObjectClass *oc,const void *data)
Signature · 1 line
2.43.0
PATCH 8/12 hw/arm/aspeed_ast27x0-fc: Add VBOOTROM support
In reply to Jamin Lin viaIntroduces support for loading a vbootrom image into the dedicated vbootrom memory region in the AST2700 Full Core machine.
--- hw/arm/aspeed_ast27x0-fc.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/arm/aspeed_ast27x0-fc.c +5 -0
@@ -60,6 +60,7 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp)Ast2700FCState *s =AST2700A1FC (machine);AspeedSoCState *soc;AspeedSoCClass *sc; +const char *bios_name =NULL ;BlockBackend *fmc0 =NULL ;DeviceState *dev =NULL ;uint64_t rom_size;
@@ -122,6 +123,10 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp)aspeed_install_boot_rom (soc, fmc0, &s->ca35_boot_rom, rom_size); } +/* VBOOTROM */ + bios_name = machine->firmware ?:VBOOTROM_FILE_NAME ; +aspeed_load_vbootrom (soc, bios_name, errp); +arm_load_kernel (ARM_CPU (first_cpu), machine, &ast2700fc_board_info);return true;
Signature · 1 line
2.43.0
PATCH 9/12 tests/functional/aarch64/ast2700fc: Update test ASPEED SDK v09.08
In reply to Jamin Lin via--- tests/functional/aarch64/test_aspeed_ast2700fc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700fc.py +6 -6
@@ -36,9 +36,9 @@ 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}:~#') - ASSET_SDK_V906_AST2700 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2700-default-obmc.tar.gz', - 'f1d53e0be8a404ecce3e105f72bc50fa4e090ad13160ffa91b10a6e0233a9dc6') + ASSET_SDK_V908_AST2700 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.08/ast2700-default-obmc.tar.gz', + 'eac3dc409b7ea3cd4b03d4792d3cebd469792ad893cb51e1d15f0fc20bd1e2cd') def do_ast2700_i2c_test(self): exec_command_and_wait_for_pattern(self,
@@ -66,7 +66,7 @@ def do_ast2700fc_ssp_test(self): self.vm.set_console(console_index=1) self.vm.launch() - exec_command_and_wait_for_pattern(self, '\012', 'ssp:~$') + exec_command_and_wait_for_pattern(self, '\012', 'ssp_tsp:~$') exec_command_and_wait_for_pattern(self, 'version', 'Zephyr version 3.7.1') exec_command_and_wait_for_pattern(self, 'md 72c02000 1',
@@ -133,10 +133,10 @@ def start_ast2700fc_test(self, name): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc')) - def test_aarch64_ast2700fc_sdk_v09_06(self): + def test_aarch64_ast2700fc_sdk_v09_08(self): self.set_machine('ast2700fc') - self.archive_extract(self.ASSET_SDK_V906_AST2700) + self.archive_extract(self.ASSET_SDK_V908_AST2700) self.start_ast2700fc_test('ast2700-default') self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700_i2c_test()
Signature · 1 line
2.43.0
PATCH 10/12 tests/functional/aarch64/ast2700fc: Add eth2 network interface check in PCIe test
In reply to Jamin Lin viaEnhance the AST2700 functional PCIe test to verify the network interface configuration for eth2. This adds an additional command to check the IP address assignment on eth2 to ensure network functionality is correctly initialized in the test environment.
--- tests/functional/aarch64/test_aspeed_ast2700fc.py | 4 ++++ 1 file changed, 4 insertions(+)
tests/functional/aarch64/test_aspeed_ast2700fc.py +4 -0
@@ -60,6 +60,9 @@ def do_ast2700_pcie_test(self): 'lspci -s 0002:01:00.0', '0002:01:00.0 Ethernet controller: ' 'Intel Corporation 82574L Gigabit Network Connection') + exec_command_and_wait_for_pattern(self, + 'ip addr show dev eth2', + 'inet 10.0.2.15/24') def do_ast2700fc_ssp_test(self): self.vm.shutdown()
@@ -135,6 +138,7 @@ def start_ast2700fc_test(self, name): def test_aarch64_ast2700fc_sdk_v09_08(self): self.set_machine('ast2700fc') + self.require_netdev('user') self.archive_extract(self.ASSET_SDK_V908_AST2700) self.start_ast2700fc_test('ast2700-default')
Signature · 1 line
2.43.0
PATCH 3/12 hw/arm/ast27x0: Add SRAM link and alias mapping for SSP coprocessor
In reply to Jamin Lin viaAST2700 has a 128KB SRAM, physically mapped at 0x10000000–0x1001FFFF for the PSP (CA35) processor. The SSP coprocessor shares this same SRAM but accesses it through a different address window at 0x70000000–0x7001FFFF.
To model this shared-memory behavior in QEMU, this commit introduces a linked SRAM property and alias mapping between the PSP and SSP subsystems.
Changes include:
- Add a "MemoryRegion *sram" link and "MemoryRegion sram_alias" to AspeedCoprocessorState.
- Register the new "sram" property in aspeed_coprocessor_common.c.
- In aspeed_ast27x0-fc.c, connect the SSP coprocessor’s "sram" link to the PSP’s SRAM region.
- In aspeed_ast27x0-ssp.c, create an alias mapping for SRAM at 0x70000000 – 0x7001FFFF in the SSP’s memory map.
This ensures that the SSP can correctly access the shared SRAM contents through its own address space while maintaining a consistent physical backing region. It also guarantees that the SRAM is realized before the SSP device, ensuring successful alias setup.
--- include/hw/arm/aspeed_coprocessor.h | 3 ++- hw/arm/aspeed_ast27x0-fc.c | 4 ++++ hw/arm/aspeed_ast27x0-ssp.c | 7 +++++++ hw/arm/aspeed_coprocessor_common.c | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-)
include/hw/arm/aspeed_coprocessor.h +2 -1
@@ -17,7 +17,8 @@ struct AspeedCoprocessorState {MemoryRegion *memory;MemoryRegion sdram; -MemoryRegion sram; +MemoryRegion *sram; +MemoryRegion sram_alias;Clock *sysclk;AspeedSCUState scu;
hw/arm/aspeed_ast27x0-fc.c +4 -0
@@ -118,6 +118,8 @@ static bool ast2700fc_ssp_init(MachineState *machine, Error **errp)AspeedCoprocessorState *soc;AspeedCoprocessorClass *sc;Ast2700FCState *s =AST2700A1FC (machine); +AspeedSoCState *psp =ASPEED_SOC (&s->ca35); + s->ssp_sysclk =clock_new (OBJECT (s),"SSP_SYSCLK" );clock_set_hz (s->ssp_sysclk,200000000ULL );
@@ -134,6 +136,8 @@ static bool ast2700fc_ssp_init(MachineState *machine, Error **errp) sc =ASPEED_COPROCESSOR_GET_CLASS (soc);aspeed_soc_uart_set_chr (soc->uart,ASPEED_DEV_UART4 , sc->uarts_base, sc->uarts_num,serial_hd (1 )); +object_property_set_link (OBJECT (&s->ssp),"sram" , +OBJECT (&psp->sram), &error_abort);if (!qdev_realize (DEVICE (&s->ssp),NULL , errp)) {return false; }
hw/arm/aspeed_ast27x0-ssp.c +7 -0
@@ -20,6 +20,7 @@static const hwaddr aspeed_soc_ast27x0ssp_memmap[] = { [ASPEED_DEV_SDRAM ] =0x00000000 , + [ASPEED_DEV_SRAM ] =0x70000000 , [ASPEED_DEV_INTC ] =0x72100000 , [ASPEED_DEV_SCU ] =0x72C02000 , [ASPEED_DEV_SCUIO ] =0x74C02000 ,
@@ -195,6 +196,12 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp) sc->memmap[ASPEED_DEV_SDRAM ], &s->sdram); +/* SRAM */ +memory_region_init_alias (&s->sram_alias,OBJECT (s),"sram.alias" , + s->sram,0 ,memory_region_size (s->sram)); +memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SRAM ], + &s->sram_alias); +/* SCU */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {return ;
hw/arm/aspeed_coprocessor_common.c +2 -0
@@ -25,6 +25,8 @@ static void aspeed_coprocessor_realize(DeviceState *dev, Error **errp)static const Property aspeed_coprocessor_properties[] = {DEFINE_PROP_LINK ("memory" , AspeedCoprocessorState, memory, TYPE_MEMORY_REGION, MemoryRegion *), +DEFINE_PROP_LINK ("sram" , AspeedCoprocessorState, sram,TYPE_MEMORY_REGION , + MemoryRegion *), };static void aspeed_coprocessor_class_init (ObjectClass *oc,const void *data)
Signature · 1 line
2.43.0
PATCH 6/12 hw/arm/ast27x0: Share single UART set across PSP, SSP, and TSP
In reply to Jamin Lin viaIn the original model, each subsystem (PSP, SSP, and TSP) created its own set of 13 UART devices, resulting in a total of 39 UART instances. However, on real AST2700 hardware, there is only one set of 13 UARTs shared among all processors.
This commit reworks the UART handling to correctly model the shared hardware design. The PSP now creates the full set of 13 UART instances, while the SSP and TSP link to the corresponding shared UART device through object properties.
Changes include:
- Add "DEFINE_PROP_LINK("uart", ...)" and "DEFINE_PROP_INT32("uart-dev", ...)" to allow each coprocessor to reference a specific shared UART instance.
- Modify SSP to link to PSP’s UART4, and TSP to link to PSP’s UART7.
- Introduce "uart_alias" to remap the UART’s MMIO region into the coprocessor’s memory space.
- Redirect the UART interrupt to the coprocessor’s NVIC, replacing the default routing to the PSP’s GIC.
With this change, only one set of 13 UART devices is instantiated by the PSP, while the SSP and TSP reuse them via aliasing and shared interrupt routing, matching the real AST2700 hardware behavior.
--- include/hw/arm/aspeed_coprocessor.h | 6 +++--- hw/arm/aspeed_ast27x0-fc.c | 24 ++++++++++++------------ hw/arm/aspeed_ast27x0-ssp.c | 29 ++++++++++++----------------- hw/arm/aspeed_ast27x0-tsp.c | 29 ++++++++++++----------------- hw/arm/aspeed_coprocessor_common.c | 3 +++ 5 files changed, 42 insertions(+), 49 deletions(-)
include/hw/arm/aspeed_coprocessor.h +3 -3
@@ -19,13 +19,15 @@ struct AspeedCoprocessorState {MemoryRegion sdram;MemoryRegion *sram;MemoryRegion sram_alias; +MemoryRegion uart_alias;MemoryRegion scu_alias;Clock *sysclk;AspeedSCUState *scu;AspeedSCUState scuio;AspeedTimerCtrlState timerctrl; -SerialMM uart[ASPEED_UARTS_NUM ]; +SerialMM *uart; +int uart_dev; };#define TYPE_ASPEED_COPROCESSOR "aspeed-coprocessor"
@@ -39,8 +41,6 @@ struct AspeedCoprocessorClass {const char *const *valid_cpu_types;const hwaddr *memmap;const int *irqmap; -int uarts_base; -int uarts_num; };struct Aspeed27x0CoprocessorState {
hw/arm/aspeed_ast27x0-fc.c +12 -12
@@ -93,6 +93,10 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp) AST2700FC_HW_STRAP2, &error_abort);aspeed_soc_uart_set_chr (soc->uart,ASPEED_DEV_UART12 , sc->uarts_base, sc->uarts_num,serial_hd (0 )); +aspeed_soc_uart_set_chr (soc->uart,ASPEED_DEV_UART4 , sc->uarts_base, + 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 ));if (!qdev_realize (DEVICE (&s->ca35),NULL , errp)) {return false; }
@@ -115,8 +119,6 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp)static bool ast2700fc_ssp_init (MachineState *machine,Error **errp) { -AspeedCoprocessorState *soc; -AspeedCoprocessorClass *sc;Ast2700FCState *s =AST2700A1FC (machine);AspeedSoCState *psp =ASPEED_SOC (&s->ca35);
@@ -132,10 +134,10 @@ static bool ast2700fc_ssp_init(MachineState *machine, Error **errp)object_property_set_link (OBJECT (&s->ssp),"memory" ,OBJECT (&s->ssp_memory), &error_abort); - soc =ASPEED_COPROCESSOR (&s->ssp); - sc =ASPEED_COPROCESSOR_GET_CLASS (soc); -aspeed_soc_uart_set_chr (soc->uart,ASPEED_DEV_UART4 , sc->uarts_base, - sc->uarts_num,serial_hd (1 )); +object_property_set_link (OBJECT (&s->ssp),"uart" , +OBJECT (&psp->uart[4 ]), &error_abort); +object_property_set_int (OBJECT (&s->ssp),"uart-dev" ,ASPEED_DEV_UART4 , + &error_abort);object_property_set_link (OBJECT (&s->ssp),"sram" ,OBJECT (&psp->sram), &error_abort); object_property_set_link(OBJECT(&s->ssp), "scu",
@@ -149,8 +151,6 @@ static bool ast2700fc_ssp_init(MachineState *machine, Error **errp)static bool ast2700fc_tsp_init (MachineState *machine,Error **errp) { -AspeedCoprocessorState *soc; -AspeedCoprocessorClass *sc;Ast2700FCState *s =AST2700A1FC (machine);AspeedSoCState *psp =ASPEED_SOC (&s->ca35);
@@ -166,10 +166,10 @@ static bool ast2700fc_tsp_init(MachineState *machine, Error **errp)object_property_set_link (OBJECT (&s->tsp),"memory" ,OBJECT (&s->tsp_memory), &error_abort); - soc =ASPEED_COPROCESSOR (&s->tsp); - sc =ASPEED_COPROCESSOR_GET_CLASS (soc); -aspeed_soc_uart_set_chr (soc->uart,ASPEED_DEV_UART7 , sc->uarts_base, - sc->uarts_num,serial_hd (2 )); +object_property_set_link (OBJECT (&s->tsp),"uart" , +OBJECT (&psp->uart[7 ]), &error_abort); +object_property_set_int (OBJECT (&s->tsp),"uart-dev" ,ASPEED_DEV_UART7 , + &error_abort);object_property_set_link (OBJECT (&s->tsp),"sram" ,OBJECT (&psp->sram), &error_abort); object_property_set_link(OBJECT(&s->tsp), "scu",
hw/arm/aspeed_ast27x0-ssp.c +12 -17
@@ -133,16 +133,10 @@ static void aspeed_soc_ast27x0ssp_init(Object *obj) {Aspeed27x0CoprocessorState *a =ASPEED27X0SSP_COPROCESSOR (obj);AspeedCoprocessorState *s =ASPEED_COPROCESSOR (obj); -AspeedCoprocessorClass *sc =ASPEED_COPROCESSOR_GET_CLASS (s); -int i;object_initialize_child (obj,"armv7m" , &a->armv7m,TYPE_ARMV7M ); s->sysclk =qdev_init_clock_in (DEVICE (s),"sysclk" ,NULL ,NULL ,0 ); -for (i =0 ; i < sc->uarts_num; i++) { -object_initialize_child (obj,"uart[*]" , &s->uart[i],TYPE_SERIAL_MM ); - } -object_initialize_child (obj,"intc0" , &a->intc[0 ],TYPE_ASPEED_2700SSP_INTC ); object_initialize_child(obj, "intc1", &a->intc[1],
@@ -165,7 +159,6 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)AspeedCoprocessorClass *sc =ASPEED_COPROCESSOR_GET_CLASS (s);DeviceState *armv7m; g_autofree char *sdram_name = NULL; -int uart;int i;if (!clock_has_source (s->sysclk)) {
@@ -244,15 +237,19 @@ static void aspeed_soc_ast27x0ssp_realize(DeviceState *dev_soc, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc[1 ]), i,qdev_get_gpio_in (DEVICE (&a->intc[0 ].orgates[0 ]), i)); } +/* UART */ -for (i =0 , uart = sc->uarts_base; i < sc->uarts_num; i++, uart++) { -if (!aspeed_soc_uart_realize (s->memory, &s->uart[i], - sc->memmap[uart], errp)) { -return ; - } -sysbus_connect_irq (SYS_BUS_DEVICE (&s->uart[i]),0 , -aspeed_soc_ast27x0ssp_get_irq (s, uart)); - } +memory_region_init_alias (&s->uart_alias,OBJECT (s),"uart.alias" , + &s->uart->serial.io,0 , +memory_region_size (&s->uart->serial.io)); +memory_region_add_subregion (s->memory, sc->memmap[s->uart_dev], + &s->uart_alias); +/* +* Redirect the UART interrupt to the NVIC, replacing the default routing +* to the PSP's GIC. +*/ +sysbus_connect_irq (SYS_BUS_DEVICE (s->uart),0 , +aspeed_soc_ast27x0ssp_get_irq (s, s->uart_dev)); aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->timerctrl), "aspeed.timerctrl",
@@ -283,8 +280,6 @@ static void aspeed_soc_ast27x0ssp_class_init(ObjectClass *klass, dc->realize = aspeed_soc_ast27x0ssp_realize; sc->valid_cpu_types = valid_cpu_types; - sc->uarts_num =13 ; - sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast27x0ssp_irqmap; sc->memmap = aspeed_soc_ast27x0ssp_memmap; }
hw/arm/aspeed_ast27x0-tsp.c +12 -17
@@ -133,16 +133,10 @@ static void aspeed_soc_ast27x0tsp_init(Object *obj) {Aspeed27x0CoprocessorState *a =ASPEED27X0TSP_COPROCESSOR (obj);AspeedCoprocessorState *s =ASPEED_COPROCESSOR (obj); -AspeedCoprocessorClass *sc =ASPEED_COPROCESSOR_GET_CLASS (s); -int i;object_initialize_child (obj,"armv7m" , &a->armv7m,TYPE_ARMV7M ); s->sysclk =qdev_init_clock_in (DEVICE (s),"sysclk" ,NULL ,NULL ,0 ); -for (i =0 ; i < sc->uarts_num; i++) { -object_initialize_child (obj,"uart[*]" , &s->uart[i],TYPE_SERIAL_MM ); - } -object_initialize_child (obj,"intc0" , &a->intc[0 ],TYPE_ASPEED_2700TSP_INTC ); object_initialize_child(obj, "intc1", &a->intc[1],
@@ -165,7 +159,6 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)AspeedCoprocessorClass *sc =ASPEED_COPROCESSOR_GET_CLASS (s);DeviceState *armv7m; g_autofree char *sdram_name = NULL; -int uart;int i;if (!clock_has_source (s->sysclk)) {
@@ -244,15 +237,19 @@ static void aspeed_soc_ast27x0tsp_realize(DeviceState *dev_soc, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&a->intc[1 ]), i,qdev_get_gpio_in (DEVICE (&a->intc[0 ].orgates[0 ]), i)); } +/* UART */ -for (i =0 , uart = sc->uarts_base; i < sc->uarts_num; i++, uart++) { -if (!aspeed_soc_uart_realize (s->memory, &s->uart[i], - sc->memmap[uart], errp)) { -return ; - } -sysbus_connect_irq (SYS_BUS_DEVICE (&s->uart[i]),0 , -aspeed_soc_ast27x0tsp_get_irq (s, uart)); - } +memory_region_init_alias (&s->uart_alias,OBJECT (s),"uart.alias" , + &s->uart->serial.io,0 , +memory_region_size (&s->uart->serial.io)); +memory_region_add_subregion (s->memory, sc->memmap[s->uart_dev], + &s->uart_alias); +/* +* Redirect the UART interrupt to the NVIC, replacing the default routing +* to the PSP's GIC. +*/ +sysbus_connect_irq (SYS_BUS_DEVICE (s->uart),0 , +aspeed_soc_ast27x0tsp_get_irq (s, s->uart_dev)); aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->timerctrl), "aspeed.timerctrl",
@@ -283,8 +280,6 @@ static void aspeed_soc_ast27x0tsp_class_init(ObjectClass *klass, dc->realize = aspeed_soc_ast27x0tsp_realize; sc->valid_cpu_types = valid_cpu_types; - sc->uarts_num =13 ; - sc->uarts_base =ASPEED_DEV_UART0 ; sc->irqmap = aspeed_soc_ast27x0tsp_irqmap; sc->memmap = aspeed_soc_ast27x0tsp_memmap; }
hw/arm/aspeed_coprocessor_common.c +3 -0
@@ -29,6 +29,9 @@ static const Property aspeed_coprocessor_properties[] = { MemoryRegion *),DEFINE_PROP_LINK ("scu" , AspeedCoprocessorState, scu,TYPE_ASPEED_SCU , AspeedSCUState *), +DEFINE_PROP_LINK ("uart" , AspeedCoprocessorState, uart,TYPE_SERIAL_MM , + SerialMM *), + DEFINE_PROP_INT32("uart-dev", AspeedCoprocessorState, uart_dev, 0), };static void aspeed_coprocessor_class_init (ObjectClass *oc,const void *data)
Signature · 1 line
2.43.0
PATCH 12/12 tests/functional/aarch64/ast2700fc: Add vbootrom test
In reply to Jamin Lin viaAdd start_ast2700fc_test_vbootrom() which boots the ast2700fc machine with -bios ast27x0_bootrom.bin and reuses the coprocessor loader.
Add test_aarch64_ast2700fc_sdk_vbootrom_v09_08() to test the vbootrom with ast2700fc machine.
--- tests/functional/aarch64/test_aspeed_ast2700fc.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tests/functional/aarch64/test_aspeed_ast2700fc.py +15 -0
@@ -138,6 +138,12 @@ def start_ast2700fc_test(self, 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')) + def test_aarch64_ast2700fc_sdk_v09_08(self): self.set_machine('ast2700fc') self.require_netdev('user')
@@ -150,5 +156,14 @@ def test_aarch64_ast2700fc_sdk_v09_08(self): self.do_ast2700fc_ssp_test() self.do_ast2700fc_tsp_test() + def test_aarch64_ast2700fc_sdk_vbootrom_v09_08(self): + self.set_machine('ast2700fc') + + self.archive_extract(self.ASSET_SDK_V908_AST2700) + self.start_ast2700fc_test_vbootrom('ast2700-default') + self.verify_openbmc_boot_and_login('ast2700-default') + self.do_ast2700fc_ssp_test() + self.do_ast2700fc_tsp_test() + if __name__ == '__main__': QemuSystemTest.main()
Signature · 1 line
2.43.0
PATCH 11/12 tests/functional/aarch64/ast2700fc: Move coprocessor image loading to common function
In reply to Jamin Lin viaThis removes duplicate code in start_ast2700fc_test() and prepares for reuse in upcoming VBOOTROM tests.
--- .../aarch64/test_aspeed_ast2700fc.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700fc.py +12 -10
@@ -36,6 +36,17 @@ 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_V908_AST2700 = Asset( 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.08/ast2700-default-obmc.tar.gz', 'eac3dc409b7ea3cd4b03d4792d3cebd469792ad893cb51e1d15f0fc20bd1e2cd')
@@ -123,16 +134,7 @@ def start_ast2700fc_test(self, name): self.vm.add_args('-device', f'loader,addr=0x430000000,cpu-num={i}') - 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}') - + self.load_ast2700fc_coprocessor(name) self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc'))
Signature · 1 line
2.43.0
Re: [SPAM] [PATCH v1 05/12] hw/arm/ast27x0: Share single SCU instance across PSP, SSP, and TSP
In reply to Jamin Lin viaQuoted 25 lines · Jamin Lin
AST2700 has a single SCU hardware block, memory-mapped at 0x12C02000–0x12C03FFF from the perspective of the main CA35 processor (PSP). The SSP and TSP coprocessors access this same SCU block at different
addresses: 0x72C02000–0x72C03FFF.Previously, each subsystem (PSP, SSP, and TSP) instantiated its own SCU device, resulting in three independent SCU instances in the QEMU model. In real hardware, however, only a single SCU exists and is shared among all processors.
This commit reworks the SCU model to correctly reflect the hardware behavior by allowing SSP and TSP to reference the PSP’s SCU instance. The following changes are introduced:
- Add a scu property to AspeedCoprocessorState for linking the coprocessor to the PSP’s SCU instance.
- Replace per-coprocessor SCU instantiation with a shared SCU link.
- Add "MemoryRegionscu_alias" to model address remapping for SSP and TSP.
- Create SCU alias regions in both SSP and TSP coprocessors and map them at0x72C02000to mirror the PSP’s SCU registers.
- Ensure the SCU device in PSP is realized before SSP/TSP alias setup.With this change, PSP, SSP, and TSP now share a consistent SCU state, matching the single-SCU hardware design of AST2700.
Quoted 9 lines
Signed-off-by Jamin Lin <[email protected]>--- include/hw/arm/aspeed_coprocessor.h | 4 ++-- hw/arm/aspeed_ast27x0-fc.c | 4 ++++ hw/arm/aspeed_ast27x0-ssp.c | 13 +++++-------- hw/arm/aspeed_ast27x0-tsp.c | 13 +++++-------- hw/arm/aspeed_coprocessor_common.c | 2 ++ 5 files changed, 18 insertions(+), 18 deletions(-)
Thanks,
C.
Re: [SPAM] [PATCH v1 06/12] hw/arm/ast27x0: Share single UART set across PSP, SSP, and TSP
In reply to Jamin Lin viaQuoted 23 lines · Jamin Lin
In the original model, each subsystem (PSP, SSP, and TSP) created its own set of 13 UART devices, resulting in a total of 39 UART instances. However, on real AST2700 hardware, there is only one set of 13 UARTs shared among all processors.
This commit reworks the UART handling to correctly model the shared hardware design. The PSP now creates the full set of 13 UART instances, while the SSP and TSP link to the corresponding shared UART device through object properties.
Changes include:
- Add "DEFINE_PROP_LINK("uart", ...)" and "DEFINE_PROP_INT32("uart-dev", ...)" to allow each coprocessor to reference a specific shared UART instance.
- Modify SSP to link to PSP’s UART4, and TSP to link to PSP’s UART7.
- Introduce "uart_alias" to remap the UART’s MMIO region into the coprocessor’s memory space.
- Redirect the UART interrupt to the coprocessor’s NVIC, replacing the default routing to the PSP’s GIC.With this change, only one set of 13 UART devices is instantiated by the PSP, while the SSP and TSP reuse them via aliasing and shared interrupt routing, matching the real AST2700 hardware behavior.
Quoted 9 lines
Signed-off-by Jamin Lin <[email protected]>--- include/hw/arm/aspeed_coprocessor.h | 6 +++--- hw/arm/aspeed_ast27x0-fc.c | 24 ++++++++++++------------ hw/arm/aspeed_ast27x0-ssp.c | 29 ++++++++++++----------------- hw/arm/aspeed_ast27x0-tsp.c | 29 ++++++++++++----------------- hw/arm/aspeed_coprocessor_common.c | 3 +++ 5 files changed, 42 insertions(+), 49 deletions(-)
Thanks,
C.
Re: [SPAM] [PATCH v1 01/12] hw/arm/aspeed_ast27x0-ssp: Add SDRAM region and fix naming and size to 512MB
In reply to Jamin Lin viaQuoted 6 lines · Jamin Lin
Previously, the SSP memory was incorrectly modeled as "SRAM" with a 32 MB size. This change introduces a new sdram field in AspeedCoprocessorState and updates the realization logic accordingly. Rename from SRAM to SDRAM and correct size from 32MB to 512MB to match hardware.
Quoted 6 lines
Signed-off-by Jamin Lin <[email protected]>--- include/hw/arm/aspeed_coprocessor.h | 1 + hw/arm/aspeed_ast27x0-ssp.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-)
Thanks,
C.
Re: [SPAM] [PATCH v1 03/12] hw/arm/ast27x0: Add SRAM link and alias mapping for SSP coprocessor
In reply to Jamin Lin viaQuoted 21 lines · Jamin Lin
AST2700 has a 128KB SRAM, physically mapped at 0x10000000–0x1001FFFF for the PSP (CA35) processor. The SSP coprocessor shares this same SRAM but accesses it through a different address window at 0x70000000–0x7001FFFF.
To model this shared-memory behavior in QEMU, this commit introduces a linked SRAM property and alias mapping between the PSP and SSP subsystems.
Changes include:
- Add a "MemoryRegion *sram" link and "MemoryRegionsram_alias" to AspeedCoprocessorState.
- Register the new "sram" property inaspeed_coprocessor_common.c.
- Inaspeed_ast27x0-fc.c, connect the SSP coprocessor’s "sram" link to the PSP’s SRAM region.
- Inaspeed_ast27x0-ssp.c, create an alias mapping for SRAM at0x70000000–0x7001FFFFin the SSP’s memory map.This ensures that the SSP can correctly access the shared SRAM contents through its own address space while maintaining a consistent physical backing region. It also guarantees that the SRAM is realized before the SSP device, ensuring successful alias setup.
Quoted 8 lines
Signed-off-by Jamin Lin <[email protected]>--- include/hw/arm/aspeed_coprocessor.h | 3 ++- hw/arm/aspeed_ast27x0-fc.c | 4 ++++ hw/arm/aspeed_ast27x0-ssp.c | 7 +++++++ hw/arm/aspeed_coprocessor_common.c | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-)
Thanks,
C.
Re: [SPAM] [PATCH v1 04/12] hw/arm/ast27x0: Add SRAM link and alias mapping for TSP coprocessor
In reply to Jamin Lin viaQuoted 14 lines · Jamin Lin
AST2700 has a 128KB SRAM, physically mapped at 0x10000000–0x1001FFFF for the PSP (CA35) processor. The TSP coprocessor shares this same SRAM but accesses it through a different address window at 0x70000000–0x7001FFFF.
To model this shared-memory behavior in QEMU, this commit introduces a linked SRAM property and alias mapping between the PSP and TSP subsystems.
Changes include:
- Add the SRAM alias mapping at0x70000000inaspeed_ast27x0-tsp.c.
- Inaspeed_ast27x0-fc.c, connect the TSP coprocessor’s "sram" link to the PSP’s SRAM region.
- Ensure the alias region is initialized during TSP SoC realization so the TSP can correctly access shared SRAM through its own address space.
Quoted 8 lines
This ensures that the TSP and PSP share the same physical SRAM backing.
Signed-off-by Jamin Lin <[email protected]>--- hw/arm/aspeed_ast27x0-fc.c | 4 ++++ hw/arm/aspeed_ast27x0-tsp.c | 7 +++++++ 2 files changed, 11 insertions(+)
Thanks,
C.
Re: [SPAM] [PATCH v1 02/12] hw/arm/aspeed_ast27x0-tsp: Add SDRAM region and fix naming and size to 512MB
In reply to Jamin Lin viaQuoted 9 lines · Jamin Lin
Previously, the TSP memory was incorrectly modeled as "SRAM" with a 32 MB size. Rename from SRAM to SDRAM and correct size from 32MB to 512MB to match hardware.
Signed-off-by Jamin Lin <[email protected]>--- hw/arm/aspeed_ast27x0-tsp.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
Thanks,
C.
Re: [SPAM] [PATCH v1 11/12] tests/functional/aarch64/ast2700fc: Move coprocessor image loading to common function
In reply to Jamin Lin viaQuoted 38 lines · Jamin Lin
This removes duplicate code in
start_ast2700fc_test()and prepares for reuse in upcoming VBOOTROM tests.Signed-off-by Jamin Lin <[email protected]>--- .../aarch64/test_aspeed_ast2700fc.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-)tests/functional/aarch64/test_aspeed_ast2700fc.py +11
-4@@ -36,6 +36,17 @@ 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_V908_AST2700 = Asset( 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.08/ast2700-default-obmc.tar.gz', 'eac3dc409b7ea3cd4b03d4792d3cebd469792ad893cb51e1d15f0fc20bd1e2cd')@@ -123,16 +134,7 @@ def start_ast2700fc_test(self, name): self.vm.add_args('-device', f'loader,addr=0x430000000,cpu-num={i}') - load_elf_list = { - 'ssp': self.scratch_file(name, 'zephyr-aspeed-ssp.elf'), - 'tsp': self.scratch_file(name, 'zephyr-aspeed-tsp.elf') - }
tests/functional/aarch64/test_aspeed_ast2700fc.py def start_ast2700fc_test(self, name): · line 140
Quoted 10 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +1
-6- - 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}') - + self.load_ast2700fc_coprocessor(name) self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc'))
Thanks,
C.
Re: [SPAM] [PATCH v1 10/12] tests/functional/aarch64/ast2700fc: Add eth2 network interface check in PCIe test
In reply to Jamin Lin viaQuoted 25 lines · Jamin Lin
Enhance the AST2700 functional PCIe test to verify the network interface configuration for eth2. This adds an additional command to check the IP address assignment on eth2 to ensure network functionality is correctly initialized in the test environment.
Signed-off-by Jamin Lin <[email protected]>--- tests/functional/aarch64/test_aspeed_ast2700fc.py | 4 ++++ 1 file changed, 4 insertions(+)tests/functional/aarch64/test_aspeed_ast2700fc.py +3
-0@@ -60,6 +60,9 @@ def do_ast2700_pcie_test(self): 'lspci -s 0002:01:00.0', '0002:01:00.0 Ethernet controller: ' 'Intel Corporation 82574L Gigabit Network Connection') + exec_command_and_wait_for_pattern(self, + 'ip addr show dev eth2', + 'inet 10.0.2.15/24') def do_ast2700fc_ssp_test(self): self.vm.shutdown()
tests/functional/aarch64/test_aspeed_ast2700fc.py def start_ast2700fc_test(self, name): · line 144
Quoted 7 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +1
-0@@ -135,6 +138,7 @@ def start_ast2700fc_test(self, name): def test_aarch64_ast2700fc_sdk_v09_08(self): self.set_machine('ast2700fc') + self.require_netdev('user') self.archive_extract(self.ASSET_SDK_V908_AST2700) self.start_ast2700fc_test('ast2700-default')
Thanks,
C.
Re: [SPAM] [PATCH v1 09/12] tests/functional/aarch64/ast2700fc: Update test ASPEED SDK v09.08
In reply to Jamin Lin viaQuoted 34 lines · Jamin Lin
Signed-off-by Jamin Lin <[email protected]>--- tests/functional/aarch64/test_aspeed_ast2700fc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)tests/functional/aarch64/test_aspeed_ast2700fc.py +4
-4@@ -36,9 +36,9 @@ 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}:~#') - ASSET_SDK_V906_AST2700 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2700-default-obmc.tar.gz', - 'f1d53e0be8a404ecce3e105f72bc50fa4e090ad13160ffa91b10a6e0233a9dc6') + ASSET_SDK_V908_AST2700 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.08/ast2700-default-obmc.tar.gz', + 'eac3dc409b7ea3cd4b03d4792d3cebd469792ad893cb51e1d15f0fc20bd1e2cd') def do_ast2700_i2c_test(self): exec_command_and_wait_for_pattern(self,@@ -66,7 +66,7 @@ def do_ast2700fc_ssp_test(self): self.vm.set_console(console_index=1) self.vm.launch() - exec_command_and_wait_for_pattern(self, '\012', 'ssp:~$') + exec_command_and_wait_for_pattern(self, '\012', 'ssp_tsp:~$') exec_command_and_wait_for_pattern(self, 'version', 'Zephyr version 3.7.1') exec_command_and_wait_for_pattern(self, 'md 72c02000 1',@@ -133,10 +133,10 @@ def start_ast2700fc_test(self, name): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc'))
tests/functional/aarch64/test_aspeed_ast2700fc.py def start_ast2700fc_test(self, name): · line 142
Quoted 10 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +2
-2- def test_aarch64_ast2700fc_sdk_v09_06(self): + def test_aarch64_ast2700fc_sdk_v09_08(self): self.set_machine('ast2700fc') - self.archive_extract(self.ASSET_SDK_V906_AST2700) + self.archive_extract(self.ASSET_SDK_V908_AST2700) self.start_ast2700fc_test('ast2700-default') self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700_i2c_test()
Thanks,
C.
Re: [SPAM] [PATCH v1 12/12] tests/functional/aarch64/ast2700fc: Add vbootrom test
In reply to Jamin Lin viaQuoted 33 lines · Jamin Lin
Add
start_ast2700fc_test_vbootrom()which boots the ast2700fc machine with -bios ast27x0_bootrom.bin and reuses the coprocessor loader.Add
test_aarch64_ast2700fc_sdk_vbootrom_v09_08()to test the vbootrom with ast2700fc machine.Signed-off-by Jamin Lin <[email protected]>--- tests/functional/aarch64/test_aspeed_ast2700fc.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+)tests/functional/aarch64/test_aspeed_ast2700fc.py +7
-0@@ -138,6 +138,12 @@ def start_ast2700fc_test(self, 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')) + def test_aarch64_ast2700fc_sdk_v09_08(self): self.set_machine('ast2700fc') self.require_netdev('user')@@ -150,5 +156,14 @@ def test_aarch64_ast2700fc_sdk_v09_08(self): self.do_ast2700fc_ssp_test() self.do_ast2700fc_tsp_test() + def test_aarch64_ast2700fc_sdk_vbootrom_v09_08(self):
tests/functional/aarch64/test_aspeed_ast2700fc.py def test_aarch64_ast2700fc_sdk_v09_08(self): · line 169
Quoted 10 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +8
-0+ self.set_machine('ast2700fc') + + self.archive_extract(self.ASSET_SDK_V908_AST2700) + self.start_ast2700fc_test_vbootrom('ast2700-default') + self.verify_openbmc_boot_and_login('ast2700-default') + self.do_ast2700fc_ssp_test() + self.do_ast2700fc_tsp_test() + if __name__ == '__main__': QemuSystemTest.main()
Thanks,
C.
Cédric Le Goater
AppliedQuoted 27 lines · Jamin Lin
v1:
1. Improved memory mapping
2. Added SRAM support and increased SDRAM size to 512MB to fix coprocessor crash observed in SDK v09.08
3. Updated coprocessor functional tests for SDK v09.08
4. Added VBOOTROM support
5. Shared a single SCU instance among PSP, SSP, and TSP
6. Shared UART set among PSP, SSP, and TSPJamin Lin (12):
hw/arm/aspeed_ast27x0-ssp: Add SDRAM region and fix naming and size to512MB hw/arm/aspeed_ast27x0-tsp: Add SDRAM region and fix naming and size to 512MBhw/arm/ast27x0: Add SRAM link and alias mapping for SSP coprocessor hw/arm/ast27x0: Add SRAM link and alias mapping for TSP coprocessor hw/arm/ast27x0: Share single SCU instance across PSP, SSP, and TSP hw/arm/ast27x0: Share single UART set across PSP, SSP, and TSP hw/arm/aspeed_ast27x0-fc: Map FMC0 flash contents into CA35 boot ROM hw/arm/aspeed_ast27x0-fc: Add VBOOTROM support tests/functional/aarch64/ast2700fc: Update test ASPEED SDK v09.08 tests/functional/aarch64/ast2700fc: Add eth2 network interface check
in PCIe test
tests/functional/aarch64/ast2700fc: Move coprocessor image loading to
common function
tests/functional/aarch64/ast2700fc: Add vbootrom test
Quoted 8 lines
include/hw/arm/aspeed_coprocessor.h | 14 ++-- hw/arm/aspeed_ast27x0-fc.c | 55 +++++++++++---- hw/arm/aspeed_ast27x0-ssp.c | 69 +++++++++---------- hw/arm/aspeed_ast27x0-tsp.c | 69 +++++++++---------- hw/arm/aspeed_coprocessor_common.c | 7 ++ .../aarch64/test_aspeed_ast2700fc.py | 51 ++++++++++---- 6 files changed, 160 insertions(+), 105 deletions(-)
Applied to aspeed-next.
Thanks,
C.