Commit 27d4e71757 for qemu.org
commit 27d4e71757f2e08a1338541fc6e3dd55b55d4977
Author: Bin Meng <bin.meng@processmission.com>
Date: Sun Aug 16 21:12:39 2026 +0800
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>
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index c25bbf3c82..f8bcf42c61 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -581,13 +581,19 @@ static void icp_control_init(Object *obj)
/* Board init. */
-static struct arm_boot_info integrator_binfo = {
- .loader_start = 0x0,
- .board_id = 0x113,
+#define TYPE_INTEGRATORCP_MACHINE MACHINE_TYPE_NAME("integratorcp")
+OBJECT_DECLARE_SIMPLE_TYPE(IntegratorcpMachineState,
+ INTEGRATORCP_MACHINE)
+
+struct IntegratorcpMachineState {
+ MachineState parent;
+
+ struct arm_boot_info bootinfo;
};
static void integratorcp_init(MachineState *machine)
{
+ IntegratorcpMachineState *icms = INTEGRATORCP_MACHINE(machine);
ram_addr_t ram_size = machine->ram_size;
Object *cpuobj;
ARMCPU *cpu;
@@ -680,8 +686,10 @@ static void integratorcp_init(MachineState *machine)
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xc0000000);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[22]);
- integrator_binfo.ram_size = ram_size;
- arm_load_kernel(cpu, machine, &integrator_binfo);
+ icms->bootinfo.loader_start = 0x0;
+ icms->bootinfo.board_id = 0x113;
+ icms->bootinfo.ram_size = ram_size;
+ arm_load_kernel(cpu, machine, &icms->bootinfo);
}
static void integratorcp_machine_init(MachineClass *mc)
@@ -696,7 +704,9 @@ static void integratorcp_machine_init(MachineClass *mc)
machine_add_audiodev_property(mc);
}
-DEFINE_MACHINE_ARM("integratorcp", integratorcp_machine_init)
+DEFINE_MACHINE_EXTENDED("integratorcp", MACHINE, IntegratorcpMachineState,
+ integratorcp_machine_init, false,
+ arm_machine_interfaces)
static const Property core_properties[] = {
DEFINE_PROP_UINT32("memsz", IntegratorCMState, memsz, 0),