Support VBOOTROM to ast2700fc machine
v4 cover Support VBOOTROM to ast2700fc machine
v1
1. Added support for Vboot ROM.
2. Moved coprocessor initialization from machine level to SoC level
3. Unified SCU controllers between PSP and coprocessors
4. Shared the same SRAM between PSP and coprocessors
5. Support PSP DRAM remaps coprocessor SDRAM
6. Added support for controlling coprocessor reset via SCU registers.
v2
Split the original patch set into smaller sub-patches for review.
This patch focuses on:
1. Adding support for Vboot ROM.
2. Moving common APIs to SoC-level code for reuse in different platforms and reducing duplication.
v3
1. Drop dead return checks.
2. Make sub-init functions return bool with errp.
v4:
1. Add ast2700fc with vbootrom functional test.
2. update commit log
Dependencies
Based on https://github.com/legoater/qemu at the aspeed-next branch.
Jamin Lin (3):
hw/arm/aspeed_ast27x0-fc: Map FMC0 flash contents into CA35 boot ROM hw/arm/aspeed_ast27x0-fc: Add VBOOTROM support tests/functional/aarch64/test_aspeed_ast2700fc: Add vbootrom test
hw/arm/aspeed_ast27x0-fc.c | 19 +++++++++- .../aarch64/test_aspeed_ast2700fc.py | 37 ++++++++++++++----- 2 files changed, 45 insertions(+), 11 deletions(-)
Signature · 1 line
2.43.0
PATCH v4 1/3 hw/arm/aspeed_ast27x0-fc: Map FMC0 flash contents into CA35 boot ROM
This 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;Aspeed27x0SSPSoCState ssp;Aspeed27x0TSPSoCState 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);
@@ -107,6 +109,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 v4 2/3 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;
@@ -117,6 +118,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 v4 3/3 tests/functional/aarch64/test_aspeed_ast2700fc: Add vbootrom test
In reply to Jamin Lin viaIntroduce load_ast2700fc_coprocessor() to load the SSP/TSP ELF images via -device loader. Use this helper in start_ast2700fc_test() to remove duplicated code.
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_06() to test the vbootrom with ast2700fc machine.
--- .../aarch64/test_aspeed_ast2700fc.py | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700fc.py +28 -9
@@ -83,6 +83,17 @@ def do_ast2700fc_tsp_test(self): exec_command_and_wait_for_pattern(self, 'md 72c02000 1', '[72c02000] 06010103') + 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}') + def start_ast2700fc_test(self, name): ca35_core = 4 uboot_size = os.path.getsize(self.scratch_file(name,
@@ -120,16 +131,13 @@ 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')) + 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'))
@@ -144,5 +152,16 @@ def test_aarch64_ast2700fc_sdk_v09_06(self): self.do_ast2700fc_ssp_test() self.do_ast2700fc_tsp_test() + def test_aarch64_ast2700fc_sdk_vbootrom_v09_06(self): + self.set_machine('ast2700fc') + + self.archive_extract(self.ASSET_SDK_V906_AST2700) + self.start_ast2700fc_test_vbootrom('ast2700-default') + self.verify_openbmc_boot_and_login('ast2700-default') + self.do_ast2700_i2c_test() + self.do_ast2700_pcie_test() + self.do_ast2700fc_ssp_test() + self.do_ast2700fc_tsp_test() + if __name__ == '__main__': QemuSystemTest.main()
Signature · 1 line
2.43.0
Re: [PATCH v4 3/3] tests/functional/aarch64/test_aspeed_ast2700fc: Add vbootrom test
Hello,
Quoted 3 lines · Jamin Lin
Introduce
load_ast2700fc_coprocessor()to load the SSP/TSP ELF images via -device loader. Use this helper instart_ast2700fc_test()to remove duplicated code.
Ideally, this should be an extra patch. Minor.
Quoted 58 lines
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_06()to test the vbootrom with ast2700fc machine.Signed-off-by Jamin Lin <[email protected]>--- .../aarch64/test_aspeed_ast2700fc.py | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-)tests/functional/aarch64/test_aspeed_ast2700fc.py +17
-9@@ -83,6 +83,17 @@ def do_ast2700fc_tsp_test(self): exec_command_and_wait_for_pattern(self, 'md 72c02000 1', '[72c02000] 06010103') + 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}') + def start_ast2700fc_test(self, name): ca35_core = 4 uboot_size = os.path.getsize(self.scratch_file(name,@@ -120,16 +131,13 @@ 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')) + 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'))
tests/functional/aarch64/test_aspeed_ast2700fc.py def test_aarch64_ast2700fc_sdk_v09_06(self): · line 158
Quoted 7 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +4
-0@@ -144,5 +152,16 @@ def test_aarch64_ast2700fc_sdk_v09_06(self): self.do_ast2700fc_ssp_test() self.do_ast2700fc_tsp_test() + def test_aarch64_ast2700fc_sdk_vbootrom_v09_06(self): + self.set_machine('ast2700fc') + + self.archive_extract(self.ASSET_SDK_V906_AST2700)
Could we update all tests to use the latest SDK v09.08 [1] which was released ?
Thanks,
C.
[1] https://github.com/AspeedTech-BMC/openbmc/releases/tag/v09.08ed
Quoted 9 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +7
-0+ self.start_ast2700fc_test_vbootrom('ast2700-default') + self.verify_openbmc_boot_and_login('ast2700-default') + self.do_ast2700_i2c_test() + self.do_ast2700_pcie_test() + self.do_ast2700fc_ssp_test() + self.do_ast2700fc_tsp_test() + if __name__ == '__main__': QemuSystemTest.main()
RE: [PATCH v4 3/3] tests/functional/aarch64/test_aspeed_ast2700fc: Add vbootrom test
Hi Cédric
Quoted 11 lines
Subject: Re: [PATCH v4 3/3] tests/functional/aarch64/test_aspeed_ast2700fc:
Add vbootrom testHello,
Quoted 3 lines · Jamin Lin
Introduce
load_ast2700fc_coprocessor()to load the SSP/TSP ELF images via -device loader. Use this helper instart_ast2700fc_test()to remove duplicated code.Ideally, this should be an extra patch. Minor.
Will fix
Quoted 66 lines
Quoted 11 lines
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_06()to test the vbootrom with ast2700fc machine.Signed-off-by Jamin Lin <[email protected]>--- .../aarch64/test_aspeed_ast2700fc.py | 37++++++++++++++-----
tests/functional/aarch64/test_aspeed_ast2700fc.py def do_ast2700fc_tsp_test(self): · line 84
Quoted 10 lines
1 file changed, 28 insertions(+), 9 deletions(-)tests/functional/aarch64/test_aspeed_ast2700fc.py +0
-0@@ -83,6 +83,17 @@ def do_ast2700fc_tsp_test(self): exec_command_and_wait_for_pattern(self, 'md 72c02000 1', '[72c02000]06010103')
Quoted 16 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +11
-0+ 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}') + def start_ast2700fc_test(self, name): ca35_core = 4 uboot_size = os.path.getsize(self.scratch_file(name,tests/functional/aarch64/test_aspeed_ast2700fc.py def start_ast2700fc_test(self, name): · line 132
Quoted 2 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +0
-0@@ -120,16 +131,13 @@ def start_ast2700fc_test(self, name): self.vm.add_args('-device',f'loader,addr=0x430000000,cpu-num={i}')
Quoted 24 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +6
-9- 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')) + 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'))@@ -144,5 +152,16 @@ def test_aarch64_ast2700fc_sdk_v09_06(self): self.do_ast2700fc_ssp_test() self.do_ast2700fc_tsp_test()
Quoted 7 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py def test_aarch64_ast2700fc_sdk_v09_06(self): · line 158
Quoted 4 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +4
-0+ def test_aarch64_ast2700fc_sdk_vbootrom_v09_06(self): + self.set_machine('ast2700fc') + + self.archive_extract(self.ASSET_SDK_V906_AST2700)Could we update all tests to use the latest SDK v09.08 [1] which was released ?
I’ll update AST2500 and AST2600 to SDK v09.08 after the release.
For AST2700, there are a few issues we should discuss.
1. AST2700 (ast2700fc) – SDK v09.08 support
The ast2700fc machine currently works only with SDK v09.06. v09.07 and v09.08 --> Will encounter boot crash.
To move to v09.08, I need the patch series(Control Coprocessor Reset....). I’m reworking it so it can be accepted upstream.
This refactor introduces AspeedBase and AspeedCoprocessor classes and will require substantial changes across the codebase(It will need a lot of changes).
2. Starting with SDK v09.07, our SDK no longer produces "u-boot-nodtb.bin".
As a result, the manual device loader tests only work with v09.06 (-device loader,addr=0x400000000,file=u-boot-nodtb.bin,force-raw=on) .
Proposal: drop the manual device loader tests and keep only the vbootrom-based test cases going forward.
Could you please give me any suggestion?
Thanks-Jamin
Quoted 15 lines
Thanks,
C.
[1] https://github.com/AspeedTech-BMC/openbmc/releases/tag/v09.08ed
Quoted 9 lines
tests/functional/aarch64/test_aspeed_ast2700fc.py +7
-0+ self.start_ast2700fc_test_vbootrom('ast2700-default') + self.verify_openbmc_boot_and_login('ast2700-default') + self.do_ast2700_i2c_test() + self.do_ast2700_pcie_test() + self.do_ast2700fc_ssp_test() + self.do_ast2700fc_tsp_test() + if __name__ == '__main__': QemuSystemTest.main()
Re: [PATCH v4 3/3] tests/functional/aarch64/test_aspeed_ast2700fc: Add vbootrom test
Hello Jamin,
Quoted 11 lines
Quoted 2 lines
Could we update all tests to use the latest SDK v09.08 [1] which was released ?
I’ll update AST2500 and AST2600 to SDK v09.08 after the release.
For AST2700, there are a few issues we should discuss.
1. AST2700 (ast2700fc) – SDK v09.08 support
The ast2700fc machine currently works only with SDK v09.06. v09.07 and v09.08 --> Will encounter boot crash.
To move to v09.08, I need the patch series(Control Coprocessor Reset....). I’m reworking it so it can be accepted upstream.
This refactor introduces AspeedBase and AspeedCoprocessor classes and will require substantial changes across the codebase(It will need a lot of changes).
Quoted 5 lines
2. Starting with SDK v09.07, our SDK no longer produces "u-boot-nodtb.bin".
As a result, the manual device loader tests only work with v09.06 (-device loader,addr=0x400000000,file=u-boot-nodtb.bin,force-raw=on) .
Proposal: drop the manual device loader tests and keep only the vbootrom-based test cases going forward.Could you please give me any suggestion?
I suggest updating tests with SDK v09.08 for all supported machines. The commit log should mention which, and briefly why, machines are kept to the previous releases.
Then, the series refactoring the AspeedCoprocessor models can update the SDK to v09.08 once it is ready.
Thanks,
C.
RE: [PATCH v4 3/3] tests/functional/aarch64/test_aspeed_ast2700fc: Add vbootrom test
Hi Cédric
Quoted 26 lines
Subject: Re: [PATCH v4 3/3] tests/functional/aarch64/test_aspeed_ast2700fc:
Add vbootrom testHello Jamin,
Quoted 1 line
Quoted 1 line
Could we update all tests to use the latest SDK v09.08 [1] which was
released ?
Quoted 7 lines
Quoted 1 line
I’ll update AST2500 and AST2600 to SDK v09.08 after the release.
For AST2700, there are a few issues we should discuss.
1. AST2700 (ast2700fc) – SDK v09.08 support The ast2700fc machine currently works only with SDK v09.06. v09.07 and v09.08 --> Will encounterboot crash.
Quoted 1 line
To move to v09.08, I need the patch series(Control Coprocessor Reset....).
I’m reworking it so it can be accepted upstream.
Quoted 1 line
This refactor introduces AspeedBase and AspeedCoprocessor classes and will
require substantial changes across the codebase(It will need a lot of changes).
Quoted 3 lines
2. Starting with SDK v09.07, our SDK no longer produces "u-boot-nodtb.bin". As a result, the manual device loader tests only work with v09.06 (-device
loader,addr=0x400000000,file=u-boot-nodtb.bin,force-raw=on) .
Quoted 1 line
Proposal: drop the manual device loader tests and keep only the
vbootrom-based test cases going forward.
Quoted 1 line
Quoted 9 lines
Quoted 1 line
Could you please give me any suggestion?
I suggest updating tests with SDK v09.08 for all supported machines. The commit log should mention which, and briefly why, machines are kept to the previous releases.
Then, the series refactoring the AspeedCoprocessor models can update the SDK to v09.08 once it is ready.
This patch series will not be resent and will remain pending until the AspeedCoprocessor models patch series is accepted.
Thanks-Jamin
Quoted 3 lines
Thanks,
C.