From: Bin Meng <bin.meng@processmission.com>
To: QEMU <qemu-devel@nongnu.org>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-arm@nongnu.org
Subject: [PATCH v2 03/20] hw/arm: bananapi_m2u: Store boot info in the machine state
Date: Sun, 16 Aug 2026 21:12:33 +0800 [thread overview]
Message-ID: <20260816131300.51799-4-bin.meng@processmission.com> (raw)
In-Reply-To: <20260816131300.51799-1-bin.meng@processmission.com>
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 Bpim2uMachineState 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>
---
hw/arm/bananapi_m2u.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/hw/arm/bananapi_m2u.c b/hw/arm/bananapi_m2u.c
index 9b468cd8ac..0079aa1dd2 100644
--- a/hw/arm/bananapi_m2u.c
+++ b/hw/arm/bananapi_m2u.c
@@ -29,7 +29,14 @@
#include "hw/arm/boot.h"
#include "hw/arm/machines-qom.h"
-static struct arm_boot_info bpim2u_binfo;
+#define TYPE_BPIM2U_MACHINE MACHINE_TYPE_NAME("bpim2u")
+OBJECT_DECLARE_SIMPLE_TYPE(Bpim2uMachineState, BPIM2U_MACHINE)
+
+struct Bpim2uMachineState {
+ MachineState parent;
+
+ struct arm_boot_info bootinfo;
+};
/*
* R40 can boot from mmc0 and mmc2, and bpim2u has two mmc interface, one is
@@ -62,6 +69,7 @@ static void mmc_attach_drive(AwR40State *s, AwSdHostState *mmc, int unit,
static void bpim2u_init(MachineState *machine)
{
+ Bpim2uMachineState *bpms = BPIM2U_MACHINE(machine);
bool bootroom_loaded = false;
AwR40State *r40;
I2CBus *i2c;
@@ -120,10 +128,10 @@ static void bpim2u_init(MachineState *machine)
memory_region_add_subregion(get_system_memory(),
r40->memmap[AW_R40_DEV_SDRAM], machine->ram);
- bpim2u_binfo.loader_start = r40->memmap[AW_R40_DEV_SDRAM];
- bpim2u_binfo.ram_size = machine->ram_size;
- bpim2u_binfo.psci_conduit = QEMU_PSCI_CONDUIT_SMC;
- arm_load_kernel(&r40->cpus[0], machine, &bpim2u_binfo);
+ bpms->bootinfo.loader_start = r40->memmap[AW_R40_DEV_SDRAM];
+ bpms->bootinfo.ram_size = machine->ram_size;
+ bpms->bootinfo.psci_conduit = QEMU_PSCI_CONDUIT_SMC;
+ arm_load_kernel(&r40->cpus[0], machine, &bpms->bootinfo);
}
static void bpim2u_machine_init(MachineClass *mc)
@@ -145,4 +153,5 @@ static void bpim2u_machine_init(MachineClass *mc)
mc->auto_create_sdcard = true;
}
-DEFINE_MACHINE_ARM("bpim2u", bpim2u_machine_init)
+DEFINE_MACHINE_EXTENDED("bpim2u", MACHINE, Bpim2uMachineState,
+ bpim2u_machine_init, false, arm_machine_interfaces)
--
2.53.0
next prev parent reply other threads:[~2026-08-16 13:16 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 13:12 [PATCH v2 00/20] hw/arm: Store the ARM boot info in the machine state Bin Meng
2026-08-16 13:12 ` [PATCH v2 01/20] hw/arm: aspeed: Store " Bin Meng
2026-08-16 14:54 ` Philippe Mathieu-Daudé
2026-08-21 9:23 ` Peter Maydell
2026-08-16 13:12 ` [PATCH v2 02/20] hw/arm: aspeed_ast27x0-fc: " Bin Meng
2026-08-16 14:55 ` Philippe Mathieu-Daudé
2026-08-16 13:12 ` Bin Meng [this message]
2026-08-16 13:12 ` [PATCH v2 04/20] hw/arm: collie: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 05/20] hw/arm: cubieboard: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 06/20] hw/arm: exynos4_boards: Store boot info in the board state Bin Meng
2026-08-16 14:56 ` Philippe Mathieu-Daudé
2026-08-16 13:12 ` [PATCH v2 07/20] hw/arm: imx25_pdk: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 08/20] hw/arm: imx8mm-evk: Store boot info in the machine state Bin Meng
2026-08-16 13:12 ` [PATCH v2 09/20] hw/arm: integratorcp: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 10/20] hw/arm: kzm: Store boot info in the board state Bin Meng
2026-08-16 13:12 ` [PATCH v2 11/20] hw/arm: mcimx7d-sabre: Store boot info in the machine state Bin Meng
2026-08-16 13:12 ` [PATCH v2 12/20] hw/arm: musicpal: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 13/20] hw/arm: npcm7xx: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 14/20] hw/arm: npcm8xx: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 15/20] hw/arm: omap_sx1: " Bin Meng
2026-08-16 14:57 ` Philippe Mathieu-Daudé
2026-08-16 13:12 ` [PATCH v2 16/20] hw/arm: orangepi: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 17/20] hw/arm: realview: " Bin Meng
2026-08-16 13:12 ` [PATCH v2 18/20] hw/arm: sabrelite: " Bin Meng
2026-08-16 15:07 ` Philippe Mathieu-Daudé
2026-08-16 13:12 ` [PATCH v2 19/20] hw/arm: versatilepb: " Bin Meng
2026-08-16 15:06 ` Philippe Mathieu-Daudé
2026-08-21 9:49 ` Peter Maydell
2026-08-16 13:12 ` [PATCH v2 20/20] hw/arm: xilinx_zynq: " Bin Meng
2026-08-21 9:49 ` [PATCH v2 00/20] hw/arm: Store the ARM " Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260816131300.51799-4-bin.meng@processmission.com \
--to=bin.meng@processmission.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox