@samitouri / QOSamiQemu / commits / 7a0c61ad4e

hw/arm: aspeed: Store boot info in the machine state

arm_load_kernel() keeps a pointer to the boot info struct for the lifetime of the VM, so the struct logically belongs to the machine rather than to a file scoped static object. Move the boot info into the existing AspeedMachineState. As in the xlnx-zcu102 and raspi machines, the boot info belongs to the machine rather than to a static object: 4d1ac883a7 ("hw/arm: xlnx-zcu102: Move arm_boot_info into XlnxZCU102") 0f15c6e338 ("hw/arm/raspi: Move arm_boot_info structure to RaspiMachineState") Signed-off-by: Bin Meng <bin.meng@processmission.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Message-id: 20260816131300.51799-2-bin.meng@processmission.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Bin Meng committed Aug 16, 2026 at 21:12 UTC 7a0c61ad4ed53fe84e82283369728629ae9ea380
2 files changed +9 -10
hw/arm/aspeed.c
+7 -10
@@ -24,10 +24,6 @@
24 #include "hw/core/qdev-clock.h"
25 #include "system/system.h"
26
27 -static struct arm_boot_info aspeed_board_binfo = {
28 - .board_id = -1, /* device-tree-only board */
29 -};
30 -
27 #define AST_SMP_MAILBOX_BASE 0x1e6e2180
28 #define AST_SMP_MBOX_FIELD_ENTRY (AST_SMP_MAILBOX_BASE + 0x0)
29 #define AST_SMP_MBOX_FIELD_GOSIGN (AST_SMP_MAILBOX_BASE + 0x4)
@@ -206,13 +202,14 @@ static void aspeed_machine_init(MachineState *machine)
202 memory_region_add_subregion(get_system_memory(),
203 AST_SMP_MAILBOX_BASE, smpboot);
204
209 - aspeed_board_binfo.write_secondary_boot = aspeed_write_smpboot;
210 - aspeed_board_binfo.secondary_cpu_reset_hook = aspeed_reset_secondary;
211 - aspeed_board_binfo.smp_loader_start = AST_SMP_MBOX_CODE;
205 + bmc->bootinfo.write_secondary_boot = aspeed_write_smpboot;
206 + bmc->bootinfo.secondary_cpu_reset_hook = aspeed_reset_secondary;
207 + bmc->bootinfo.smp_loader_start = AST_SMP_MBOX_CODE;
208 }
209
214 - aspeed_board_binfo.ram_size = machine->ram_size;
215 - aspeed_board_binfo.loader_start = sc->memmap[ASPEED_DEV_SDRAM];
210 + bmc->bootinfo.board_id = -1; /* device-tree-only board */
211 + bmc->bootinfo.ram_size = machine->ram_size;
212 + bmc->bootinfo.loader_start = sc->memmap[ASPEED_DEV_SDRAM];
213
214 if (amc->i2c_init) {
215 amc->i2c_init(bmc);
@@ -248,7 +245,7 @@ static void aspeed_machine_init(MachineState *machine)
245 aspeed_load_vbootrom(bmc->soc, bios_name, &error_abort);
246 }
247
251 - arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo);
248 + arm_load_kernel(ARM_CPU(first_cpu), machine, &bmc->bootinfo);
249 }
250
251 void aspeed_create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
include/hw/arm/aspeed.h
+2
@@ -12,6 +12,7 @@
12 #include "hw/core/boards.h"
13 #include "qom/object.h"
14 #include "hw/arm/aspeed_soc.h"
15 +#include "hw/arm/boot.h"
16
17 typedef struct AspeedMachineState AspeedMachineState;
18
@@ -42,6 +43,7 @@ struct AspeedMachineState {
43 char *fmc_model;
44 char *spi_model;
45 uint32_t hw_strap1;
46 + struct arm_boot_info bootinfo;
47 };
48
49 struct AspeedMachineClass {