qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [PATCH v7 13/13] hmp: Add "info ppc-cpu-cores" command


From: Bharata B Rao
Subject: [Qemu-ppc] [PATCH v7 13/13] hmp: Add "info ppc-cpu-cores" command
Date: Thu, 28 Jan 2016 11:19:55 +0530

This is the hmp equivalent of "query ppc-cpu-cores"

Signed-off-by: Bharata B Rao <address@hidden>
---
 hmp-commands-info.hx | 16 ++++++++++++++++
 hmp.c                | 31 +++++++++++++++++++++++++++++++
 hmp.h                |  1 +
 3 files changed, 48 insertions(+)

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 9b71351..cd9a42e 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -786,6 +786,22 @@ STEXI
 Display the value of a storage key (s390 only)
 ETEXI
 
+#if defined(TARGET_PPC64)
+    {
+        .name       = "ppc-cpu-cores",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show PowerPC CPU core devices",
+        .mhandler.cmd = hmp_info_ppc_cpu_cores,
+    },
+#endif
+
+STEXI
address@hidden info ppc-cpu-cores
address@hidden ppc-cpu-cores
+Show PowerPC CPU core devices.
+ETEXI
+
 STEXI
 @end table
 ETEXI
diff --git a/hmp.c b/hmp.c
index 54f2620..ae75aa1 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2375,3 +2375,34 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict 
*qdict)
 
     qapi_free_RockerOfDpaGroupList(list);
 }
+
+void hmp_info_ppc_cpu_cores(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    PPCCPUCoreList *ppc_cpu_core_list = qmp_query_ppc_cpu_cores(&err);
+    PPCCPUCoreList *s = ppc_cpu_core_list;
+    CpuInfoList *thread;
+
+    while (s) {
+        monitor_printf(mon, "PowerPC CPU device: \"%s\"\n",
+                       s->value->id ? s->value->id : "");
+        monitor_printf(mon, "  hotplugged: %s\n",
+                           s->value->hotplugged ? "true" : "false");
+        monitor_printf(mon, "  hotpluggable: %s\n",
+                           s->value->hotpluggable ? "true" : "false");
+        monitor_printf(mon, "  Threads:\n");
+        for (thread = s->value->threads; thread; thread = thread->next) {
+            monitor_printf(mon, "    CPU #%" PRId64 ":", thread->value->CPU);
+            monitor_printf(mon, " nip=0x%016" PRIx64,
+                           thread->value->u.ppc->nip);
+            if (thread->value->halted) {
+                monitor_printf(mon, " (halted)");
+            }
+            monitor_printf(mon, " thread_id=%" PRId64 "\n",
+                           thread->value->thread_id);
+        }
+        s = s->next;
+    }
+
+    qapi_free_PPCCPUCoreList(ppc_cpu_core_list);
+}
diff --git a/hmp.h b/hmp.h
index a8c5b5a..a31e3d2 100644
--- a/hmp.h
+++ b/hmp.h
@@ -131,5 +131,6 @@ void hmp_rocker(Monitor *mon, const QDict *qdict);
 void hmp_rocker_ports(Monitor *mon, const QDict *qdict);
 void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict);
 void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict);
+void hmp_info_ppc_cpu_cores(Monitor *mon, const QDict *qdict);
 
 #endif
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]