@samitouri / QOSamiQemu / commits / b8e984eb90

hw/arm: musicpal: 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 it into a new MusicPalMachineState and register the machine type explicitly instead of through the DEFINE_MACHINE_ARM macro. 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> Message-id: 20260816131300.51799-13-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 b8e984eb90f02df57b0b82c464170b693226d565
1 file changed +15 -6
hw/arm/musicpal.c
+15 -6
@@ -1200,13 +1200,18 @@ static const TypeInfo musicpal_key_info = {
1200
1201 #define FLASH_SECTOR_SIZE (64 * KiB)
1202
1203 -static struct arm_boot_info musicpal_binfo = {
1204 - .loader_start = 0x0,
1205 - .board_id = 0x20e,
1203 +#define TYPE_MUSICPAL_MACHINE MACHINE_TYPE_NAME("musicpal")
1204 +OBJECT_DECLARE_SIMPLE_TYPE(MusicPalMachineState, MUSICPAL_MACHINE)
1205 +
1206 +struct MusicPalMachineState {
1207 + MachineState parent;
1208 +
1209 + struct arm_boot_info bootinfo;
1210 };
1211
1212 static void musicpal_init(MachineState *machine)
1213 {
1214 + MusicPalMachineState *mpms = MUSICPAL_MACHINE(machine);
1215 ARMCPU *cpu;
1216 DeviceState *dev;
1217 DeviceState *pic;
@@ -1341,8 +1346,10 @@ static void musicpal_init(MachineState *machine)
1346 sysbus_mmio_map(s, 0, MP_AUDIO_BASE);
1347 sysbus_connect_irq(s, 0, qdev_get_gpio_in(pic, MP_AUDIO_IRQ));
1348
1344 - musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE;
1345 - arm_load_kernel(cpu, machine, &musicpal_binfo);
1349 + mpms->bootinfo.loader_start = 0x0;
1350 + mpms->bootinfo.board_id = 0x20e;
1351 + mpms->bootinfo.ram_size = MP_RAM_DEFAULT_SIZE;
1352 + arm_load_kernel(cpu, machine, &mpms->bootinfo);
1353 }
1354
1355 static void musicpal_machine_init(MachineClass *mc)
@@ -1357,7 +1364,9 @@ static void musicpal_machine_init(MachineClass *mc)
1364 machine_add_audiodev_property(mc);
1365 }
1366
1360 -DEFINE_MACHINE_ARM("musicpal", musicpal_machine_init)
1367 +DEFINE_MACHINE_EXTENDED("musicpal", MACHINE, MusicPalMachineState,
1368 + musicpal_machine_init, false,
1369 + arm_machine_interfaces)
1370
1371 static void mv88w8618_wlan_class_init(ObjectClass *klass, const void *data)
1372 {