Skip to contentSkip to conversation

Support vbootrom for AST2700

PATCH Superseded Jamin Lin via 6 participants 34 messages Apr 17, 2025 – Apr 29, 2025

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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

Jamin Lin (10):
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: Add to test vbootrom for AST2700 docs/system/arm/aspeed: Support vbootrom for AST2700

 MAINTAINERS                             |   1 +
 docs/system/arm/aspeed.rst              |  29 +++++++++++-
 include/hw/arm/aspeed.h                 |   2 +
 include/hw/arm/aspeed_soc.h             |   3 ++
 hw/arm/aspeed.c                         |  41 +++++++++++++++-
 hw/arm/aspeed_ast27x0.c                 |  20 ++++++--
 pc-bios/README                          |   6 +++
 pc-bios/ast27x0_bootrom.bin             | Bin 0 -> 15464 bytes
 pc-bios/meson.build                     |   1 +
 tests/functional/test_aarch64_aspeed.py |  59 +++++++++++++++---------
 10 files changed, 135 insertions(+), 27 deletions(-)
 create mode 100644 pc-bios/ast27x0_bootrom.bin
Signature · 1 line
2.43.0
#1 lore raw

PATCH v4 1/10 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
index dce7255a2c..b05ed75ff4 100644
@@ -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
#2 lore raw

PATCH v4 2/10 hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

In reply to Jamin Lin via

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

Introduced a "vbootrom_size" attribute in "AspeedSoCClass" to define virtual boot ROM size.

---
 include/hw/arm/aspeed_soc.h |  3 +++
 hw/arm/aspeed_ast27x0.c     | 12 ++++++++++++
 2 files changed, 15 insertions(+)
include/hw/arm/aspeed_soc.h +3 -0
index f069d17d16..9af8cfbc3e 100644
@@ -59,6 +59,7 @@ struct AspeedSoCState {
     MemoryRegion sram;
     MemoryRegion spi_boot_container;
     MemoryRegion spi_boot;
+    MemoryRegion vbootrom;
     AddressSpace dram_as;
     AspeedRtcState rtc;
     AspeedTimerCtrlState timerctrl;
@@ -152,6 +153,7 @@ struct AspeedSoCClass {
     const char * const *valid_cpu_types;
     uint32_t silicon_rev;
     uint64_t sram_size;
+    uint64_t vbootrom_size;
     uint64_t secsram_size;
     int spis_num;
     int ehcis_num;
@@ -169,6 +171,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 +12 -0
index b05ed75ff4..7eece8e286 100644
@@ -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,15 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
     memory_region_add_subregion(s->memory,
                                 sc->memmap[ASPEED_DEV_SRAM], &s->sram);
 
+    /* VBOOTROM */
+    name = g_strdup_printf("aspeed.vbootrom.%d", CPU(&a->cpu[0])->cpu_index);
+    if (!memory_region_init_ram(&s->vbootrom, OBJECT(s), name,
+                                sc->vbootrom_size, 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;
@@ -898,6 +908,7 @@ static void aspeed_soc_ast2700a0_class_init(ObjectClass *oc, void *data)
 
     sc->valid_cpu_types = valid_cpu_types;
     sc->silicon_rev  = AST2700_A0_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
     sc->sram_size    = 0x20000;
     sc->spis_num     = 3;
     sc->wdts_num     = 8;
@@ -925,6 +936,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, void *data)
 
     sc->valid_cpu_types = valid_cpu_types;
     sc->silicon_rev  = AST2700_A1_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
     sc->sram_size    = 0x20000;
     sc->spis_num     = 3;
     sc->wdts_num     = 8;
Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH v4 02/10] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

Quoted 10 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_VBOOTROM index.

Introduced a "vbootrom_size" attribute in "AspeedSoCClass" to define virtual boot ROM size.

Could you please explain why we need a class attribute to size the vbootrom region ? The rest looks good.

Thanks,

C.

Quoted 81 lines
---
  include/hw/arm/aspeed_soc.h |  3 +++
  hw/arm/aspeed_ast27x0.c     | 12 ++++++++++++
  2 files changed, 15 insertions(+)
include/hw/arm/aspeed_soc.h +3 -0
index f069d17d16..9af8cfbc3e 100644
@@ -59,6 +59,7 @@ struct AspeedSoCState {
      MemoryRegion sram;
      MemoryRegion spi_boot_container;
      MemoryRegion spi_boot;
+    MemoryRegion vbootrom;
      AddressSpace dram_as;
      AspeedRtcState rtc;
      AspeedTimerCtrlState timerctrl;
@@ -152,6 +153,7 @@ struct AspeedSoCClass {
      const char * const *valid_cpu_types;
      uint32_t silicon_rev;
      uint64_t sram_size;
+    uint64_t vbootrom_size;
      uint64_t secsram_size;
      int spis_num;
      int ehcis_num;
@@ -169,6 +171,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 +12 -0
index b05ed75ff4..7eece8e286 100644
@@ -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,15 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
      memory_region_add_subregion(s->memory,
                                  sc->memmap[ASPEED_DEV_SRAM], &s->sram);
 
+    /* VBOOTROM */
+    name = g_strdup_printf("aspeed.vbootrom.%d", CPU(&a->cpu[0])->cpu_index);
+    if (!memory_region_init_ram(&s->vbootrom, OBJECT(s), name,
+                                sc->vbootrom_size, 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;
@@ -898,6 +908,7 @@ static void aspeed_soc_ast2700a0_class_init(ObjectClass *oc, void *data)
 
      sc->valid_cpu_types = valid_cpu_types;
      sc->silicon_rev  = AST2700_A0_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
      sc->sram_size    = 0x20000;
      sc->spis_num     = 3;
      sc->wdts_num     = 8;
@@ -925,6 +936,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, void *data)
 
      sc->valid_cpu_types = valid_cpu_types;
      sc->silicon_rev  = AST2700_A1_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
      sc->sram_size    = 0x20000;
      sc->spis_num     = 3;
      sc->wdts_num     = 8;
#4 lore raw

RE: [PATCH v4 02/10] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

Hi Cedric,

Quoted 10 lines

Subject: Re: [PATCH v4 02/10] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

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

Quoted 3 lines

This memory region is intended for loading a vbootrom image file as part of the boot process.

Quoted 9 lines
Quoted 5 lines

The vbootrom registered in the SoC's address space using the ASPEED_DEV_VBOOTROM index.

Introduced a "vbootrom_size" attribute in "AspeedSoCClass" to define virtual boot ROM size.

Could you please explain why we need a class attribute to size the vbootrom region ? The rest looks good.

I've reviewed the SRAM design and used it as a reference to create a new class attribute for setting the size of the vbootrom memory region. Currently, I don't plan to support different vbootrom images for the AST27x0. My understanding is that a single vbootrom image should be sufficient to support all AST27x0 variants. If you agree, I will remove this class attribute and instead hardcode the vbootrom size to 128KB.

Thanks-Jamin

Quoted 96 lines

Thanks,

C.

hw/arm/aspeed_ast27x0.c static void

Quoted 50 lines
---
  include/hw/arm/aspeed_soc.h |  3 +++
  hw/arm/aspeed_ast27x0.c     | 12 ++++++++++++
  2 files changed, 15 insertions(+)
include/hw/arm/aspeed_soc.h +3 -0
index f069d17d16..9af8cfbc3e 100644
@@ -59,6 +59,7 @@ struct AspeedSoCState {
      MemoryRegion sram;
      MemoryRegion spi_boot_container;
      MemoryRegion spi_boot;
+    MemoryRegion vbootrom;
      AddressSpace dram_as;
      AspeedRtcState rtc;
      AspeedTimerCtrlState timerctrl;
@@ -152,6 +153,7 @@ struct AspeedSoCClass {
      const char * const *valid_cpu_types;
      uint32_t silicon_rev;
      uint64_t sram_size;
+    uint64_t vbootrom_size;
      uint64_t secsram_size;
      int spis_num;
      int ehcis_num;
@@ -169,6 +171,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 index renamed from hw/arm/aspeed_ast27x0.c +0 -0

b05ed75ff4..7eece8e286 100644

hw/arm/aspeed_ast27x0.c +1 -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,15 @@ static void

aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) · line 660

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +0 -0
      memory_region_add_subregion(s->memory,
 

sc->memmap[ASPEED_DEV_SRAM],

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)

Quoted 4 lines
hw/arm/aspeed_ast27x0.c +2 -0
 &s->sram);
 
+    /* VBOOTROM */
+    name = g_strdup_printf("aspeed.vbootrom.%d",

CPU(&a->cpu[0])->cpu_index);

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) · line 669

Quoted 6 lines
hw/arm/aspeed_ast27x0.c +6 -0
+    if (!memory_region_init_ram(&s->vbootrom, OBJECT(s), name,
+                                sc->vbootrom_size, errp)) {
+        return;
+    }
+    memory_region_add_subregion(s->memory,
+

sc->memmap[ASPEED_DEV_VBOOTROM],

Quoted 23 lines
hw/arm/aspeed_ast27x0.c +3 -0
+ &s->vbootrom);
+
      /* SCU */
      if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
          return;
@@ -898,6 +908,7 @@ static void
 aspeed_soc_ast2700a0_class_init(ObjectClass *oc, void *data)
 
      sc->valid_cpu_types = valid_cpu_types;
      sc->silicon_rev  = AST2700_A0_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
      sc->sram_size    = 0x20000;
      sc->spis_num     = 3;
      sc->wdts_num     = 8;
hw/arm/aspeed_ast27x0.c +1 -0
@@ -925,6 +936,7 @@ static void
 aspeed_soc_ast2700a1_class_init(ObjectClass *oc, void *data)
 
      sc->valid_cpu_types = valid_cpu_types;
      sc->silicon_rev  = AST2700_A1_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
      sc->sram_size    = 0x20000;
      sc->spis_num     = 3;
      sc->wdts_num     = 8;
#5 lore raw

Re: [PATCH v4 02/10] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

Quoted 18 lines · Jamin Lin

Hi Cedric,

Quoted 16 lines

Subject: Re: [PATCH v4 02/10] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

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

Quoted 8 lines

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.

Introduced a "vbootrom_size" attribute in "AspeedSoCClass" to define virtual boot ROM size.

Quoted 7 lines
Quoted 3 lines

Could you please explain why we need a class attribute to size the vbootrom region ? The rest looks good.

I've reviewed the SRAM design and used it as a reference to create a new class attribute for setting the size of the vbootrom memory region. Currently, I don't plan to support different vbootrom images for the AST27x0. My understanding is that a single vbootrom image should be sufficient to support all AST27x0 variants. If you agree, I will remove this class attribute and instead hardcode the vbootrom size to 128KB.

Looks good to me.

Thanks,

C.

#6 lore raw

Re: [PATCH v4 02/10] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

In reply to Jamin Lin via
Quoted 60 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_VBOOTROM index.

Introduced a "vbootrom_size" attribute in "AspeedSoCClass" to define virtual boot ROM size.

---
  include/hw/arm/aspeed_soc.h |  3 +++
  hw/arm/aspeed_ast27x0.c     | 12 ++++++++++++
  2 files changed, 15 insertions(+)
include/hw/arm/aspeed_soc.h +3 -0
index f069d17d16..9af8cfbc3e 100644
@@ -59,6 +59,7 @@ struct AspeedSoCState {
      MemoryRegion sram;
      MemoryRegion spi_boot_container;
      MemoryRegion spi_boot;
+    MemoryRegion vbootrom;
      AddressSpace dram_as;
      AspeedRtcState rtc;
      AspeedTimerCtrlState timerctrl;
@@ -152,6 +153,7 @@ struct AspeedSoCClass {
      const char * const *valid_cpu_types;
      uint32_t silicon_rev;
      uint64_t sram_size;
+    uint64_t vbootrom_size;
      uint64_t secsram_size;
      int spis_num;
      int ehcis_num;
@@ -169,6 +171,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 +1 -0
index b05ed75ff4..7eece8e286 100644
@@ -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,

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) · line 662

Quoted 5 lines
hw/arm/aspeed_ast27x0.c +2 -0
@@ -657,6 +658,15 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
      memory_region_add_subregion(s->memory,
                                  sc->memmap[ASPEED_DEV_SRAM], &s->sram);
 
+    /* VBOOTROM */
+    name = g_strdup_printf("aspeed.vbootrom.%d", CPU(&a->cpu[0])->cpu_index);

can't we simply name the region "aspeed.vbootrom" or "aspeed.vboot_rom" ?

Thanks,

C.

Quoted 25 lines
hw/arm/aspeed_ast27x0.c +8 -0
+    if (!memory_region_init_ram(&s->vbootrom, OBJECT(s), name,> +                                sc->vbootrom_size, 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;
@@ -898,6 +908,7 @@ static void aspeed_soc_ast2700a0_class_init(ObjectClass *oc, void *data)
 
      sc->valid_cpu_types = valid_cpu_types;
      sc->silicon_rev  = AST2700_A0_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
      sc->sram_size    = 0x20000;
      sc->spis_num     = 3;
      sc->wdts_num     = 8;
@@ -925,6 +936,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, void *data)
 
      sc->valid_cpu_types = valid_cpu_types;
      sc->silicon_rev  = AST2700_A1_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
      sc->sram_size    = 0x20000;
      sc->spis_num     = 3;
      sc->wdts_num     = 8;
#7 lore raw

RE: [PATCH v4 02/10] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

Hi Cedric,

Quoted 69 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 02/10] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region

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

hw/arm/aspeed_ast27x0.c static void

Quoted 58 lines

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.

Introduced a "vbootrom_size" attribute in "AspeedSoCClass" to define virtual boot ROM size.

---
  include/hw/arm/aspeed_soc.h |  3 +++
  hw/arm/aspeed_ast27x0.c     | 12 ++++++++++++
  2 files changed, 15 insertions(+)
include/hw/arm/aspeed_soc.h +3 -0
index f069d17d16..9af8cfbc3e 100644
@@ -59,6 +59,7 @@ struct AspeedSoCState {
      MemoryRegion sram;
      MemoryRegion spi_boot_container;
      MemoryRegion spi_boot;
+    MemoryRegion vbootrom;
      AddressSpace dram_as;
      AspeedRtcState rtc;
      AspeedTimerCtrlState timerctrl;
@@ -152,6 +153,7 @@ struct AspeedSoCClass {
      const char * const *valid_cpu_types;
      uint32_t silicon_rev;
      uint64_t sram_size;
+    uint64_t vbootrom_size;
      uint64_t secsram_size;
      int spis_num;
      int ehcis_num;
@@ -169,6 +171,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 index renamed from hw/arm/aspeed_ast27x0.c +0 -0

b05ed75ff4..7eece8e286 100644

hw/arm/aspeed_ast27x0.c +1 -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,15 @@ static void

aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) · line 660

Quoted 2 lines
hw/arm/aspeed_ast27x0.c +0 -0
      memory_region_add_subregion(s->memory,
 
Quoted 9 lines

sc->memmap[ASPEED_DEV_SRAM],

hw/arm/aspeed_ast27x0.c static void · line 664

Quoted 5 lines
hw/arm/aspeed_ast27x0.c +3 -0
 &s->sram);
 
+    /* VBOOTROM */
+    name = g_strdup_printf("aspeed.vbootrom.%d",
+ CPU(&a->cpu[0])->cpu_index);

can't we simply name the region "aspeed.vbootrom" or "aspeed.vboot_rom" ?

Thanks for review.
Will do
Jamin

Quoted 37 lines

Thanks,

C.

hw/arm/aspeed_ast27x0.c static void · line 665

Quoted 1 line
hw/arm/aspeed_ast27x0.c +1 -0
+    if (!memory_region_init_ram(&s->vbootrom, OBJECT(s), name,> +

sc->vbootrom_size, errp)) {

hw/arm/aspeed_ast27x0.c static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) · line 669

Quoted 4 lines
hw/arm/aspeed_ast27x0.c +4 -0
+        return;
+    }
+    memory_region_add_subregion(s->memory,
+

sc->memmap[ASPEED_DEV_VBOOTROM],

Quoted 23 lines
hw/arm/aspeed_ast27x0.c +3 -0
+ &s->vbootrom);
+
      /* SCU */
      if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
          return;
@@ -898,6 +908,7 @@ static void
 aspeed_soc_ast2700a0_class_init(ObjectClass *oc, void *data)
 
      sc->valid_cpu_types = valid_cpu_types;
      sc->silicon_rev  = AST2700_A0_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
      sc->sram_size    = 0x20000;
      sc->spis_num     = 3;
      sc->wdts_num     = 8;
hw/arm/aspeed_ast27x0.c +1 -0
@@ -925,6 +936,7 @@ static void
 aspeed_soc_ast2700a1_class_init(ObjectClass *oc, void *data)
 
      sc->valid_cpu_types = valid_cpu_types;
      sc->silicon_rev  = AST2700_A1_SILICON_REV;
+    sc->vbootrom_size = 0x20000;
      sc->sram_size    = 0x20000;
      sc->spis_num     = 3;
      sc->wdts_num     = 8;
#8 lore raw

PATCH v4 4/10 hw/arm/aspeed: Reuse rom_size variable for vbootrom setup

In reply to Jamin Lin via

Move 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
index e852bbc4cb..b70a120e62 100644
@@ -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
#9 lore raw

PATCH v4 3/10 hw/arm/aspeed: Add vbootrom support on AST2700 EVB machines

In reply to Jamin Lin via

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.

---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 2 ++
 2 files changed, 3 insertions(+)
include/hw/arm/aspeed.h +1 -0
index 9cae45a1c9..973277bea6 100644
@@ -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
index 82f42582fa..e852bbc4cb 100644
@@ -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
#10 lore raw

PATCH v4 5/10 pc-bios: Add AST27x0 vBootrom

In reply to Jamin Lin via

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

---
 MAINTAINERS                 |   1 +
 pc-bios/README              |   6 ++++++
 pc-bios/ast27x0_bootrom.bin | Bin 0 -> 15464 bytes
 pc-bios/meson.build         |   1 +
 4 files changed, 8 insertions(+)
 create mode 100644 pc-bios/ast27x0_bootrom.bin
MAINTAINERS +1 -0
index d54b5578f8..70ab0d0afa 100644
@@ -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
index f0f13e15f2..d009c37895 100644
@@ -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
new file mode 100644
index 0000000000000000000000000000000000000000..e50f56eed9deeea65cbc1dd37897d59b1ff64ddd
GIT binary patch
pc-bios/meson.build +1 -0
index 34d6616c32..83998f6071 100644
@@ -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
#11 lore raw

PATCH v4 6/10 hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

In reply to Jamin Lin via

Introduce "aspeed_load_vbootrom()" to support loading a virtual boot ROM image into the vbootrom memory region, using the "-bios" command-line option.

---
 include/hw/arm/aspeed.h |  1 +
 hw/arm/aspeed.c         | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
include/hw/arm/aspeed.h +1 -0
index 973277bea6..2b8332a7d7 100644
@@ -41,6 +41,7 @@ struct AspeedMachineClass {
     uint32_t uart_default;
     bool sdhci_wp_inverted;
     bool vbootrom;
+    const char *vbootrom_name;
 };
 
 
hw/arm/aspeed.c +36 -0
index b70a120e62..7f11371f02 100644
@@ -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,34 @@ static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
                    rom_size, &error_abort);
 }
 
+/*
+ * 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);
+    AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(machine);
+    const char *bios_name = machine->firmware ?: amc->vbootrom_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 +512,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);
 }
 
@@ -1691,6 +1725,7 @@ static void aspeed_machine_ast2700a0_evb_class_init(ObjectClass *oc, void *data)
     amc->uart_default = ASPEED_DEV_UART12;
     amc->i2c_init  = ast2700_evb_i2c_init;
     amc->vbootrom = true;
+    amc->vbootrom_name = "ast27x0_bootrom.bin";
     mc->auto_create_sdcard = true;
     mc->default_ram_size = 1 * GiB;
     aspeed_machine_class_init_cpus_defaults(mc);
@@ -1712,6 +1747,7 @@ static void aspeed_machine_ast2700a1_evb_class_init(ObjectClass *oc, void *data)
     amc->uart_default = ASPEED_DEV_UART12;
     amc->i2c_init  = ast2700_evb_i2c_init;
     amc->vbootrom = true;
+    amc->vbootrom_name = "ast27x0_bootrom.bin";
     mc->auto_create_sdcard = true;
     mc->default_ram_size = 1 * GiB;
     aspeed_machine_class_init_cpus_defaults(mc);
Signature · 1 line
2.43.0
#12 lore raw

Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

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

---
  include/hw/arm/aspeed.h |  1 +
  hw/arm/aspeed.c         | 36 ++++++++++++++++++++++++++++++++++++
  2 files changed, 37 insertions(+)
include/hw/arm/aspeed.h +0 -0
index 973277bea6..2b8332a7d7 100644

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 44

Quoted 4 lines
include/hw/arm/aspeed.h +1 -0
@@ -41,6 +41,7 @@ struct AspeedMachineClass {
      uint32_t uart_default;
      bool sdhci_wp_inverted;
      bool vbootrom;
+    const char *vbootrom_name;

I don't think adding a class attribute for the default firmware image file is that useful. A define should be enough :

    #define VBOOTROM_FILE_NAME  "ast27x0_bootrom.bin"

and use VBOOTROM_FILE_NAME when defining the bios_name variable.

Unless you already plan to have different default firmware files for the ast27* machines ?

Quoted 51 lines
include/hw/arm/aspeed.h +0 -0
  };
 
 
hw/arm/aspeed.c +29 -0
index b70a120e62..7f11371f02 100644
@@ -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,34 @@ static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
                     rom_size, &error_abort);
  }
 
+/*
+ * 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);
+    AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(machine);
+    const char *bios_name = machine->firmware ?: amc->vbootrom_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)
  {

hw/arm/aspeed.c static void aspeed_machine_init(MachineState *machine) · line 515

Quoted 4 lines
hw/arm/aspeed.c +1 -0
@@ -483,6 +512,11 @@ static void aspeed_machine_init(MachineState *machine)
          }
      }
 
+    if (amc->vbootrom) {

what about the "aspeed.boot_rom" region ? Is it ok to have both ?

Thanks,

C.

Quoted 23 lines
hw/arm/aspeed.c +6 -0
+        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);
  }
 
@@ -1691,6 +1725,7 @@ static void aspeed_machine_ast2700a0_evb_class_init(ObjectClass *oc, void *data)
      amc->uart_default = ASPEED_DEV_UART12;
      amc->i2c_init  = ast2700_evb_i2c_init;
      amc->vbootrom = true;
+    amc->vbootrom_name = "ast27x0_bootrom.bin";
      mc->auto_create_sdcard = true;
      mc->default_ram_size = 1 * GiB;
      aspeed_machine_class_init_cpus_defaults(mc);
@@ -1712,6 +1747,7 @@ static void aspeed_machine_ast2700a1_evb_class_init(ObjectClass *oc, void *data)
      amc->uart_default = ASPEED_DEV_UART12;
      amc->i2c_init  = ast2700_evb_i2c_init;
      amc->vbootrom = true;
+    amc->vbootrom_name = "ast27x0_bootrom.bin";
      mc->auto_create_sdcard = true;
      mc->default_ram_size = 1 * GiB;
      aspeed_machine_class_init_cpus_defaults(mc);
#13 lore raw

RE: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hi Cedric,

Quoted 31 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 06/10] 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.

Quoted 7 lines
---
  include/hw/arm/aspeed.h |  1 +
  hw/arm/aspeed.c         | 36

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

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 44

Quoted 11 lines
  2 files changed, 37 insertions(+)
include/hw/arm/aspeed.h index renamed from include/hw/arm/aspeed.h +0 -0

973277bea6..2b8332a7d7 100644

include/hw/arm/aspeed.h +1 -0
@@ -41,6 +41,7 @@ struct AspeedMachineClass {
      uint32_t uart_default;
      bool sdhci_wp_inverted;
      bool vbootrom;
+    const char *vbootrom_name;

I don't think adding a class attribute for the default firmware image file is that useful. A define should be enough :

Quoted 7 lines
     #define VBOOTROM_FILE_NAME  "ast27x0_bootrom.bin"

and use VBOOTROM_FILE_NAME when defining the bios_name variable.

Unless you already plan to have different default firmware files for the ast27* machines ?

If we plan to support the vbootrom feature for multiple ASPEED SoCs such as the AST28x0 series, it seems that the current default define
for the image name cannot be reused for both AST27x0 and future ASPEED SoCs. This is because the vbootrom file names differ between the two series.
That’s the reason I introduced a machine class attribute — to allow flexibility in specifying the correct vbootrom name for each SoC family.
I will use the DEFINE for now in the v5 patch. When we plan to support vbootrom for new SoCs in the future, we can revisit and discuss the appropriate default naming convention at that time.

Quoted 62 lines

hw/arm/aspeed.c static void

Quoted 17 lines
include/hw/arm/aspeed.h +0 -0
  };
 
 
hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0 -0

b70a120e62..7f11371f02 100644

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,34 @@ static void

aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,

hw/arm/aspeed.c static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,

Quoted 11 lines
hw/arm/aspeed.c +8 -0
                     rom_size, &error_abort);
  }
 
+/*
+ * 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,

hw/arm/aspeed.c static void · line 319

Quoted 3 lines
hw/arm/aspeed.c +3 -0
+                                 Error **errp) {
+    AspeedMachineState *bmc = ASPEED_MACHINE(machine);
+    AspeedMachineClass *amc =

ASPEED_MACHINE_GET_CLASS(machine);

hw/arm/aspeed.c static void · line 320

Quoted 1 line
hw/arm/aspeed.c +1 -0
+    const char *bios_name = machine->firmware ?:

amc->vbootrom_name;

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,

hw/arm/aspeed.c static void · line 339

Quoted 1 line
hw/arm/aspeed.c +0 -0
                                        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 +512,11 @@ static void aspeed_machine_init(MachineState

*machine)

Quoted 7 lines

hw/arm/aspeed.c static void aspeed_machine_init(MachineState *machine) · line 515

Quoted 4 lines
hw/arm/aspeed.c +1 -0
          }
      }
 
+    if (amc->vbootrom) {

what about the "aspeed.boot_rom" region ? Is it ok to have both ?

Based on the design of aspeed_install_boot_rom, users can place their ROM code at the top of the image-bmc, and this function will install image-bmc which included the user's ROM IMAGE at the ASPEED_DEV_SPI_BOOT address. For AST2600, users typically set the boot address to 0x0 and boot directly from there.

For AST2700, we introduced a vbootrom to simulate the ROM code and the BOOTMCU SPL (RISC-V).
We use aspeed_install_boot_rom to load the image-bmc at the FMC CS0 memory-mapped I/O address, so we set ASPEED_DEV_SPI_BOOT to 0x100000000.
We load the vbootrom image into the vbootrom memory region at address 0x0 and start execution from there.
The guest OS first enters the vbootrom. From there, it can easily access the flash data (image-bmc) at 0x100000000, since vbootrom itself doesn’t require SPI/flash/emmc host drivers. To support future eMMC booting, we also plan to install the eMMC image at the ASPEED_DEV_SPI_BOOT address.
https://github.com/qemu/qemu/blob/master/hw/arm/aspeed.c#L477

It is fully supported to have both options. If users want to include their own ROM code within image-bmc, they can set the program counter (PC) to 0x100000000, just like how a manual loader set it to 0x43000000 (e.g., to jump directly to BL31). This allows users to bypass the vbootrom if desired.
However, I believe this use case will be rare, as the vbootrom design should be able to satisfy most, if not all, user requirements.

Thanks-Jamin

Quoted 33 lines

Thanks,

C.

hw/arm/aspeed.c static void aspeed_machine_init(MachineState *machine)

Quoted 5 lines
hw/arm/aspeed.c +4 -0
+        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);

hw/arm/aspeed.c static void

Quoted 3 lines
hw/arm/aspeed.c +0 -0
  }
 
@@ -1691,6 +1725,7 @@ static void

aspeed_machine_ast2700a0_evb_class_init(ObjectClass *oc, void *data)

hw/arm/aspeed.c static void

Quoted 8 lines
hw/arm/aspeed.c +1 -0
      amc->uart_default = ASPEED_DEV_UART12;
      amc->i2c_init  = ast2700_evb_i2c_init;
      amc->vbootrom = true;
+    amc->vbootrom_name = "ast27x0_bootrom.bin";
      mc->auto_create_sdcard = true;
      mc->default_ram_size = 1 * GiB;
      aspeed_machine_class_init_cpus_defaults(mc);
@@ -1712,6 +1747,7 @@ static void

aspeed_machine_ast2700a1_evb_class_init(ObjectClass *oc, void *data)

Quoted 7 lines
hw/arm/aspeed.c +1 -0
      amc->uart_default = ASPEED_DEV_UART12;
      amc->i2c_init  = ast2700_evb_i2c_init;
      amc->vbootrom = true;
+    amc->vbootrom_name = "ast27x0_bootrom.bin";
      mc->auto_create_sdcard = true;
      mc->default_ram_size = 1 * GiB;
      aspeed_machine_class_init_cpus_defaults(mc);
#14 lore raw

Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

Quoted 8 lines

Based on the design of aspeed_install_boot_rom, users can place their ROM code at the top of the image-bmc, and this function will install image-bmc which included the user's ROM IMAGE at the ASPEED_DEV_SPI_BOOT address. For AST2600, users typically set the boot address to 0x0 and boot directly from there.

For AST2700, we introduced a vbootrom to simulate the ROM code and the BOOTMCU SPL (RISC-V).

Side question, is anyone working on the BOOTMCU SPL (RISC-V) models ? heterogeneous machines should be supported one day.

Quoted 7 lines

We use aspeed_install_boot_rom to load the image-bmc at the FMC CS0 memory-mapped I/O address, so we set ASPEED_DEV_SPI_BOOT to 0x100000000.

We load the vbootrom image into the vbootrom memory region at address 0x0 and start execution from there.

Quoted 7 lines

The guest OS first enters the vbootrom. From there, it can easily access the flash data (image-bmc) at 0x100000000, since vbootrom itself doesn’t require SPI/flash/emmc host drivers.

To support future eMMC booting, we also plan to install the eMMC image at the ASPEED_DEV_SPI_BOOT address.
https://github.com/qemu/qemu/blob/master/hw/arm/aspeed.c#L477

ok.

Quoted 5 lines

It is fully supported to have both options. If users want to include their own ROM code within image-bmc, they can set the program counter (PC) to 0x100000000, just like how a manual loader set it to 0x43000000 (e.g., to jump directly to BL31). This allows users to bypass the vbootrom if desired.

ok.

Quoted 3 lines

However, I believe this use case will be rare, as the vbootrom design should be able to satisfy most, if not all, user requirements.

We need to be careful about what we offer the user in terms of boot method. It's difficult to maintain on the long term. Let's recap.

For the AST2[456]00 machines, we have :

1. kernel boot
2. flash device boot with or without "execute-in-place" machine option

and this could work for AST2700 machines with some loader magic. It would be good to decide to or not to support it. If not supported, let's inform the user asap.

For the AST2600 ast2600evb and rainier machines only, we have :

3. emmc device boot

and we plan to extend it for AST2700 machines.

For the AST2700 machines, we have :

4. manual loader boot (this could work for the other SoCs, although we have never tried)
5. firmware boot

We need to define a priority between these methods too (the list above is more or less ordered, apart from 4.) and handle conflicts.

All of which is to say that the piece of code below will require some care:

    if (!bmc->mmio_exec) {
        DeviceState *dev = ssi_get_cs(bmc->soc->fmc.spi, 0);
        BlockBackend *fmc0 = dev ? m25p80_get_blk(dev) : NULL;

        if (fmc0 && !boot_emmc) {
            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);
        }
    }

    if (amc->vbootrom) {
        rom_size = memory_region_size(&bmc->soc->vbootrom);
        aspeed_load_vbootrom(machine, rom_size, &error_abort);
    }

Thanks,

C.

#15 lore raw

RE: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hi Cedric,

Quoted 12 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

Quoted 6 lines

Based on the design of aspeed_install_boot_rom, users can place their ROM code at the top of the image-bmc, and this function will install image-bmc which included the user's ROM IMAGE at the ASPEED_DEV_SPI_BOOT address. For AST2600, users typically set the boot address to 0x0 and boot directly from there.

Quoted 6 lines
Quoted 2 lines

For AST2700, we introduced a vbootrom to simulate the ROM code and the BOOTMCU SPL (RISC-V).

Side question, is anyone working on the BOOTMCU SPL (RISC-V) models ? heterogeneous machines should be supported one day.

Troy developed an initial implementation, but testing has not yet been performed due to uncertainty around "how to share DRAM memory and controllers registers" between the RISC-V and the Cortex-A35 cores. Furthermore, RISC-V interrupt support is currently not implemented.

Quoted 23 lines
Quoted 7 lines

We use aspeed_install_boot_rom to load the image-bmc at the FMC CS0 memory-mapped I/O address, so we set ASPEED_DEV_SPI_BOOT to 0x100000000.

We load the vbootrom image into the vbootrom memory region at address 0x0 and start execution from there.

Quoted 7 lines

The guest OS first enters the vbootrom. From there, it can easily access the flash data (image-bmc) at 0x100000000, since vbootrom itself doesn’t require SPI/flash/emmc host drivers.

To support future eMMC booting, we also plan to install the eMMC image at the ASPEED_DEV_SPI_BOOT address.
https://github.com/qemu/qemu/blob/master/hw/arm/aspeed.c#L477

ok.

Quoted 5 lines

It is fully supported to have both options. If users want to include their own ROM code within image-bmc, they can set the program counter (PC) to 0x100000000, just like how a manual loader set it to 0x43000000 (e.g., to jump directly to BL31). This allows users to bypass the vbootrom if desired.

Quoted 8 lines

ok.

Quoted 2 lines

However, I believe this use case will be rare, as the vbootrom design should be able to satisfy most, if not all, user requirements.

We need to be careful about what we offer the user in terms of boot method. It's difficult to maintain on the long term. Let's recap.

For the AST2700, I am currently considering support for the following boot methods only:

1. eMMC device boot
2. UFS device boot (Note: QEMU currently only supports PCI-based UFS and does not support platform-based UFS. This remains a long-term goal)
3. Firmware boot using vbootrom
4. Firmware boot using a manual loader

The boot flow for the AST2700’s Cortex-A35 should follow this sequence:
BL31 (Trusted Firmware-A) → BL32 (OP-TEE OS) → BL33 (U-Boot)

I don't think we should support direct kernel boot , as I don't know how to start execution directly from the kernel.

By the way, AST2700 support to boot from either EMMC or UFS. I am considering to read OTP configs and strap instead of command line.
Ex: we used bootmmc=true to change hardstrap.
It just my briefly plane and future goal.

Thanks-Jamin

Quoted 49 lines

For the AST2[456]00 machines, we have :

1. kernel boot
2. flash device boot with or without "execute-in-place" machine option

and this could work for AST2700 machines with some loader magic.
It would be good to decide to or not to support it. If not supported, let's inform the user asap.

For the AST2600 ast2600evb and rainier machines only, we have :

3. emmc device boot

and we plan to extend it for AST2700 machines.

For the AST2700 machines, we have :

4. manual loader boot (this could work for the other SoCs, although we have never tried)
5. firmware boot

We need to define a priority between these methods too (the list above is more or less ordered, apart from 4.) and handle conflicts.

All of which is to say that the piece of code below will require some care:

     if (!bmc->mmio_exec) {
         DeviceState *dev = ssi_get_cs(bmc->soc->fmc.spi, 0);
         BlockBackend *fmc0 = dev ? m25p80_get_blk(dev) : NULL;

         if (fmc0 && !boot_emmc) {
             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);
         }
     }

     if (amc->vbootrom) {
         rom_size = memory_region_size(&bmc->soc->vbootrom);
         aspeed_load_vbootrom(machine, rom_size, &error_abort);
     }

Thanks,

C.

#16 lore raw

Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

+ Phil.

Quoted 17 lines · Jamin Lin

Hi Cedric,

Quoted 15 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

Quoted 8 lines

Based on the design of aspeed_install_boot_rom, users can place their ROM code at the top of the image-bmc, and this function will install image-bmc which included the user's ROM IMAGE at the ASPEED_DEV_SPI_BOOT address. For AST2600, users typically set the boot address to 0x0 and boot directly from there.

For AST2700, we introduced a vbootrom to simulate the ROM code and the BOOTMCU SPL (RISC-V).

Quoted 7 lines
Quoted 3 lines

Side question, is anyone working on the BOOTMCU SPL (RISC-V) models ? heterogeneous machines should be supported one day.

Troy developed an initial implementation, but testing has not yet been performed due to uncertainty around "how to share DRAM memory and controllers registers" between the RISC-V and the Cortex-A35 cores. Furthermore, RISC-V interrupt support is currently not implemented.

Could you explain a bit more the issues you are facing ? Single QEMU binary is expected to become a reality in the near future and the ast2700 models could benefit from it.

Thanks,

C.

#17 lore raw

RE: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hi Cedric,

Quoted 29 lines

Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

+ Phil.

Quoted 21 lines · Jamin Lin

Hi Cedric,

Quoted 18 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

Quoted 8 lines

Based on the design of aspeed_install_boot_rom, users can place their ROM code at the top of the image-bmc, and this function will install image-bmc which included the user's ROM IMAGE at the ASPEED_DEV_SPI_BOOT address. For AST2600, users typically set the boot address to 0x0 and boot directly from there.

For AST2700, we introduced a vbootrom to simulate the ROM code and the BOOTMCU SPL (RISC-V).

Side question, is anyone working on the BOOTMCU SPL (RISC-V) models ? heterogeneous machines should be supported one day.

Quoted 8 lines
Quoted 2 lines

Troy developed an initial implementation, but testing has not yet been performed due to uncertainty around "how to share DRAM memory and

controllers registers" between the RISC-V and the Cortex-A35 cores.

Quoted 1 line

Furthermore, RISC-V interrupt support is currently not implemented.

Could you explain a bit more the issues you are facing ? Single QEMU binary is expected to become a reality in the near future and the
ast2700 models could benefit from it.

There is a BootMCU which is a 32-bit RISC-V CPU, and its DRAM start address is 0x80000000 (32-bit address space). The primary CPU is a Cortex-A35, and its DRAM start address is 0x400000000 (64-bit address space).

If the BootMCU writes 0x12345678 to address 0x80000000, the Cortex-A35 should be able to read 0x12345678 from address 0x400000000. Similarly, if the Cortex-A35 writes 0x00ABCDEF to address 0x400000000, the BootMCU should be able to read 0x00ABCDEF from address 0x80000000.

Thanks-Jamin

Quoted 6 lines

Thanks,

C.

#18 lore raw

Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Quoted 39 lines · Jamin Lin

Hi Cedric,

Quoted 29 lines

Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

+ Phil.

Quoted 21 lines · Jamin Lin

Hi Cedric,

Quoted 18 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

Quoted 8 lines

Based on the design of aspeed_install_boot_rom, users can place their ROM code at the top of the image-bmc, and this function will install image-bmc which included the user's ROM IMAGE at the ASPEED_DEV_SPI_BOOT address. For AST2600, users typically set the boot address to 0x0 and boot directly from there.

For AST2700, we introduced a vbootrom to simulate the ROM code and the BOOTMCU SPL (RISC-V).

Side question, is anyone working on the BOOTMCU SPL (RISC-V) models ? heterogeneous machines should be supported one day.

Quoted 8 lines
Quoted 2 lines

Troy developed an initial implementation, but testing has not yet been performed due to uncertainty around "how to share DRAM memory and

controllers registers" between the RISC-V and the Cortex-A35 cores.

Quoted 1 line

Furthermore, RISC-V interrupt support is currently not implemented.

Could you explain a bit more the issues you are facing ? Single QEMU binary is expected to become a reality in the near future and the
ast2700 models could benefit from it.

Quoted 5 lines

There is a BootMCU which is a 32-bit RISC-V CPU, and its DRAM start address is 0x80000000 (32-bit address space). The primary CPU is a Cortex-A35, and its DRAM start address is 0x400000000 (64-bit address space).

If the BootMCU writes 0x12345678 to address 0x80000000, the Cortex-A35 should be able to read 0x12345678 from address 0x400000000. Similarly, if the Cortex-A35 writes 0x00ABCDEF to address 0x400000000, the BootMCU should be able to read 0x00ABCDEF from address 0x80000000.

This shouldn't be a problem, the raspi machines have something similar.

I remember having an issue when displaying the address spaces on the monitor, using your example, if you start mapping the dram on the rv core, then the AS has some internal offset, and when you map it on the arm cluster, the offset persists and you'd see it mapped at 0x3_8000_0000 while being at 0x4_0000_0000 (it is a bug). However the accesses from the arm cores really hit 0x4_0000_0000 base: it is just a display problem IIRC.

Maybe the thread around this issue was this one:
https://lore.kernel.org/qemu-devel/20210421144846.GI4440@xz-x1/

#19 lore raw

RE: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hi Cedric, Philippe

Quoted 64 lines

Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Quoted 34 lines · Jamin Lin

Hi Cedric,

Quoted 32 lines

Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

+ Phil.

Quoted 24 lines · Jamin Lin

Hi Cedric,

Quoted 12 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 06/10] hw/arm/aspeed: Add support for loading vbootrom image via "-bios"

Hello Jamin,

Quoted 6 lines

Based on the design of aspeed_install_boot_rom, users can place their ROM code at the top of the image-bmc, and this function will install image-bmc which included the user's ROM IMAGE at the ASPEED_DEV_SPI_BOOT address. For AST2600, users typically set the boot address to 0x0 and boot directly from there.

Quoted 6 lines
Quoted 2 lines

For AST2700, we introduced a vbootrom to simulate the ROM code and the BOOTMCU SPL (RISC-V).

Side question, is anyone working on the BOOTMCU SPL (RISC-V) models ? heterogeneous machines should be supported one day.

Troy developed an initial implementation, but testing has not yet been performed due to uncertainty around "how to share DRAM memory and

Quoted 7 lines
Quoted 6 lines

controllers registers" between the RISC-V and the Cortex-A35 cores.

Quoted 1 line

Furthermore, RISC-V interrupt support is currently not implemented.

Could you explain a bit more the issues you are facing ? Single QEMU binary is expected to become a reality in the near future and the ast2700 models could benefit from it.

There is a BootMCU which is a 32-bit RISC-V CPU, and its DRAM start

address is 0x80000000 (32-bit address space).

Quoted 1 line

The primary CPU is a Cortex-A35, and its DRAM start address is

0x400000000 (64-bit address space).

Quoted 2 lines

If the BootMCU writes 0x12345678 to address 0x80000000, the Cortex-A35

should be able to read 0x12345678 from address 0x400000000.

Quoted 1 line

Similarly, if the Cortex-A35 writes 0x00ABCDEF to address 0x400000000, the

BootMCU should be able to read 0x00ABCDEF from address 0x80000000.

This shouldn't be a problem, the raspi machines have something similar.

I remember having an issue when displaying the address spaces on the monitor, using your example, if you start mapping the dram on the rv core, then the AS has some internal offset, and when you map it on the arm cluster, the offset persists and you'd see it mapped at
0x3_8000_0000 while being at 0x4_0000_0000 (it is a bug). However the accesses from the arm cores really hit 0x4_0000_0000 base: it is just a display problem IIRC.

Quoted 2 lines

Maybe the thread around this issue was this one:
https://lore.kernel.org/qemu-devel/20210421144846.GI4440@xz-x1/

Thanks for your reply.
After QEMU adds support for a "single binary and this issue is resolved", I will study the single binary design and plan to enable the AST2700 to boot starting from the "BOOTMCU (RISC-V 32-bit)". This is our long-term goal.

Jamin

#20 lore raw

PATCH v4 7/10 tests/functional/aspeed: Move I2C test into shared helper for AST2700 reuse

In reply to Jamin Lin via

Move 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
index c25c966278..441f7f3919 100755
@@ -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
Reviewed-by on v4 7/10
#21 lore raw

Re: [PATCH v4 07/10] tests/functional/aspeed: Move I2C test into shared helper for AST2700 reuse

Quoted 6 lines · Jamin Lin

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

Quoted 78 lines
---
 tests/functional/test_aarch64_aspeed.py | 28 +++++++++++++------------
 1 file changed, 15 insertions(+), 13 deletions(-)
tests/functional/test_aarch64_aspeed.py +15 -14
index c25c966278..441f7f3919 100755
@@ -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()
--

2.43.0

Reviewed-by on v4 7/10
#22 lore raw

Re: [PATCH v4 07/10] tests/functional/aspeed: Move I2C test into shared helper for AST2700 reuse

In reply to Jamin Lin via
Quoted 5 lines · Jamin Lin

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

Thanks,

C.

Quoted 75 lines
---
  tests/functional/test_aarch64_aspeed.py | 28 +++++++++++++------------
  1 file changed, 15 insertions(+), 13 deletions(-)
tests/functional/test_aarch64_aspeed.py +15 -13
index c25c966278..441f7f3919 100755
@@ -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()
#23 lore raw

PATCH v4 8/10 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
index 441f7f3919..337d701917 100755
@@ -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
Reviewed-by on v4 8/10
#24 lore raw

Re: [PATCH v4 08/10] tests/functional/aspeed: Update test ASPEED SDK v09.06

Quoted 1 line · Jamin Lin

Thanks,

C.

Quoted 50 lines
---
  tests/functional/test_aarch64_aspeed.py | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)
tests/functional/test_aarch64_aspeed.py +10 -10
index 441f7f3919..337d701917 100755
@@ -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()
 
#25 lore raw

Re: [PATCH v4 08/10] tests/functional/aspeed: Update test ASPEED SDK v09.06

In reply to Jamin Lin via

Jamin,

Quoted 41 lines · Jamin Lin
---
  tests/functional/test_aarch64_aspeed.py | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)
tests/functional/test_aarch64_aspeed.py +8 -8
index 441f7f3919..337d701917 100755
@@ -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()

tests/functional/test_aarch64_aspeed.py def start_ast2700_test(self, name): · line 110

Quoted 10 lines
tests/functional/test_aarch64_aspeed.py +2 -2
 
-    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()
 

While at it, could you please update the SDK version for the tests in the other aspeed files too ?

tests/functional/test_aarch64_ast2700fc.py
tests/functional/test_arm_aspeed_ast2500.py
tests/functional/test_arm_aspeed_ast2600.py

Thanks,

C.

#26 lore raw

RE: [PATCH v4 08/10] tests/functional/aspeed: Update test ASPEED SDK v09.06

Hi Cedric,

Quoted 70 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 08/10] tests/functional/aspeed: Update test ASPEED SDK v09.06

Jamin,

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image): · line 29

Quoted 12 lines · Jamin Lin
---
  tests/functional/test_aarch64_aspeed.py | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)
tests/functional/test_aarch64_aspeed.py +0 -0
index 441f7f3919..337d701917 100755
@@ -29,13 +29,13 @@ def do_test_aarch64_aspeed_sdk_start(self, image):
          wait_for_console_pattern(self, '## Loading kernel from FIT

Image')

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image):

Quoted 4 lines
tests/functional/test_aarch64_aspeed.py +0 -2
          wait_for_console_pattern(self, 'Starting kernel ...')
 
-    ASSET_SDK_V905_AST2700 = Asset(
-

'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast 2700-a0-default-obmc.tar.gz',

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image): · line 34

Quoted 1 line
tests/functional/test_aarch64_aspeed.py +0 -1
-

'cfbbd1cce72f2a3b73b9080c41eecdadebb7077fba4f7806d72ac99f3e84b74a')

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image): · line 33

Quoted 2 lines
tests/functional/test_aarch64_aspeed.py +2 -0
+    ASSET_SDK_V906_AST2700 = Asset(
+

'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast 2700-a0-default-obmc.tar.gz',

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image): · line 35

Quoted 2 lines
tests/functional/test_aarch64_aspeed.py +2 -0
+
+

'7247b6f19dbfb700686f8d9f723ac23f3eb229226c0589cb9b06b80d1b61f3cb')

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image): · line 36

Quoted 3 lines
tests/functional/test_aarch64_aspeed.py +0 -2
-    ASSET_SDK_V905_AST2700A1 = Asset(
-

'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.05/ast 2700-default-obmc.tar.gz',

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image): · line 37

Quoted 1 line
tests/functional/test_aarch64_aspeed.py +0 -1
-

'c1f4496aec06743c812a6e9a1a18d032f34d62f3ddb6956e924fef62aa2046a5')

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image): · line 37

Quoted 2 lines
tests/functional/test_aarch64_aspeed.py +2 -0
+    ASSET_SDK_V906_AST2700A1 = Asset(
+

'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast 2700-default-obmc.tar.gz',

tests/functional/test_aarch64_aspeed.py def do_test_aarch64_aspeed_sdk_start(self, image): · line 39

Quoted 2 lines
tests/functional/test_aarch64_aspeed.py +2 -0
+
+

'f1d53e0be8a404ecce3e105f72bc50fa4e090ad13160ffa91b10a6e0233a9dc6')

Quoted 21 lines
tests/functional/test_aarch64_aspeed.py +3 -3
      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')
 
Quoted 9 lines

tests/functional/test_aarch64_aspeed.py def start_ast2700_test(self, name): · line 109

Quoted 5 lines
tests/functional/test_aarch64_aspeed.py +1 -1
-        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()

While at it, could you please update the SDK version for the tests in the other aspeed files too ?

Got it.
Will update them.
Thanks-Jamin

Quoted 8 lines
   tests/functional/test_aarch64_ast2700fc.py
   tests/functional/test_arm_aspeed_ast2500.py
   tests/functional/test_arm_aspeed_ast2600.py

Thanks,

C.

#27 lore raw

PATCH v4 9/10 tests/functional/aspeed: Add to test vbootrom for AST2700

In reply to Jamin Lin via

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.

---
 tests/functional/test_aarch64_aspeed.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
tests/functional/test_aarch64_aspeed.py +15 -0
index 337d701917..85789c1b1d 100755
@@ -94,6 +94,14 @@ 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 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'))
+        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')
 
@@ -108,5 +116,12 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self):
         self.start_ast2700_test('ast2700-default')
         self.do_ast2700_i2c_test()
 
+    def test_aarch64_ast2700a1_evb_sdk_vboottom_v09_06(self):
+        self.set_machine('ast2700a1-evb')
+
+        self.archive_extract(self.ASSET_SDK_V906_AST2700A1)
+        self.start_ast2700_test_vbootrom('ast2700-default')
+        self.do_ast2700_i2c_test()
+
 if __name__ == '__main__':
     QemuSystemTest.main()
Signature · 1 line
2.43.0
Reviewed-by on v4 9/10
#28 lore raw

Re: [PATCH v4 09/10] tests/functional/aspeed: Add to test vbootrom for AST2700

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

Quoted 39 lines
---
 tests/functional/test_aarch64_aspeed.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
tests/functional/test_aarch64_aspeed.py +15 -1
index 337d701917..85789c1b1d 100755
@@ -94,6 +94,14 @@ 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 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'))
+        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')
 
@@ -108,5 +116,12 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self):
         self.start_ast2700_test('ast2700-default')
         self.do_ast2700_i2c_test()
 
+    def test_aarch64_ast2700a1_evb_sdk_vboottom_v09_06(self):
+        self.set_machine('ast2700a1-evb')
+
+        self.archive_extract(self.ASSET_SDK_V906_AST2700A1)
+        self.start_ast2700_test_vbootrom('ast2700-default')
+        self.do_ast2700_i2c_test()
+
 if __name__ == '__main__':
     QemuSystemTest.main()
--

2.43.0

#29 lore raw

Re: [PATCH v4 09/10] tests/functional/aspeed: Add to test vbootrom for AST2700

In reply to Jamin Lin via
Quoted 30 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.

---
  tests/functional/test_aarch64_aspeed.py | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
tests/functional/test_aarch64_aspeed.py +8 -0
index 337d701917..85789c1b1d 100755
@@ -94,6 +94,14 @@ 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 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'))
+        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')
 

tests/functional/test_aarch64_aspeed.py def test_aarch64_ast2700a1_evb_sdk_v09_06(self): · line 119

Quoted 4 lines
tests/functional/test_aarch64_aspeed.py +1 -0
@@ -108,5 +116,12 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self):
          self.start_ast2700_test('ast2700-default')
          self.do_ast2700_i2c_test()
 
+    def test_aarch64_ast2700a1_evb_sdk_vboottom_v09_06(self):

vboottom -> vbootrom

tests/functional/test_aarch64_aspeed.py def test_aarch64_ast2700a1_evb_sdk_v09_06(self): · line 127

Quoted 8 lines
tests/functional/test_aarch64_aspeed.py +6 -0
+        self.set_machine('ast2700a1-evb')
+
+        self.archive_extract(self.ASSET_SDK_V906_AST2700A1)
+        self.start_ast2700_test_vbootrom('ast2700-default')
+        self.do_ast2700_i2c_test()
+
  if __name__ == '__main__':
      QemuSystemTest.main()

I think we should add some patterns to catch the vbootrom output. See below.

Thanks,

C.

_ ______ ____ ____ __________ ____ __ ___ ___ ______________ ______ ______

| |  / / __ )/ __ \/ __ \/_  __/ __ \/ __ \/  |/  /     /   | / ___/_  __/__ \/__  / |/ / __ \
| | / / __  / / / / / / / / / / /_/ / / / / /|_/ /_____/ /| | \__ \ / /  __/ /  / /|   / / / /
| |/ / /_/ / /_/ / /_/ / / / / _, _/ /_/ / /  / /_____/ ___ |___/ // /  / __/  / //   / /_/ /
|___/_____/\____/\____/ /_/ /_/ |_|\____/_/  /_/     /_/  |_/____//_/  /____/ /_//_/|_\____/

Version:1.0.0

Found valid FIT image at 0x100100000 (size: 0x15908b bytes) [uboot] load address: 0x80000000
[uboot] load end address: 0x800b39a0
[uboot] data: 735648 bytes @ offset 0x11c
[uboot] loading 735648 bytes to 0x400000000 ... done [fdt] load: property not found
[fdt] no load addr, fallback to u-boot end: 0x800b39a0 [fdt] data: 25752 bytes @ offset 0xb3b5c
[fdt] loading 25752 bytes to 0x4000b39a0 ... done [tee] load address: 0xb0080000
[tee] data: 433304 bytes @ offset 0xba070
[tee] loading 433304 bytes to 0x430080000 ... done [atf] load address: 0xb0000000
[atf] data: 28777 bytes @ offset 0x123da8
[atf] loading 28777 bytes to 0x430000000 ... done [sspfw] load address: 0xac000000
[sspfw] data: 67260 bytes @ offset 0x12aecc [sspfw] loading 67260 bytes to 0x42c000000 ... done [tspfw] load address: 0xae000000
[tspfw] data: 67392 bytes @ offset 0x13b630 [tspfw] loading 67392 bytes to 0x42e000000 ... done [ibexfw] load address: 0x14ba8000
[ibexfw] data: 52460 bytes @ offset 0x14be18 [ibexfw] loading 52460 bytes to 0x14ba8000 ... done

Jumping to BL31 (Trusted Firmware-A) at 0x430000000

#30 lore raw

RE: [PATCH v4 09/10] tests/functional/aspeed: Add to test vbootrom for AST2700

Hi Cedric,

Quoted 44 lines

Subject: Re: [PATCH v4 09/10] tests/functional/aspeed: Add to test vbootrom for AST2700

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

---
  tests/functional/test_aarch64_aspeed.py | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
tests/functional/test_aarch64_aspeed.py +9 -0
index 337d701917..85789c1b1d 100755
@@ -94,6 +94,14 @@ 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 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'))
+        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')

tests/functional/test_aarch64_aspeed.py def test_aarch64_ast2700a1_evb_sdk_v09_06(self): · line 119

Quoted 4 lines
tests/functional/test_aarch64_aspeed.py +1 -0
@@ -108,5 +116,12 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self):
          self.start_ast2700_test('ast2700-default')
          self.do_ast2700_i2c_test()
 
+    def test_aarch64_ast2700a1_evb_sdk_vboottom_v09_06(self):

vboottom -> vbootrom

Quoted 11 lines

tests/functional/test_aarch64_aspeed.py def test_aarch64_ast2700a1_evb_sdk_v09_06(self): · line 127

Quoted 8 lines
tests/functional/test_aarch64_aspeed.py +6 -0
+        self.set_machine('ast2700a1-evb')
+
+        self.archive_extract(self.ASSET_SDK_V906_AST2700A1)
+        self.start_ast2700_test_vbootrom('ast2700-default')
+        self.do_ast2700_i2c_test()
+
  if __name__ == '__main__':
      QemuSystemTest.main()

I think we should add some patterns to catch the vbootrom output. See below.

Thanks for your suggestion and review.
Will add
Thanks-Jamin

Quoted 37 lines

Thanks,

C.

_ ______ ____ ____ __________ ____ __ ___ ___
______________ ______ ______

| |  / / __ )/ __ \/ __ \/_  __/ __ \/ __ \/  |/  /     /   | / ___/_  __/__
\/__  / |/ / __ \
| | / / __  / / / / / / / / / / /_/ / / / / /|_/ /_____/ /| | \__ \ / /  __/ /  / /|
/ / / /
| |/ / /_/ / /_/ / /_/ / / / / _, _/ /_/ / /  / /_____/ ___ |___/ // /  / __/  / //
/ /_/ /
|___/_____/\____/\____/ /_/ /_/ |_|\____/_/  /_/     /_/  |_/____//_/
/____/ /_//_/|_\____/

Version:1.0.0

Found valid FIT image at 0x100100000 (size: 0x15908b bytes) [uboot] load
address: 0x80000000 [uboot] load end address: 0x800b39a0 [uboot] data:
735648 bytes @ offset 0x11c [uboot] loading 735648 bytes to 0x400000000 ... done [fdt] load: property not found [fdt] no load addr, fallback to u-boot end:
0x800b39a0 [fdt] data: 25752 bytes @ offset 0xb3b5c [fdt] loading 25752 bytes to 0x4000b39a0 ... done [tee] load address: 0xb0080000 [tee] data: 433304 bytes @ offset 0xba070 [tee] loading 433304 bytes to 0x430080000 ... done [atf] load address: 0xb0000000 [atf] data: 28777 bytes @ offset 0x123da8 [atf] loading 28777 bytes to 0x430000000 ... done [sspfw] load address: 0xac000000 [sspfw] data: 67260 bytes @ offset 0x12aecc [sspfw] loading 67260 bytes to 0x42c000000 ... done [tspfw] load address: 0xae000000 [tspfw] data: 67392 bytes @ offset 0x13b630 [tspfw] loading 67392 bytes to 0x42e000000 ... done [ibexfw] load address: 0x14ba8000 [ibexfw] data: 52460 bytes @ offset 0x14be18 [ibexfw] loading 52460 bytes to 0x14ba8000 ... done

Jumping to BL31 (Trusted Firmware-A) at 0x430000000

#31 lore raw

PATCH v4 10/10 docs/system/arm/aspeed: Support vbootrom for AST2700

In reply to Jamin Lin via

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.

---
 docs/system/arm/aspeed.rst | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
docs/system/arm/aspeed.rst +28 -1
index 97fd6a0e7f..c87a2cf796 100644
@@ -250,7 +250,14 @@ under Linux), use :
 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 +277,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
#32 lore raw

Re: [PATCH v4 10/10] docs/system/arm/aspeed: Support vbootrom for AST2700

Jamin,

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

---
  docs/system/arm/aspeed.rst | 29 ++++++++++++++++++++++++++++-
  1 file changed, 28 insertions(+), 1 deletion(-)
docs/system/arm/aspeed.rst +0 -0
index 97fd6a0e7f..c87a2cf796 100644

docs/system/arm/aspeed.rst under Linux), use : · line 251

Quoted 2 lines
docs/system/arm/aspeed.rst +0 -0
@@ -250,7 +250,14 @@ under Linux), use :
  Booting the ast2700-evb machine
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Currently, we have 2 sections for the Aspeed boards :

1. Aspeed family boards (ast2500-evb, ast2600-evb, ast2700-evb, ast2700fc, 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)
2. Aspeed minibmc family boards (ast1030-evb)

The first is quite big and relatively consistent for the AST2400, AST2500 and AST2600 SoCs. Since the AST2700 SoC boards boot differently, I think it is time to introduce a new section for the ast2700 machines.

Thanks,

C.

Quoted 39 lines
docs/system/arm/aspeed.rst +28 -1
-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 +277,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``)
  ==================================================================
 
#33 lore raw

RE: [PATCH v4 10/10] docs/system/arm/aspeed: Support vbootrom for AST2700

Hi Cedric,

Quoted 35 lines

Cc: Troy Lee <[email protected]>; [email protected]
Subject: Re: [PATCH v4 10/10] docs/system/arm/aspeed: Support vbootrom for AST2700

Jamin,

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

---
  docs/system/arm/aspeed.rst | 29 ++++++++++++++++++++++++++++-
  1 file changed, 28 insertions(+), 1 deletion(-)
docs/system/arm/aspeed.rst +0 -0
index 97fd6a0e7f..c87a2cf796 100644

docs/system/arm/aspeed.rst under Linux), use : · line 251

Quoted 2 lines
docs/system/arm/aspeed.rst +0 -0
@@ -250,7 +250,14 @@ under Linux), use :
  Booting the ast2700-evb machine
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Currently, we have 2 sections for the Aspeed boards :

1. Aspeed family boards (ast2500-evb, ast2600-evb, ast2700-evb, ast2700fc, 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) 2. Aspeed minibmc family boards (ast1030-evb)

Quoted 4 lines

The first is quite big and relatively consistent for the AST2400, AST2500 and AST2600 SoCs. Since the AST2700 SoC boards boot differently, I think it is time to introduce a new section for the ast2700 machines.

Thanks for review.
Will create a new section for the AST2700.
Jamin

Quoted 51 lines

Thanks,

C.

docs/system/arm/aspeed.rst under Linux), use :

Quoted 4 lines
docs/system/arm/aspeed.rst +3 -1
-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:

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image,

Quoted 9 lines
docs/system/arm/aspeed.rst +5 -0
+
+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 +277,26 @@ Boot the AST2700 machine from the flash image,

use an MTD drive :

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, use an MTD drive :

Quoted 8 lines
docs/system/arm/aspeed.rst +5 -0
         -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.

Quoted 7 lines
docs/system/arm/aspeed.rst +7 -0
+
+.. code-block:: bash
+
+  $ qemu-system-aarch64 -M ast2700-evb \
+      -drive file=image-bmc,format=raw,if=mtd \
+      -nographic
+

docs/system/arm/aspeed.rst Boot the AST2700 machine from the flash image, use an MTD drive : · line 302

Quoted 10 lines
docs/system/arm/aspeed.rst +8 -0
+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``)
 

================================================================
==

Quoted 1 line