@samitouri / QOSamiQemu / commits / 27d4e71757

hw/arm: integratorcp: 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 IntegratorcpMachineState 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-10-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 27d4e71757f2e08a1338541fc6e3dd55b55d4977
1 file changed +16 -6
hw/arm/integratorcp.c
+16 -6
@@ -581,13 +581,19 @@ static void icp_control_init(Object *obj)
581
582 /* Board init. */
583
584 -static struct arm_boot_info integrator_binfo = {
585 - .loader_start = 0x0,
586 - .board_id = 0x113,
584 +#define TYPE_INTEGRATORCP_MACHINE MACHINE_TYPE_NAME("integratorcp")
585 +OBJECT_DECLARE_SIMPLE_TYPE(IntegratorcpMachineState,
586 + INTEGRATORCP_MACHINE)
587 +
588 +struct IntegratorcpMachineState {
589 + MachineState parent;
590 +
591 + struct arm_boot_info bootinfo;
592 };
593
594 static void integratorcp_init(MachineState *machine)
595 {
596 + IntegratorcpMachineState *icms = INTEGRATORCP_MACHINE(machine);
597 ram_addr_t ram_size = machine->ram_size;
598 Object *cpuobj;
599 ARMCPU *cpu;
@@ -680,8 +686,10 @@ static void integratorcp_init(MachineState *machine)
686 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xc0000000);
687 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[22]);
688
683 - integrator_binfo.ram_size = ram_size;
684 - arm_load_kernel(cpu, machine, &integrator_binfo);
689 + icms->bootinfo.loader_start = 0x0;
690 + icms->bootinfo.board_id = 0x113;
691 + icms->bootinfo.ram_size = ram_size;
692 + arm_load_kernel(cpu, machine, &icms->bootinfo);
693 }
694
695 static void integratorcp_machine_init(MachineClass *mc)
@@ -696,7 +704,9 @@ static void integratorcp_machine_init(MachineClass *mc)
704 machine_add_audiodev_property(mc);
705 }
706
699 -DEFINE_MACHINE_ARM("integratorcp", integratorcp_machine_init)
707 +DEFINE_MACHINE_EXTENDED("integratorcp", MACHINE, IntegratorcpMachineState,
708 + integratorcp_machine_init, false,
709 + arm_machine_interfaces)
710
711 static const Property core_properties[] = {
712 DEFINE_PROP_UINT32("memsz", IntegratorCMState, memsz, 0),