* [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support
@ 2025-12-25 1:41 Bibo Mao
2025-12-25 1:41 ` [PATCH v2 1/2] hw/loongarch/virt: Define virt machine type with type_init() Bibo Mao
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Bibo Mao @ 2025-12-25 1:41 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
Now la464 CPU type feature is basically finished, versioned machine type
is added here for compatibility support in future.
---
v1 ... v2:
1. Change version machine from 10.2 to 11.0
---
Bibo Mao (2):
hw/loongarch/virt: Define virt machine type with type_init()
hw/loongarch/virt: Define versioned virt machine
hw/loongarch/virt.c | 66 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 53 insertions(+), 13 deletions(-)
base-commit: 8dd5bceb2f9cc58481e9d22355a8d998220896de
--
2.39.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] hw/loongarch/virt: Define virt machine type with type_init()
2025-12-25 1:41 [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
@ 2025-12-25 1:41 ` Bibo Mao
2025-12-25 1:41 ` [PATCH v2 2/2] hw/loongarch/virt: Define versioned virt machine Bibo Mao
2026-03-26 7:50 ` [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
2 siblings, 0 replies; 6+ messages in thread
From: Bibo Mao @ 2025-12-25 1:41 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
Define virt machine with function type_init(), so that qemu versioned
virt machine can be added in later with similar method.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/loongarch/virt.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 49434ad182..ed406e3410 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1371,18 +1371,21 @@ static void virt_class_init(ObjectClass *oc, const void *data)
"The string may be up to 8 bytes in size");
}
-static const TypeInfo virt_machine_types[] = {
- {
- .name = TYPE_LOONGARCH_VIRT_MACHINE,
- .parent = TYPE_MACHINE,
- .instance_size = sizeof(LoongArchVirtMachineState),
- .class_init = virt_class_init,
- .instance_init = virt_initfn,
- .interfaces = (const InterfaceInfo[]) {
- { TYPE_HOTPLUG_HANDLER },
- { }
- },
- }
+static const TypeInfo virt_machine_info = {
+ .name = TYPE_LOONGARCH_VIRT_MACHINE,
+ .parent = TYPE_MACHINE,
+ .instance_size = sizeof(LoongArchVirtMachineState),
+ .class_init = virt_class_init,
+ .instance_init = virt_initfn,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { }
+ },
};
-DEFINE_TYPES(virt_machine_types)
+static void machvirt_machine_init(void)
+{
+ type_register_static(&virt_machine_info);
+}
+
+type_init(machvirt_machine_init);
--
2.39.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] hw/loongarch/virt: Define versioned virt machine
2025-12-25 1:41 [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
2025-12-25 1:41 ` [PATCH v2 1/2] hw/loongarch/virt: Define virt machine type with type_init() Bibo Mao
@ 2025-12-25 1:41 ` Bibo Mao
2026-03-26 7:50 ` [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
2 siblings, 0 replies; 6+ messages in thread
From: Bibo Mao @ 2025-12-25 1:41 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
Add versioned virt machine started from QEMU 11.0
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/loongarch/virt.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index ed406e3410..a177d0a195 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1371,9 +1371,41 @@ static void virt_class_init(ObjectClass *oc, const void *data)
"The string may be up to 8 bytes in size");
}
+#define DEFINE_VIRT_MACHINE_VERSION(latest, ...) \
+ static void MACHINE_VER_SYM(class_init, virt, __VA_ARGS__)( \
+ ObjectClass *oc, \
+ const void *data) \
+ { \
+ MachineClass *mc = MACHINE_CLASS(oc); \
+ MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \
+ mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " LoongArch Virtual Machine"; \
+ MACHINE_VER_DEPRECATION(__VA_ARGS__); \
+ if (latest) { \
+ mc->alias = "virt"; \
+ } \
+ } \
+ static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \
+ { \
+ .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \
+ .parent = TYPE_LOONGARCH_VIRT_MACHINE, \
+ .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \
+ }; \
+ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \
+ { \
+ MACHINE_VER_DELETION(__VA_ARGS__); \
+ type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \
+ } \
+ type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__));
+
+#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor) \
+ DEFINE_VIRT_MACHINE_VERSION(true, major, minor)
+#define DEFINE_VIRT_MACHINE(major, minor) \
+ DEFINE_VIRT_MACHINE_VERSION(false, major, minor)
+
static const TypeInfo virt_machine_info = {
.name = TYPE_LOONGARCH_VIRT_MACHINE,
.parent = TYPE_MACHINE,
+ .abstract = true,
.instance_size = sizeof(LoongArchVirtMachineState),
.class_init = virt_class_init,
.instance_init = virt_initfn,
@@ -1389,3 +1421,8 @@ static void machvirt_machine_init(void)
}
type_init(machvirt_machine_init);
+
+static void virt_machine_11_0_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE_AS_LATEST(11, 0)
--
2.39.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support
2025-12-25 1:41 [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
2025-12-25 1:41 ` [PATCH v2 1/2] hw/loongarch/virt: Define virt machine type with type_init() Bibo Mao
2025-12-25 1:41 ` [PATCH v2 2/2] hw/loongarch/virt: Define versioned virt machine Bibo Mao
@ 2026-03-26 7:50 ` Bibo Mao
2026-03-31 12:22 ` Cornelia Huck
2 siblings, 1 reply; 6+ messages in thread
From: Bibo Mao @ 2026-03-26 7:50 UTC (permalink / raw)
To: Song Gao, Cornelia Huck; +Cc: Jiaxun Yang, qemu-devel
ping.
Should the first compatible machine type patch merged before QEMU
version release or just after it?
Regards
Bibo Mao
On 2025/12/25 上午9:41, Bibo Mao wrote:
> Now la464 CPU type feature is basically finished, versioned machine type
> is added here for compatibility support in future.
>
> ---
> v1 ... v2:
> 1. Change version machine from 10.2 to 11.0
> ---
> Bibo Mao (2):
> hw/loongarch/virt: Define virt machine type with type_init()
> hw/loongarch/virt: Define versioned virt machine
>
> hw/loongarch/virt.c | 66 ++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 53 insertions(+), 13 deletions(-)
>
>
> base-commit: 8dd5bceb2f9cc58481e9d22355a8d998220896de
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support
2026-03-26 7:50 ` [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
@ 2026-03-31 12:22 ` Cornelia Huck
2026-04-01 1:05 ` Bibo Mao
0 siblings, 1 reply; 6+ messages in thread
From: Cornelia Huck @ 2026-03-31 12:22 UTC (permalink / raw)
To: Bibo Mao, Song Gao; +Cc: Jiaxun Yang, qemu-devel
On Thu, Mar 26 2026, Bibo Mao <maobibo@loongson.cn> wrote:
> ping.
>
> Should the first compatible machine type patch merged before QEMU
> version release or just after it?
This is unfortunately the first time I've seen these patches... I would
expect it to be merged at the beginning of a development cycle, maybe
softfreeze would have still been ok, but I guess we're a bit late for
11.0 now.
Note, I'm not really the maintainer for this, I guess maintainership for
this would be with general loongarch machine maintainership, and I would
have expected it to be included in a pull req there.
I plan on sending the compat machines for 11.1 soon, feel free to pick
that patch and rebase this series on top of that (or on top of whatever
pull req ends up including the 11.1 machines.)
>
> Regards
> Bibo Mao
>
> On 2025/12/25 上午9:41, Bibo Mao wrote:
>> Now la464 CPU type feature is basically finished, versioned machine type
>> is added here for compatibility support in future.
>>
>> ---
>> v1 ... v2:
>> 1. Change version machine from 10.2 to 11.0
>> ---
>> Bibo Mao (2):
>> hw/loongarch/virt: Define virt machine type with type_init()
>> hw/loongarch/virt: Define versioned virt machine
>>
>> hw/loongarch/virt.c | 66 ++++++++++++++++++++++++++++++++++++---------
>> 1 file changed, 53 insertions(+), 13 deletions(-)
>>
>>
>> base-commit: 8dd5bceb2f9cc58481e9d22355a8d998220896de
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support
2026-03-31 12:22 ` Cornelia Huck
@ 2026-04-01 1:05 ` Bibo Mao
0 siblings, 0 replies; 6+ messages in thread
From: Bibo Mao @ 2026-04-01 1:05 UTC (permalink / raw)
To: Cornelia Huck, Song Gao; +Cc: Jiaxun Yang, qemu-devel
On 2026/3/31 下午8:22, Cornelia Huck wrote:
> On Thu, Mar 26 2026, Bibo Mao <maobibo@loongson.cn> wrote:
>
>> ping.
>>
>> Should the first compatible machine type patch merged before QEMU
>> version release or just after it?
>
> This is unfortunately the first time I've seen these patches... I would
> expect it to be merged at the beginning of a development cycle, maybe
> softfreeze would have still been ok, but I guess we're a bit late for
> 11.0 now.
>
> Note, I'm not really the maintainer for this, I guess maintainership for
> this would be with general loongarch machine maintainership, and I would
> have expected it to be included in a pull req there.
>
> I plan on sending the compat machines for 11.1 soon, feel free to pick
> that patch and rebase this series on top of that (or on top of whatever
> pull req ends up including the 11.1 machines.)
Hi Cornelia,
Thanks for your guidance.
I will sent a new patch with the compat machines for 11.1, please help
me to pick the patch.
Regards
Bibo Mao
>
>>
>> Regards
>> Bibo Mao
>>
>> On 2025/12/25 上午9:41, Bibo Mao wrote:
>>> Now la464 CPU type feature is basically finished, versioned machine type
>>> is added here for compatibility support in future.
>>>
>>> ---
>>> v1 ... v2:
>>> 1. Change version machine from 10.2 to 11.0
>>> ---
>>> Bibo Mao (2):
>>> hw/loongarch/virt: Define virt machine type with type_init()
>>> hw/loongarch/virt: Define versioned virt machine
>>>
>>> hw/loongarch/virt.c | 66 ++++++++++++++++++++++++++++++++++++---------
>>> 1 file changed, 53 insertions(+), 13 deletions(-)
>>>
>>>
>>> base-commit: 8dd5bceb2f9cc58481e9d22355a8d998220896de
>>>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-04-01 1:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-25 1:41 [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
2025-12-25 1:41 ` [PATCH v2 1/2] hw/loongarch/virt: Define virt machine type with type_init() Bibo Mao
2025-12-25 1:41 ` [PATCH v2 2/2] hw/loongarch/virt: Define versioned virt machine Bibo Mao
2026-03-26 7:50 ` [PATCH v2 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
2026-03-31 12:22 ` Cornelia Huck
2026-04-01 1:05 ` Bibo Mao
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.