Commit 53fad63eeb for qemu.org
commit 53fad63eeb954200b667255b87e6d74b52720863
Author: Bin Meng <bin.meng@processmission.com>
Date: Sun Aug 16 21:12:45 2026 +0800
hw/arm: omap_sx1: 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 the sx1 and sx1-v1 machine types the same Sx1MachineState
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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-id: 20260816131300.51799-16-bin.meng@processmission.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index bcb7105323..3b628d13cb 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -91,14 +91,16 @@ static const MemoryRegionOps static_ops = {
#define FLASH1_SIZE (8 * MiB)
#define FLASH2_SIZE (32 * MiB)
-static struct arm_boot_info sx1_binfo = {
- .loader_start = OMAP_EMIFF_BASE,
- .ram_size = SDRAM_SIZE,
- .board_id = 0x265,
-};
+typedef struct Sx1MachineState {
+ MachineState parent;
+
+ struct arm_boot_info bootinfo;
+} Sx1MachineState;
static void sx1_init(MachineState *machine, const int version)
{
+ /* Both sx1 and sx1-v1 embed the same state as their first member */
+ Sx1MachineState *sms = (Sx1MachineState *)machine;
struct omap_mpu_state_s *mpu;
MachineClass *mc = MACHINE_GET_CLASS(machine);
MemoryRegion *address_space = get_system_memory();
@@ -187,7 +189,10 @@ static void sx1_init(MachineState *machine, const int version)
}
/* Load the kernel. */
- arm_load_kernel(mpu->cpu, machine, &sx1_binfo);
+ sms->bootinfo.loader_start = OMAP_EMIFF_BASE;
+ sms->bootinfo.ram_size = SDRAM_SIZE;
+ sms->bootinfo.board_id = 0x265;
+ arm_load_kernel(mpu->cpu, machine, &sms->bootinfo);
/* TODO: fix next line */
//~ qemu_console_resize(ds, 640, 480);
@@ -220,6 +225,7 @@ static const TypeInfo sx1_machine_v2_type = {
.name = MACHINE_TYPE_NAME("sx1"),
.parent = TYPE_MACHINE,
.class_init = sx1_machine_v2_class_init,
+ .instance_size = sizeof(Sx1MachineState),
.interfaces = arm_machine_interfaces,
};
@@ -240,6 +246,7 @@ static const TypeInfo sx1_machine_v1_type = {
.name = MACHINE_TYPE_NAME("sx1-v1"),
.parent = TYPE_MACHINE,
.class_init = sx1_machine_v1_class_init,
+ .instance_size = sizeof(Sx1MachineState),
.interfaces = arm_machine_interfaces,
};