public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PATCH 0/3] target/loongarch: Enhancement about query-cpu-model-expansion
@ 2026-01-19 10:06 Bibo Mao
  2026-01-19 10:07 ` [PATCH 1/3] target/loongarch: Add missing vCPU features with QMP method Bibo Mao
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bibo Mao @ 2026-01-19 10:06 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel

Here is enhancement about query-cpu-model-expansion QMP cpu model query
command. Missing CPU feature ptw and msgint and full type is added, also
property set is added with QMP cpu model query command.

Bibo Mao (3):
  target/loongarch: Add missing vCPU features with QMP method
  target/loongarch: Add full type support with query-cpu-model-expansion
  target/loongarch: Add property set with query-cpu-model-expansion

 target/loongarch/loongarch-qmp-cmds.c | 46 +++++++++++++++++++--------
 1 file changed, 32 insertions(+), 14 deletions(-)


base-commit: 38879a667fbb4ef54c70de71494882615f600a64
-- 
2.39.3



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

* [PATCH 1/3] target/loongarch: Add missing vCPU features with QMP method
  2026-01-19 10:06 [PATCH 0/3] target/loongarch: Enhancement about query-cpu-model-expansion Bibo Mao
@ 2026-01-19 10:07 ` Bibo Mao
  2026-02-11  8:44   ` gaosong
  2026-01-19 10:07 ` [PATCH 2/3] target/loongarch: Add full type support with query-cpu-model-expansion Bibo Mao
  2026-01-19 10:07 ` [PATCH 3/3] target/loongarch: Add property set " Bibo Mao
  2 siblings, 1 reply; 7+ messages in thread
From: Bibo Mao @ 2026-01-19 10:07 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel

Feature msgint and ptw is missing with QMP method, such as:
  query-cpu-model-expansion type=static model={"name":"max"}

Here add missing features in cpu_model_advertised_features array.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 target/loongarch/loongarch-qmp-cmds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c
index 1d8cd32f5f..f89f67ce47 100644
--- a/target/loongarch/loongarch-qmp-cmds.c
+++ b/target/loongarch/loongarch-qmp-cmds.c
@@ -41,7 +41,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
 }
 
 static const char *cpu_model_advertised_features[] = {
-    "lsx", "lasx", "lbt", "pmu", "kvm-pv-ipi", "kvm-steal-time", NULL
+    "lsx", "lasx", "lbt", "pmu", "kvm-pv-ipi", "kvm-steal-time", "msgint",
+    "ptw", NULL
 };
 
 CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
-- 
2.39.3



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

* [PATCH 2/3] target/loongarch: Add full type support with query-cpu-model-expansion
  2026-01-19 10:06 [PATCH 0/3] target/loongarch: Enhancement about query-cpu-model-expansion Bibo Mao
  2026-01-19 10:07 ` [PATCH 1/3] target/loongarch: Add missing vCPU features with QMP method Bibo Mao
@ 2026-01-19 10:07 ` Bibo Mao
  2026-02-11  8:45   ` gaosong
  2026-01-19 10:07 ` [PATCH 3/3] target/loongarch: Add property set " Bibo Mao
  2 siblings, 1 reply; 7+ messages in thread
From: Bibo Mao @ 2026-01-19 10:07 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel

On LoongArch with QMP command query-cpu-model-expansion, only static
type is supported, full type is not supported. Here add full type support
with QMP cpu model query command.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 target/loongarch/loongarch-qmp-cmds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c
index f89f67ce47..6a95080fe4 100644
--- a/target/loongarch/loongarch-qmp-cmds.c
+++ b/target/loongarch/loongarch-qmp-cmds.c
@@ -58,7 +58,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
     const char *name;
     int i;
 
-    if (type != CPU_MODEL_EXPANSION_TYPE_STATIC) {
+    if ((type != CPU_MODEL_EXPANSION_TYPE_STATIC) &&
+        (type != CPU_MODEL_EXPANSION_TYPE_FULL)) {
         error_setg(errp, "The requested expansion type is not supported");
         return NULL;
     }
-- 
2.39.3



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

* [PATCH 3/3] target/loongarch: Add property set with query-cpu-model-expansion
  2026-01-19 10:06 [PATCH 0/3] target/loongarch: Enhancement about query-cpu-model-expansion Bibo Mao
  2026-01-19 10:07 ` [PATCH 1/3] target/loongarch: Add missing vCPU features with QMP method Bibo Mao
  2026-01-19 10:07 ` [PATCH 2/3] target/loongarch: Add full type support with query-cpu-model-expansion Bibo Mao
@ 2026-01-19 10:07 ` Bibo Mao
  2026-02-11  9:48   ` gaosong
  2 siblings, 1 reply; 7+ messages in thread
From: Bibo Mao @ 2026-01-19 10:07 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel

On LoongArch with QMP command query-cpu-model-expansion, property
setting is not supported witch command such as:
  query-cpu-model-expansion type=static model={"name":"max","props":{"lasx":false}}

Here add property setting support with QMP command.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 target/loongarch/loongarch-qmp-cmds.c | 40 +++++++++++++++++++--------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c
index 6a95080fe4..f053f22bb8 100644
--- a/target/loongarch/loongarch-qmp-cmds.c
+++ b/target/loongarch/loongarch-qmp-cmds.c
@@ -50,7 +50,6 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
                                                      Error **errp)
 {
     Visitor *visitor;
-    bool ok;
     CpuModelExpansionInfo *expansion_info;
     QDict *qdict_out;
     ObjectClass *oc;
@@ -64,30 +63,47 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
         return NULL;
     }
 
+    oc = cpu_class_by_name(TYPE_LOONGARCH_CPU, model->name);
+    if (!oc) {
+        error_setg(errp, "The CPU type '%s' is not a recognized LoongArch "
+                         "CPU type", model->name);
+        return NULL;
+    }
+
+    obj = object_new(object_class_get_name(oc));
     if (model->props) {
+        Error *err = NULL;
+        const QDict *qdict_in;
+
         visitor = qobject_input_visitor_new(model->props);
         if (!visit_start_struct(visitor, "model.props", NULL, 0, errp)) {
             visit_free(visitor);
+            object_unref(obj);
             return NULL;
         }
 
-        ok = visit_check_struct(visitor, errp);
+        qdict_in = qobject_to(QDict, model->props);
+        i = 0;
+        while ((name = cpu_model_advertised_features[i++]) != NULL) {
+            if (qdict_get(qdict_in, name)) {
+                if (!object_property_set(obj, name, visitor, &err)) {
+                    break;
+                }
+            }
+        }
+
+        if (!err) {
+            visit_check_struct(visitor, &err);
+        }
         visit_end_struct(visitor, NULL);
         visit_free(visitor);
-        if (!ok) {
+        if (err) {
+            error_propagate(errp, err);
+            object_unref(obj);
             return NULL;
         }
     }
 
-    oc = cpu_class_by_name(TYPE_LOONGARCH_CPU, model->name);
-    if (!oc) {
-        error_setg(errp, "The CPU type '%s' is not a recognized LoongArch CPU type",
-                   model->name);
-        return NULL;
-    }
-
-    obj = object_new(object_class_get_name(oc));
-
     expansion_info = g_new0(CpuModelExpansionInfo, 1);
     expansion_info->model = g_malloc0(sizeof(*expansion_info->model));
     expansion_info->model->name = g_strdup(model->name);
-- 
2.39.3



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

* Re: [PATCH 1/3] target/loongarch: Add missing vCPU features with QMP method
  2026-01-19 10:07 ` [PATCH 1/3] target/loongarch: Add missing vCPU features with QMP method Bibo Mao
@ 2026-02-11  8:44   ` gaosong
  0 siblings, 0 replies; 7+ messages in thread
From: gaosong @ 2026-02-11  8:44 UTC (permalink / raw)
  To: Bibo Mao; +Cc: qemu-devel

在 2026/1/19 下午6:07, Bibo Mao 写道:
> Feature msgint and ptw is missing with QMP method, such as:
>    query-cpu-model-expansion type=static model={"name":"max"}
>
> Here add missing features in cpu_model_advertised_features array.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>   target/loongarch/loongarch-qmp-cmds.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao
> diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c
> index 1d8cd32f5f..f89f67ce47 100644
> --- a/target/loongarch/loongarch-qmp-cmds.c
> +++ b/target/loongarch/loongarch-qmp-cmds.c
> @@ -41,7 +41,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
>   }
>   
>   static const char *cpu_model_advertised_features[] = {
> -    "lsx", "lasx", "lbt", "pmu", "kvm-pv-ipi", "kvm-steal-time", NULL
> +    "lsx", "lasx", "lbt", "pmu", "kvm-pv-ipi", "kvm-steal-time", "msgint",
> +    "ptw", NULL
>   };
>   
>   CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,



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

* Re: [PATCH 2/3] target/loongarch: Add full type support with query-cpu-model-expansion
  2026-01-19 10:07 ` [PATCH 2/3] target/loongarch: Add full type support with query-cpu-model-expansion Bibo Mao
@ 2026-02-11  8:45   ` gaosong
  0 siblings, 0 replies; 7+ messages in thread
From: gaosong @ 2026-02-11  8:45 UTC (permalink / raw)
  To: Bibo Mao; +Cc: qemu-devel

在 2026/1/19 下午6:07, Bibo Mao 写道:
> On LoongArch with QMP command query-cpu-model-expansion, only static
> type is supported, full type is not supported. Here add full type support
> with QMP cpu model query command.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>   target/loongarch/loongarch-qmp-cmds.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao
> diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c
> index f89f67ce47..6a95080fe4 100644
> --- a/target/loongarch/loongarch-qmp-cmds.c
> +++ b/target/loongarch/loongarch-qmp-cmds.c
> @@ -58,7 +58,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
>       const char *name;
>       int i;
>   
> -    if (type != CPU_MODEL_EXPANSION_TYPE_STATIC) {
> +    if ((type != CPU_MODEL_EXPANSION_TYPE_STATIC) &&
> +        (type != CPU_MODEL_EXPANSION_TYPE_FULL)) {
>           error_setg(errp, "The requested expansion type is not supported");
>           return NULL;
>       }



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

* Re: [PATCH 3/3] target/loongarch: Add property set with query-cpu-model-expansion
  2026-01-19 10:07 ` [PATCH 3/3] target/loongarch: Add property set " Bibo Mao
@ 2026-02-11  9:48   ` gaosong
  0 siblings, 0 replies; 7+ messages in thread
From: gaosong @ 2026-02-11  9:48 UTC (permalink / raw)
  To: Bibo Mao; +Cc: qemu-devel

在 2026/1/19 下午6:07, Bibo Mao 写道:
> On LoongArch with QMP command query-cpu-model-expansion, property
> setting is not supported witch command such as:
>    query-cpu-model-expansion type=static model={"name":"max","props":{"lasx":false}}
>
> Here add property setting support with QMP command.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>   target/loongarch/loongarch-qmp-cmds.c | 40 +++++++++++++++++++--------
>   1 file changed, 28 insertions(+), 12 deletions(-)
Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao
> diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c
> index 6a95080fe4..f053f22bb8 100644
> --- a/target/loongarch/loongarch-qmp-cmds.c
> +++ b/target/loongarch/loongarch-qmp-cmds.c
> @@ -50,7 +50,6 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
>                                                        Error **errp)
>   {
>       Visitor *visitor;
> -    bool ok;
>       CpuModelExpansionInfo *expansion_info;
>       QDict *qdict_out;
>       ObjectClass *oc;
> @@ -64,30 +63,47 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
>           return NULL;
>       }
>   
> +    oc = cpu_class_by_name(TYPE_LOONGARCH_CPU, model->name);
> +    if (!oc) {
> +        error_setg(errp, "The CPU type '%s' is not a recognized LoongArch "
> +                         "CPU type", model->name);
> +        return NULL;
> +    }
> +
> +    obj = object_new(object_class_get_name(oc));
>       if (model->props) {
> +        Error *err = NULL;
> +        const QDict *qdict_in;
> +
>           visitor = qobject_input_visitor_new(model->props);
>           if (!visit_start_struct(visitor, "model.props", NULL, 0, errp)) {
>               visit_free(visitor);
> +            object_unref(obj);
>               return NULL;
>           }
>   
> -        ok = visit_check_struct(visitor, errp);
> +        qdict_in = qobject_to(QDict, model->props);
> +        i = 0;
> +        while ((name = cpu_model_advertised_features[i++]) != NULL) {
> +            if (qdict_get(qdict_in, name)) {
> +                if (!object_property_set(obj, name, visitor, &err)) {
> +                    break;
> +                }
> +            }
> +        }
> +
> +        if (!err) {
> +            visit_check_struct(visitor, &err);
> +        }
>           visit_end_struct(visitor, NULL);
>           visit_free(visitor);
> -        if (!ok) {
> +        if (err) {
> +            error_propagate(errp, err);
> +            object_unref(obj);
>               return NULL;
>           }
>       }
>   
> -    oc = cpu_class_by_name(TYPE_LOONGARCH_CPU, model->name);
> -    if (!oc) {
> -        error_setg(errp, "The CPU type '%s' is not a recognized LoongArch CPU type",
> -                   model->name);
> -        return NULL;
> -    }
> -
> -    obj = object_new(object_class_get_name(oc));
> -
>       expansion_info = g_new0(CpuModelExpansionInfo, 1);
>       expansion_info->model = g_malloc0(sizeof(*expansion_info->model));
>       expansion_info->model->name = g_strdup(model->name);



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

end of thread, other threads:[~2026-02-11  9:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19 10:06 [PATCH 0/3] target/loongarch: Enhancement about query-cpu-model-expansion Bibo Mao
2026-01-19 10:07 ` [PATCH 1/3] target/loongarch: Add missing vCPU features with QMP method Bibo Mao
2026-02-11  8:44   ` gaosong
2026-01-19 10:07 ` [PATCH 2/3] target/loongarch: Add full type support with query-cpu-model-expansion Bibo Mao
2026-02-11  8:45   ` gaosong
2026-01-19 10:07 ` [PATCH 3/3] target/loongarch: Add property set " Bibo Mao
2026-02-11  9:48   ` gaosong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox