Skip to contentSkip to conversation

aspeed: pre-PR for QEMU 10.0 (RESEND)

PATCH In review Cédric Le Goater 3 participants 15 messages Jan 22, 2025 Arm/Aspeed machine support

lore
Share & tools
lore
#0 lore raw

cover aspeed: pre-PR for QEMU 10.0 (RESEND)

Hello,

Here are the changes I plan to send as a PR for QEMU 10.0, this week or the next. The last 3 patches still need a review. An Ack would be appreciated.

Thanks,

C.

Cédric Le Goater (3):
test/functional: Update the Aspeed aarch64 test test/functional: Update buildroot images to 2024.11
aspeed: Create sd devices only when defaults are enabled

Jamin Lin (5):
hw/sd/sdhci: Introduce a new Write Protected pin inverted property hw/arm/aspeed: Invert sdhci write protected pin for AST2600 EVB hw/timer/aspeed: Refactor Timer Callbacks for SoC-Specific
Implementations
hw/timer/aspeed: Add AST2700 Support
aspeed/soc: Support Timer for AST2700

Kenneth Jia (1):
hw/arm/aspeed: fix connect_serial_hds_to_uarts

 include/hw/arm/aspeed.h                     |   1 +
 include/hw/sd/sdhci.h                       |   5 +
 include/hw/timer/aspeed_timer.h             |   1 +
 hw/arm/aspeed.c                             |  15 +-
 hw/arm/aspeed_ast27x0.c                     |  17 ++
 hw/sd/sdhci.c                               |   6 +
 hw/timer/aspeed_timer.c                     | 263 ++++++++++++++++++--
 hw/timer/trace-events                       |   2 +-
 tests/functional/aspeed.py                  |   2 +-
 tests/functional/test_aarch64_aspeed.py     |   8 +-
 tests/functional/test_arm_aspeed_ast2500.py |   8 +-
 tests/functional/test_arm_aspeed_ast2600.py |   8 +-
 12 files changed, 303 insertions(+), 33 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/9 hw/arm/aspeed: fix connect_serial_hds_to_uarts

From: Kenneth Jia <[email protected]>

In the loop, we need ignore the index increase when uart == uart_chosen We should increase the index only after we allocate a serial.

Fixes d2b3eaefb4d7 ("aspeed: Refactor UART init for multi-SoC machines")
---
 hw/arm/aspeed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/aspeed.c +2 -2
index a18d4ed1fb10..2662465ada4f 100644
@@ -364,11 +364,11 @@ static void connect_serial_hds_to_uarts(AspeedMachineState *bmc)
     int uart_chosen = bmc->uart_chosen ? bmc->uart_chosen : amc->uart_default;
 
     aspeed_soc_uart_set_chr(s, uart_chosen, serial_hd(0));
-    for (int i = 1, uart = sc->uarts_base; i < sc->uarts_num; i++, uart++) {
+    for (int i = 1, uart = sc->uarts_base; i < sc->uarts_num; uart++) {
         if (uart == uart_chosen) {
             continue;
         }
-        aspeed_soc_uart_set_chr(s, uart, serial_hd(i));
+        aspeed_soc_uart_set_chr(s, uart, serial_hd(i++));
     }
 }
 
Signature · 1 line
2.48.1
#2 lore raw

PATCH 2/9 hw/sd/sdhci: Introduce a new Write Protected pin inverted property

In reply to Cédric Le Goater

From: Jamin Lin <[email protected]>

The Write Protect pin of SDHCI model is default active low to match the SDHCI spec. So, write enable the bit 19 should be 1 and write protected the bit 19 should be 0 at the Present State Register (0x24). However, some boards are design Write Protected pin active high. In other words, write enable the bit 19 should be 0 and write protected the bit 19 should be 1 at the Present State Register (0x24). To support it, introduces a new "wp-inverted" property and set it false by default.

---
 include/hw/sd/sdhci.h | 5 +++++
 hw/sd/sdhci.c         | 6 ++++++
 2 files changed, 11 insertions(+)
include/hw/sd/sdhci.h +5 -0
index 6cd2822f1d13..38c08e285980 100644
@@ -100,6 +100,11 @@ struct SDHCIState {
     uint8_t sd_spec_version;
     uint8_t uhs_mode;
     uint8_t vendor;        /* For vendor specific functionality */
+    /*
+     * Write Protect pin default active low for detecting SD card
+     * to be protected. Set wp_inverted to invert the signal.
+     */
+    bool wp_inverted;
 };
 typedef struct SDHCIState SDHCIState;
 
hw/sd/sdhci.c +6 -0
index 318587ff57ca..99dd4a4e9528 100644
@@ -274,6 +274,10 @@ static void sdhci_set_readonly(DeviceState *dev, bool level)
 {
     SDHCIState *s = (SDHCIState *)dev;
 
+    if (s->wp_inverted) {
+        level = !level;
+    }
+
     if (level) {
         s->prnsts &= ~SDHC_WRITE_PROTECT;
     } else {
@@ -1555,6 +1559,8 @@ static const Property sdhci_sysbus_properties[] = {
                      false),
     DEFINE_PROP_LINK("dma", SDHCIState,
                      dma_mr, TYPE_MEMORY_REGION, MemoryRegion *),
+    DEFINE_PROP_BOOL("wp-inverted", SDHCIState,
+                     wp_inverted, false),
 };
 
 static void sdhci_sysbus_init(Object *obj)
Signature · 1 line
2.48.1
#3 lore raw

PATCH 3/9 hw/arm/aspeed: Invert sdhci write protected pin for AST2600 EVB

In reply to Cédric Le Goater

From: Jamin Lin <[email protected]>

The Write Protect pin of SDHCI model is default active low to match the SDHCI spec. So, write enable the bit 19 should be 1 and write protected the bit 19 should be 0 at the Present State Register (0x24).

According to the design of AST2600 EVB, the Write Protected pin is active high by default. To support it, introduces a new "sdhci_wp_inverted" property in ASPEED MACHINE State and set it true for AST2600 EVB and set "wp_inverted" property true of sdhci-generic model.

---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 7 +++++++
 2 files changed, 8 insertions(+)
include/hw/arm/aspeed.h +1 -0
index cbeacb214ca4..9cae45a1c99c 100644
@@ -39,6 +39,7 @@ struct AspeedMachineClass {
     uint32_t macs_mask;
     void (*i2c_init)(AspeedMachineState *bmc);
     uint32_t uart_default;
+    bool sdhci_wp_inverted;
 };
 
 
hw/arm/aspeed.c +7 -0
index 2662465ada4f..53a859a6e4aa 100644
@@ -409,6 +409,12 @@ static void aspeed_machine_init(MachineState *machine)
                              OBJECT(get_system_memory()), &error_abort);
     object_property_set_link(OBJECT(bmc->soc), "dram",
                              OBJECT(machine->ram), &error_abort);
+    if (amc->sdhci_wp_inverted) {
+        for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
+            object_property_set_bool(OBJECT(&bmc->soc->sdhci.slots[i]),
+                                     "wp-inverted", true, &error_abort);
+        }
+    }
     if (machine->kernel_filename) {
         /*
          * When booting with a -kernel command line there is no u-boot
@@ -1415,6 +1421,7 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data)
     amc->num_cs    = 1;
     amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON | ASPEED_MAC2_ON |
                      ASPEED_MAC3_ON;
+    amc->sdhci_wp_inverted = true;
     amc->i2c_init  = ast2600_evb_i2c_init;
     mc->default_ram_size = 1 * GiB;
     aspeed_machine_class_init_cpus_defaults(mc);
Signature · 1 line
2.48.1
#4 lore raw

PATCH 4/9 hw/timer/aspeed: Refactor Timer Callbacks for SoC-Specific Implementations

In reply to Cédric Le Goater

From: Jamin Lin <[email protected]>

The register set have a significant change in AST2700. The TMC00-TMC3C are used for TIMER0 and TMC40-TMC7C are used for TIMER1. In additional, TMC20-TMC3C and TMC60-TMC7C are reserved registers for TIMER0 and TIMER1, respectively.

Besides, each TIMER has their own control and interrupt status register. In other words, users are able to set control and interrupt status for TIMER0 in one register. Both aspeed_timer_read and aspeed_timer_write callback functions are not compatible AST2700.

Introduce common read and write functions for ASPEED timers. Modify the aspeed_timer_read and aspeed_timer_write functions to delegate to SoC-specific callbacks first.
Update the AST2400, AST2500, AST2600 and AST1030 specific read and write functions to call the common implementations for common register accesses.

This refactoring improves the organization of call delegation and prepares the codebase for future SoC-specific specializations, such as the AST2700.

---
 hw/timer/aspeed_timer.c | 55 ++++++++++++++++++++++++++++++-----------
 hw/timer/trace-events   |  2 +-
 2 files changed, 41 insertions(+), 16 deletions(-)
hw/timer/aspeed_timer.c +40 -15
index 4868651ad489..24ba40cbe9b4 100644
@@ -239,9 +239,8 @@ static uint64_t aspeed_timer_get_value(AspeedTimer *t, int reg)
     return value;
 }
 
-static uint64_t aspeed_timer_read(void *opaque, hwaddr offset, unsigned size)
+static uint64_t aspeed_timer_read_common(AspeedTimerCtrlState *s, hwaddr offset)
 {
-    AspeedTimerCtrlState *s = opaque;
     const int reg = (offset & 0xf) / 4;
     uint64_t value;
 
@@ -256,10 +255,11 @@ static uint64_t aspeed_timer_read(void *opaque, hwaddr offset, unsigned size)
         value = aspeed_timer_get_value(&s->timers[(offset >> 4) - 1], reg);
         break;
     default:
-        value = ASPEED_TIMER_GET_CLASS(s)->read(s, offset);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
+                      __func__, offset);
+        value = 0;
         break;
     }
-    trace_aspeed_timer_read(offset, size, value);
     return value;
 }
 
@@ -431,12 +431,11 @@ static void aspeed_timer_set_ctrl2(AspeedTimerCtrlState *s, uint32_t value)
     trace_aspeed_timer_set_ctrl2(value);
 }
 
-static void aspeed_timer_write(void *opaque, hwaddr offset, uint64_t value,
-                               unsigned size)
+static void aspeed_timer_write_common(AspeedTimerCtrlState *s, hwaddr offset,
+                                      uint64_t value)
 {
     const uint32_t tv = (uint32_t)(value & 0xFFFFFFFF);
     const int reg = (offset & 0xf) / 4;
-    AspeedTimerCtrlState *s = opaque;
 
     switch (offset) {
     /* Control Registers */
@@ -451,11 +450,25 @@ static void aspeed_timer_write(void *opaque, hwaddr offset, uint64_t value,
         aspeed_timer_set_value(s, (offset >> TIMER_NR_REGS) - 1, reg, tv);
         break;
     default:
-        ASPEED_TIMER_GET_CLASS(s)->write(s, offset, value);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
+                      __func__, offset);
         break;
     }
 }
 
+static uint64_t aspeed_timer_read(void *opaque, hwaddr offset, unsigned size)
+{
+    AspeedTimerCtrlState *s = ASPEED_TIMER(opaque);
+    return ASPEED_TIMER_GET_CLASS(s)->read(s, offset);
+}
+
+static void aspeed_timer_write(void *opaque, hwaddr offset, uint64_t value,
+                               unsigned size)
+{
+    AspeedTimerCtrlState *s = ASPEED_TIMER(opaque);
+    ASPEED_TIMER_GET_CLASS(s)->write(s, offset, value);
+}
+
 static const MemoryRegionOps aspeed_timer_ops = {
     .read = aspeed_timer_read,
     .write = aspeed_timer_write,
@@ -475,12 +488,15 @@ static uint64_t aspeed_2400_timer_read(AspeedTimerCtrlState *s, hwaddr offset)
         break;
     case 0x38:
     case 0x3C:
-    default:
         qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
                 __func__, offset);
         value = 0;
         break;
+    default:
+        value = aspeed_timer_read_common(s, offset);
+        break;
     }
+    trace_aspeed_timer_read(offset, value);
     return value;
 }
 
@@ -495,10 +511,12 @@ static void aspeed_2400_timer_write(AspeedTimerCtrlState *s, hwaddr offset,
         break;
     case 0x38:
     case 0x3C:
-    default:
         qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
                 __func__, offset);
         break;
+    default:
+        aspeed_timer_write_common(s, offset, value);
+        break;
     }
 }
 
@@ -514,12 +532,15 @@ static uint64_t aspeed_2500_timer_read(AspeedTimerCtrlState *s, hwaddr offset)
         value = s->ctrl3 & BIT(0);
         break;
     case 0x3C:
-    default:
         qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
                 __func__, offset);
         value = 0;
         break;
+    default:
+        value = aspeed_timer_read_common(s, offset);
+        break;
     }
+    trace_aspeed_timer_read(offset, value);
     return value;
 }
 
@@ -548,8 +569,7 @@ static void aspeed_2500_timer_write(AspeedTimerCtrlState *s, hwaddr offset,
         break;
 
     default:
-        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
-                __func__, offset);
+        aspeed_timer_write_common(s, offset, value);
         break;
     }
 }
@@ -564,12 +584,15 @@ static uint64_t aspeed_2600_timer_read(AspeedTimerCtrlState *s, hwaddr offset)
         break;
     case 0x38:
     case 0x3C:
-    default:
         qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
                 __func__, offset);
         value = 0;
         break;
+    default:
+        value = aspeed_timer_read_common(s, offset);
+        break;
     }
+    trace_aspeed_timer_read(offset, value);
     return value;
 }
 
@@ -586,10 +609,12 @@ static void aspeed_2600_timer_write(AspeedTimerCtrlState *s, hwaddr offset,
         aspeed_timer_set_ctrl(s, s->ctrl & ~tv);
         break;
     case 0x38:
-    default:
         qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
                 __func__, offset);
         break;
+    default:
+        aspeed_timer_write_common(s, offset, value);
+        break;
     }
 }
 
hw/timer/trace-events +1 -1
index 5cfc369fba46..c5b6db49f587 100644
@@ -31,7 +31,7 @@ aspeed_timer_ctrl_overflow_interrupt(uint8_t i, bool enable) "Timer %" PRIu8 ":
 aspeed_timer_ctrl_pulse_enable(uint8_t i, bool enable) "Timer %" PRIu8 ": %d"
 aspeed_timer_set_ctrl2(uint32_t value) "Value: 0x%" PRIx32
 aspeed_timer_set_value(int timer, int reg, uint32_t value) "Timer %d register %d: 0x%" PRIx32
-aspeed_timer_read(uint64_t offset, unsigned size, uint64_t value) "From 0x%" PRIx64 ": of size %u: 0x%" PRIx64
+aspeed_timer_read(uint64_t offset, uint64_t value) "From 0x%" PRIx64 ": 0x%" PRIx64
 
 # armv7m_systick.c
 systick_reload(void) "systick reload"
Signature · 1 line
2.48.1
#5 lore raw

PATCH 5/9 hw/timer/aspeed: Add AST2700 Support

In reply to Cédric Le Goater

From: Jamin Lin <[email protected]>

The timer controller include 8 sets of 32-bit decrement counters, based on either PCLK or 1MHZ clock and the design of timer controller between AST2600 and AST2700 are almost the same.

TIMER0 – TIMER7 has their own individual control and interrupt status register. In other words, users are able to set timer control in register TMC10 with different TIMER base address and clear timer control and interrupt status in register TMC14 with different TIMER base address.

Introduce new "aspeed_2700_timer_read" and "aspeed_2700_timer_write" callback functions and a new ast2700 class to support AST2700.

The base address of TIMER0 to TIMER7 as following. Base Address of Timer 0 = 0x12C1_0000
Base Address of Timer 1 = 0x12C1_0040
Base Address of Timer 2 = 0x12C1_0080
Base Address of Timer 3 = 0x12C1_00C0
Base Address of Timer 4 = 0x12C1_0100
Base Address of Timer 5 = 0x12C1_0140
Base Address of Timer 6 = 0x12C1_0180
Base Address of Timer 7 = 0x12C1_01C0

The register address space of each TIMER is "0x40" , and uses the following formula to get the index and register of each TIMER.

timer_index = offset >> 6;
timer_offset = offset & 0x3f;

The TMC010 is a counter control set and interrupt status register. Write "1" to TMC10[3:0] will set the specific bits to "1". Introduce a new "aspeed_2700_timer_set_ctrl" function to handle this register behavior.

The TMC014 is a counter control clear and interrupt status register, to clear the specific bits to "0", it should write "1" to TMC14[3:0] on the same bit position. Introduce a new "aspeed_2700_timer_clear_ctrl" function to handle this register behavior. TMC014 does not support read operation.

---
 include/hw/timer/aspeed_timer.h |   1 +
 hw/timer/aspeed_timer.c         | 208 ++++++++++++++++++++++++++++++++
 2 files changed, 209 insertions(+)
include/hw/timer/aspeed_timer.h +1 -0
index 07dc6b6f2cbd..767cae4b05ba 100644
@@ -32,6 +32,7 @@ OBJECT_DECLARE_TYPE(AspeedTimerCtrlState, AspeedTimerClass, ASPEED_TIMER)
 #define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500"
 #define TYPE_ASPEED_2600_TIMER TYPE_ASPEED_TIMER "-ast2600"
 #define TYPE_ASPEED_1030_TIMER TYPE_ASPEED_TIMER "-ast1030"
+#define TYPE_ASPEED_2700_TIMER TYPE_ASPEED_TIMER "-ast2700"
 
 #define ASPEED_TIMER_NR_TIMERS 8
 
hw/timer/aspeed_timer.c +208 -0

226 lines not on this page · raw message

Signature · 1 line
2.48.1
#6 lore raw

PATCH 6/9 aspeed/soc: Support Timer for AST2700

In reply to Cédric Le Goater

From: Jamin Lin <[email protected]>

Add Timer model for AST2700 Timer support. The Timer controller include 8 sets of 32-bit decrement counters.

The base address of TIMER0 to TIMER7 as following. Base Address of Timer 0 = 0x12C1_0000
Base Address of Timer 1 = 0x12C1_0040
Base Address of Timer 2 = 0x12C1_0080
Base Address of Timer 3 = 0x12C1_00C0
Base Address of Timer 4 = 0x12C1_0100
Base Address of Timer 5 = 0x12C1_0140
Base Address of Timer 6 = 0x12C1_0180
Base Address of Timer 7 = 0x12C1_01C0

The interrupt of TIMER0 to TIMER7 as following.
GICINT16 = TIMER 0 interrupt
GICINT17 = TIMER 1 interrupt
GICINT18 = TIMER 2 interrupt
GICINT19 = TIMER 3 interrupt
GICINT20 = TIMER 4 interrupt
GICINT21 = TIMER 5 interrupt
GICINT22 = TIMER 6 interrupt
GICINT23 = TIMER 7 interrupt

---
 hw/arm/aspeed_ast27x0.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
hw/arm/aspeed_ast27x0.c +17 -0
index fee37558372a..4114e15dddf4 100644
@@ -66,6 +66,7 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_GPIO]      =  0x14C0B000,
     [ASPEED_DEV_RTC]       =  0x12C0F000,
     [ASPEED_DEV_SDHCI]     =  0x14080000,
+    [ASPEED_DEV_TIMER1]    =  0x12C10000,
 };
 
 #define AST2700_MAX_IRQ 256
@@ -397,6 +398,9 @@ static void aspeed_soc_ast2700_init(Object *obj)
 
     object_initialize_child(obj, "emmc-controller.sdhci", &s->emmc.slots[0],
                             TYPE_SYSBUS_SDHCI);
+
+    snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname);
+    object_initialize_child(obj, "timerctrl", &s->timerctrl, typename);
 }
 
 /*
@@ -716,6 +720,19 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc), 0,
                        aspeed_soc_get_irq(s, ASPEED_DEV_EMMC));
 
+    /* Timer */
+    object_property_set_link(OBJECT(&s->timerctrl), "scu", OBJECT(&s->scu),
+                             &error_abort);
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->timerctrl), errp)) {
+        return;
+    }
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->timerctrl), 0,
+                    sc->memmap[ASPEED_DEV_TIMER1]);
+    for (i = 0; i < ASPEED_TIMER_NR_TIMERS; i++) {
+        irq = aspeed_soc_get_irq(s, ASPEED_DEV_TIMER1 + i);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq);
+    }
+
     create_unimplemented_device("ast2700.dpmcu", 0x11000000, 0x40000);
     create_unimplemented_device("ast2700.iomem0", 0x12000000, 0x01000000);
     create_unimplemented_device("ast2700.iomem1", 0x14000000, 0x01000000);
Signature · 1 line
2.48.1
#7 lore raw

PATCH 7/9 test/functional: Update the Aspeed aarch64 test

In reply to Cédric Le Goater

Bumped SDK version to v09.03. v09.04 is available but not yet supported in QEMU.

---
 tests/functional/test_aarch64_aspeed.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/test_aarch64_aspeed.py +4 -4
index 141d86385936..6a9ae2a34956 100755
@@ -27,14 +27,14 @@ 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_V902_AST2700 = Asset(
-            'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.02/ast2700-default-obmc.tar.gz',
-            'ac969c2602f4e6bdb69562ff466b89ae3fe1d86e1f6797bb7969d787f82116a7')
+    ASSET_SDK_V903_AST2700 = Asset(
+            'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.03/ast2700-default-obmc.tar.gz',
+            '91225f50d255e2905ba8d8e0c80b71b9d157c3609770c7a740cd786370d85a77')
 
     def test_aarch64_ast2700_evb_sdk_v09_02(self):
         self.set_machine('ast2700-evb')
 
-        self.archive_extract(self.ASSET_SDK_V902_AST2700)
+        self.archive_extract(self.ASSET_SDK_V903_AST2700)
 
         num_cpu = 4
         uboot_size = os.path.getsize(self.scratch_file('ast2700-default',
Signature · 1 line
2.48.1
Reviewed-by on v1 7/9
#8 lore raw

RE: [PATCH 7/9] test/functional: Update the Aspeed aarch64 test

Hi Cedric,

Quoted 41 lines

From: Cédric Le Goater <[email protected]>
Sent: Wednesday, January 22, 2025 3:09 PM
To: [email protected]; [email protected]
Cc: Joel Stanley <[email protected]>; Andrew Jeffery <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Steven Lee <[email protected]>; Cédric Le Goater <[email protected]>
Subject: [PATCH 7/9] test/functional: Update the Aspeed aarch64 test

Bumped SDK version to v09.03. v09.04 is available but not yet supported in QEMU.

---
 tests/functional/test_aarch64_aspeed.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/test_aarch64_aspeed.py +0 -2
index 141d86385936..6a9ae2a34956 100755
@@ -27,14 +27,14 @@ 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_V902_AST2700 = Asset(
-

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

tests/functional/test_aarch64_aspeed.py +2 -0
+    ASSET_SDK_V903_AST2700 = Asset(
+

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

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

'91225f50d255e2905ba8d8e0c80b71b9d157c3609770c7a740cd786370d85a77' )

Quoted 1 line
     def test_aarch64_ast2700_evb_sdk_v09_02(self):

Do we need to change v09_03?

Others looks good to me.

Thanks

Quoted 9 lines
         self.set_machine('ast2700-evb')
tests/functional/test_aarch64_aspeed.py +1 -2
-        self.archive_extract(self.ASSET_SDK_V902_AST2700)
+        self.archive_extract(self.ASSET_SDK_V903_AST2700)
 
         num_cpu = 4
         uboot_size = os.path.getsize(self.scratch_file('ast2700-default',
--

2.48.1

#9 lore raw

Re: [PATCH 7/9] test/functional: Update the Aspeed aarch64 test

Quoted 43 lines · Jamin Lin

Hi Cedric,

Quoted 41 lines

From: Cédric Le Goater <[email protected]>
Sent: Wednesday, January 22, 2025 3:09 PM
To: [email protected]; [email protected]
Cc: Joel Stanley <[email protected]>; Andrew Jeffery <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Steven Lee <[email protected]>; Cédric Le Goater <[email protected]>
Subject: [PATCH 7/9] test/functional: Update the Aspeed aarch64 test

Bumped SDK version to v09.03. v09.04 is available but not yet supported in QEMU.

---
  tests/functional/test_aarch64_aspeed.py | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/test_aarch64_aspeed.py +0 -2
index 141d86385936..6a9ae2a34956 100755
@@ -27,14 +27,14 @@ 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_V902_AST2700 = Asset(
-

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

tests/functional/test_aarch64_aspeed.py +2 -0
+    ASSET_SDK_V903_AST2700 = Asset(
+

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

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

'91225f50d255e2905ba8d8e0c80b71b9d157c3609770c7a740cd786370d85a77' )

Quoted 2 lines
Quoted 1 line
      def test_aarch64_ast2700_evb_sdk_v09_02(self):

Do we need to change v09_03?

Indeed ! Will fix.

Quoted 4 lines

Others looks good to me.

Thanks,

C.

#10 lore raw

PATCH 8/9 test/functional: Update buildroot images to 2024.11

In reply to Cédric Le Goater

The main changes compared to upstream 2024.11 buildroot are

- bumped Linux to version 6.11.11 with a custom config
- changed U-Boot to OpenBMC branch for more support
- included extra target packages

See branch [1] for more details.

There is a slight output change when powering off the machine, the console now contains :

reboot: Power off not available: System halted

Adjust accordingly the expect string in
do_test_arm_aspeed_buildroot_poweroff().

[1] https://github.com/legoater/buildroot/commits/aspeed-2024.11

---
 tests/functional/aspeed.py                  | 2 +-
 tests/functional/test_arm_aspeed_ast2500.py | 8 ++++----
 tests/functional/test_arm_aspeed_ast2600.py | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)
tests/functional/aspeed.py +1 -1
index 62f50bab7a33..b52358bb8c61 100644
@@ -42,7 +42,7 @@ def do_test_arm_aspeed_buildroot_start(self, image, cpu_id, pattern='Aspeed EVB'
 
     def do_test_arm_aspeed_buildroot_poweroff(self):
         exec_command_and_wait_for_pattern(self, 'poweroff',
-                                          'reboot: System halted');
+                                          'System halted');
 
     def do_test_arm_aspeed_sdk_start(self, image):
         self.require_netdev('user')
tests/functional/test_arm_aspeed_ast2500.py +4 -4
index 743fc46eb29e..1ffba6c9953d 100755
@@ -11,15 +11,15 @@
 
 class AST2500Machine(AspeedTest):
 
-    ASSET_BR2_202311_AST2500_FLASH = Asset(
+    ASSET_BR2_202411_AST2500_FLASH = Asset(
         ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
-         'images/ast2500-evb/buildroot-2023.11/flash.img'),
-        'c23db6160cf77d0258397eb2051162c8473a56c441417c52a91ba217186e715f')
+         'images/ast2500-evb/buildroot-2024.11/flash.img'),
+        '641e6906c18c0f19a2aeb48099d66d4771929c361001d554d0d45c667413e13a')
 
     def test_arm_ast2500_evb_buildroot(self):
         self.set_machine('ast2500-evb')
 
-        image_path = self.ASSET_BR2_202311_AST2500_FLASH.fetch()
+        image_path = self.ASSET_BR2_202411_AST2500_FLASH.fetch()
 
         self.vm.add_args('-device',
                          'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
tests/functional/test_arm_aspeed_ast2600.py +4 -4
index 21640123ee81..6ae4ed636ac3 100755
@@ -16,15 +16,15 @@
 
 class AST2600Machine(AspeedTest):
 
-    ASSET_BR2_202311_AST2600_FLASH = Asset(
+    ASSET_BR2_202411_AST2600_FLASH = Asset(
         ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
-         'images/ast2600-evb/buildroot-2023.11/flash.img'),
-        'b62808daef48b438d0728ee07662290490ecfa65987bb91294cafb1bb7ad1a68')
+         'images/ast2600-evb/buildroot-2024.11/flash.img'),
+        '4bb2f3dfdea31199b51d66b42f686dc5374c144a7346fdc650194a5578b73609')
 
     def test_arm_ast2600_evb_buildroot(self):
         self.set_machine('ast2600-evb')
 
-        image_path = self.ASSET_BR2_202311_AST2600_FLASH.fetch()
+        image_path = self.ASSET_BR2_202411_AST2600_FLASH.fetch()
 
         self.vm.add_args('-device',
                          'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
Signature · 1 line
2.48.1
Reviewed-by on v1 8/9
#11 lore raw

RE: [PATCH 8/9] test/functional: Update buildroot images to 2024.11

Quoted 108 lines

From: Cédric Le Goater <[email protected]>
Sent: Wednesday, January 22, 2025 3:09 PM
To: [email protected]; [email protected]
Cc: Joel Stanley <[email protected]>; Andrew Jeffery <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Steven Lee <[email protected]>; Cédric Le Goater <[email protected]>
Subject: [PATCH 8/9] test/functional: Update buildroot images to 2024.11

The main changes compared to upstream 2024.11 buildroot are

- bumped Linux to version 6.11.11 with a custom config
- changed U-Boot to OpenBMC branch for more support
- included extra target packages

See branch [1] for more details.

There is a slight output change when powering off the machine, the console now contains :

reboot: Power off not available: System halted

Adjust accordingly the expect string in
do_test_arm_aspeed_buildroot_poweroff().

[1] https://github.com/legoater/buildroot/commits/aspeed-2024.11

---
 tests/functional/aspeed.py                  | 2 +-
 tests/functional/test_arm_aspeed_ast2500.py | 8 ++++----
tests/functional/test_arm_aspeed_ast2600.py | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)
tests/functional/aspeed.py index renamed from tests/functional/aspeed.py +0 -0

62f50bab7a33..b52358bb8c61 100644

tests/functional/aspeed.py +0 -0
@@ -42,7 +42,7 @@ def do_test_arm_aspeed_buildroot_start(self, image,

cpu_id, pattern='Aspeed EVB'

def do_test_arm_aspeed_buildroot_poweroff(self):
exec_command_and_wait_for_pattern(self, 'poweroff',

tests/functional/aspeed.py +1 -1
-                                          'reboot: System halted');
+                                          'System halted');
 
     def do_test_arm_aspeed_sdk_start(self, image):
         self.require_netdev('user')
tests/functional/test_arm_aspeed_ast2500.py +1 -3
index 743fc46eb29e..1ffba6c9953d 100755
@@ -11,15 +11,15 @@
 
 class AST2500Machine(AspeedTest):
 
-    ASSET_BR2_202311_AST2500_FLASH = Asset(
+    ASSET_BR2_202411_AST2500_FLASH = Asset(
         ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
-         'images/ast2500-evb/buildroot-2023.11/flash.img'),
-

'c23db6160cf77d0258397eb2051162c8473a56c441417c52a91ba217186e715f' )

tests/functional/test_arm_aspeed_ast2500.py +3 -0
+         'images/ast2500-evb/buildroot-2024.11/flash.img'),
+
+

'641e6906c18c0f19a2aeb48099d66d4771929c361001d554d0d45c667413e13a' )

     def test_arm_ast2500_evb_buildroot(self):
         self.set_machine('ast2500-evb')
tests/functional/test_arm_aspeed_ast2500.py +1 -1
-        image_path = self.ASSET_BR2_202311_AST2500_FLASH.fetch()
+        image_path = self.ASSET_BR2_202411_AST2500_FLASH.fetch()
 
         self.vm.add_args('-device',

'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');

tests/functional/test_arm_aspeed_ast2600.py +1 -3
index 21640123ee81..6ae4ed636ac3 100755
@@ -16,15 +16,15 @@
 
 class AST2600Machine(AspeedTest):
 
-    ASSET_BR2_202311_AST2600_FLASH = Asset(
+    ASSET_BR2_202411_AST2600_FLASH = Asset(
         ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
-         'images/ast2600-evb/buildroot-2023.11/flash.img'),
-

'b62808daef48b438d0728ee07662290490ecfa65987bb91294cafb1bb7ad1a68' )

tests/functional/test_arm_aspeed_ast2600.py +3 -0
+         'images/ast2600-evb/buildroot-2024.11/flash.img'),
+
+

'4bb2f3dfdea31199b51d66b42f686dc5374c144a7346fdc650194a5578b73609')

     def test_arm_ast2600_evb_buildroot(self):
         self.set_machine('ast2600-evb')
tests/functional/test_arm_aspeed_ast2600.py +1 -1
-        image_path = self.ASSET_BR2_202311_AST2600_FLASH.fetch()
+        image_path = self.ASSET_BR2_202411_AST2600_FLASH.fetch()
 
         self.vm.add_args('-device',
Quoted 3 lines

'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test'); --
2.48.1

Thanks

#12 lore raw

PATCH 9/9 aspeed: Create sd devices only when defaults are enabled

In reply to Cédric Le Goater

When the -nodefaults option is set, sd devices should not be automatically created by the machine. Instead they should be defined on the command line.

Note that it is not currently possible to define which bus an "sd-card" device is attached to:

  -blockdev node-name=drive0,driver=file,filename=/path/to/file.img \
  -device sd-card,drive=drive0,id=sd0

and the first bus named "sd-bus" will be used.

---
 hw/arm/aspeed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/aspeed.c +2 -2
index 53a859a6e4aa..d9418e2b9f2c 100644
@@ -456,14 +456,14 @@ static void aspeed_machine_init(MachineState *machine)
         amc->i2c_init(bmc);
     }
 
-    for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
+    for (i = 0; i < bmc->soc->sdhci.num_slots && defaults_enabled(); i++) {
         sdhci_attach_drive(&bmc->soc->sdhci.slots[i],
                            drive_get(IF_SD, 0, i), false, false);
     }
 
     boot_emmc = sc->boot_from_emmc(bmc->soc);
 
-    if (bmc->soc->emmc.num_slots) {
+    if (bmc->soc->emmc.num_slots && defaults_enabled()) {
         emmc0 = drive_get(IF_SD, 0, bmc->soc->sdhci.num_slots);
         sdhci_attach_drive(&bmc->soc->emmc.slots[0], emmc0, true, boot_emmc);
     }
Signature · 1 line
2.48.1
Reviewed-by on v1 9/9
#13 lore raw

RE: [PATCH 9/9] aspeed: Create sd devices only when defaults are enabled

Quoted 50 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Wednesday, January 22, 2025 3:09 PM
To: [email protected]; [email protected]
Cc: Joel Stanley <[email protected]>; Andrew Jeffery <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Steven Lee <[email protected]>; Cédric Le Goater <[email protected]>
Subject: [PATCH 9/9] aspeed: Create sd devices only when defaults are enabled

When the -nodefaults option is set, sd devices should not be automatically created by the machine. Instead they should be defined on the command line.

Note that it is not currently possible to define which bus an "sd-card" device is attached to:

  -blockdev node-name=drive0,driver=file,filename=/path/to/file.img \
  -device sd-card,drive=drive0,id=sd0

and the first bus named "sd-bus" will be used.

---
 hw/arm/aspeed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0 -0

53a859a6e4aa..d9418e2b9f2c 100644

hw/arm/aspeed.c +3 -2
@@ -456,14 +456,14 @@ static void aspeed_machine_init(MachineState
 *machine)
         amc->i2c_init(bmc);
     }
 
-    for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
+    for (i = 0; i < bmc->soc->sdhci.num_slots && defaults_enabled();
+ i++) {
         sdhci_attach_drive(&bmc->soc->sdhci.slots[i],
                            drive_get(IF_SD, 0, i), false, false);
     }
 
     boot_emmc = sc->boot_from_emmc(bmc->soc);
 
-    if (bmc->soc->emmc.num_slots) {
+    if (bmc->soc->emmc.num_slots && defaults_enabled()) {
         emmc0 = drive_get(IF_SD, 0, bmc->soc->sdhci.num_slots);
         sdhci_attach_drive(&bmc->soc->emmc.slots[0], emmc0, true,
boot_emmc);
     }
Quoted 2 lines

--
2.48.1

Thanks

Acked-by on v1 9/9
#14 lore raw

Re: [PATCH 9/9] aspeed: Create sd devices only when defaults are enabled

In reply to Cédric Le Goater
Quoted 10 lines · Cédric Le Goater

When the -nodefaults option is set, sd devices should not be automatically created by the machine. Instead they should be defined on the command line.

Note that it is not currently possible to define which bus an "sd-card" device is attached to:

   -blockdev node-name=drive0,driver=file,filename=/path/to/file.img \
   -device sd-card,drive=drive0,id=sd0
Quoted 6 lines

and the first bus named "sd-bus" will be used.

---
  hw/arm/aspeed.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

For SDHCI: