All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support
@ 2026-04-01  1:57 Bibo Mao
  2026-04-01  1:57 ` [PATCH v3 1/2] hw/loongarch/virt: Define virt machine type with type_init() Bibo Mao
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Bibo Mao @ 2026-04-01  1:57 UTC (permalink / raw)
  To: Song Gao, Cornelia Huck; +Cc: Jiaxun Yang, qemu-devel

Now la464 CPU type feature is basically finished, versioned machine type
is added here for compatibility support in future.

---
v2 ... v3:
  1. Refresh the patch based on the latest code
  2. Change version machine from 11.0 to 11.1

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: 559919ce54927d59b215a4665eda7ab6118a48aa
-- 
2.39.3



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/2] hw/loongarch/virt: Define virt machine type with type_init()
  2026-04-01  1:57 [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
@ 2026-04-01  1:57 ` Bibo Mao
  2026-04-01  1:57 ` [PATCH v3 2/2] hw/loongarch/virt: Define versioned virt machine Bibo Mao
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Bibo Mao @ 2026-04-01  1:57 UTC (permalink / raw)
  To: Song Gao, Cornelia Huck; +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 2fc1526130..c134b102c2 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1535,18 +1535,21 @@ static void virt_class_init(ObjectClass *oc, const void *data)
                                           "for PCI MMIO");
 }
 
-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 v3 2/2] hw/loongarch/virt: Define versioned virt machine
  2026-04-01  1:57 [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
  2026-04-01  1:57 ` [PATCH v3 1/2] hw/loongarch/virt: Define virt machine type with type_init() Bibo Mao
@ 2026-04-01  1:57 ` Bibo Mao
  2026-04-17 15:19 ` [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Cornelia Huck
  2026-05-07  6:23 ` gaosong
  3 siblings, 0 replies; 6+ messages in thread
From: Bibo Mao @ 2026-04-01  1:57 UTC (permalink / raw)
  To: Song Gao, Cornelia Huck; +Cc: Jiaxun Yang, qemu-devel

Add versioned virt machine started from QEMU 11.1

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 c134b102c2..f68ccdb12b 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1535,9 +1535,41 @@ static void virt_class_init(ObjectClass *oc, const void *data)
                                           "for PCI MMIO");
 }
 
+#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,
@@ -1553,3 +1585,8 @@ static void machvirt_machine_init(void)
 }
 
 type_init(machvirt_machine_init);
+
+static void virt_machine_11_1_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE_AS_LATEST(11, 1)
-- 
2.39.3



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support
  2026-04-01  1:57 [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
  2026-04-01  1:57 ` [PATCH v3 1/2] hw/loongarch/virt: Define virt machine type with type_init() Bibo Mao
  2026-04-01  1:57 ` [PATCH v3 2/2] hw/loongarch/virt: Define versioned virt machine Bibo Mao
@ 2026-04-17 15:19 ` Cornelia Huck
  2026-04-20  7:44   ` Bibo Mao
  2026-05-07  6:23 ` gaosong
  3 siblings, 1 reply; 6+ messages in thread
From: Cornelia Huck @ 2026-04-17 15:19 UTC (permalink / raw)
  To: Bibo Mao, Song Gao; +Cc: Jiaxun Yang, qemu-devel

On Wed, Apr 01 2026, Bibo Mao <maobibo@loongson.cn> wrote:

> Now la464 CPU type feature is basically finished, versioned machine type
> is added here for compatibility support in future.
>
> ---
> v2 ... v3:
>   1. Refresh the patch based on the latest code
>   2. Change version machine from 11.0 to 11.1
>
> 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(-)

LGTM.

(For the new compat machines, you could either pick the patch yourself
or wait until the s390 changes get merged, I guess.)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support
  2026-04-17 15:19 ` [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Cornelia Huck
@ 2026-04-20  7:44   ` Bibo Mao
  0 siblings, 0 replies; 6+ messages in thread
From: Bibo Mao @ 2026-04-20  7:44 UTC (permalink / raw)
  To: Cornelia Huck, Song Gao; +Cc: Jiaxun Yang, qemu-devel



On 2026/4/17 下午11:19, Cornelia Huck wrote:
> On Wed, Apr 01 2026, Bibo Mao <maobibo@loongson.cn> wrote:
> 
>> Now la464 CPU type feature is basically finished, versioned machine type
>> is added here for compatibility support in future.
>>
>> ---
>> v2 ... v3:
>>    1. Refresh the patch based on the latest code
>>    2. Change version machine from 11.0 to 11.1
>>
>> 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(-)
> 
> LGTM.
> 
> (For the new compat machines, you could either pick the patch yourself
> or wait until the s390 changes get merged, I guess.)
Hi Cornelia,

Thanks for your reminder, I will wait until s390 changes get merged.

Regards
Bibo Mao



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support
  2026-04-01  1:57 [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
                   ` (2 preceding siblings ...)
  2026-04-17 15:19 ` [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Cornelia Huck
@ 2026-05-07  6:23 ` gaosong
  3 siblings, 0 replies; 6+ messages in thread
From: gaosong @ 2026-05-07  6:23 UTC (permalink / raw)
  To: Bibo Mao, Cornelia Huck; +Cc: Jiaxun Yang, qemu-devel

在 2026/4/1 上午9:57, Bibo Mao 写道:
> Now la464 CPU type feature is basically finished, versioned machine type
> is added here for compatibility support in future.
>
> ---
> v2 ... v3:
>    1. Refresh the patch based on the latest code
>    2. Change version machine from 11.0 to 11.1
>
> 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: 559919ce54927d59b215a4665eda7ab6118a48aa
For this series

Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-05-07  6:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  1:57 [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Bibo Mao
2026-04-01  1:57 ` [PATCH v3 1/2] hw/loongarch/virt: Define virt machine type with type_init() Bibo Mao
2026-04-01  1:57 ` [PATCH v3 2/2] hw/loongarch/virt: Define versioned virt machine Bibo Mao
2026-04-17 15:19 ` [PATCH v3 0/2] hw/loongarch/virt: Add versioned machine type support Cornelia Huck
2026-04-20  7:44   ` Bibo Mao
2026-05-07  6:23 ` gaosong

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.