mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
machine: remove 'query-cpus' QMP command
The newer 'query-cpus-fast' command avoids side effects on the guest execution. Note that some of the field names are different in the 'query-cpus-fast' command. Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
cbde7be900
commit
8af54b9172
11 changed files with 22 additions and 258 deletions
|
@ -24,85 +24,6 @@
|
|||
#include "sysemu/runstate.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
CpuInfoList *qmp_query_cpus(Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||||
CpuInfoList *head = NULL, **tail = &head;
|
||||
CPUState *cpu;
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
CpuInfo *value;
|
||||
#if defined(TARGET_I386)
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
#elif defined(TARGET_PPC)
|
||||
PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu);
|
||||
CPUPPCState *env = &ppc_cpu->env;
|
||||
#elif defined(TARGET_SPARC)
|
||||
SPARCCPU *sparc_cpu = SPARC_CPU(cpu);
|
||||
CPUSPARCState *env = &sparc_cpu->env;
|
||||
#elif defined(TARGET_RISCV)
|
||||
RISCVCPU *riscv_cpu = RISCV_CPU(cpu);
|
||||
CPURISCVState *env = &riscv_cpu->env;
|
||||
#elif defined(TARGET_MIPS)
|
||||
MIPSCPU *mips_cpu = MIPS_CPU(cpu);
|
||||
CPUMIPSState *env = &mips_cpu->env;
|
||||
#elif defined(TARGET_TRICORE)
|
||||
TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu);
|
||||
CPUTriCoreState *env = &tricore_cpu->env;
|
||||
#elif defined(TARGET_S390X)
|
||||
S390CPU *s390_cpu = S390_CPU(cpu);
|
||||
CPUS390XState *env = &s390_cpu->env;
|
||||
#endif
|
||||
|
||||
cpu_synchronize_state(cpu);
|
||||
|
||||
value = g_malloc0(sizeof(*value));
|
||||
value->CPU = cpu->cpu_index;
|
||||
value->current = (cpu == first_cpu);
|
||||
value->halted = cpu->halted;
|
||||
value->qom_path = object_get_canonical_path(OBJECT(cpu));
|
||||
value->thread_id = cpu->thread_id;
|
||||
#if defined(TARGET_I386)
|
||||
value->arch = CPU_INFO_ARCH_X86;
|
||||
value->u.x86.pc = env->eip + env->segs[R_CS].base;
|
||||
#elif defined(TARGET_PPC)
|
||||
value->arch = CPU_INFO_ARCH_PPC;
|
||||
value->u.ppc.nip = env->nip;
|
||||
#elif defined(TARGET_SPARC)
|
||||
value->arch = CPU_INFO_ARCH_SPARC;
|
||||
value->u.q_sparc.pc = env->pc;
|
||||
value->u.q_sparc.npc = env->npc;
|
||||
#elif defined(TARGET_MIPS)
|
||||
value->arch = CPU_INFO_ARCH_MIPS;
|
||||
value->u.q_mips.PC = env->active_tc.PC;
|
||||
#elif defined(TARGET_TRICORE)
|
||||
value->arch = CPU_INFO_ARCH_TRICORE;
|
||||
value->u.tricore.PC = env->PC;
|
||||
#elif defined(TARGET_S390X)
|
||||
value->arch = CPU_INFO_ARCH_S390;
|
||||
value->u.s390.cpu_state = env->cpu_state;
|
||||
#elif defined(TARGET_RISCV)
|
||||
value->arch = CPU_INFO_ARCH_RISCV;
|
||||
value->u.riscv.pc = env->pc;
|
||||
#else
|
||||
value->arch = CPU_INFO_ARCH_OTHER;
|
||||
#endif
|
||||
value->has_props = !!mc->cpu_index_to_instance_props;
|
||||
if (value->has_props) {
|
||||
CpuInstanceProperties *props;
|
||||
props = g_malloc0(sizeof(*props));
|
||||
*props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
|
||||
value->props = props;
|
||||
}
|
||||
|
||||
QAPI_LIST_APPEND(tail, value);
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target)
|
||||
{
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue