hmp: add PC information for ARM vCPUs
PATCH 1/1 hmp: add PC information for ARM vCPUs
--- cpus.c | 6 ++++++ hmp.c | 3 +++ qapi-schema.json | 14 +++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-)
cpus.c +6 -0
@@ -1869,6 +1869,9 @@ CpuInfoList *qmp_query_cpus(Error **errp)#elif defined(TARGET_TRICORE )TriCoreCPU *tricore_cpu =TRICORE_CPU (cpu);CPUTriCoreState *env = &tricore_cpu->env; +#elif defined(TARGET_AARCH64 ) +ARMCPU *arm_cpu =ARM_CPU (cpu); +CPUARMState *env = &arm_cpu->env;#endif cpu_synchronize_state (cpu);
@@ -1896,6 +1899,9 @@ CpuInfoList *qmp_query_cpus(Error **errp)#elif defined(TARGET_TRICORE ) info->value->arch =CPU_INFO_ARCH_TRICORE ; info->value->u.tricore.PC = env->PC; +#elif defined(TARGET_AARCH64 ) + info->value->arch =CPU_INFO_ARCH_ARM ; + info->value->u.arm.pc = env->pc;#else info->value->arch =CPU_INFO_ARCH_OTHER ;#endif
hmp.c +3 -0
@@ -369,6 +369,9 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)case CPU_INFO_ARCH_TRICORE :monitor_printf (mon," PC=0x%016" PRIx64, cpu->value->u.tricore.PC);break ; +case CPU_INFO_ARCH_ARM : +monitor_printf (mon," pc=0x%016" PRIx64, cpu->value->u.arm.pc); +break ;default :break ; }
qapi-schema.json +13 -1
@@ -1277,7 +1277,7 @@ # Since: 2.6 ## { 'enum': 'CpuInfoArch', - 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 'other' ] } + 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 'arm', 'other' ] } ## # @CpuInfo:
@@ -1312,6 +1312,7 @@ 'ppc': 'CpuInfoPPC', 'mips': 'CpuInfoMIPS', 'tricore': 'CpuInfoTricore', + 'arm': 'CpuInfoARM', 'other': 'CpuInfoOther' } } ##
@@ -1372,6 +1373,17 @@ { 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } } ## +# @CpuInfoARM: +# +# Additional information about a virtual ARM CPU +# +# @pc: the instruction pointer +# +# Since: 2.9 +## +{ 'struct': 'CpuInfoARM', 'data': { 'pc': 'int' } } + +## # @CpuInfoOther: # # No additional information is available about the virtual CPU
Signature · 1 line
2.11.0
Quoted 10 lines · Alex Bennée
Signed-off-by Alex Bennée <[email protected]>--- cpus.c | 6 ++++++ hmp.c | 3 +++ qapi-schema.json | 14 +++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-)+++
b/qapi-schema.json
qapi-schema.json line 1280
Quoted 5 lines
qapi-schema.json +1
-1@@ -1277,7 +1277,7 @@ # Since: 2.6 ## { 'enum': 'CpuInfoArch', - 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 'other' ] } + 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 'arm', 'other' ] }
Is it possible to document "'arm' since 2.9" somewhere for this enum?
Otherwise looks fine to me.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 22 lines · Alex Bennée
Signed-off-by Alex Bennée <[email protected]>--- cpus.c | 6 ++++++ hmp.c | 3 +++ qapi-schema.json | 14 +++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-)cpus.c +3
-0@@ -1869,6 +1869,9 @@ CpuInfoList *qmp_query_cpus(Error **errp)#elif defined(TARGET_TRICORE )TriCoreCPU *tricore_cpu =TRICORE_CPU (cpu);CPUTriCoreState *env = &tricore_cpu->env; +#elif defined(TARGET_AARCH64 ) +ARMCPU *arm_cpu =ARM_CPU (cpu); +CPUARMState *env = &arm_cpu->env;#endif cpu_synchronize_state (cpu);
cpus.c CpuInfoList *qmp_query_cpus(Error **errp) · line 1907
Quoted 9 lines
cpus.c +3
-0@@ -1896,6 +1899,9 @@ CpuInfoList *qmp_query_cpus(Error **errp)#elif defined(TARGET_TRICORE ) info->value->arch =CPU_INFO_ARCH_TRICORE ; info->value->u.tricore.PC = env->PC; +#elif defined(TARGET_AARCH64 ) + info->value->arch =CPU_INFO_ARCH_ARM ; + info->value->u.arm.pc = env->pc;#else info->value->arch =CPU_INFO_ARCH_OTHER ;#endif
My standard reaction when I see patches adding another arm to a target-ifdef ladder like this is to ask whether we can refactor this so that the target-specific code lives in target/$ARCH instead...
thanks
-- PMM
Quoted 21 lines · * Peter Maydell ([email protected]) wrote:
Quoted 20 lines · Alex Bennée
Signed-off-by Alex Bennée <[email protected]>--- cpus.c | 6 ++++++ hmp.c | 3 +++ qapi-schema.json | 14 +++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-)cpus.c +3
-0@@ -1869,6 +1869,9 @@ CpuInfoList *qmp_query_cpus(Error **errp)#elif defined(TARGET_TRICORE )TriCoreCPU *tricore_cpu =TRICORE_CPU (cpu);CPUTriCoreState *env = &tricore_cpu->env; +#elif defined(TARGET_AARCH64 ) +ARMCPU *arm_cpu =ARM_CPU (cpu); +CPUARMState *env = &arm_cpu->env;#endif
Quoted 16 lines
cpus.c CpuInfoList *qmp_query_cpus(Error **errp) · line 1907
Quoted 11 lines
cpus.c +3
-0cpu_synchronize_state (cpu);@@ -1896,6 +1899,9 @@ CpuInfoList *qmp_query_cpus(Error **errp)#elif defined(TARGET_TRICORE ) info->value->arch =CPU_INFO_ARCH_TRICORE ; info->value->u.tricore.PC = env->PC; +#elif defined(TARGET_AARCH64 ) + info->value->arch =CPU_INFO_ARCH_ARM ; + info->value->u.arm.pc = env->pc;#else info->value->arch =CPU_INFO_ARCH_OTHER ;#endif My standard reaction when I see patches adding another arm to a target-ifdef ladder like this is to ask whether we can refactor this so that the target-specific code lives in target/$ARCH instead...
It feels like that should be possible with PC; but then you get the weird outliers; x86 that adds in CS, but OK that could be wrapped up in a target function; and then SPARC that's got pc and npc just to be different.
Dave
Quoted 3 lines
thanks
-- PMM
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK