Patchwork [RFC,3/3] target-i386: add qmp command 'query-cpus' to display apic_id

login
register
mail settings
Submitter chenfan
Date Jan. 14, 2014, 9:27 a.m.
Message ID <8d961a7b5e5c4d856b89125ee8205dde87fa38f5.1389685621.git.chen.fan.fnst@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/310530/
State New
Headers show

Comments

chenfan - Jan. 14, 2014, 9:27 a.m.
this patch provided the apic_id display as using command 'query-cpus'.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
---
 cpus.c           | 1 +
 qapi-schema.json | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
Eric Blake - Feb. 17, 2014, 6:37 p.m.
On 01/14/2014 02:27 AM, Chen Fan wrote:
> this patch provided the apic_id display as using command 'query-cpus'.
> 
> Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
> ---
>  cpus.c           | 1 +
>  qapi-schema.json | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 

> +++ b/qapi-schema.json
> @@ -783,6 +783,8 @@
>  #
>  # @thread_id: ID of the underlying host thread
>  #
> +# @apic_id: the apic id of the virtual CPU
> +#

Needs a (since 2.0) designation on this line.

Patch

diff --git a/cpus.c b/cpus.c
index ca4c59f..e6ed098 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1351,6 +1351,7 @@  CpuInfoList *qmp_query_cpus(Error **errp)
 #if defined(TARGET_I386)
         info->value->has_pc = true;
         info->value->pc = env->eip + env->segs[R_CS].base;
+        info->value->apic_id = env->cpuid_apic_id;
 #elif defined(TARGET_PPC)
         info->value->has_nip = true;
         info->value->nip = env->nip;
diff --git a/qapi-schema.json b/qapi-schema.json
index c3c939c..40c67ac 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -783,6 +783,8 @@ 
 #
 # @thread_id: ID of the underlying host thread
 #
+# @apic_id: the apic id of the virtual CPU
+#
 # Since: 0.14.0
 #
 # Notes: @halted is a transient state that changes frequently.  By the time the
@@ -790,7 +792,7 @@ 
 ##
 { 'type': 'CpuInfo',
   'data': {'CPU': 'int', 'current': 'bool', 'halted': 'bool', '*pc': 'int',
-           '*nip': 'int', '*npc': 'int', '*PC': 'int', 'thread_id': 'int'} }
+           '*nip': 'int', '*npc': 'int', '*PC': 'int', 'thread_id': 'int', 'apic_id': 'int'} }
 
 ##
 # @query-cpus: