Commit 4477c14482 for qemu.org

commit 4477c1448252fc33c978db30e96d1787ebd4df80
Author: Bin Meng <bin.meng@processmission.com>
Date:   Sun Aug 16 21:12:49 2026 +0800

    hw/arm: versatilepb: 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.

    Give both machine types the same VersatileMachineState instance struct
    and store the boot info there.

    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-20-bin.meng@processmission.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index c6991a52e6..520af79c80 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -182,10 +182,16 @@ static void vpb_sic_init(Object *obj)
    peripherals and expansion busses.  For now we emulate a subset of the
    PB peripherals and just change the board ID.  */

-static struct arm_boot_info versatile_binfo;
+typedef struct VersatileMachineState {
+    MachineState parent;
+
+    struct arm_boot_info bootinfo;
+} VersatileMachineState;

 static void versatile_init(MachineState *machine, int board_id)
 {
+    /* versatilepb and versatileab embed the same state as first member */
+    VersatileMachineState *vms = (VersatileMachineState *)machine;
     Object *cpuobj;
     ARMCPU *cpu;
     MemoryRegion *sysmem = get_system_memory();
@@ -397,9 +403,9 @@ static void versatile_init(MachineState *machine, int board_id)
                           VERSATILE_FLASH_SECT_SIZE,
                           4, 0x0089, 0x0018, 0x0000, 0x0, 0);

-    versatile_binfo.ram_size = machine->ram_size;
-    versatile_binfo.board_id = board_id;
-    arm_load_kernel(cpu, machine, &versatile_binfo);
+    vms->bootinfo.ram_size = machine->ram_size;
+    vms->bootinfo.board_id = board_id;
+    arm_load_kernel(cpu, machine, &vms->bootinfo);
 }

 static void vpb_init(MachineState *machine)
@@ -431,6 +437,7 @@ static const TypeInfo versatilepb_type = {
     .name = MACHINE_TYPE_NAME("versatilepb"),
     .parent = TYPE_MACHINE,
     .class_init = versatilepb_class_init,
+    .instance_size = sizeof(VersatileMachineState),
     .interfaces = arm_machine_interfaces,
 };

@@ -453,6 +460,7 @@ static const TypeInfo versatileab_type = {
     .name = MACHINE_TYPE_NAME("versatileab"),
     .parent = TYPE_MACHINE,
     .class_init = versatileab_class_init,
+    .instance_size = sizeof(VersatileMachineState),
     .interfaces = arm_machine_interfaces,
 };