Support vbootrom for AST2700
Subsystems (2)
v5 cover Support vbootrom for AST2700
v1:
Add initial support for AST27x0
The purpose of vbootrom here is to simulate the work of BootMCU SPL (riscv) in AST2700, because QEMU doesn't support heterogenous architecture yet.
ast27x0_bootrom.bin is a simplified, free (Apache 2.0) boot ROM for ASPEED AST27x0 BMC SOC. It currently implements the bare minimum to load, parse, initialize and run boot images stored in SPI flash, but may grow more features over time as needed. The source code is available at:
https://github.com/google/vbootrom
v2:
Add "Introduced ASPEED_DEV_VBOOTROM in the device enumeration" patch to fix build failed.
v3:
1. Supports both vbootrom and device loader boot methods, with vbootrom used as the default.
2. Fix review and QTEST test failed issues.
v4:
Adjust the patch order.
v5:
fix review issue and remove unnecessary class attribure.
doc: create a new section for AST2700.
Jamin Lin (11):
hw/arm/aspeed_ast27x0: Rename variable sram_name to name in ast2700
realize
hw/arm/aspeed_ast27x0 Introduce vbootrom memory region hw/arm/aspeed: Add vbootrom support on AST2700 EVB machines hw/arm/aspeed: Reuse rom_size variable for vbootrom setup
pc-bios: Add AST27x0 vBootrom
hw/arm/aspeed: Add support for loading vbootrom image via "-bios" tests/functional/aspeed: Move I2C test into shared helper for AST2700
reuse
tests/functional/aspeed: Update test ASPEED SDK v09.06 tests/functional/aspeed: extract boot and login sequence into helper
function
tests/functional/aspeed: Add to test vbootrom for AST2700 docs/system/arm/aspeed: Support vbootrom for AST2700
MAINTAINERS | 1 + docs/system/arm/aspeed.rst | 96 ++++++++++++++++++++++-- include/hw/arm/aspeed.h | 1 + include/hw/arm/aspeed_soc.h | 2 + hw/arm/aspeed.c | 40 +++++++++- hw/arm/aspeed_ast27x0.c | 17 ++++- pc-bios/README | 6 ++ pc-bios/ast27x0_bootrom.bin | Bin 0 -> 15424 bytes pc-bios/meson.build | 1 + tests/functional/test_aarch64_aspeed.py | 82 +++++++++++++------- 10 files changed, 209 insertions(+), 37 deletions(-) create mode 100644 pc-bios/ast27x0_bootrom.bin
Signature · 1 line
2.43.0
PATCH v5 1/11 hw/arm/aspeed_ast27x0: Rename variable sram_name to name in ast2700 realize
The variable "sram_name" was only used for naming the SRAM memory region. Rename it to "name" for consistency with similar code and avoid unnecessary new local variable declarations.
--- hw/arm/aspeed_ast27x0.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/arm/aspeed_ast27x0.c +4 -4
@@ -577,7 +577,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)AspeedSoCClass *sc =ASPEED_SOC_GET_CLASS (s);AspeedINTCClass *ic =ASPEED_INTC_GET_CLASS (&a->intc[0 ]);AspeedINTCClass *icio =ASPEED_INTC_GET_CLASS (&a->intc[1 ]); - g_autofree char *sram_name = NULL; + g_autofree char *name = NULL;qemu_irq irq;/* Default boot region (SPI memory or ROMs) */
@@ -649,9 +649,9 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) }/* SRAM */ - sram_name =g_strdup_printf ("aspeed.sram.%d" ,CPU (&a->cpu[0 ])->cpu_index); -if (!memory_region_init_ram (&s->sram,OBJECT (s), sram_name, sc->sram_size, - errp)) { + name =g_strdup_printf ("aspeed.sram.%d" ,CPU (&a->cpu[0 ])->cpu_index); +if (!memory_region_init_ram (&s->sram,OBJECT (s), name, sc->sram_size, + errp)) {return ; } memory_region_add_subregion(s->memory,
Signature · 1 line
2.43.0
PATCH v5 3/11 hw/arm/aspeed: Add vbootrom support on AST2700 EVB machines
In reply to Jamin Lin viaIntroduce a new "vbootrom" field in the AspeedMachineClass to indicate whether a machine supports the virtual boot ROM region.
Set this field to true by default for the AST2700-A0 and AST2700-A1 EVB machines.
--- include/hw/arm/aspeed.h | 1 + hw/arm/aspeed.c | 2 ++ 2 files changed, 3 insertions(+)
include/hw/arm/aspeed.h +1 -0
@@ -40,6 +40,7 @@ struct AspeedMachineClass {void (*i2c_init)(AspeedMachineState *bmc);uint32_t uart_default;bool sdhci_wp_inverted; +bool vbootrom; };
hw/arm/aspeed.c +2 -0
@@ -1689,6 +1689,7 @@ static void aspeed_machine_ast2700a0_evb_class_init(ObjectClass *oc, void *data) amc->macs_mask =ASPEED_MAC0_ON |ASPEED_MAC1_ON |ASPEED_MAC2_ON ; amc->uart_default =ASPEED_DEV_UART12 ; amc->i2c_init = ast2700_evb_i2c_init; + amc->vbootrom = true; mc->auto_create_sdcard = true; mc->default_ram_size =1 * GiB;aspeed_machine_class_init_cpus_defaults (mc);
@@ -1709,6 +1710,7 @@ static void aspeed_machine_ast2700a1_evb_class_init(ObjectClass *oc, void *data) amc->macs_mask =ASPEED_MAC0_ON |ASPEED_MAC1_ON |ASPEED_MAC2_ON ; amc->uart_default =ASPEED_DEV_UART12 ; amc->i2c_init = ast2700_evb_i2c_init; + amc->vbootrom = true; mc->auto_create_sdcard = true; mc->default_ram_size =1 * GiB;aspeed_machine_class_init_cpus_defaults (mc);
Signature · 1 line
2.43.0
Re: [PATCH v5 03/11] hw/arm/aspeed: Add vbootrom support on AST2700 EVB machines
Quoted 9 lines · Jamin Lin
Introduce a new "vbootrom" field in the AspeedMachineClass to indicate whether a machine supports the virtual boot ROM region.
Set this field to true by default for the AST2700-A0 and AST2700-A1 EVB machines.
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>Tested-by Nabih Estefan <[email protected]>
I would merge this patch in patch 6.
Thanks,
C.
Quoted 37 lines
--- include/hw/arm/aspeed.h | 1 + hw/arm/aspeed.c | 2 ++ 2 files changed, 3 insertions(+)include/hw/arm/aspeed.h +1
-0@@ -40,6 +40,7 @@ struct AspeedMachineClass {void (*i2c_init)(AspeedMachineState *bmc);uint32_t uart_default;bool sdhci_wp_inverted; +bool vbootrom; };hw/arm/aspeed.c +2
-0@@ -1689,6 +1689,7 @@ static void aspeed_machine_ast2700a0_evb_class_init(ObjectClass *oc, void *data) amc->macs_mask =ASPEED_MAC0_ON |ASPEED_MAC1_ON |ASPEED_MAC2_ON ; amc->uart_default =ASPEED_DEV_UART12 ; amc->i2c_init = ast2700_evb_i2c_init; + amc->vbootrom = true; mc->auto_create_sdcard = true; mc->default_ram_size =1 * GiB;aspeed_machine_class_init_cpus_defaults (mc);@@ -1709,6 +1710,7 @@ static void aspeed_machine_ast2700a1_evb_class_init(ObjectClass *oc, void *data) amc->macs_mask =ASPEED_MAC0_ON |ASPEED_MAC1_ON |ASPEED_MAC2_ON ; amc->uart_default =ASPEED_DEV_UART12 ; amc->i2c_init = ast2700_evb_i2c_init; + amc->vbootrom = true; mc->auto_create_sdcard = true; mc->default_ram_size =1 * GiB;aspeed_machine_class_init_cpus_defaults (mc);
RE: [PATCH v5 03/11] hw/arm/aspeed: Add vbootrom support on AST2700 EVB machines
Hi Cedric,
Quoted 10 lines
Subject: Re: [PATCH v5 03/11] hw/arm/aspeed: Add vbootrom support on AST2700 EVB machines
Quoted 6 lines · Jamin Lin
Introduce a new "vbootrom" field in the AspeedMachineClass to indicate whether a machine supports the virtual boot ROM region.
Set this field to true by default for the AST2700-A0 and AST2700-A1 EVB machines.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>Tested-by Nabih Estefan <[email protected]>I would merge this patch in patch 6.
Thanks for suggestion.
Will merge this in patch 6
Jamin
Quoted 48 lines
Thanks,
C.
hw/arm/aspeed.c static void
Quoted 22 lines
--- include/hw/arm/aspeed.h | 1 + hw/arm/aspeed.c | 2 ++ 2 files changed, 3 insertions(+)include/hw/arm/aspeed.h index renamed from include/hw/arm/aspeed.h +0
-0
9cae45a1c9..973277bea6100644include/hw/arm/aspeed.h +1
-0@@ -40,6 +40,7 @@ struct AspeedMachineClass {void (*i2c_init)(AspeedMachineState *bmc);uint32_t uart_default;bool sdhci_wp_inverted; +bool vbootrom; };hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0
-0
82f42582fa..e852bbc4cb100644hw/arm/aspeed.c +0
-0@@ -1689,6 +1689,7 @@ static void
aspeed_machine_ast2700a0_evb_class_init(ObjectClass *oc, void *data)hw/arm/aspeed.c static void · line 1689
Quoted 1 line
hw/arm/aspeed.c +0
-0amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON |
ASPEED_MAC2_ON;hw/arm/aspeed.c static void
Quoted 7 lines
hw/arm/aspeed.c +1
-0amc->uart_default =ASPEED_DEV_UART12 ; amc->i2c_init = ast2700_evb_i2c_init; + amc->vbootrom = true; mc->auto_create_sdcard = true; mc->default_ram_size =1 * GiB;aspeed_machine_class_init_cpus_defaults (mc);@@ -1709,6 +1710,7 @@ static void
aspeed_machine_ast2700a1_evb_class_init(ObjectClass *oc, void *data)hw/arm/aspeed.c static void · line 1710
Quoted 1 line
hw/arm/aspeed.c +0
-0amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON |
ASPEED_MAC2_ON;Quoted 6 lines
hw/arm/aspeed.c +1
-0amc->uart_default =ASPEED_DEV_UART12 ; amc->i2c_init = ast2700_evb_i2c_init; + amc->vbootrom = true; mc->auto_create_sdcard = true; mc->default_ram_size =1 * GiB;aspeed_machine_class_init_cpus_defaults (mc);
PATCH v5 4/11 hw/arm/aspeed: Reuse rom_size variable for vbootrom setup
In reply to Jamin Lin viaMove the declaration of "rom_size" to an outer scope in aspeed_machine_init() so it can be reused for setting up the vbootrom region as well.
This avoids introducing a redundant local variable and ensures consistent ROM sizing logic when both SPI boot and vbootrom are used.
--- hw/arm/aspeed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/aspeed.c +2 -1
@@ -381,6 +381,7 @@ static void aspeed_machine_init(MachineState *machine)AspeedSoCClass *sc;int i;DriveInfo *emmc0 =NULL ; +uint64_t rom_size;bool boot_emmc; bmc->soc =ASPEED_SOC (object_new (amc->soc_name));
@@ -475,7 +476,7 @@ static void aspeed_machine_init(MachineState *machine)BlockBackend *fmc0 = dev ?m25p80_get_blk (dev) :NULL ;if (fmc0 && !boot_emmc) { -uint64_t rom_size =memory_region_size (&bmc->soc->spi_boot); + rom_size =memory_region_size (&bmc->soc->spi_boot);aspeed_install_boot_rom (bmc, fmc0, rom_size); }else if (emmc0) {aspeed_install_boot_rom (bmc,blk_by_legacy_dinfo (emmc0),64 * KiB);
Signature · 1 line
2.43.0
Re: [PATCH v5 04/11] hw/arm/aspeed: Reuse rom_size variable for vbootrom setup
Quoted 26 lines · Jamin Lin
Move the declaration of "
rom_size" to an outer scope inaspeed_machine_init()so it can be reused for setting up the vbootrom region as well.This avoids introducing a redundant local variable and ensures consistent ROM sizing logic when both SPI boot and vbootrom are used.
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Cédric Le Goater <[email protected]>Tested-by Nabih Estefan <[email protected]>--- hw/arm/aspeed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/arm/aspeed.c +1
-0@@ -381,6 +381,7 @@ static void aspeed_machine_init(MachineState *machine)AspeedSoCClass *sc;int i;DriveInfo *emmc0 =NULL ; +uint64_t rom_size;bool boot_emmc; bmc->soc =ASPEED_SOC (object_new (amc->soc_name));
hw/arm/aspeed.c static void aspeed_machine_init(MachineState *machine) · line 482
Quoted 8 lines
hw/arm/aspeed.c +1
-1@@ -475,7 +476,7 @@ static void aspeed_machine_init(MachineState *machine)BlockBackend *fmc0 = dev ?m25p80_get_blk (dev) :NULL ;if (fmc0 && !boot_emmc) { -uint64_t rom_size =memory_region_size (&bmc->soc->spi_boot); + rom_size =memory_region_size (&bmc->soc->spi_boot);aspeed_install_boot_rom (bmc, fmc0, rom_size); }else if (emmc0) {aspeed_install_boot_rom (bmc,blk_by_legacy_dinfo (emmc0),64 * KiB);
I don't think this patch is useful. See comment on patch 6.
Thanks,
C.
RE: [PATCH v5 04/11] hw/arm/aspeed: Reuse rom_size variable for vbootrom setup
Hi Cedric,
Quoted 38 lines
Subject: Re: [PATCH v5 04/11] hw/arm/aspeed: Reuse
rom_sizevariable for vbootrom setupQuoted 2 lines · Jamin Lin
Move the declaration of "
rom_size" to an outer scope inaspeed_machine_init()so it can be reused for setting up the vbootrom regionas well.
hw/arm/aspeed.c static void aspeed_machine_init(MachineState
Quoted 16 lines
This avoids introducing a redundant local variable and ensures consistent ROM sizing logic when both SPI boot and vbootrom are used.
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Cédric Le Goater <[email protected]>Tested-by Nabih Estefan <[email protected]>--- hw/arm/aspeed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0
-0
e852bbc4cb..b70a120e62100644hw/arm/aspeed.c +0
-0@@ -381,6 +381,7 @@ static void aspeed_machine_init(MachineState*machine)
hw/arm/aspeed.c static void aspeed_machine_init(MachineState
Quoted 8 lines
hw/arm/aspeed.c +1
-0AspeedSoCClass *sc;int i;DriveInfo *emmc0 =NULL ; +uint64_t rom_size;bool boot_emmc; bmc->soc =ASPEED_SOC (object_new (amc->soc_name));@@ -475,7 +476,7 @@ static void aspeed_machine_init(MachineState*machine)
hw/arm/aspeed.c static void aspeed_machine_init(MachineState *machine)
Quoted 4 lines
hw/arm/aspeed.c +0
-1BlockBackend *fmc0 = dev ?m25p80_get_blk (dev) :NULL ;if (fmc0 && !boot_emmc) { - uint64_t rom_size =
memory_region_size(&bmc->soc->spi_boot);
Quoted 9 lines
hw/arm/aspeed.c static void aspeed_machine_init(MachineState *machine)
Quoted 4 lines
hw/arm/aspeed.c +1
-0+ rom_size =memory_region_size (&bmc->soc->spi_boot);aspeed_install_boot_rom (bmc, fmc0, rom_size); }else if (emmc0) { aspeed_install_boot_rom(bmc,
blk_by_legacy_dinfo(emmc0),Quoted 1 line
64 * KiB);
I don't think this patch is useful. See comment on patch 6.
Thanks for suggestion and review.
Will drop this patch
Jamin
Quoted 5 lines
Thanks,
C.
PATCH v5 2/11 hw/arm/aspeed_ast27x0 Introduce vbootrom memory region
In reply to Jamin Lin viaIntroduce a new vbootrom memory region. The region is mapped at address "0x00000000" and has a size of 128KB, identical to the SRAM region size. This memory region is intended for loading a vbootrom image file as part of the boot process.
The vbootrom registered in the SoC's address space using the ASPEED_DEV_VBOOTROM index.
--- include/hw/arm/aspeed_soc.h | 2 ++ hw/arm/aspeed_ast27x0.c | 9 +++++++++ 2 files changed, 11 insertions(+)
include/hw/arm/aspeed_soc.h +2 -0
@@ -59,6 +59,7 @@ struct AspeedSoCState {MemoryRegion sram;MemoryRegion spi_boot_container;MemoryRegion spi_boot; +MemoryRegion vbootrom;AddressSpace dram_as;AspeedRtcState rtc;AspeedTimerCtrlState timerctrl;
@@ -169,6 +170,7 @@ struct AspeedSoCClass {const char *aspeed_soc_cpu_type (AspeedSoCClass *sc);enum { +ASPEED_DEV_VBOOTROM ,ASPEED_DEV_SPI_BOOT ,ASPEED_DEV_IOMEM ,ASPEED_DEV_UART0 ,
hw/arm/aspeed_ast27x0.c +9 -0
@@ -24,6 +24,7 @@#include "qemu/log.h" static const hwaddr aspeed_soc_ast2700_memmap[] = { + [ASPEED_DEV_VBOOTROM ] =0x00000000 , [ASPEED_DEV_SRAM ] =0x10000000 , [ASPEED_DEV_HACE ] =0x12070000 , [ASPEED_DEV_EMMC ] =0x12090000 ,
@@ -657,6 +658,14 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SRAM ], &s->sram); +/* VBOOTROM */ +if (!memory_region_init_ram (&s->vbootrom,OBJECT (s),"aspeed.vbootrom" , +0x20000 , errp)) { +return ; + } +memory_region_add_subregion (s->memory, + sc->memmap[ASPEED_DEV_VBOOTROM ], &s->vbootrom); +/* SCU */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {return ;
Signature · 1 line
2.43.0
Re: [PATCH v5 02/11] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region
Quoted 11 lines · Jamin Lin
Introduce a new vbootrom memory region. The region is mapped at address "
0x00000000" and has a size of 128KB, identical to the SRAM region size. This memory region is intended for loading a vbootrom image file as part of the boot process.The vbootrom registered in the SoC's address space using the
ASPEED_DEV_VBOOTROMindex.Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>Tested-by Nabih Estefan <[email protected]>
Thanks,
C.
Quoted 52 lines
--- include/hw/arm/aspeed_soc.h | 2 ++ hw/arm/aspeed_ast27x0.c | 9 +++++++++ 2 files changed, 11 insertions(+)include/hw/arm/aspeed_soc.h +2
-0@@ -59,6 +59,7 @@ struct AspeedSoCState {MemoryRegion sram;MemoryRegion spi_boot_container;MemoryRegion spi_boot; +MemoryRegion vbootrom;AddressSpace dram_as;AspeedRtcState rtc;AspeedTimerCtrlState timerctrl;@@ -169,6 +170,7 @@ struct AspeedSoCClass {const char *aspeed_soc_cpu_type (AspeedSoCClass *sc);enum { +ASPEED_DEV_VBOOTROM ,ASPEED_DEV_SPI_BOOT ,ASPEED_DEV_IOMEM ,ASPEED_DEV_UART0 ,hw/arm/aspeed_ast27x0.c +9
-0@@ -24,6 +24,7 @@#include "qemu/log.h" static const hwaddr aspeed_soc_ast2700_memmap[] = { + [ASPEED_DEV_VBOOTROM ] =0x00000000 , [ASPEED_DEV_SRAM ] =0x10000000 , [ASPEED_DEV_HACE ] =0x12070000 , [ASPEED_DEV_EMMC ] =0x12090000 ,@@ -657,6 +658,14 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SRAM ], &s->sram); +/* VBOOTROM */ +if (!memory_region_init_ram (&s->vbootrom,OBJECT (s),"aspeed.vbootrom" , +0x20000 , errp)) { +return ; + } +memory_region_add_subregion (s->memory, + sc->memmap[ASPEED_DEV_VBOOTROM ], &s->vbootrom); +/* SCU */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {return ;
PATCH v5 5/11 pc-bios: Add AST27x0 vBootrom
In reply to Jamin Lin viaThe boot ROM is a minimal implementation designed to load an AST27x0 boot image. Its source code is available at:
https://github.com/google/vbootrom
--- MAINTAINERS | 1 + pc-bios/README | 6 ++++++ pc-bios/ast27x0_bootrom.bin | Bin 0 -> 15424 bytes pc-bios/meson.build | 1 + 4 files changed, 8 insertions(+) create mode 100644 pc-bios/ast27x0_bootrom.bin
MAINTAINERS +1 -0
@@ -1163,6 +1163,7 @@ F: docs/system/arm/fby35.rst F: tests/*/*aspeed* F: tests/*/*ast2700* F: hw/arm/fby35.c +F: pc-bios/ast27x0_bootrom.bin NRF51 M: Joel Stanley <[email protected]>
pc-bios/README +6 -0
@@ -89,6 +89,12 @@ more features over time as needed. The source code is available at: https://github.com/google/vbootrom +- ast27x0_bootrom.bin is a simplified, free (Apache 2.0) boot ROM for + ASPEED AST27x0 BMC SOC. It currently implements the bare minimum to + load, parse, initialize and run boot images stored in SPI flash, but may grow + more features over time as needed. The source code is available at: + https://github.com/google/vbootrom + - hppa-firmware.img (32-bit) and hppa-firmware64.img (64-bit) are firmware files for the HP-PARISC (hppa) architecture. They are built form the SeaBIOS-hppa sources, which is a fork of SeaBIOS
pc-bios/ast27x0_bootrom.bin new file binary +0 -0
pc-bios/meson.build +1 -0
@@ -84,6 +84,7 @@ blobs = [ 'npcm8xx_bootrom.bin', 'vof.bin', 'vof-nvram.bin', + 'ast27x0_bootrom.bin', ] dtc = find_program('dtc', required: false)
Signature · 1 line
2.43.0
Re: [PATCH v5 05/11] pc-bios: Add AST27x0 vBootrom
Quoted 3 lines · Jamin Lin
The boot ROM is a minimal implementation designed to load an AST27x0 boot image. Its source code is available at:
https://github.com/google/vbootrom
It is not merged yet. Please resend when done and mention the commit id.
Thanks,
C.
Quoted 218 lines
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>Tested-by Nabih Estefan <[email protected]>--- MAINTAINERS | 1 + pc-bios/README | 6 ++++++ pc-bios/ast27x0_bootrom.bin | Bin 0 -> 15424 bytes pc-bios/meson.build | 1 + 4 files changed, 8 insertions(+)create mode 100644 pc-bios/ast27x0_bootrom.bin
MAINTAINERS +1
-0@@ -1163,6 +1163,7 @@ F: docs/system/arm/fby35.rst F: tests/*/*aspeed* F: tests/*/*ast2700* F: hw/arm/fby35.c +F: pc-bios/ast27x0_bootrom.bin NRF51 M: Joel Stanley <[email protected]>pc-bios/README +6
-0@@ -89,6 +89,12 @@ more features over time as needed. The source code is available at: https://github.com/google/vbootrom +- ast27x0_bootrom.bin is a simplified, free (Apache 2.0) boot ROM for + ASPEED AST27x0 BMC SOC. It currently implements the bare minimum to + load, parse, initialize and run boot images stored in SPI flash, but may grow + more features over time as needed. The source code is available at: + https://github.com/google/vbootrom + - hppa-firmware.img (32-bit) and hppa-firmware64.img (64-bit) are firmware files for the HP-PARISC (hppa) architecture. They are built form the SeaBIOS-hppa sources, which is a fork of SeaBIOSpc-bios/ast27x0_bootrom.bin new file binary +0
-0pc-bios/meson.build +1
-0@@ -84,6 +84,7 @@ blobs = [ 'npcm8xx_bootrom.bin', 'vof.bin', 'vof-nvram.bin', + 'ast27x0_bootrom.bin', ] dtc = find_program('dtc', required: false)
Re: [PATCH v5 05/11] pc-bios: Add AST27x0 vBootrom
Just got merged into https://github.com/google/vbootrom
Commit id: 82bed5ca62295228ea7bcdc721b63db178f686e8
Thanks,
Nabih
Quoted 234 lines · Cédric Le Goater
Quoted 3 lines · Jamin Lin
The boot ROM is a minimal implementation designed to load an AST27x0 boot image. Its source code is available at:
https://github.com/google/vbootromIt is not merged yet. Please resend when done and mention the commit id.
Thanks,
C.
Quoted 218 lines
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>Tested-by Nabih Estefan <[email protected]>--- MAINTAINERS | 1 + pc-bios/README | 6 ++++++ pc-bios/ast27x0_bootrom.bin | Bin 0 -> 15424 bytes pc-bios/meson.build | 1 + 4 files changed, 8 insertions(+)create mode 100644 pc-bios/ast27x0_bootrom.bin
MAINTAINERS +1
-0@@ -1163,6 +1163,7 @@ F: docs/system/arm/fby35.rst F: tests/*/*aspeed* F: tests/*/*ast2700* F: hw/arm/fby35.c +F: pc-bios/ast27x0_bootrom.bin NRF51 M: Joel Stanley <[email protected]>pc-bios/README +6
-0@@ -89,6 +89,12 @@ more features over time as needed. The source code is available at: https://github.com/google/vbootrom +- ast27x0_bootrom.bin is a simplified, free (Apache 2.0) boot ROM for + ASPEED AST27x0 BMC SOC. It currently implements the bare minimum to + load, parse, initialize and run boot images stored in SPI flash, but may grow + more features over time as needed. The source code is available at: + https://github.com/google/vbootrom + - hppa-firmware.img (32-bit) and hppa-firmware64.img (64-bit) are firmware files for the HP-PARISC (hppa) architecture. They are built form the SeaBIOS-hppa sources, which is a fork of SeaBIOSpc-bios/ast27x0_bootrom.bin new file binary +0
-0pc-bios/meson.build +1
-0@@ -84,6 +84,7 @@ blobs = [ 'npcm8xx_bootrom.bin', 'vof.bin', 'vof-nvram.bin', + 'ast27x0_bootrom.bin', ] dtc = find_program('dtc', required: false)
Re: [PATCH v5 05/11] pc-bios: Add AST27x0 vBootrom
Quoted 3 lines · Nabih Estefan
Just got merged into https://github.com/google/vbootrom
Commit id:
82bed5ca62295228ea7bcdc721b63db178f686e8
Thanks Nabih.
v6 should be ready for merge then.
C.
Quoted 240 lines
Thanks,
Nabih
Quoted 234 lines · Cédric Le Goater
Quoted 3 lines · Jamin Lin
The boot ROM is a minimal implementation designed to load an AST27x0 boot image. Its source code is available at:
https://github.com/google/vbootromIt is not merged yet. Please resend when done and mention the commit id.
Thanks,
C.
Quoted 218 lines
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>Tested-by Nabih Estefan <[email protected]>--- MAINTAINERS | 1 + pc-bios/README | 6 ++++++ pc-bios/ast27x0_bootrom.bin | Bin 0 -> 15424 bytes pc-bios/meson.build | 1 + 4 files changed, 8 insertions(+)create mode 100644 pc-bios/ast27x0_bootrom.bin
MAINTAINERS +1
-0@@ -1163,6 +1163,7 @@ F: docs/system/arm/fby35.rst F: tests/*/*aspeed* F: tests/*/*ast2700* F: hw/arm/fby35.c +F: pc-bios/ast27x0_bootrom.bin NRF51 M: Joel Stanley <[email protected]>pc-bios/README +6
-0@@ -89,6 +89,12 @@ more features over time as needed. The source code is available at: https://github.com/google/vbootrom +- ast27x0_bootrom.bin is a simplified, free (Apache 2.0) boot ROM for + ASPEED AST27x0 BMC SOC. It currently implements the bare minimum to + load, parse, initialize and run boot images stored in SPI flash, but may grow + more features over time as needed. The source code is available at: + https://github.com/google/vbootrom + - hppa-firmware.img (32-bit) and hppa-firmware64.img (64-bit) are firmware files for the HP-PARISC (hppa) architecture. They are built form the SeaBIOS-hppa sources, which is a fork of SeaBIOSpc-bios/ast27x0_bootrom.bin new file binary +0
-0pc-bios/meson.build +1
-0@@ -84,6 +84,7 @@ blobs = [ 'npcm8xx_bootrom.bin', 'vof.bin', 'vof-nvram.bin', + 'ast27x0_bootrom.bin', ] dtc = find_program('dtc', required: false)
PATCH v5 6/11 hw/arm/aspeed: Add support for loading vbootrom image via "-bios"
In reply to Jamin Lin viaIntroduce "aspeed_load_vbootrom()" to support loading a virtual boot ROM image into the vbootrom memory region, using the "-bios" command-line option.
--- hw/arm/aspeed.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
hw/arm/aspeed.c +35 -0
@@ -27,6 +27,7 @@#include "system/reset.h" #include "hw/loader.h" #include "qemu/error-report.h" +#include "qemu/datadir.h" #include "qemu/units.h" #include "hw/qdev-clock.h" #include "system/system.h"
@@ -305,6 +306,35 @@ static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk, rom_size, &error_abort); } +#define VBOOTROM_FILE_NAME "ast27x0_bootrom.bin" + +/* +* This function locates the vbootrom image file specified via the command line +* using the -bios option. It loads the specified image into the vbootrom +* memory region and handles errors if the file cannot be found or loaded. +*/ +static void aspeed_load_vbootrom (MachineState *machine,uint64_t rom_size, +Error **errp) +{ +AspeedMachineState *bmc =ASPEED_MACHINE (machine); +const char *bios_name = machine->firmware ?:VBOOTROM_FILE_NAME ; + g_autofree char *filename = NULL; +AspeedSoCState *soc = bmc->soc; +int ret; + + filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!filename) { +error_setg (errp,"Could not find vbootrom image '%s'" , bios_name); +return ; + } + + ret =load_image_mr (filename, &soc->vbootrom); +if (ret <0 ) { +error_setg (errp,"Failed to load vbootrom image '%s'" , bios_name); +return ; + } +} +void aspeed_board_init_flashes (AspeedSMCState *s,const char *flashtype,unsigned int count,int unit0) {
@@ -483,6 +513,11 @@ static void aspeed_machine_init(MachineState *machine) } } +if (amc->vbootrom) { + rom_size =memory_region_size (&bmc->soc->vbootrom); +aspeed_load_vbootrom (machine, rom_size, &error_abort); + } +arm_load_kernel (ARM_CPU (first_cpu), machine, &aspeed_board_binfo); }
Signature · 1 line
2.43.0
Re: [PATCH v5 06/11] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"
Quoted 24 lines · Jamin Lin
Introduce "
aspeed_load_vbootrom()" to support loading a virtual boot ROM image into the vbootrom memory region, using the "-bios" command-line option.Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>Tested-by Nabih Estefan <[email protected]>--- hw/arm/aspeed.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)hw/arm/aspeed.c +1
-0@@ -27,6 +27,7 @@#include "system/reset.h" #include "hw/loader.h" #include "qemu/error-report.h" +#include "qemu/datadir.h" #include "qemu/units.h" #include "hw/qdev-clock.h" #include "system/system.h" @@ -305,6 +306,35 @@ static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk, rom_size, &error_abort);
hw/arm/aspeed.c static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk, · line 316
Quoted 10 lines
hw/arm/aspeed.c +8
-0} +#define VBOOTROM_FILE_NAME "ast27x0_bootrom.bin" + +/* +* This function locates the vbootrom image file specified via the command line +* using the -bios option. It loads the specified image into the vbootrom +* memory region and handles errors if the file cannot be found or loaded. +*/ +static void aspeed_load_vbootrom(MachineState *machine, uint64_t rom_size,
rom_size is unused.
hw/arm/aspeed.c static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk, · line 320
Quoted 4 lines
hw/arm/aspeed.c +4
-0+ Error **errp) +{ +AspeedMachineState *bmc =ASPEED_MACHINE (machine); +const char *bios_name = machine->firmware ?:VBOOTROM_FILE_NAME ;
I would change the prototype of aspeed_load_vbootrom to:
void aspeed_load_vbootrom(AspeedMachineState *bmc, const char *bios_name,
Error **errp)
Thanks,
C.
Quoted 32 lines
hw/arm/aspeed.c +22
-0+ g_autofree char *filename = NULL; +AspeedSoCState *soc = bmc->soc; +int ret; + + filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!filename) { +error_setg (errp,"Could not find vbootrom image '%s'" , bios_name); +return ; + } + + ret =load_image_mr (filename, &soc->vbootrom); +if (ret <0 ) { +error_setg (errp,"Failed to load vbootrom image '%s'" , bios_name); +return ; + } +} +void aspeed_board_init_flashes (AspeedSMCState *s,const char *flashtype,unsigned int count,int unit0) {@@ -483,6 +513,11 @@ static void aspeed_machine_init(MachineState *machine) } } +if (amc->vbootrom) { + rom_size =memory_region_size (&bmc->soc->vbootrom); +aspeed_load_vbootrom (machine, rom_size, &error_abort); + } +arm_load_kernel (ARM_CPU (first_cpu), machine, &aspeed_board_binfo); }
RE: [PATCH v5 06/11] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"
Hi Cedric,
Quoted 49 lines
Subject: Re: [PATCH v5 06/11] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"
Quoted 2 lines · Jamin Lin
Introduce "
aspeed_load_vbootrom()" to support loading a virtual boot ROM image into the vbootrom memory region, using the "-bios"command-line option.
hw/arm/aspeed.c static void
Quoted 21 lines
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>Tested-by Nabih Estefan <[email protected]>--- hw/arm/aspeed.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0
-0
b70a120e62..b5831ef4c1100644hw/arm/aspeed.c +1
-0@@ -27,6 +27,7 @@#include "system/reset.h" #include "hw/loader.h" #include "qemu/error-report.h" +#include "qemu/datadir.h" #include "qemu/units.h" #include "hw/qdev-clock.h" #include "system/system.h" @@ -305,6 +306,35 @@ static voidaspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
Quoted 4 lines
hw/arm/aspeed.c +1
-0rom_size, &error_abort); } +#define VBOOTROM_FILE_NAME "ast27x0_bootrom.bin"hw/arm/aspeed.c static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
Quoted 10 lines
hw/arm/aspeed.c +10
-0+ +/* +* This function locates the vbootrom image file specified via the +command line +* using the -bios option. It loads the specified image into the +vbootrom +* memory region and handles errors if the file cannot be found or loaded. +*/ +static void aspeed_load_vbootrom(MachineState *machine, uint64_t +rom_size,
rom_sizeis unused.hw/arm/aspeed.c static void · line 322
Quoted 3 lines
hw/arm/aspeed.c +3
-0+ Error **errp) { +AspeedMachineState *bmc =ASPEED_MACHINE (machine); + const char *bios_name = machine->firmware ?:
Quoted 8 lines
VBOOTROM_FILE_NAME;I would change the prototype of
aspeed_load_vbootromto:void aspeed_load_vbootrom(AspeedMachineState *bmc, const char
*bios_name,
Error **errp)
Thanks for review and suggestion.
Will revise it
Jamin
Quoted 46 lines
Thanks,
C.
hw/arm/aspeed.c static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
Quoted 7 lines
hw/arm/aspeed.c +7
-0+ g_autofree char *filename = NULL; +AspeedSoCState *soc = bmc->soc; +int ret; + + filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!filename) { + error_setg(errp, "Could not find vbootrom image '%s'",
bios_name);hw/arm/aspeed.c static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
Quoted 6 lines
hw/arm/aspeed.c +6
-0+return ; + } + + ret =load_image_mr (filename, &soc->vbootrom); +if (ret <0 ) { + error_setg(errp, "Failed to load vbootrom image '%s'",
bios_name);hw/arm/aspeed.c static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
Quoted 5 lines
hw/arm/aspeed.c +4
-0+return ; + } +} + void aspeed_board_init_flashes(AspeedSMCState *s, const char*flashtype,
Quoted 1 line
unsigned int count, int
unit0)
hw/arm/aspeed.c static void aspeed_machine_init(MachineState
Quoted 2 lines
{hw/arm/aspeed.c +0
-0@@ -483,6 +513,11 @@ static void aspeed_machine_init(MachineState*machine)
hw/arm/aspeed.c static void aspeed_machine_init(MachineState *machine)
Quoted 9 lines
hw/arm/aspeed.c +5
-0} } +if (amc->vbootrom) { + rom_size =memory_region_size (&bmc->soc->vbootrom); +aspeed_load_vbootrom (machine, rom_size, &error_abort); + } + arm_load_kernel(ARM_CPU(first_cpu), machine,
&aspeed_board_binfo);Quoted 2 lines
hw/arm/aspeed.c +0
-0}
PATCH v5 7/11 tests/functional/aspeed: Move I2C test into shared helper for AST2700 reuse
In reply to Jamin Lin viaMove the I2C test case into a common helper function (do_ast2700_i2c_test) so it can be reused across multiple AST2700-based test cases. This reduces duplication and improves maintainability.
--- tests/functional/test_aarch64_aspeed.py | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-)
tests/functional/test_aarch64_aspeed.py +15 -13
@@ -18,6 +18,8 @@ class AST2x00MachineSDK(QemuSystemTest): def do_test_aarch64_aspeed_sdk_start(self, image): self.require_netdev('user') self.vm.set_console() + self.vm.add_args('-device', + 'tmp105,bus=aspeed.i2c.bus.1,address=0x4d,id=tmp-test') self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw', '-net', 'nic', '-net', 'user', '-snapshot')
@@ -35,6 +37,17 @@ def do_test_aarch64_aspeed_sdk_start(self, image): 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast2700-default-obmc.tar.gz', 'c1f4496aec06743c812a6e9a1a18d032f34d62f3ddb6956e924fef62aa2046a5') + def do_ast2700_i2c_test(self): + exec_command_and_wait_for_pattern(self, + 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-1/device/new_device ', + 'i2c i2c-1: new_device: Instantiated device lm75 at 0x4d'); + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '0') + self.vm.cmd('qom-set', path='/machine/peripheral/tmp-test', + property='temperature', value=18000) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000') + def start_ast2700_test(self, name): num_cpu = 4 uboot_size = os.path.getsize(self.scratch_file(name,
@@ -73,8 +86,6 @@ def start_ast2700_test(self, name): f'loader,addr=0x430000000,cpu-num={i}') self.vm.add_args('-smp', str(num_cpu)) - self.vm.add_args('-device', - 'tmp105,bus=aspeed.i2c.bus.1,address=0x4d,id=tmp-test') self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc'))
@@ -83,28 +94,19 @@ def start_ast2700_test(self, name): exec_command_and_wait_for_pattern(self, 'root', 'Password:') exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#') - exec_command_and_wait_for_pattern(self, - 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-1/device/new_device ', - 'i2c i2c-1: new_device: Instantiated device lm75 at 0x4d'); - exec_command_and_wait_for_pattern(self, - 'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '0') - self.vm.cmd('qom-set', path='/machine/peripheral/tmp-test', - property='temperature', value=18000) - exec_command_and_wait_for_pattern(self, - 'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000') - def test_aarch64_ast2700_evb_sdk_v09_05(self): self.set_machine('ast2700-evb') self.archive_extract(self.ASSET_SDK_V905_AST2700) self.start_ast2700_test('ast2700-a0-default') + self.do_ast2700_i2c_test() def test_aarch64_ast2700a1_evb_sdk_v09_05(self): self.set_machine('ast2700a1-evb') self.archive_extract(self.ASSET_SDK_V905_AST2700A1) self.start_ast2700_test('ast2700-default') - + self.do_ast2700_i2c_test() if __name__ == '__main__': QemuSystemTest.main()
Signature · 1 line
2.43.0
PATCH v5 8/11 tests/functional/aspeed: Update test ASPEED SDK v09.06
In reply to Jamin Lin via--- tests/functional/test_aarch64_aspeed.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
tests/functional/test_aarch64_aspeed.py +10 -10
@@ -29,13 +29,13 @@ def do_test_aarch64_aspeed_sdk_start(self, image): wait_for_console_pattern(self, '## Loading kernel from FIT Image') wait_for_console_pattern(self, 'Starting kernel ...') - ASSET_SDK_V905_AST2700 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast2700-a0-default-obmc.tar.gz', - 'cfbbd1cce72f2a3b73b9080c41eecdadebb7077fba4f7806d72ac99f3e84b74a') + ASSET_SDK_V906_AST2700 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2700-a0-default-obmc.tar.gz', + '7247b6f19dbfb700686f8d9f723ac23f3eb229226c0589cb9b06b80d1b61f3cb') - ASSET_SDK_V905_AST2700A1 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast2700-default-obmc.tar.gz', - 'c1f4496aec06743c812a6e9a1a18d032f34d62f3ddb6956e924fef62aa2046a5') + ASSET_SDK_V906_AST2700A1 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2700-default-obmc.tar.gz', + 'f1d53e0be8a404ecce3e105f72bc50fa4e090ad13160ffa91b10a6e0233a9dc6') def do_ast2700_i2c_test(self): exec_command_and_wait_for_pattern(self,
@@ -94,17 +94,17 @@ def start_ast2700_test(self, name): exec_command_and_wait_for_pattern(self, 'root', 'Password:') exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#') - def test_aarch64_ast2700_evb_sdk_v09_05(self): + def test_aarch64_ast2700_evb_sdk_v09_06(self): self.set_machine('ast2700-evb') - self.archive_extract(self.ASSET_SDK_V905_AST2700) + self.archive_extract(self.ASSET_SDK_V906_AST2700) self.start_ast2700_test('ast2700-a0-default') self.do_ast2700_i2c_test() - def test_aarch64_ast2700a1_evb_sdk_v09_05(self): + def test_aarch64_ast2700a1_evb_sdk_v09_06(self): self.set_machine('ast2700a1-evb') - self.archive_extract(self.ASSET_SDK_V905_AST2700A1) + self.archive_extract(self.ASSET_SDK_V906_AST2700A1) self.start_ast2700_test('ast2700-default') self.do_ast2700_i2c_test()
Signature · 1 line
2.43.0
PATCH v5 10/11 tests/functional/aspeed: Add to test vbootrom for AST2700
In reply to Jamin Lin viaAdd the AST2700 functional test to boot using the vbootrom image instead of manually loading boot components with -device loader. The boot ROM binary is now passed via the
-bios option, using the image located in pc-bios/ast27x0_bootrom.bin.
--- tests/functional/test_aarch64_aspeed.py | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
tests/functional/test_aarch64_aspeed.py +26 -0
@@ -25,6 +25,18 @@ def do_test_aarch64_aspeed_sdk_start(self, image): self.vm.launch() + def verify_vbootrom_firmware_flow(self): + wait_for_console_pattern(self, 'Found valid FIT image') + wait_for_console_pattern(self, '[uboot] loading') + wait_for_console_pattern(self, 'done') + wait_for_console_pattern(self, '[fdt] loading') + wait_for_console_pattern(self, 'done') + wait_for_console_pattern(self, '[tee] loading') + wait_for_console_pattern(self, 'done') + wait_for_console_pattern(self, '[atf] loading') + wait_for_console_pattern(self, 'done') + wait_for_console_pattern(self, 'Jumping to BL31 (Trusted Firmware-A)') + def verify_openbmc_boot_and_login(self, name): wait_for_console_pattern(self, 'U-Boot 2023.10') wait_for_console_pattern(self, '## Loading kernel from FIT Image')
@@ -94,6 +106,11 @@ def start_ast2700_test(self, name): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc')) + def start_ast2700_test_vbootrom(self, name): + self.vm.add_args('-bios', 'ast27x0_bootrom.bin') + self.do_test_aarch64_aspeed_sdk_start( + self.scratch_file(name, 'image-bmc')) + def test_aarch64_ast2700_evb_sdk_v09_06(self): self.set_machine('ast2700-evb')
@@ -110,5 +127,14 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self): self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700_i2c_test() + def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_06(self): + self.set_machine('ast2700a1-evb') + + self.archive_extract(self.ASSET_SDK_V906_AST2700A1) + self.start_ast2700_test_vbootrom('ast2700-default') + self.verify_vbootrom_firmware_flow() + self.verify_openbmc_boot_and_login('ast2700-default') + self.do_ast2700_i2c_test() + if __name__ == '__main__': QemuSystemTest.main()
Signature · 1 line
2.43.0
Re: [PATCH v5 10/11] tests/functional/aspeed: Add to test vbootrom for AST2700
Quoted 6 lines · Jamin Lin
Add the AST2700 functional test to boot using the vbootrom image instead of manually loading boot components with -device loader. The boot ROM binary is now passed via the
-bios option, using the image located in pc-bios/ast27x0_bootrom.bin.Signed-off-by Jamin Lin <[email protected]>
Thanks,
C.
Quoted 54 lines
--- tests/functional/test_aarch64_aspeed.py | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+)tests/functional/test_aarch64_aspeed.py +26
-0@@ -25,6 +25,18 @@ def do_test_aarch64_aspeed_sdk_start(self, image): self.vm.launch() + def verify_vbootrom_firmware_flow(self): + wait_for_console_pattern(self, 'Found valid FIT image') + wait_for_console_pattern(self, '[uboot] loading') + wait_for_console_pattern(self, 'done') + wait_for_console_pattern(self, '[fdt] loading') + wait_for_console_pattern(self, 'done') + wait_for_console_pattern(self, '[tee] loading') + wait_for_console_pattern(self, 'done') + wait_for_console_pattern(self, '[atf] loading') + wait_for_console_pattern(self, 'done') + wait_for_console_pattern(self, 'Jumping to BL31 (Trusted Firmware-A)') + def verify_openbmc_boot_and_login(self, name): wait_for_console_pattern(self, 'U-Boot 2023.10') wait_for_console_pattern(self, '## Loading kernel from FIT Image')@@ -94,6 +106,11 @@ def start_ast2700_test(self, name): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc')) + def start_ast2700_test_vbootrom(self, name): + self.vm.add_args('-bios', 'ast27x0_bootrom.bin') + self.do_test_aarch64_aspeed_sdk_start( + self.scratch_file(name, 'image-bmc')) + def test_aarch64_ast2700_evb_sdk_v09_06(self): self.set_machine('ast2700-evb')@@ -110,5 +127,14 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self): self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700_i2c_test() + def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_06(self): + self.set_machine('ast2700a1-evb') + + self.archive_extract(self.ASSET_SDK_V906_AST2700A1) + self.start_ast2700_test_vbootrom('ast2700-default') + self.verify_vbootrom_firmware_flow() + self.verify_openbmc_boot_and_login('ast2700-default') + self.do_ast2700_i2c_test() + if __name__ == '__main__': QemuSystemTest.main()
PATCH v5 9/11 tests/functional/aspeed: extract boot and login sequence into helper function
In reply to Jamin Lin viaExtracted repeated boot and login steps into a new helper function. No change in functional behavior.
--- tests/functional/test_aarch64_aspeed.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
tests/functional/test_aarch64_aspeed.py +7 -5
@@ -25,10 +25,15 @@ def do_test_aarch64_aspeed_sdk_start(self, image): self.vm.launch() + def verify_openbmc_boot_and_login(self, name): wait_for_console_pattern(self, 'U-Boot 2023.10') wait_for_console_pattern(self, '## Loading kernel from FIT Image') wait_for_console_pattern(self, 'Starting kernel ...') + wait_for_console_pattern(self, f'{name} login:') + 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-a0-default-obmc.tar.gz', '7247b6f19dbfb700686f8d9f723ac23f3eb229226c0589cb9b06b80d1b61f3cb')
@@ -89,16 +94,12 @@ def start_ast2700_test(self, name): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc')) - wait_for_console_pattern(self, f'{name} login:') - - exec_command_and_wait_for_pattern(self, 'root', 'Password:') - exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#') - def test_aarch64_ast2700_evb_sdk_v09_06(self): self.set_machine('ast2700-evb') self.archive_extract(self.ASSET_SDK_V906_AST2700) self.start_ast2700_test('ast2700-a0-default') + self.verify_openbmc_boot_and_login('ast2700-a0-default') self.do_ast2700_i2c_test() def test_aarch64_ast2700a1_evb_sdk_v09_06(self):
@@ -106,6 +107,7 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self): self.archive_extract(self.ASSET_SDK_V906_AST2700A1) self.start_ast2700_test('ast2700-default') + self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700_i2c_test() if __name__ == '__main__':
Signature · 1 line
2.43.0
Re: [PATCH v5 09/11] tests/functional/aspeed: extract boot and login sequence into helper function
Quoted 4 lines · Jamin Lin
Extracted repeated boot and login steps into a new helper function. No change in functional behavior.
Signed-off-by Jamin Lin <[email protected]>
Thanks,
C.
Quoted 50 lines
--- tests/functional/test_aarch64_aspeed.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)tests/functional/test_aarch64_aspeed.py +7
-5@@ -25,10 +25,15 @@ def do_test_aarch64_aspeed_sdk_start(self, image): self.vm.launch() + def verify_openbmc_boot_and_login(self, name): wait_for_console_pattern(self, 'U-Boot 2023.10') wait_for_console_pattern(self, '## Loading kernel from FIT Image') wait_for_console_pattern(self, 'Starting kernel ...') + wait_for_console_pattern(self, f'{name} login:') + 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-a0-default-obmc.tar.gz', '7247b6f19dbfb700686f8d9f723ac23f3eb229226c0589cb9b06b80d1b61f3cb')@@ -89,16 +94,12 @@ def start_ast2700_test(self, name): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc')) - wait_for_console_pattern(self, f'{name} login:') - - exec_command_and_wait_for_pattern(self, 'root', 'Password:') - exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#') - def test_aarch64_ast2700_evb_sdk_v09_06(self): self.set_machine('ast2700-evb') self.archive_extract(self.ASSET_SDK_V906_AST2700) self.start_ast2700_test('ast2700-a0-default') + self.verify_openbmc_boot_and_login('ast2700-a0-default') self.do_ast2700_i2c_test() def test_aarch64_ast2700a1_evb_sdk_v09_06(self):@@ -106,6 +107,7 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self): self.archive_extract(self.ASSET_SDK_V906_AST2700A1) self.start_ast2700_test('ast2700-default') + self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700_i2c_test() if __name__ == '__main__':
PATCH v5 11/11 docs/system/arm/aspeed: Support vbootrom for AST2700
In reply to Jamin Lin viaUsing the vbootrom image support and the boot ROM binary is now passed via the -bios option, using the image located in pc-bios/ast27x0_bootrom.bin.
--- docs/system/arm/aspeed.rst | 96 +++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 6 deletions(-)
docs/system/arm/aspeed.rst +90 -6
@@ -1,4 +1,4 @@ -Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``ast2700-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``) +Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``) ================================================================================================================================================================================================================================================================================================================================================================================================================== The QEMU Aspeed machines model BMCs of various OpenPOWER systems and
@@ -39,10 +39,6 @@ AST2600 SoC based machines : - ``qcom-dc-scm-v1-bmc`` Qualcomm DC-SCM V1 BMC - ``qcom-firework-bmc`` Qualcomm Firework BMC -AST2700 SoC based machines : - -- ``ast2700-evb`` Aspeed AST2700 Evaluation board (Cortex-A35) - Supported devices -----------------
@@ -247,10 +243,78 @@ under Linux), use : -M ast2500-evb,bmc-console=uart3 +Aspeed 2700 family boards (``ast2700-evb``) +================================================================== + +The QEMU Aspeed machines model BMCs of Aspeed evaluation boards. +They are based on different releases of the Aspeed SoC : +the AST2700 with quad cores ARM Cortex-A35 64 bits CPUs (1.6GHz) + +The SoC comes with RAM, Gigabit ethernet, USB, SD/MMC, USB, SPI, I2C, +etc. + +AST2700 SoC based machines : + +- ``ast2700-evb`` Aspeed AST2700 Evaluation board (Cortex-A35) + +Supported devices +----------------- + * Interrupt Controller + * Timer Controller + * RTC Controller + * I2C Controller + * System Control Unit (SCU) + * SRAM mapping + * X-DMA Controller (basic interface) + * Static Memory Controller (SMC or FMC) - Only SPI Flash support + * SPI Memory Controller + * USB 2.0 Controller + * SD/MMC storage controllers + * SDRAM controller (dummy interface for basic settings and training) + * Watchdog Controller + * GPIO Controller (Master only) + * UART + * Ethernet controllers + * Front LEDs (PCA9552 on I2C bus) + * LPC Peripheral Controller (a subset of subdevices are supported) + * Hash/Crypto Engine (HACE) - Hash support only. TODO: Crypto + * ADC + * eMMC Boot Controller (dummy) + * PECI Controller (minimal) + * I3C Controller + * Internal Bridge Controller (SLI dummy) + +Missing devices +--------------- + * Coprocessor support + * PWM and Fan Controller + * Slave GPIO Controller + * Super I/O Controller + * PCI-Express 1 Controller + * Graphic Display Controller + * MCTP Controller + * Mailbox Controller + * Virtual UART + * eSPI Controller + +Boot options +------------ + +Images can be downloaded from the ASPEED Forked OpenBMC GitHub release repository : + + https://github.com/AspeedTech-BMC/openbmc/releases + Booting the ast2700-evb machine ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Boot the AST2700 machine from the flash image, use an MTD drive : +Boot the AST2700 machine from the flash image. + +There are two supported methods for booting the AST2700 machine with a flash image: + +Manual boot using ``-device loader``: + +It causes all 4 CPU cores to start execution from address ``0x430000000``, which +corresponds to the BL31 image load address. .. code-block:: bash
@@ -270,6 +334,26 @@ Boot the AST2700 machine from the flash image, use an MTD drive : -drive file=${IMGDIR}/image-bmc,format=raw,if=mtd \ -nographic +Boot using a virtual boot ROM (``-bios``): + +If users do not specify the ``-bios option``, QEMU will attempt to load the +default vbootrom image ``ast27x0_bootrom.bin`` from either the current working +directory or the ``pc-bios`` directory within the QEMU source tree. + +.. code-block:: bash + + $ qemu-system-aarch64 -M ast2700-evb \ + -drive file=image-bmc,format=raw,if=mtd \ + -nographic + +The ``-bios`` option allows users to specify a custom path for the vbootrom +image to be loaded during boot. This will load the vbootrom image from the +specified path in the ${HOME} directory. + +.. code-block:: bash + + -bios ${HOME}/ast27x0_bootrom.bin + Aspeed minibmc family boards (``ast1030-evb``) ==================================================================
Signature · 1 line
2.43.0
Re: [PATCH v5 11/11] docs/system/arm/aspeed: Support vbootrom for AST2700
Quoted 6 lines · Jamin Lin
Using the vbootrom image support and the boot ROM binary is now passed via the -bios option, using the image located in pc-bios/ast27x0_bootrom.bin.
Signed-off-by Jamin Lin <[email protected]>Reviewed-by Nabih Estefan <[email protected]>
Some comments below,
Quoted 15 lines
--- docs/system/arm/aspeed.rst | 96 +++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 6 deletions(-)docs/system/arm/aspeed.rst +1
-1@@ -1,4 +1,4 @@ -Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``ast2700-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``) +Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``) ================================================================================================================================================================================================================================================================================================================================================================================================================== The QEMU Aspeed machines model BMCs of various OpenPOWER systems and
docs/system/arm/aspeed.rst AST2600 SoC based machines : · line 45
Quoted 7 lines
docs/system/arm/aspeed.rst +0
-4@@ -39,10 +39,6 @@ AST2600 SoC based machines : - ``qcom-dc-scm-v1-bmc`` Qualcomm DC-SCM V1 BMC - ``qcom-firework-bmc`` Qualcomm Firework BMC -AST2700 SoC based machines : - -- ``ast2700-evb`` Aspeed AST2700 Evaluation board (Cortex-A35) -
This will conflict with Steven's series adding the ast2700fc machine. To ease upstreaming of both, it might be good idea to separate the change adding the "Aspeed 2700 family boards" section from the change adding the "Boot using a virtual boot ROM" subsection.
Thanks,
C.
Quoted 110 lines
docs/system/arm/aspeed.rst +89
-1Supported devices -----------------@@ -247,10 +243,78 @@ under Linux), use : -M ast2500-evb,bmc-console=uart3 +Aspeed 2700 family boards (``ast2700-evb``) +================================================================== + +The QEMU Aspeed machines model BMCs of Aspeed evaluation boards. +They are based on different releases of the Aspeed SoC : +the AST2700 with quad cores ARM Cortex-A35 64 bits CPUs (1.6GHz) + +The SoC comes with RAM, Gigabit ethernet, USB, SD/MMC, USB, SPI, I2C, +etc. + +AST2700 SoC based machines : + +- ``ast2700-evb`` Aspeed AST2700 Evaluation board (Cortex-A35) + +Supported devices +----------------- + * Interrupt Controller + * Timer Controller + * RTC Controller + * I2C Controller + * System Control Unit (SCU) + * SRAM mapping + * X-DMA Controller (basic interface) + * Static Memory Controller (SMC or FMC) - Only SPI Flash support + * SPI Memory Controller + * USB 2.0 Controller + * SD/MMC storage controllers + * SDRAM controller (dummy interface for basic settings and training) + * Watchdog Controller + * GPIO Controller (Master only) + * UART + * Ethernet controllers + * Front LEDs (PCA9552 on I2C bus) + * LPC Peripheral Controller (a subset of subdevices are supported) + * Hash/Crypto Engine (HACE) - Hash support only. TODO: Crypto + * ADC + * eMMC Boot Controller (dummy) + * PECI Controller (minimal) + * I3C Controller + * Internal Bridge Controller (SLI dummy) + +Missing devices +--------------- + * Coprocessor support + * PWM and Fan Controller + * Slave GPIO Controller + * Super I/O Controller + * PCI-Express 1 Controller + * Graphic Display Controller + * MCTP Controller + * Mailbox Controller + * Virtual UART + * eSPI Controller + +Boot options +------------ + +Images can be downloaded from the ASPEED Forked OpenBMC GitHub release repository : + + https://github.com/AspeedTech-BMC/openbmc/releases + Booting the ast2700-evb machine ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Boot the AST2700 machine from the flash image, use an MTD drive : +Boot the AST2700 machine from the flash image. + +There are two supported methods for booting the AST2700 machine with a flash image: + +Manual boot using ``-device loader``: + +It causes all 4 CPU cores to start execution from address ``0x430000000``, which +corresponds to the BL31 image load address. .. code-block:: bash@@ -270,6 +334,26 @@ Boot the AST2700 machine from the flash image, use an MTD drive : -drive file=${IMGDIR}/image-bmc,format=raw,if=mtd \ -nographic +Boot using a virtual boot ROM (``-bios``): + +If users do not specify the ``-bios option``, QEMU will attempt to load the +default vbootrom image ``ast27x0_bootrom.bin`` from either the current working +directory or the ``pc-bios`` directory within the QEMU source tree. + +.. code-block:: bash + + $ qemu-system-aarch64 -M ast2700-evb \ + -drive file=image-bmc,format=raw,if=mtd \ + -nographic + +The ``-bios`` option allows users to specify a custom path for the vbootrom +image to be loaded during boot. This will load the vbootrom image from the +specified path in the ${HOME} directory. + +.. code-block:: bash + + -bios ${HOME}/ast27x0_bootrom.bin + Aspeed minibmc family boards (``ast1030-evb``) ==================================================================
Cédric Le Goater
AppliedQuoted 54 lines · Jamin Lin
v1:
Add initial support for AST27x0
The purpose of vbootrom here is to simulate the work of BootMCU SPL (riscv) in AST2700, because QEMU doesn't support heterogenous architecture yet.ast27x0_bootrom.bin is a simplified, free (Apache 2.0) boot ROM for ASPEED AST27x0 BMC SOC. It currently implements the bare minimum to load, parse, initialize and run boot images stored in SPI flash, but may grow more features over time as needed. The source code is available at:
https://github.com/google/vbootromv2:
Add "IntroducedASPEED_DEV_VBOOTROMin the device enumeration" patch to fix build failed.v3:
1. Supports both vbootrom and device loader boot methods, with vbootrom used as the default.
2. Fix review and QTEST test failed issues.v4:
Adjust the patch order.v5:
fix review issue and remove unnecessary class attribure.
doc: create a new section for AST2700.Jamin Lin (11):
hw/arm/aspeed_ast27x0: Rename variablesram_nameto name in ast2700
realize
hw/arm/aspeed_ast27x0 Introduce vbootrom memory region hw/arm/aspeed: Add vbootrom support on AST2700 EVB machines hw/arm/aspeed: Reuserom_sizevariable for vbootrom setup
pc-bios: Add AST27x0 vBootrom
hw/arm/aspeed: Add support for loading vbootrom image via "-bios" tests/functional/aspeed: Move I2C test into shared helper for AST2700
reuse
tests/functional/aspeed: Update test ASPEED SDK v09.06 tests/functional/aspeed: extract boot and login sequence into helper
function
tests/functional/aspeed: Add to test vbootrom for AST2700 docs/system/arm/aspeed: Support vbootrom for AST2700MAINTAINERS | 1 + docs/system/arm/aspeed.rst | 96 ++++++++++++++++++++++-- include/hw/arm/aspeed.h | 1 + include/hw/arm/aspeed_soc.h | 2 + hw/arm/aspeed.c | 40 +++++++++- hw/arm/aspeed_ast27x0.c | 17 ++++- pc-bios/README | 6 ++ pc-bios/ast27x0_bootrom.bin | Bin 0 -> 15424 bytes pc-bios/meson.build | 1 + tests/functional/test_aarch64_aspeed.py | 82 +++++++++++++------- 10 files changed, 209 insertions(+), 37 deletions(-)
Quoted 2 lines
create mode 100644 pc-bios/ast27x0_bootrom.bin
Applied patches 1,7,8,9 to aspeed-next.
Thanks,
C.