hw/core/machine: Display CPU model name in 'info cpus' command
v7 cover hw/core/machine: Display CPU model name in 'info cpus' command
Since v6 [*]:
- Expose QOM type name on QMP (instead of model name)
(R-b tags kept)
[*] https://lore.kernel.org/qemu-devel/[email protected]/
Philippe Mathieu-Daudé (2):
qapi/machine: Add @qom-type field to CpuInfoFast structure hw/core/machine: Display CPU model name in 'info cpus' command
qapi/machine.json | 3 +++ hw/core/machine-hmp-cmds.c | 4 +++- hw/core/machine-qmp-cmds.c | 1 + 3 files changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.49.0
PATCH v7 1/2 qapi/machine: Add @qom-type field to CpuInfoFast structure
Knowing the QOM type name of a CPU can be useful, in particular to infer its model name.
--- qapi/machine.json | 3 +++ hw/core/machine-qmp-cmds.c | 1 + 2 files changed, 4 insertions(+)
qapi/machine.json +3 -0
@@ -76,6 +76,8 @@ # # @cpu-index: index of the virtual CPU # +# @qom-type: QOM type name of the CPU (since 10.1) +# # @qom-path: path to the CPU object in the QOM tree # # @thread-id: ID of the underlying host thread
@@ -89,6 +91,7 @@ ## { 'union' : 'CpuInfoFast', 'base' : { 'cpu-index' : 'int', + 'qom-type' : 'str', 'qom-path' : 'str', 'thread-id' : 'int', '*props' : 'CpuInstanceProperties',
hw/core/machine-qmp-cmds.c +1 -0
@@ -47,6 +47,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) value->cpu_index = cpu->cpu_index; value->qom_path =object_get_canonical_path (OBJECT (cpu)); value->thread_id = cpu->thread_id; + value->qom_type =g_strdup (object_get_typename (OBJECT (cpu)));if (mc->cpu_index_to_instance_props) {CpuInstanceProperties *props;
Signature · 1 line
2.49.0
Re: [PATCH-for-10.1 v7 1/2] qapi/machine: Add @qom-type field to CpuInfoFast structure
Quoted 6 lines · Philippe Mathieu-Daudé
Knowing the QOM type name of a CPU can be useful, in particular to infer its model name.
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 38 lines
--- qapi/machine.json | 3 +++ hw/core/machine-qmp-cmds.c | 1 + 2 files changed, 4 insertions(+)qapi/machine.json +3
-0@@ -76,6 +76,8 @@ # # @cpu-index: index of the virtual CPU # +# @qom-type: QOM type name of the CPU (since 10.1) +# # @qom-path: path to the CPU object in the QOM tree # # @thread-id: ID of the underlying host thread@@ -89,6 +91,7 @@ ## { 'union' : 'CpuInfoFast', 'base' : { 'cpu-index' : 'int', + 'qom-type' : 'str', 'qom-path' : 'str', 'thread-id' : 'int', '*props' : 'CpuInstanceProperties',hw/core/machine-qmp-cmds.c +1
-0@@ -47,6 +47,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) value->cpu_index = cpu->cpu_index; value->qom_path =object_get_canonical_path (OBJECT (cpu)); value->thread_id = cpu->thread_id; + value->qom_type =g_strdup (object_get_typename (OBJECT (cpu)));if (mc->cpu_index_to_instance_props) {CpuInstanceProperties *props;
PATCH v7 2/2 hw/core/machine: Display CPU model name in 'info cpus' command
In reply to Philippe Mathieu-DaudéDisplay the CPU model in 'info cpus'. Example before:
$ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio QEMU 10.0.0 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=42924 CPU #1: thread_id=42924 CPU #2: thread_id=42924 CPU #3: thread_id=42924 (qemu) q
and after:
$ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio QEMU 10.0.50 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=42916 model=cortex-a72 CPU #1: thread_id=42916 model=cortex-a72 CPU #2: thread_id=42916 model=cortex-r5f CPU #3: thread_id=42916 model=cortex-r5f (qemu)
--- hw/core/machine-hmp-cmds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/core/machine-hmp-cmds.c +3 -1
@@ -32,6 +32,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict) cpu_list =qmp_query_cpus_fast (NULL );for (cpu = cpu_list; cpu; cpu = cpu->next) { + g_autofree char *cpu_model = cpu_model_from_type(cpu->value->qom_type);int active =' ' ;if (cpu->value->cpu_index ==monitor_get_cpu_index (mon)) {
@@ -40,7 +41,8 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)monitor_printf (mon,"%c CPU #%" PRId64":" , active, cpu->value->cpu_index); -monitor_printf (mon," thread_id=%" PRId64"\n" , cpu->value->thread_id); +monitor_printf (mon," thread_id=%" PRId64" model=%s\n" , + cpu->value->thread_id, cpu_model); }qapi_free_CpuInfoFastList (cpu_list);
Signature · 1 line
2.49.0
Quoted 22 lines · Philippe Mathieu-Daudé
Display the CPU model in 'info cpus'. Example before:
$ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio QEMU 10.0.0 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=42924 CPU #1: thread_id=42924 CPU #2: thread_id=42924 CPU #3: thread_id=42924 (qemu) qand after:
$ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio QEMU 10.0.50 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=42916 model=cortex-a72 CPU #1: thread_id=42916 model=cortex-a72 CPU #2: thread_id=42916 model=cortex-r5f CPU #3: thread_id=42916 model=cortex-r5f (qemu)
Quoted 4 lines
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Zhao Liu <[email protected]>Tested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
IIRC, I gave r-b tag before. Anyway,
Quoted 26 lines
--- hw/core/machine-hmp-cmds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)hw/core/machine-hmp-cmds.c +3
-1@@ -32,6 +32,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict) cpu_list =qmp_query_cpus_fast (NULL );for (cpu = cpu_list; cpu; cpu = cpu->next) { + g_autofree char *cpu_model = cpu_model_from_type(cpu->value->qom_type);int active =' ' ;if (cpu->value->cpu_index ==monitor_get_cpu_index (mon)) {@@ -40,7 +41,8 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)monitor_printf (mon,"%c CPU #%" PRId64":" , active, cpu->value->cpu_index); -monitor_printf (mon," thread_id=%" PRId64"\n" , cpu->value->thread_id); +monitor_printf (mon," thread_id=%" PRId64" model=%s\n" , + cpu->value->thread_id, cpu_model); }qapi_free_CpuInfoFastList (cpu_list);
Quoted 23 lines · Xiaoyao Li
Quoted 22 lines · Philippe Mathieu-Daudé
Display the CPU model in 'info cpus'. Example before:
$ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio QEMU 10.0.0 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=42924 CPU #1: thread_id=42924 CPU #2: thread_id=42924 CPU #3: thread_id=42924 (qemu) qand after:
$ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio QEMU 10.0.50 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=42916 model=cortex-a72 CPU #1: thread_id=42916 model=cortex-a72 CPU #2: thread_id=42916 model=cortex-r5f CPU #3: thread_id=42916 model=cortex-r5f (qemu)
Quoted 8 lines
Quoted 4 lines
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Zhao Liu <[email protected]>Tested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>IIRC, I gave r-b tag before. Anyway,
Reviewed-by Xiaoyao Li <[email protected]>
Sorry I missed it and thank you :)
Philippe Mathieu-Daudé
AppliedQuoted 3 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (2):
qapi/machine: Add @qom-type field to CpuInfoFast structure hw/core/machine: Display CPU model name in 'info cpus' command
Queued, thanks.