target/ppc: Restrict 'qapi-commands-machine.h' to system emulation
Since commit a0e61807a3
("qapi: Remove QMP events and commands from
user-mode builds") we don't generate the "qapi-commands-machine.h"
header in a user-emulation-only build.
Move the QMP functions from cpu_init.c (which is always compiled)
to monitor.c (which is only compiled when system-emulation
is selected). Rename monitor.c to arm-qmp-cmds.c.
Note ppc_cpu_class_by_name() is used by both file units, so we
expose its prototype in "cpu-qom.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20230223155540.30370-5-philmd@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
381b43f855
commit
0f3fea2171
@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)
|
OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)
|
||||||
|
|
||||||
|
ObjectClass *ppc_cpu_class_by_name(const char *name);
|
||||||
|
|
||||||
typedef struct CPUArchState CPUPPCState;
|
typedef struct CPUArchState CPUPPCState;
|
||||||
typedef struct ppc_tb_t ppc_tb_t;
|
typedef struct ppc_tb_t ppc_tb_t;
|
||||||
typedef struct ppc_dcr_t ppc_dcr_t;
|
typedef struct ppc_dcr_t ppc_dcr_t;
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
#include "disas/capstone.h"
|
#include "disas/capstone.h"
|
||||||
#include "fpu/softfloat.h"
|
#include "fpu/softfloat.h"
|
||||||
#include "qapi/qapi-commands-machine-target.h"
|
|
||||||
|
|
||||||
#include "helper_regs.h"
|
#include "helper_regs.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
@ -6841,7 +6840,7 @@ static const char *ppc_cpu_lookup_alias(const char *alias)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ObjectClass *ppc_cpu_class_by_name(const char *name)
|
ObjectClass *ppc_cpu_class_by_name(const char *name)
|
||||||
{
|
{
|
||||||
char *cpu_model, *typename;
|
char *cpu_model, *typename;
|
||||||
ObjectClass *oc;
|
ObjectClass *oc;
|
||||||
@ -6981,51 +6980,6 @@ void ppc_cpu_list(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
|
|
||||||
{
|
|
||||||
ObjectClass *oc = data;
|
|
||||||
CpuDefinitionInfoList **first = user_data;
|
|
||||||
const char *typename;
|
|
||||||
CpuDefinitionInfo *info;
|
|
||||||
|
|
||||||
typename = object_class_get_name(oc);
|
|
||||||
info = g_malloc0(sizeof(*info));
|
|
||||||
info->name = g_strndup(typename,
|
|
||||||
strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
|
|
||||||
|
|
||||||
QAPI_LIST_PREPEND(*first, info);
|
|
||||||
}
|
|
||||||
|
|
||||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
|
||||||
{
|
|
||||||
CpuDefinitionInfoList *cpu_list = NULL;
|
|
||||||
GSList *list;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
list = object_class_get_list(TYPE_POWERPC_CPU, false);
|
|
||||||
g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
|
|
||||||
g_slist_free(list);
|
|
||||||
|
|
||||||
for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
|
|
||||||
PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
|
|
||||||
ObjectClass *oc;
|
|
||||||
CpuDefinitionInfo *info;
|
|
||||||
|
|
||||||
oc = ppc_cpu_class_by_name(alias->model);
|
|
||||||
if (oc == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
info = g_malloc0(sizeof(*info));
|
|
||||||
info->name = g_strdup(alias->alias);
|
|
||||||
info->q_typename = g_strdup(object_class_get_name(oc));
|
|
||||||
|
|
||||||
QAPI_LIST_PREPEND(cpu_list, info);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cpu_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ppc_cpu_set_pc(CPUState *cs, vaddr value)
|
static void ppc_cpu_set_pc(CPUState *cs, vaddr value)
|
||||||
{
|
{
|
||||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||||
|
@ -39,7 +39,7 @@ ppc_softmmu_ss.add(files(
|
|||||||
'machine.c',
|
'machine.c',
|
||||||
'mmu-hash32.c',
|
'mmu-hash32.c',
|
||||||
'mmu_common.c',
|
'mmu_common.c',
|
||||||
'monitor.c',
|
'ppc-qmp-cmds.c',
|
||||||
))
|
))
|
||||||
ppc_softmmu_ss.add(when: 'CONFIG_TCG', if_true: files(
|
ppc_softmmu_ss.add(when: 'CONFIG_TCG', if_true: files(
|
||||||
'mmu_helper.c',
|
'mmu_helper.c',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* QEMU monitor
|
* QEMU PPC (monitor definitions)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003-2004 Fabrice Bellard
|
* Copyright (c) 2003-2004 Fabrice Bellard
|
||||||
*
|
*
|
||||||
@ -28,6 +28,9 @@
|
|||||||
#include "qemu/ctype.h"
|
#include "qemu/ctype.h"
|
||||||
#include "monitor/hmp-target.h"
|
#include "monitor/hmp-target.h"
|
||||||
#include "monitor/hmp.h"
|
#include "monitor/hmp.h"
|
||||||
|
#include "qapi/qapi-commands-machine-target.h"
|
||||||
|
#include "cpu-models.h"
|
||||||
|
#include "cpu-qom.h"
|
||||||
|
|
||||||
static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
|
static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
|
||||||
int val)
|
int val)
|
||||||
@ -172,3 +175,48 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval)
|
|||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
|
||||||
|
{
|
||||||
|
ObjectClass *oc = data;
|
||||||
|
CpuDefinitionInfoList **first = user_data;
|
||||||
|
const char *typename;
|
||||||
|
CpuDefinitionInfo *info;
|
||||||
|
|
||||||
|
typename = object_class_get_name(oc);
|
||||||
|
info = g_malloc0(sizeof(*info));
|
||||||
|
info->name = g_strndup(typename,
|
||||||
|
strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
|
||||||
|
|
||||||
|
QAPI_LIST_PREPEND(*first, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||||
|
{
|
||||||
|
CpuDefinitionInfoList *cpu_list = NULL;
|
||||||
|
GSList *list;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
list = object_class_get_list(TYPE_POWERPC_CPU, false);
|
||||||
|
g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
|
||||||
|
g_slist_free(list);
|
||||||
|
|
||||||
|
for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
|
||||||
|
PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
|
||||||
|
ObjectClass *oc;
|
||||||
|
CpuDefinitionInfo *info;
|
||||||
|
|
||||||
|
oc = ppc_cpu_class_by_name(alias->model);
|
||||||
|
if (oc == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
info = g_malloc0(sizeof(*info));
|
||||||
|
info->name = g_strdup(alias->alias);
|
||||||
|
info->q_typename = g_strdup(object_class_get_name(oc));
|
||||||
|
|
||||||
|
QAPI_LIST_PREPEND(cpu_list, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cpu_list;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user