From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>,
Bernhard Beschow <shentey@gmail.com>,
Pavel Pisa <pisa@cmp.felk.cvut.cz>,
Jason Wang <jasowang@redhat.com>,
Francisco Iglesias <francisco.iglesias@amd.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, Matyas Bobek <matyas.bobek@gmail.com>,
Jean-Christophe Dubois <jcd@tribudubois.net>,
Vikram Garhwal <vikram.garhwal@bytedance.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Subject: [PATCH 3/4] hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
Date: Thu, 2 Jul 2026 00:46:11 +0200 [thread overview]
Message-ID: <20260701224612.48342-4-shentey@gmail.com> (raw)
In-Reply-To: <20260701224612.48342-1-shentey@gmail.com>
Introduce class FslImx8mpEvkState which will be needed for holding
CanBusState attributes and associated properties.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/arm/imx8mp-evk.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/hw/arm/imx8mp-evk.c b/hw/arm/imx8mp-evk.c
index 4a0c9df76b..ca0ee2d3f2 100644
--- a/hw/arm/imx8mp-evk.c
+++ b/hw/arm/imx8mp-evk.c
@@ -19,6 +19,17 @@
#include "qapi/error.h"
#include <libfdt.h>
+#define TYPE_IMX8MPEVK_MACHINE MACHINE_TYPE_NAME("imx8mp-evk")
+OBJECT_DECLARE_SIMPLE_TYPE(FslImx8mpEvkState, IMX8MPEVK_MACHINE)
+
+struct FslImx8mpEvkState {
+ MachineState parent_obj;
+
+ FslImx8mpState soc;
+
+ struct arm_boot_info boot_info;
+};
+
static void imx8mp_evk_modify_dtb(const struct arm_boot_info *info, void *fdt)
{
int i, offset;
@@ -57,8 +68,7 @@ static void imx8mp_evk_modify_dtb(const struct arm_boot_info *info, void *fdt)
static void imx8mp_evk_init(MachineState *machine)
{
- static struct arm_boot_info boot_info;
- FslImx8mpState *s;
+ FslImx8mpEvkState *s = IMX8MPEVK_MACHINE(machine);
if (machine->ram_size > FSL_IMX8MP_RAM_SIZE_MAX) {
error_report("RAM size " RAM_ADDR_FMT " above max supported (%08" PRIx64 ")",
@@ -66,7 +76,7 @@ static void imx8mp_evk_init(MachineState *machine)
exit(1);
}
- boot_info = (struct arm_boot_info) {
+ s->boot_info = (struct arm_boot_info) {
.loader_start = FSL_IMX8MP_RAM_START,
.board_id = -1,
.ram_size = machine->ram_size,
@@ -74,10 +84,9 @@ static void imx8mp_evk_init(MachineState *machine)
.modify_dtb = imx8mp_evk_modify_dtb,
};
- s = FSL_IMX8MP(object_new(TYPE_FSL_IMX8MP));
- object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
- object_property_set_uint(OBJECT(s), "fec1-phy-num", 1, &error_fatal);
- sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
+ object_initialize_child(OBJECT(machine), "soc", &s->soc, TYPE_FSL_IMX8MP);
+ object_property_set_uint(OBJECT(&s->soc), "fec1-phy-num", 1, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(&s->soc), &error_fatal);
memory_region_add_subregion(get_system_memory(), FSL_IMX8MP_RAM_START,
machine->ram);
@@ -93,14 +102,14 @@ static void imx8mp_evk_init(MachineState *machine)
}
blk = blk_by_legacy_dinfo(di);
- bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
+ bus = qdev_get_child_bus(DEVICE(&s->soc.usdhc[i]), "sd-bus");
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, bus, &error_fatal);
}
if (!qtest_enabled()) {
- arm_load_kernel(&s->cpu[0], machine, &boot_info);
+ arm_load_kernel(&s->soc.cpu[0], machine, &s->boot_info);
}
}
@@ -128,9 +137,10 @@ static void imx8mp_evk_machine_class_init(ObjectClass *oc, const void *data)
static const TypeInfo imx8mp_evk_machine_types[] = {
{
- .name = MACHINE_TYPE_NAME("imx8mp-evk"),
+ .name = TYPE_IMX8MPEVK_MACHINE,
.parent = TYPE_MACHINE,
.class_init = imx8mp_evk_machine_class_init,
+ .instance_size = sizeof(FslImx8mpEvkState),
.interfaces = aarch64_machine_interfaces,
},
};
--
2.54.0
next prev parent reply other threads:[~2026-07-01 22:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 22:46 [PATCH 0/4] hw/arm/fsl-imx8mp: Add inital FlexCAN support Bernhard Beschow
2026-07-01 22:46 ` [PATCH 1/4] hw/net/can/flexcan: Subclass TYPE_CAN_FLEXCAN Bernhard Beschow
2026-07-02 12:45 ` Philippe Mathieu-Daudé
2026-07-02 16:58 ` Bernhard Beschow
2026-07-01 22:46 ` [PATCH 2/4] hw/arm/imx8mp-evk: Open code DEFINE_MACHINE_AARCH64 Bernhard Beschow
2026-07-02 12:23 ` Philippe Mathieu-Daudé
2026-07-01 22:46 ` Bernhard Beschow [this message]
2026-07-02 12:23 ` [PATCH 3/4] hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState Philippe Mathieu-Daudé
2026-07-01 22:46 ` [PATCH 4/4] hw/arm: Add basic FlexCAN3 support to TYPE_FSL_IMX8MP and imx8mp-evk Bernhard Beschow
2026-07-02 12:41 ` Philippe Mathieu-Daudé
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=20260701224612.48342-4-shentey@gmail.com \
--to=shentey@gmail.com \
--cc=francisco.iglesias@amd.com \
--cc=gaurav.sharma_7@nxp.com \
--cc=jasowang@redhat.com \
--cc=jcd@tribudubois.net \
--cc=matyas.bobek@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=pisa@cmp.felk.cvut.cz \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vikram.garhwal@bytedance.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.