@samitouri / QOSamiQemu / commits / 4a421f0a7b

hw/arm: sabrelite: 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 SabreliteMachineState. 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-19-bin.meng@processmission.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Bin Meng committed Aug 16, 2026 at 21:12 UTC 4a421f0a7b9a6ee8221480fb026a2da9ebad3572
1 file changed +10 -12
hw/arm/sabrelite.c
+10 -12
@@ -25,18 +25,12 @@ struct SabreliteMachineState {
25
26 FslIMX6State soc;
27 CanBusState *canbus[FSL_IMX6_NUM_CANS];
28 + struct arm_boot_info bootinfo;
29 };
30
31 #define TYPE_SABRELITE_MACHINE MACHINE_TYPE_NAME("sabrelite")
32 OBJECT_DECLARE_SIMPLE_TYPE(SabreliteMachineState, SABRELITE_MACHINE)
33
33 -static struct arm_boot_info sabrelite_binfo = {
34 - /* DDR memory start */
35 - .loader_start = FSL_IMX6_MMDC_ADDR,
36 - /* No board ID, we boot from DT tree */
37 - .board_id = -1,
38 -};
39 -
34 /* No need to do any particular setup for secondary boot */
35 static void sabrelite_write_secondary(ARMCPU *cpu,
36 const struct arm_boot_info *info)
@@ -110,13 +104,17 @@ static void sabrelite_init(MachineState *machine)
104 }
105 }
106
113 - sabrelite_binfo.ram_size = machine->ram_size;
114 - sabrelite_binfo.secure_boot = true;
115 - sabrelite_binfo.write_secondary_boot = sabrelite_write_secondary;
116 - sabrelite_binfo.secondary_cpu_reset_hook = sabrelite_reset_secondary;
107 + /* DDR memory start */
108 + s->bootinfo.loader_start = FSL_IMX6_MMDC_ADDR;
109 + /* No board ID, we boot from DT tree */
110 + s->bootinfo.board_id = -1;
111 + s->bootinfo.ram_size = machine->ram_size;
112 + s->bootinfo.secure_boot = true;
113 + s->bootinfo.write_secondary_boot = sabrelite_write_secondary;
114 + s->bootinfo.secondary_cpu_reset_hook = sabrelite_reset_secondary;
115
116 if (!qtest_enabled()) {
119 - arm_load_kernel(&s->soc.cpu[0], machine, &sabrelite_binfo);
117 + arm_load_kernel(&s->soc.cpu[0], machine, &s->bootinfo);
118 }
119 }
120