QAPI patches for 2019-02-18
-----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJcara+AAoJEDhwtADrkYZTmU4P/jt4seb0EQZBl/+YpqdyT75m
H8RvJWTbzh7mstSeJNbyeUG9P9hmNB7j9X9uVF978csnqnp9W8x8pK91SnG+hbcI
H6nPh+/tBxTFLdBkxiTbtr7BD4aDVLsspfdD7eT1ZticSYubfNiSd7g0rgIlrR7M
B/OPgE2vt9pKbMGcQoSjBiaui+qnuAnWcpJlHbzsPkaAS9x6U+5tkfA0YbuUgI7k
9CR9HrzZGB2YU1E93CUIE0JntmnRF/RUK1OoiKwZu9nVlcUI5K08RdqMBUTM1m9P
QouCEomzr63UXgSqSE0wCu5efwdluGOqbrDBqjzam6QOn5+Rqbn3krbbcXfY8Bub
fVYMYbeLuGkXbX/Uvyj9YoZRJ8JLvAjkLecuWz27+wEHR3V0CjqoFLCmNYQt8T9R
ti+jj9cWPt40kSoUPMF6QuboORBmTGITS/sy2akq6rMnXxsDeoN1SLdNdYC/4Rax
S9j5mh0gR/YkrWwWO7Ydr7xSF9ciYFltPVEsgxVtZy/biGj52IjpjnGhTST+gJeB
Icd65cs/vgoaN9gX+n0SKf0mna162aysw3DMT4hKO42iBVQ+P0c37j1xv80pXgdw
THMJcOJFJ/PGUWpWHl/Q0wr5RkUqRpHcVp9NvssYOsbQgMA8YH+/2NV4yoJ7TIK5
JLrDXbKvl18myezVKtz8
=pNCA
-----END PGP SIGNATURE-----
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-02-18' into staging
QAPI patches for 2019-02-18
# gpg: Signature made Mon 18 Feb 2019 13:44:30 GMT
# gpg: using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-qapi-2019-02-18:
qapi: move RTC_CHANGE to the target schema
qmp: Deprecate query-events in favor of query-qmp-schema
Revert "qapi-events: add 'if' condition to implicit event enum"
qapi: remove qmp_unregister_command()
qapi: make query-cpu-definitions depend on specific targets
qapi: make query-cpu-model-expansion depend on s390 or x86
qapi: make query-gic-capabilities depend on TARGET_ARM
target.json: add a note about query-cpu* not being s390x-specific
qapi: make s390 commands depend on TARGET_S390X
qapi: make rtc-reset-reinjection and SEV depend on TARGET_I386
qapi: New module target.json
build: Deal with all of QAPI's .o in qapi/Makefile.objs
build-sys: move qmp-introspect per target
qapi: Generate QAPIEvent stuff into separate files
qapi: Prepare for system modules other than 'builtin'
qapi: Clean up modular built-in code generation a bit
qapi: Fix up documentation for recent commit a95291007b
qapi: Belatedly document modular code generation
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
a0430dd8ab
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,6 +32,7 @@
|
||||
/qapi/qapi-builtin-visit.[ch]
|
||||
/qapi/qapi-commands-*.[ch]
|
||||
/qapi/qapi-commands.[ch]
|
||||
/qapi/qapi-emit-events.[ch]
|
||||
/qapi/qapi-events-*.[ch]
|
||||
/qapi/qapi-events.[ch]
|
||||
/qapi/qapi-introspect.[ch]
|
||||
|
2
Makefile
2
Makefile
@ -89,7 +89,6 @@ include $(SRC_PATH)/rules.mak
|
||||
|
||||
GENERATED_FILES = qemu-version.h config-host.h qemu-options.def
|
||||
|
||||
#see Makefile.objs for the definition of QAPI_MODULES
|
||||
GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
|
||||
GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
|
||||
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
|
||||
@ -101,6 +100,7 @@ GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
|
||||
GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
|
||||
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
|
||||
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c)
|
||||
GENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c
|
||||
GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c
|
||||
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h)
|
||||
GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c)
|
||||
|
@ -1,20 +1,7 @@
|
||||
QAPI_MODULES = block-core block char common crypto introspect job migration
|
||||
QAPI_MODULES += misc net rdma rocker run-state sockets tpm trace transaction
|
||||
QAPI_MODULES += ui
|
||||
|
||||
#######################################################################
|
||||
# Common libraries for tools and emulators
|
||||
stub-obj-y = stubs/ crypto/
|
||||
util-obj-y = util/ qobject/ qapi/
|
||||
util-obj-y += qapi/qapi-builtin-types.o
|
||||
util-obj-y += qapi/qapi-types.o
|
||||
util-obj-y += $(QAPI_MODULES:%=qapi/qapi-types-%.o)
|
||||
util-obj-y += qapi/qapi-builtin-visit.o
|
||||
util-obj-y += qapi/qapi-visit.o
|
||||
util-obj-y += $(QAPI_MODULES:%=qapi/qapi-visit-%.o)
|
||||
util-obj-y += qapi/qapi-events.o
|
||||
util-obj-y += $(QAPI_MODULES:%=qapi/qapi-events-%.o)
|
||||
util-obj-y += qapi/qapi-introspect.o
|
||||
|
||||
chardev-obj-y = chardev/
|
||||
slirp-obj-$(CONFIG_SLIRP) = slirp/
|
||||
@ -92,10 +79,8 @@ common-obj-$(CONFIG_FDT) += device_tree.o
|
||||
######################################################################
|
||||
# qapi
|
||||
|
||||
common-obj-y += qapi/qapi-commands.o
|
||||
common-obj-y += $(QAPI_MODULES:%=qapi/qapi-commands-%.o)
|
||||
common-obj-y += qapi/qapi-introspect.o
|
||||
common-obj-y += qmp.o hmp.o
|
||||
common-obj-y += qapi/
|
||||
endif
|
||||
|
||||
#######################################################################
|
||||
|
@ -148,6 +148,7 @@ ifdef CONFIG_SOFTMMU
|
||||
obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
|
||||
obj-y += qtest.o
|
||||
obj-y += hw/
|
||||
obj-y += qapi/
|
||||
obj-y += memory.o
|
||||
obj-y += memory_mapping.o
|
||||
obj-y += dump.o
|
||||
|
@ -1113,6 +1113,19 @@ Example:
|
||||
|
||||
[Uninteresting stuff omitted...]
|
||||
|
||||
For a modular QAPI schema (see section Include directives), code for
|
||||
each sub-module SUBDIR/SUBMODULE.json is actually generated into
|
||||
|
||||
SUBDIR/$(prefix)qapi-types-SUBMODULE.h
|
||||
SUBDIR/$(prefix)qapi-types-SUBMODULE.c
|
||||
|
||||
If qapi-gen.py is run with option --builtins, additional files are
|
||||
created:
|
||||
|
||||
qapi-builtin-types.h - C types corresponding to built-in types
|
||||
|
||||
qapi-builtin-types.c - Cleanup functions for the above C types
|
||||
|
||||
=== Code generated for visiting QAPI types ===
|
||||
|
||||
These are the visitor functions used to walk through and convert
|
||||
@ -1244,6 +1257,19 @@ Example:
|
||||
|
||||
[Uninteresting stuff omitted...]
|
||||
|
||||
For a modular QAPI schema (see section Include directives), code for
|
||||
each sub-module SUBDIR/SUBMODULE.json is actually generated into
|
||||
|
||||
SUBDIR/$(prefix)qapi-visit-SUBMODULE.h
|
||||
SUBDIR/$(prefix)qapi-visit-SUBMODULE.c
|
||||
|
||||
If qapi-gen.py is run with option --builtins, additional files are
|
||||
created:
|
||||
|
||||
qapi-builtin-visit.h - Visitor functions for built-in types
|
||||
|
||||
qapi-builtin-visit.c - Declarations for these visitor functions
|
||||
|
||||
=== Code generated for commands ===
|
||||
|
||||
These are the marshaling/dispatch functions for the commands defined
|
||||
@ -1342,6 +1368,12 @@ Example:
|
||||
|
||||
[Uninteresting stuff omitted...]
|
||||
|
||||
For a modular QAPI schema (see section Include directives), code for
|
||||
each sub-module SUBDIR/SUBMODULE.json is actually generated into
|
||||
|
||||
SUBDIR/$(prefix)qapi-commands-SUBMODULE.h
|
||||
SUBDIR/$(prefix)qapi-commands-SUBMODULE.c
|
||||
|
||||
=== Code generated for events ===
|
||||
|
||||
This is the code related to events defined in the schema, providing
|
||||
@ -1349,11 +1381,15 @@ qapi_event_send_EVENT().
|
||||
|
||||
The following files are created:
|
||||
|
||||
$(prefix)qapi-events.h - Function prototypes for each event type, plus an
|
||||
enumeration of all event names
|
||||
$(prefix)qapi-events.h - Function prototypes for each event type
|
||||
|
||||
$(prefix)qapi-events.c - Implementation of functions to send an event
|
||||
|
||||
$(prefix)qapi-emit-events.h - Enumeration of all event names, and
|
||||
common event code declarations
|
||||
|
||||
$(prefix)qapi-emit-events.c - Common event code definitions
|
||||
|
||||
Example:
|
||||
|
||||
$ cat qapi-generated/example-qapi-events.h
|
||||
@ -1365,19 +1401,8 @@ Example:
|
||||
#include "qapi/util.h"
|
||||
#include "example-qapi-types.h"
|
||||
|
||||
|
||||
void qapi_event_send_my_event(void);
|
||||
|
||||
typedef enum example_QAPIEvent {
|
||||
EXAMPLE_QAPI_EVENT_MY_EVENT,
|
||||
EXAMPLE_QAPI_EVENT__MAX,
|
||||
} example_QAPIEvent;
|
||||
|
||||
#define example_QAPIEvent_str(val) \
|
||||
qapi_enum_lookup(&example_QAPIEvent_lookup, (val))
|
||||
|
||||
extern const QEnumLookup example_QAPIEvent_lookup;
|
||||
|
||||
#endif /* EXAMPLE_QAPI_EVENTS_H */
|
||||
$ cat qapi-generated/example-qapi-events.c
|
||||
[Uninteresting stuff omitted...]
|
||||
@ -1393,6 +1418,31 @@ Example:
|
||||
qobject_unref(qmp);
|
||||
}
|
||||
|
||||
[Uninteresting stuff omitted...]
|
||||
$ cat qapi-generated/example-qapi-emit-events.h
|
||||
[Uninteresting stuff omitted...]
|
||||
|
||||
#ifndef EXAMPLE_QAPI_EMIT_EVENTS_H
|
||||
#define EXAMPLE_QAPI_EMIT_EVENTS_H
|
||||
|
||||
#include "qapi/util.h"
|
||||
|
||||
typedef enum example_QAPIEvent {
|
||||
EXAMPLE_QAPI_EVENT_MY_EVENT,
|
||||
EXAMPLE_QAPI_EVENT__MAX,
|
||||
} example_QAPIEvent;
|
||||
|
||||
#define example_QAPIEvent_str(val) \
|
||||
qapi_enum_lookup(&example_QAPIEvent_lookup, (val))
|
||||
|
||||
extern const QEnumLookup example_QAPIEvent_lookup;
|
||||
|
||||
void example_qapi_event_emit(example_QAPIEvent event, QDict *qdict);
|
||||
|
||||
#endif /* EXAMPLE_QAPI_EMIT_EVENTS_H */
|
||||
$ cat qapi-generated/example-qapi-emit-events.c
|
||||
[Uninteresting stuff omitted...]
|
||||
|
||||
const QEnumLookup example_QAPIEvent_lookup = {
|
||||
.array = (const char *const[]) {
|
||||
[EXAMPLE_QAPI_EVENT_MY_EVENT] = "MY_EVENT",
|
||||
@ -1402,6 +1452,12 @@ Example:
|
||||
|
||||
[Uninteresting stuff omitted...]
|
||||
|
||||
For a modular QAPI schema (see section Include directives), code for
|
||||
each sub-module SUBDIR/SUBMODULE.json is actually generated into
|
||||
|
||||
SUBDIR/$(prefix)qapi-events-SUBMODULE.h
|
||||
SUBDIR/$(prefix)qapi-events-SUBMODULE.c
|
||||
|
||||
=== Code generated for introspection ===
|
||||
|
||||
The following files are created:
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/ppc/spapr.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-events-misc.h"
|
||||
#include "qapi/qapi-events-target.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
void spapr_rtc_read(sPAPRRTCState *rtc, struct tm *tm, uint32_t *ns)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "hw/boards.h"
|
||||
#include "hw/s390x/storage-keys.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qapi-commands-target.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/kvm.h"
|
||||
|
@ -31,8 +31,8 @@
|
||||
#include "sysemu/replay.h"
|
||||
#include "hw/timer/mc146818rtc.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qapi-events-misc.h"
|
||||
#include "qapi/qapi-commands-target.h"
|
||||
#include "qapi/qapi-events-target.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "exec/address-spaces.h"
|
||||
|
||||
|
@ -39,7 +39,6 @@ typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList;
|
||||
|
||||
void qmp_register_command(QmpCommandList *cmds, const char *name,
|
||||
QmpCommandFunc *fn, QmpCommandOptions options);
|
||||
void qmp_unregister_command(QmpCommandList *cmds, const char *name);
|
||||
QmpCommand *qmp_find_command(QmpCommandList *cmds, const char *name);
|
||||
void qmp_disable_command(QmpCommandList *cmds, const char *name);
|
||||
void qmp_enable_command(QmpCommandList *cmds, const char *name);
|
||||
|
@ -32,15 +32,4 @@ extern const uint32_t arch_type;
|
||||
int kvm_available(void);
|
||||
int xen_available(void);
|
||||
|
||||
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp);
|
||||
CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type,
|
||||
CpuModelInfo *mode,
|
||||
Error **errp);
|
||||
CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela,
|
||||
CpuModelInfo *modelb,
|
||||
Error **errp);
|
||||
CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *modela,
|
||||
CpuModelInfo *modelb,
|
||||
Error **errp);
|
||||
|
||||
#endif
|
||||
|
88
monitor.c
88
monitor.c
@ -75,7 +75,7 @@
|
||||
#include "qemu/thread.h"
|
||||
#include "block/qapi.h"
|
||||
#include "qapi/qapi-commands.h"
|
||||
#include "qapi/qapi-events.h"
|
||||
#include "qapi/qapi-emit-events.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp-event.h"
|
||||
#include "qapi/qapi-introspect.h"
|
||||
@ -1099,6 +1099,11 @@ CommandInfoList *qmp_query_commands(Error **errp)
|
||||
|
||||
EventInfoList *qmp_query_events(Error **errp)
|
||||
{
|
||||
/*
|
||||
* TODO This deprecated command is the only user of
|
||||
* QAPIEvent_str() and QAPIEvent_lookup[]. When the command goes,
|
||||
* they should go, too.
|
||||
*/
|
||||
EventInfoList *info, *ev_list = NULL;
|
||||
QAPIEvent e;
|
||||
|
||||
@ -1131,45 +1136,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,
|
||||
*ret_data = qobject_from_qlit(&qmp_schema_qlit);
|
||||
}
|
||||
|
||||
/*
|
||||
* We used to define commands in qmp-commands.hx in addition to the
|
||||
* QAPI schema. This permitted defining some of them only in certain
|
||||
* configurations. query-commands has always reflected that (good,
|
||||
* because it lets QMP clients figure out what's actually available),
|
||||
* while query-qmp-schema never did (not so good). This function is a
|
||||
* hack to keep the configuration-specific commands defined exactly as
|
||||
* before, even though qmp-commands.hx is gone.
|
||||
*
|
||||
* FIXME Educate the QAPI schema on configuration-specific commands,
|
||||
* and drop this hack.
|
||||
*/
|
||||
static void qmp_unregister_commands_hack(void)
|
||||
{
|
||||
#ifndef TARGET_I386
|
||||
qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection");
|
||||
qmp_unregister_command(&qmp_commands, "query-sev");
|
||||
qmp_unregister_command(&qmp_commands, "query-sev-launch-measure");
|
||||
qmp_unregister_command(&qmp_commands, "query-sev-capabilities");
|
||||
#endif
|
||||
#ifndef TARGET_S390X
|
||||
qmp_unregister_command(&qmp_commands, "dump-skeys");
|
||||
#endif
|
||||
#ifndef TARGET_ARM
|
||||
qmp_unregister_command(&qmp_commands, "query-gic-capabilities");
|
||||
#endif
|
||||
#if !defined(TARGET_S390X) && !defined(TARGET_I386)
|
||||
qmp_unregister_command(&qmp_commands, "query-cpu-model-expansion");
|
||||
#endif
|
||||
#if !defined(TARGET_S390X)
|
||||
qmp_unregister_command(&qmp_commands, "query-cpu-model-baseline");
|
||||
qmp_unregister_command(&qmp_commands, "query-cpu-model-comparison");
|
||||
#endif
|
||||
#if !defined(TARGET_PPC) && !defined(TARGET_ARM) && !defined(TARGET_I386) \
|
||||
&& !defined(TARGET_S390X)
|
||||
qmp_unregister_command(&qmp_commands, "query-cpu-definitions");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void monitor_init_qmp_commands(void)
|
||||
{
|
||||
/*
|
||||
@ -1188,8 +1154,6 @@ static void monitor_init_qmp_commands(void)
|
||||
qmp_register_command(&qmp_commands, "netdev_add", qmp_netdev_add,
|
||||
QCO_NO_OPTIONS);
|
||||
|
||||
qmp_unregister_commands_hack();
|
||||
|
||||
QTAILQ_INIT(&qmp_cap_negotiation_commands);
|
||||
qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities",
|
||||
qmp_marshal_qmp_capabilities, QCO_ALLOW_PRECONFIG);
|
||||
@ -4670,46 +4634,6 @@ QemuOptsList qemu_mon_opts = {
|
||||
},
|
||||
};
|
||||
|
||||
#ifndef TARGET_I386
|
||||
void qmp_rtc_reset_reinjection(Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rtc-reset-reinjection");
|
||||
}
|
||||
|
||||
SevInfo *qmp_query_sev(Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "query-sev");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-launch-measure");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SevCapability *qmp_query_sev_capabilities(Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-capabilities");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef TARGET_S390X
|
||||
void qmp_dump_skeys(const char *filename, Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "dump-skeys");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef TARGET_ARM
|
||||
GICCapabilityList *qmp_query_gic_capabilities(Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "query-gic-capabilities");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
|
@ -4,3 +4,28 @@ util-obj-y += string-input-visitor.o string-output-visitor.o
|
||||
util-obj-y += opts-visitor.o qapi-clone-visitor.o
|
||||
util-obj-y += qmp-event.o
|
||||
util-obj-y += qapi-util.o
|
||||
|
||||
QAPI_COMMON_MODULES = block-core block char common crypto introspect
|
||||
QAPI_COMMON_MODULES += job migration misc net rdma rocker run-state
|
||||
QAPI_COMMON_MODULES += sockets tpm trace transaction ui
|
||||
QAPI_TARGET_MODULES = target
|
||||
QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
|
||||
|
||||
util-obj-y += qapi-builtin-types.o
|
||||
util-obj-y += $(QAPI_COMMON_MODULES:%=qapi-types-%.o)
|
||||
util-obj-y += qapi-builtin-visit.o
|
||||
util-obj-y += $(QAPI_COMMON_MODULES:%=qapi-visit-%.o)
|
||||
util-obj-y += qapi-emit-events.o
|
||||
util-obj-y += $(QAPI_COMMON_MODULES:%=qapi-events-%.o)
|
||||
|
||||
common-obj-y = $(QAPI_COMMON_MODULES:%=qapi-commands-%.o)
|
||||
|
||||
obj-y = qapi-introspect.o
|
||||
obj-y += $(QAPI_TARGET_MODULES:%=qapi-types-%.o)
|
||||
obj-y += qapi-types.o
|
||||
obj-y += $(QAPI_TARGET_MODULES:%=qapi-visit-%.o)
|
||||
obj-y += qapi-visit.o
|
||||
obj-y += $(QAPI_TARGET_MODULES:%=qapi-events-%.o)
|
||||
obj-y += qapi-events.o
|
||||
obj-y += $(QAPI_TARGET_MODULES:%=qapi-commands-%.o)
|
||||
obj-y += qapi-commands.o
|
||||
|
485
qapi/misc.json
485
qapi/misc.json
@ -318,12 +318,15 @@
|
||||
##
|
||||
# @query-events:
|
||||
#
|
||||
# Return a list of supported QMP events by this server
|
||||
# Return information on QMP events.
|
||||
#
|
||||
# Returns: A list of @EventInfo for all supported events
|
||||
# Returns: A list of @EventInfo.
|
||||
#
|
||||
# Since: 1.2.0
|
||||
#
|
||||
# Note: This command is deprecated, because its output doesn't reflect
|
||||
# compile-time configuration. Use query-qmp-schema instead.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-events" }
|
||||
@ -1907,27 +1910,6 @@
|
||||
{ 'command': 'query-dump-guest-memory-capability',
|
||||
'returns': 'DumpGuestMemoryCapability' }
|
||||
|
||||
##
|
||||
# @dump-skeys:
|
||||
#
|
||||
# Dump guest's storage keys
|
||||
#
|
||||
# @filename: the path to the file to dump to
|
||||
#
|
||||
# This command is only supported on s390 architecture.
|
||||
#
|
||||
# Since: 2.5
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "dump-skeys",
|
||||
# "arguments": { "filename": "/tmp/skeys" } }
|
||||
# <- { "return": {} }
|
||||
#
|
||||
##
|
||||
{ 'command': 'dump-skeys',
|
||||
'data': { 'filename': 'str' } }
|
||||
|
||||
##
|
||||
# @object-add:
|
||||
#
|
||||
@ -2078,54 +2060,6 @@
|
||||
##
|
||||
{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
|
||||
|
||||
##
|
||||
# @CpuDefinitionInfo:
|
||||
#
|
||||
# Virtual CPU definition.
|
||||
#
|
||||
# @name: the name of the CPU definition
|
||||
#
|
||||
# @migration-safe: whether a CPU definition can be safely used for
|
||||
# migration in combination with a QEMU compatibility machine
|
||||
# when migrating between different QEMU versions and between
|
||||
# hosts with different sets of (hardware or software)
|
||||
# capabilities. If not provided, information is not available
|
||||
# and callers should not assume the CPU definition to be
|
||||
# migration-safe. (since 2.8)
|
||||
#
|
||||
# @static: whether a CPU definition is static and will not change depending on
|
||||
# QEMU version, machine type, machine options and accelerator options.
|
||||
# A static model is always migration-safe. (since 2.8)
|
||||
#
|
||||
# @unavailable-features: List of properties that prevent
|
||||
# the CPU model from running in the current
|
||||
# host. (since 2.8)
|
||||
# @typename: Type name that can be used as argument to @device-list-properties,
|
||||
# to introspect properties configurable using -cpu or -global.
|
||||
# (since 2.9)
|
||||
#
|
||||
# @unavailable-features is a list of QOM property names that
|
||||
# represent CPU model attributes that prevent the CPU from running.
|
||||
# If the QOM property is read-only, that means there's no known
|
||||
# way to make the CPU model run in the current host. Implementations
|
||||
# that choose not to provide specific information return the
|
||||
# property name "type".
|
||||
# If the property is read-write, it means that it MAY be possible
|
||||
# to run the CPU model in the current host if that property is
|
||||
# changed. Management software can use it as hints to suggest or
|
||||
# choose an alternative for the user, or just to generate meaningful
|
||||
# error messages explaining why the CPU model can't be used.
|
||||
# If @unavailable-features is an empty list, the CPU model is
|
||||
# runnable using the current host and machine-type.
|
||||
# If @unavailable-features is not present, runnability
|
||||
# information for the CPU is not available.
|
||||
#
|
||||
# Since: 1.2.0
|
||||
##
|
||||
{ 'struct': 'CpuDefinitionInfo',
|
||||
'data': { 'name': 'str', '*migration-safe': 'bool', 'static': 'bool',
|
||||
'*unavailable-features': [ 'str' ], 'typename': 'str' } }
|
||||
|
||||
##
|
||||
# @MemoryInfo:
|
||||
#
|
||||
@ -2158,16 +2092,6 @@
|
||||
##
|
||||
{ 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' }
|
||||
|
||||
##
|
||||
# @query-cpu-definitions:
|
||||
#
|
||||
# Return a list of supported virtual CPU definitions
|
||||
#
|
||||
# Returns: a list of CpuDefInfo
|
||||
#
|
||||
# Since: 1.2.0
|
||||
##
|
||||
{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }
|
||||
|
||||
##
|
||||
# @CpuModelInfo:
|
||||
@ -2220,57 +2144,6 @@
|
||||
'data': [ 'static', 'full' ] }
|
||||
|
||||
|
||||
##
|
||||
# @CpuModelExpansionInfo:
|
||||
#
|
||||
# The result of a cpu model expansion.
|
||||
#
|
||||
# @model: the expanded CpuModelInfo.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'struct': 'CpuModelExpansionInfo',
|
||||
'data': { 'model': 'CpuModelInfo' } }
|
||||
|
||||
|
||||
##
|
||||
# @query-cpu-model-expansion:
|
||||
#
|
||||
# Expands a given CPU model (or a combination of CPU model + additional options)
|
||||
# to different granularities, allowing tooling to get an understanding what a
|
||||
# specific CPU model looks like in QEMU under a certain configuration.
|
||||
#
|
||||
# This interface can be used to query the "host" CPU model.
|
||||
#
|
||||
# The data returned by this command may be affected by:
|
||||
#
|
||||
# * QEMU version: CPU models may look different depending on the QEMU version.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine-type: CPU model may look different depending on the machine-type.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine options (including accelerator): in some architectures, CPU models
|
||||
# may look different depending on machine and accelerator options. (Except for
|
||||
# CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * "-cpu" arguments and global properties: arguments to the -cpu option and
|
||||
# global properties may affect expansion of CPU models. Using
|
||||
# query-cpu-model-expansion while using these is not advised.
|
||||
#
|
||||
# Some architectures may not support all expansion types. s390x supports
|
||||
# "full" and "static".
|
||||
#
|
||||
# Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU models is
|
||||
# not supported, if the model cannot be expanded, if the model contains
|
||||
# an unknown CPU definition name, unknown properties or properties
|
||||
# with a wrong type. Also returns an error if an expansion type is
|
||||
# not supported.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'command': 'query-cpu-model-expansion',
|
||||
'data': { 'type': 'CpuModelExpansionType',
|
||||
'model': 'CpuModelInfo' },
|
||||
'returns': 'CpuModelExpansionInfo' }
|
||||
|
||||
##
|
||||
# @CpuModelCompareResult:
|
||||
#
|
||||
@ -2294,122 +2167,6 @@
|
||||
{ 'enum': 'CpuModelCompareResult',
|
||||
'data': [ 'incompatible', 'identical', 'superset', 'subset' ] }
|
||||
|
||||
##
|
||||
# @CpuModelCompareInfo:
|
||||
#
|
||||
# The result of a CPU model comparison.
|
||||
#
|
||||
# @result: The result of the compare operation.
|
||||
# @responsible-properties: List of properties that led to the comparison result
|
||||
# not being identical.
|
||||
#
|
||||
# @responsible-properties is a list of QOM property names that led to
|
||||
# both CPUs not being detected as identical. For identical models, this
|
||||
# list is empty.
|
||||
# If a QOM property is read-only, that means there's no known way to make the
|
||||
# CPU models identical. If the special property name "type" is included, the
|
||||
# models are by definition not identical and cannot be made identical.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'struct': 'CpuModelCompareInfo',
|
||||
'data': {'result': 'CpuModelCompareResult',
|
||||
'responsible-properties': ['str']
|
||||
}
|
||||
}
|
||||
|
||||
##
|
||||
# @query-cpu-model-comparison:
|
||||
#
|
||||
# Compares two CPU models, returning how they compare in a specific
|
||||
# configuration. The results indicates how both models compare regarding
|
||||
# runnability. This result can be used by tooling to make decisions if a
|
||||
# certain CPU model will run in a certain configuration or if a compatible
|
||||
# CPU model has to be created by baselining.
|
||||
#
|
||||
# Usually, a CPU model is compared against the maximum possible CPU model
|
||||
# of a certain configuration (e.g. the "host" model for KVM). If that CPU
|
||||
# model is identical or a subset, it will run in that configuration.
|
||||
#
|
||||
# The result returned by this command may be affected by:
|
||||
#
|
||||
# * QEMU version: CPU models may look different depending on the QEMU version.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine-type: CPU model may look different depending on the machine-type.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine options (including accelerator): in some architectures, CPU models
|
||||
# may look different depending on machine and accelerator options. (Except for
|
||||
# CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * "-cpu" arguments and global properties: arguments to the -cpu option and
|
||||
# global properties may affect expansion of CPU models. Using
|
||||
# query-cpu-model-expansion while using these is not advised.
|
||||
#
|
||||
# Some architectures may not support comparing CPU models. s390x supports
|
||||
# comparing CPU models.
|
||||
#
|
||||
# Returns: a CpuModelBaselineInfo. Returns an error if comparing CPU models is
|
||||
# not supported, if a model cannot be used, if a model contains
|
||||
# an unknown cpu definition name, unknown properties or properties
|
||||
# with wrong types.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'command': 'query-cpu-model-comparison',
|
||||
'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
|
||||
'returns': 'CpuModelCompareInfo' }
|
||||
|
||||
##
|
||||
# @CpuModelBaselineInfo:
|
||||
#
|
||||
# The result of a CPU model baseline.
|
||||
#
|
||||
# @model: the baselined CpuModelInfo.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'struct': 'CpuModelBaselineInfo',
|
||||
'data': { 'model': 'CpuModelInfo' } }
|
||||
|
||||
##
|
||||
# @query-cpu-model-baseline:
|
||||
#
|
||||
# Baseline two CPU models, creating a compatible third model. The created
|
||||
# model will always be a static, migration-safe CPU model (see "static"
|
||||
# CPU model expansion for details).
|
||||
#
|
||||
# This interface can be used by tooling to create a compatible CPU model out
|
||||
# two CPU models. The created CPU model will be identical to or a subset of
|
||||
# both CPU models when comparing them. Therefore, the created CPU model is
|
||||
# guaranteed to run where the given CPU models run.
|
||||
#
|
||||
# The result returned by this command may be affected by:
|
||||
#
|
||||
# * QEMU version: CPU models may look different depending on the QEMU version.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine-type: CPU model may look different depending on the machine-type.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine options (including accelerator): in some architectures, CPU models
|
||||
# may look different depending on machine and accelerator options. (Except for
|
||||
# CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * "-cpu" arguments and global properties: arguments to the -cpu option and
|
||||
# global properties may affect expansion of CPU models. Using
|
||||
# query-cpu-model-expansion while using these is not advised.
|
||||
#
|
||||
# Some architectures may not support baselining CPU models. s390x supports
|
||||
# baselining CPU models.
|
||||
#
|
||||
# Returns: a CpuModelBaselineInfo. Returns an error if baselining CPU models is
|
||||
# not supported, if a model cannot be used, if a model contains
|
||||
# an unknown cpu definition name, unknown properties or properties
|
||||
# with wrong types.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'command': 'query-cpu-model-baseline',
|
||||
'data': { 'modela': 'CpuModelInfo',
|
||||
'modelb': 'CpuModelInfo' },
|
||||
'returns': 'CpuModelBaselineInfo' }
|
||||
|
||||
##
|
||||
# @AddfdInfo:
|
||||
#
|
||||
@ -3119,47 +2876,6 @@
|
||||
{ 'event': 'ACPI_DEVICE_OST',
|
||||
'data': { 'info': 'ACPIOSTInfo' } }
|
||||
|
||||
##
|
||||
# @rtc-reset-reinjection:
|
||||
#
|
||||
# This command will reset the RTC interrupt reinjection backlog.
|
||||
# Can be used if another mechanism to synchronize guest time
|
||||
# is in effect, for example QEMU guest agent's guest-set-time
|
||||
# command.
|
||||
#
|
||||
# Since: 2.1
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "rtc-reset-reinjection" }
|
||||
# <- { "return": {} }
|
||||
#
|
||||
##
|
||||
{ 'command': 'rtc-reset-reinjection' }
|
||||
|
||||
##
|
||||
# @RTC_CHANGE:
|
||||
#
|
||||
# Emitted when the guest changes the RTC time.
|
||||
#
|
||||
# @offset: offset between base RTC clock (as specified by -rtc base), and
|
||||
# new RTC clock value. Note that value will be different depending
|
||||
# on clock chosen to drive RTC (specified by -rtc clock).
|
||||
#
|
||||
# Note: This event is rate-limited.
|
||||
#
|
||||
# Since: 0.13.0
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# <- { "event": "RTC_CHANGE",
|
||||
# "data": { "offset": 78 },
|
||||
# "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
|
||||
#
|
||||
##
|
||||
{ 'event': 'RTC_CHANGE',
|
||||
'data': { 'offset': 'int' } }
|
||||
|
||||
##
|
||||
# @ReplayMode:
|
||||
#
|
||||
@ -3199,49 +2915,6 @@
|
||||
##
|
||||
{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
|
||||
|
||||
##
|
||||
# @GICCapability:
|
||||
#
|
||||
# The struct describes capability for a specific GIC (Generic
|
||||
# Interrupt Controller) version. These bits are not only decided by
|
||||
# QEMU/KVM software version, but also decided by the hardware that
|
||||
# the program is running upon.
|
||||
#
|
||||
# @version: version of GIC to be described. Currently, only 2 and 3
|
||||
# are supported.
|
||||
#
|
||||
# @emulated: whether current QEMU/hardware supports emulated GIC
|
||||
# device in user space.
|
||||
#
|
||||
# @kernel: whether current QEMU/hardware supports hardware
|
||||
# accelerated GIC device in kernel.
|
||||
#
|
||||
# Since: 2.6
|
||||
##
|
||||
{ 'struct': 'GICCapability',
|
||||
'data': { 'version': 'int',
|
||||
'emulated': 'bool',
|
||||
'kernel': 'bool' } }
|
||||
|
||||
##
|
||||
# @query-gic-capabilities:
|
||||
#
|
||||
# This command is ARM-only. It will return a list of GICCapability
|
||||
# objects that describe its capability bits.
|
||||
#
|
||||
# Returns: a list of GICCapability objects.
|
||||
#
|
||||
# Since: 2.6
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-gic-capabilities" }
|
||||
# <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
|
||||
# { "version": 3, "emulated": false, "kernel": true } ] }
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'] }
|
||||
|
||||
##
|
||||
# @CpuInstanceProperties:
|
||||
#
|
||||
@ -3365,154 +3038,6 @@
|
||||
##
|
||||
{ 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' }
|
||||
|
||||
|
||||
##
|
||||
# @SevState:
|
||||
#
|
||||
# An enumeration of SEV state information used during @query-sev.
|
||||
#
|
||||
# @uninit: The guest is uninitialized.
|
||||
#
|
||||
# @launch-update: The guest is currently being launched; plaintext data and
|
||||
# register state is being imported.
|
||||
#
|
||||
# @launch-secret: The guest is currently being launched; ciphertext data
|
||||
# is being imported.
|
||||
#
|
||||
# @running: The guest is fully launched or migrated in.
|
||||
#
|
||||
# @send-update: The guest is currently being migrated out to another machine.
|
||||
#
|
||||
# @receive-update: The guest is currently being migrated from another machine.
|
||||
#
|
||||
# Since: 2.12
|
||||
##
|
||||
{ 'enum': 'SevState',
|
||||
'data': ['uninit', 'launch-update', 'launch-secret', 'running',
|
||||
'send-update', 'receive-update' ] }
|
||||
|
||||
##
|
||||
# @SevInfo:
|
||||
#
|
||||
# Information about Secure Encrypted Virtualization (SEV) support
|
||||
#
|
||||
# @enabled: true if SEV is active
|
||||
#
|
||||
# @api-major: SEV API major version
|
||||
#
|
||||
# @api-minor: SEV API minor version
|
||||
#
|
||||
# @build-id: SEV FW build id
|
||||
#
|
||||
# @policy: SEV policy value
|
||||
#
|
||||
# @state: SEV guest state
|
||||
#
|
||||
# @handle: SEV firmware handle
|
||||
#
|
||||
# Since: 2.12
|
||||
##
|
||||
{ 'struct': 'SevInfo',
|
||||
'data': { 'enabled': 'bool',
|
||||
'api-major': 'uint8',
|
||||
'api-minor' : 'uint8',
|
||||
'build-id' : 'uint8',
|
||||
'policy' : 'uint32',
|
||||
'state' : 'SevState',
|
||||
'handle' : 'uint32'
|
||||
}
|
||||
}
|
||||
|
||||
##
|
||||
# @query-sev:
|
||||
#
|
||||
# Returns information about SEV
|
||||
#
|
||||
# Returns: @SevInfo
|
||||
#
|
||||
# Since: 2.12
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-sev" }
|
||||
# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0,
|
||||
# "build-id" : 0, "policy" : 0, "state" : "running",
|
||||
# "handle" : 1 } }
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-sev', 'returns': 'SevInfo' }
|
||||
|
||||
##
|
||||
# @SevLaunchMeasureInfo:
|
||||
#
|
||||
# SEV Guest Launch measurement information
|
||||
#
|
||||
# @data: the measurement value encoded in base64
|
||||
#
|
||||
# Since: 2.12
|
||||
#
|
||||
##
|
||||
{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'} }
|
||||
|
||||
##
|
||||
# @query-sev-launch-measure:
|
||||
#
|
||||
# Query the SEV guest launch information.
|
||||
#
|
||||
# Returns: The @SevLaunchMeasureInfo for the guest
|
||||
#
|
||||
# Since: 2.12
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-sev-launch-measure" }
|
||||
# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } }
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' }
|
||||
|
||||
##
|
||||
# @SevCapability:
|
||||
#
|
||||
# The struct describes capability for a Secure Encrypted Virtualization
|
||||
# feature.
|
||||
#
|
||||
# @pdh: Platform Diffie-Hellman key (base64 encoded)
|
||||
#
|
||||
# @cert-chain: PDH certificate chain (base64 encoded)
|
||||
#
|
||||
# @cbitpos: C-bit location in page table entry
|
||||
#
|
||||
# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
|
||||
# enabled
|
||||
#
|
||||
# Since: 2.12
|
||||
##
|
||||
{ 'struct': 'SevCapability',
|
||||
'data': { 'pdh': 'str',
|
||||
'cert-chain': 'str',
|
||||
'cbitpos': 'int',
|
||||
'reduced-phys-bits': 'int'} }
|
||||
|
||||
##
|
||||
# @query-sev-capabilities:
|
||||
#
|
||||
# This command is used to get the SEV capabilities, and is supported on AMD
|
||||
# X86 platforms only.
|
||||
#
|
||||
# Returns: SevCapability objects.
|
||||
#
|
||||
# Since: 2.12
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-sev-capabilities" }
|
||||
# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
|
||||
# "cbitpos": 47, "reduced-phys-bits": 5}}
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability' }
|
||||
|
||||
##
|
||||
# @set-numa-node:
|
||||
#
|
||||
|
@ -97,3 +97,4 @@
|
||||
{ 'include': 'trace.json' }
|
||||
{ 'include': 'introspect.json' }
|
||||
{ 'include': 'misc.json' }
|
||||
{ 'include': 'target.json' }
|
||||
|
@ -27,14 +27,6 @@ void qmp_register_command(QmpCommandList *cmds, const char *name,
|
||||
QTAILQ_INSERT_TAIL(cmds, cmd, node);
|
||||
}
|
||||
|
||||
void qmp_unregister_command(QmpCommandList *cmds, const char *name)
|
||||
{
|
||||
QmpCommand *cmd = qmp_find_command(cmds, name);
|
||||
|
||||
QTAILQ_REMOVE(cmds, cmd, node);
|
||||
g_free(cmd);
|
||||
}
|
||||
|
||||
QmpCommand *qmp_find_command(QmpCommandList *cmds, const char *name)
|
||||
{
|
||||
QmpCommand *cmd;
|
||||
|
514
qapi/target.json
Normal file
514
qapi/target.json
Normal file
@ -0,0 +1,514 @@
|
||||
# -*- Mode: Python -*-
|
||||
#
|
||||
|
||||
##
|
||||
# = Target-specific commands & events
|
||||
##
|
||||
|
||||
{ 'include': 'misc.json' }
|
||||
|
||||
##
|
||||
# @RTC_CHANGE:
|
||||
#
|
||||
# Emitted when the guest changes the RTC time.
|
||||
#
|
||||
# @offset: offset between base RTC clock (as specified by -rtc base), and
|
||||
# new RTC clock value
|
||||
#
|
||||
# Note: This event is rate-limited.
|
||||
#
|
||||
# Since: 0.13.0
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# <- { "event": "RTC_CHANGE",
|
||||
# "data": { "offset": 78 },
|
||||
# "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
|
||||
#
|
||||
##
|
||||
{ 'event': 'RTC_CHANGE',
|
||||
'data': { 'offset': 'int' },
|
||||
'if': 'defined(TARGET_ALPHA) || defined(TARGET_ARM) || defined(TARGET_HPPA) || defined(TARGET_I386) || defined(TARGET_MIPS) || defined(TARGET_MIPS64) || defined(TARGET_MOXIE) || defined(TARGET_PPC) || defined(TARGET_PPC64) || defined(TARGET_S390X) || defined(TARGET_SH4) || defined(TARGET_SPARC)' }
|
||||
|
||||
##
|
||||
# @rtc-reset-reinjection:
|
||||
#
|
||||
# This command will reset the RTC interrupt reinjection backlog.
|
||||
# Can be used if another mechanism to synchronize guest time
|
||||
# is in effect, for example QEMU guest agent's guest-set-time
|
||||
# command.
|
||||
#
|
||||
# Since: 2.1
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "rtc-reset-reinjection" }
|
||||
# <- { "return": {} }
|
||||
#
|
||||
##
|
||||
{ 'command': 'rtc-reset-reinjection',
|
||||
'if': 'defined(TARGET_I386)' }
|
||||
|
||||
|
||||
##
|
||||
# @SevState:
|
||||
#
|
||||
# An enumeration of SEV state information used during @query-sev.
|
||||
#
|
||||
# @uninit: The guest is uninitialized.
|
||||
#
|
||||
# @launch-update: The guest is currently being launched; plaintext data and
|
||||
# register state is being imported.
|
||||
#
|
||||
# @launch-secret: The guest is currently being launched; ciphertext data
|
||||
# is being imported.
|
||||
#
|
||||
# @running: The guest is fully launched or migrated in.
|
||||
#
|
||||
# @send-update: The guest is currently being migrated out to another machine.
|
||||
#
|
||||
# @receive-update: The guest is currently being migrated from another machine.
|
||||
#
|
||||
# Since: 2.12
|
||||
##
|
||||
{ 'enum': 'SevState',
|
||||
'data': ['uninit', 'launch-update', 'launch-secret', 'running',
|
||||
'send-update', 'receive-update' ],
|
||||
'if': 'defined(TARGET_I386)' }
|
||||
|
||||
##
|
||||
# @SevInfo:
|
||||
#
|
||||
# Information about Secure Encrypted Virtualization (SEV) support
|
||||
#
|
||||
# @enabled: true if SEV is active
|
||||
#
|
||||
# @api-major: SEV API major version
|
||||
#
|
||||
# @api-minor: SEV API minor version
|
||||
#
|
||||
# @build-id: SEV FW build id
|
||||
#
|
||||
# @policy: SEV policy value
|
||||
#
|
||||
# @state: SEV guest state
|
||||
#
|
||||
# @handle: SEV firmware handle
|
||||
#
|
||||
# Since: 2.12
|
||||
##
|
||||
{ 'struct': 'SevInfo',
|
||||
'data': { 'enabled': 'bool',
|
||||
'api-major': 'uint8',
|
||||
'api-minor' : 'uint8',
|
||||
'build-id' : 'uint8',
|
||||
'policy' : 'uint32',
|
||||
'state' : 'SevState',
|
||||
'handle' : 'uint32'
|
||||
},
|
||||
'if': 'defined(TARGET_I386)'
|
||||
}
|
||||
|
||||
##
|
||||
# @query-sev:
|
||||
#
|
||||
# Returns information about SEV
|
||||
#
|
||||
# Returns: @SevInfo
|
||||
#
|
||||
# Since: 2.12
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-sev" }
|
||||
# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0,
|
||||
# "build-id" : 0, "policy" : 0, "state" : "running",
|
||||
# "handle" : 1 } }
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-sev', 'returns': 'SevInfo',
|
||||
'if': 'defined(TARGET_I386)' }
|
||||
|
||||
|
||||
##
|
||||
# @SevLaunchMeasureInfo:
|
||||
#
|
||||
# SEV Guest Launch measurement information
|
||||
#
|
||||
# @data: the measurement value encoded in base64
|
||||
#
|
||||
# Since: 2.12
|
||||
#
|
||||
##
|
||||
{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'},
|
||||
'if': 'defined(TARGET_I386)' }
|
||||
|
||||
##
|
||||
# @query-sev-launch-measure:
|
||||
#
|
||||
# Query the SEV guest launch information.
|
||||
#
|
||||
# Returns: The @SevLaunchMeasureInfo for the guest
|
||||
#
|
||||
# Since: 2.12
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-sev-launch-measure" }
|
||||
# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } }
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo',
|
||||
'if': 'defined(TARGET_I386)' }
|
||||
|
||||
|
||||
##
|
||||
# @SevCapability:
|
||||
#
|
||||
# The struct describes capability for a Secure Encrypted Virtualization
|
||||
# feature.
|
||||
#
|
||||
# @pdh: Platform Diffie-Hellman key (base64 encoded)
|
||||
#
|
||||
# @cert-chain: PDH certificate chain (base64 encoded)
|
||||
#
|
||||
# @cbitpos: C-bit location in page table entry
|
||||
#
|
||||
# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
|
||||
# enabled
|
||||
#
|
||||
# Since: 2.12
|
||||
##
|
||||
{ 'struct': 'SevCapability',
|
||||
'data': { 'pdh': 'str',
|
||||
'cert-chain': 'str',
|
||||
'cbitpos': 'int',
|
||||
'reduced-phys-bits': 'int'},
|
||||
'if': 'defined(TARGET_I386)' }
|
||||
|
||||
##
|
||||
# @query-sev-capabilities:
|
||||
#
|
||||
# This command is used to get the SEV capabilities, and is supported on AMD
|
||||
# X86 platforms only.
|
||||
#
|
||||
# Returns: SevCapability objects.
|
||||
#
|
||||
# Since: 2.12
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-sev-capabilities" }
|
||||
# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
|
||||
# "cbitpos": 47, "reduced-phys-bits": 5}}
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
|
||||
'if': 'defined(TARGET_I386)' }
|
||||
|
||||
##
|
||||
# @dump-skeys:
|
||||
#
|
||||
# Dump guest's storage keys
|
||||
#
|
||||
# @filename: the path to the file to dump to
|
||||
#
|
||||
# This command is only supported on s390 architecture.
|
||||
#
|
||||
# Since: 2.5
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "dump-skeys",
|
||||
# "arguments": { "filename": "/tmp/skeys" } }
|
||||
# <- { "return": {} }
|
||||
#
|
||||
##
|
||||
{ 'command': 'dump-skeys',
|
||||
'data': { 'filename': 'str' },
|
||||
'if': 'defined(TARGET_S390X)' }
|
||||
|
||||
##
|
||||
# @CpuModelBaselineInfo:
|
||||
#
|
||||
# The result of a CPU model baseline.
|
||||
#
|
||||
# @model: the baselined CpuModelInfo.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'struct': 'CpuModelBaselineInfo',
|
||||
'data': { 'model': 'CpuModelInfo' },
|
||||
'if': 'defined(TARGET_S390X)' }
|
||||
|
||||
##
|
||||
# @CpuModelCompareInfo:
|
||||
#
|
||||
# The result of a CPU model comparison.
|
||||
#
|
||||
# @result: The result of the compare operation.
|
||||
# @responsible-properties: List of properties that led to the comparison result
|
||||
# not being identical.
|
||||
#
|
||||
# @responsible-properties is a list of QOM property names that led to
|
||||
# both CPUs not being detected as identical. For identical models, this
|
||||
# list is empty.
|
||||
# If a QOM property is read-only, that means there's no known way to make the
|
||||
# CPU models identical. If the special property name "type" is included, the
|
||||
# models are by definition not identical and cannot be made identical.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'struct': 'CpuModelCompareInfo',
|
||||
'data': { 'result': 'CpuModelCompareResult',
|
||||
'responsible-properties': ['str'] },
|
||||
'if': 'defined(TARGET_S390X)' }
|
||||
|
||||
##
|
||||
# @query-cpu-model-comparison:
|
||||
#
|
||||
# Compares two CPU models, returning how they compare in a specific
|
||||
# configuration. The results indicates how both models compare regarding
|
||||
# runnability. This result can be used by tooling to make decisions if a
|
||||
# certain CPU model will run in a certain configuration or if a compatible
|
||||
# CPU model has to be created by baselining.
|
||||
#
|
||||
# Usually, a CPU model is compared against the maximum possible CPU model
|
||||
# of a certain configuration (e.g. the "host" model for KVM). If that CPU
|
||||
# model is identical or a subset, it will run in that configuration.
|
||||
#
|
||||
# The result returned by this command may be affected by:
|
||||
#
|
||||
# * QEMU version: CPU models may look different depending on the QEMU version.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine-type: CPU model may look different depending on the machine-type.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine options (including accelerator): in some architectures, CPU models
|
||||
# may look different depending on machine and accelerator options. (Except for
|
||||
# CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * "-cpu" arguments and global properties: arguments to the -cpu option and
|
||||
# global properties may affect expansion of CPU models. Using
|
||||
# query-cpu-model-expansion while using these is not advised.
|
||||
#
|
||||
# Some architectures may not support comparing CPU models. s390x supports
|
||||
# comparing CPU models.
|
||||
#
|
||||
# Returns: a CpuModelBaselineInfo. Returns an error if comparing CPU models is
|
||||
# not supported, if a model cannot be used, if a model contains
|
||||
# an unknown cpu definition name, unknown properties or properties
|
||||
# with wrong types.
|
||||
#
|
||||
# Note: this command isn't specific to s390x, but is only implemented
|
||||
# on this architecture currently.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'command': 'query-cpu-model-comparison',
|
||||
'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
|
||||
'returns': 'CpuModelCompareInfo',
|
||||
'if': 'defined(TARGET_S390X)' }
|
||||
|
||||
##
|
||||
# @query-cpu-model-baseline:
|
||||
#
|
||||
# Baseline two CPU models, creating a compatible third model. The created
|
||||
# model will always be a static, migration-safe CPU model (see "static"
|
||||
# CPU model expansion for details).
|
||||
#
|
||||
# This interface can be used by tooling to create a compatible CPU model out
|
||||
# two CPU models. The created CPU model will be identical to or a subset of
|
||||
# both CPU models when comparing them. Therefore, the created CPU model is
|
||||
# guaranteed to run where the given CPU models run.
|
||||
#
|
||||
# The result returned by this command may be affected by:
|
||||
#
|
||||
# * QEMU version: CPU models may look different depending on the QEMU version.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine-type: CPU model may look different depending on the machine-type.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine options (including accelerator): in some architectures, CPU models
|
||||
# may look different depending on machine and accelerator options. (Except for
|
||||
# CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * "-cpu" arguments and global properties: arguments to the -cpu option and
|
||||
# global properties may affect expansion of CPU models. Using
|
||||
# query-cpu-model-expansion while using these is not advised.
|
||||
#
|
||||
# Some architectures may not support baselining CPU models. s390x supports
|
||||
# baselining CPU models.
|
||||
#
|
||||
# Returns: a CpuModelBaselineInfo. Returns an error if baselining CPU models is
|
||||
# not supported, if a model cannot be used, if a model contains
|
||||
# an unknown cpu definition name, unknown properties or properties
|
||||
# with wrong types.
|
||||
#
|
||||
# Note: this command isn't specific to s390x, but is only implemented
|
||||
# on this architecture currently.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'command': 'query-cpu-model-baseline',
|
||||
'data': { 'modela': 'CpuModelInfo',
|
||||
'modelb': 'CpuModelInfo' },
|
||||
'returns': 'CpuModelBaselineInfo',
|
||||
'if': 'defined(TARGET_S390X)' }
|
||||
|
||||
##
|
||||
# @GICCapability:
|
||||
#
|
||||
# The struct describes capability for a specific GIC (Generic
|
||||
# Interrupt Controller) version. These bits are not only decided by
|
||||
# QEMU/KVM software version, but also decided by the hardware that
|
||||
# the program is running upon.
|
||||
#
|
||||
# @version: version of GIC to be described. Currently, only 2 and 3
|
||||
# are supported.
|
||||
#
|
||||
# @emulated: whether current QEMU/hardware supports emulated GIC
|
||||
# device in user space.
|
||||
#
|
||||
# @kernel: whether current QEMU/hardware supports hardware
|
||||
# accelerated GIC device in kernel.
|
||||
#
|
||||
# Since: 2.6
|
||||
##
|
||||
{ 'struct': 'GICCapability',
|
||||
'data': { 'version': 'int',
|
||||
'emulated': 'bool',
|
||||
'kernel': 'bool' },
|
||||
'if': 'defined(TARGET_ARM)' }
|
||||
|
||||
##
|
||||
# @query-gic-capabilities:
|
||||
#
|
||||
# This command is ARM-only. It will return a list of GICCapability
|
||||
# objects that describe its capability bits.
|
||||
#
|
||||
# Returns: a list of GICCapability objects.
|
||||
#
|
||||
# Since: 2.6
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-gic-capabilities" }
|
||||
# <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
|
||||
# { "version": 3, "emulated": false, "kernel": true } ] }
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'],
|
||||
'if': 'defined(TARGET_ARM)' }
|
||||
|
||||
##
|
||||
# @CpuModelExpansionInfo:
|
||||
#
|
||||
# The result of a cpu model expansion.
|
||||
#
|
||||
# @model: the expanded CpuModelInfo.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'struct': 'CpuModelExpansionInfo',
|
||||
'data': { 'model': 'CpuModelInfo' },
|
||||
'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' }
|
||||
|
||||
##
|
||||
# @query-cpu-model-expansion:
|
||||
#
|
||||
# Expands a given CPU model (or a combination of CPU model + additional options)
|
||||
# to different granularities, allowing tooling to get an understanding what a
|
||||
# specific CPU model looks like in QEMU under a certain configuration.
|
||||
#
|
||||
# This interface can be used to query the "host" CPU model.
|
||||
#
|
||||
# The data returned by this command may be affected by:
|
||||
#
|
||||
# * QEMU version: CPU models may look different depending on the QEMU version.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine-type: CPU model may look different depending on the machine-type.
|
||||
# (Except for CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * machine options (including accelerator): in some architectures, CPU models
|
||||
# may look different depending on machine and accelerator options. (Except for
|
||||
# CPU models reported as "static" in query-cpu-definitions.)
|
||||
# * "-cpu" arguments and global properties: arguments to the -cpu option and
|
||||
# global properties may affect expansion of CPU models. Using
|
||||
# query-cpu-model-expansion while using these is not advised.
|
||||
#
|
||||
# Some architectures may not support all expansion types. s390x supports
|
||||
# "full" and "static".
|
||||
#
|
||||
# Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU models is
|
||||
# not supported, if the model cannot be expanded, if the model contains
|
||||
# an unknown CPU definition name, unknown properties or properties
|
||||
# with a wrong type. Also returns an error if an expansion type is
|
||||
# not supported.
|
||||
#
|
||||
# Since: 2.8.0
|
||||
##
|
||||
{ 'command': 'query-cpu-model-expansion',
|
||||
'data': { 'type': 'CpuModelExpansionType',
|
||||
'model': 'CpuModelInfo' },
|
||||
'returns': 'CpuModelExpansionInfo',
|
||||
'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' }
|
||||
|
||||
##
|
||||
# @CpuDefinitionInfo:
|
||||
#
|
||||
# Virtual CPU definition.
|
||||
#
|
||||
# @name: the name of the CPU definition
|
||||
#
|
||||
# @migration-safe: whether a CPU definition can be safely used for
|
||||
# migration in combination with a QEMU compatibility machine
|
||||
# when migrating between different QEMU versions and between
|
||||
# hosts with different sets of (hardware or software)
|
||||
# capabilities. If not provided, information is not available
|
||||
# and callers should not assume the CPU definition to be
|
||||
# migration-safe. (since 2.8)
|
||||
#
|
||||
# @static: whether a CPU definition is static and will not change depending on
|
||||
# QEMU version, machine type, machine options and accelerator options.
|
||||
# A static model is always migration-safe. (since 2.8)
|
||||
#
|
||||
# @unavailable-features: List of properties that prevent
|
||||
# the CPU model from running in the current
|
||||
# host. (since 2.8)
|
||||
# @typename: Type name that can be used as argument to @device-list-properties,
|
||||
# to introspect properties configurable using -cpu or -global.
|
||||
# (since 2.9)
|
||||
#
|
||||
# @unavailable-features is a list of QOM property names that
|
||||
# represent CPU model attributes that prevent the CPU from running.
|
||||
# If the QOM property is read-only, that means there's no known
|
||||
# way to make the CPU model run in the current host. Implementations
|
||||
# that choose not to provide specific information return the
|
||||
# property name "type".
|
||||
# If the property is read-write, it means that it MAY be possible
|
||||
# to run the CPU model in the current host if that property is
|
||||
# changed. Management software can use it as hints to suggest or
|
||||
# choose an alternative for the user, or just to generate meaningful
|
||||
# error messages explaining why the CPU model can't be used.
|
||||
# If @unavailable-features is an empty list, the CPU model is
|
||||
# runnable using the current host and machine-type.
|
||||
# If @unavailable-features is not present, runnability
|
||||
# information for the CPU is not available.
|
||||
#
|
||||
# Since: 1.2.0
|
||||
##
|
||||
{ 'struct': 'CpuDefinitionInfo',
|
||||
'data': { 'name': 'str',
|
||||
'*migration-safe': 'bool',
|
||||
'static': 'bool',
|
||||
'*unavailable-features': [ 'str' ],
|
||||
'typename': 'str' },
|
||||
'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X)' }
|
||||
|
||||
##
|
||||
# @query-cpu-definitions:
|
||||
#
|
||||
# Return a list of supported virtual CPU definitions
|
||||
#
|
||||
# Returns: a list of CpuDefInfo
|
||||
#
|
||||
# Since: 1.2.0
|
||||
##
|
||||
{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'],
|
||||
'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X)' }
|
@ -82,6 +82,11 @@ Use ``device_add'' for hotplugging vCPUs instead of ``cpu-add''. See
|
||||
documentation of ``query-hotpluggable-cpus'' for additional
|
||||
details.
|
||||
|
||||
@subsection query-events (since 4.0)
|
||||
|
||||
The ``query-events'' command has been superseded by the more powerful
|
||||
and accurate ``query-qmp-schema'' command.
|
||||
|
||||
@section Human Monitor Protocol (HMP) commands
|
||||
|
||||
@subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (since 3.1)
|
||||
|
26
qmp.c
26
qmp.c
@ -605,32 +605,6 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
|
||||
return prop_list;
|
||||
}
|
||||
|
||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||
{
|
||||
return arch_query_cpu_definitions(errp);
|
||||
}
|
||||
|
||||
CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
|
||||
CpuModelInfo *model,
|
||||
Error **errp)
|
||||
{
|
||||
return arch_query_cpu_model_expansion(type, model, errp);
|
||||
}
|
||||
|
||||
CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *modela,
|
||||
CpuModelInfo *modelb,
|
||||
Error **errp)
|
||||
{
|
||||
return arch_query_cpu_model_comparison(modela, modelb, errp);
|
||||
}
|
||||
|
||||
CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *modela,
|
||||
CpuModelInfo *modelb,
|
||||
Error **errp)
|
||||
{
|
||||
return arch_query_cpu_model_baseline(modela, modelb, errp);
|
||||
}
|
||||
|
||||
void qmp_add_client(const char *protocol, const char *fdname,
|
||||
bool has_skipauth, bool skipauth, bool has_tls, bool tls,
|
||||
Error **errp)
|
||||
|
@ -242,7 +242,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
|
||||
self._regy = QAPIGenCCode()
|
||||
self._visited_ret_types = {}
|
||||
|
||||
def _begin_module(self, name):
|
||||
def _begin_user_module(self, name):
|
||||
self._visited_ret_types[self._genc] = set()
|
||||
commands = self._module_basename('qapi-commands', name)
|
||||
types = self._module_basename('qapi-types', name)
|
||||
|
@ -1868,6 +1868,7 @@ class QAPISchema(object):
|
||||
def visit(self, visitor):
|
||||
visitor.visit_begin(self)
|
||||
module = None
|
||||
visitor.visit_module(module)
|
||||
for entity in self._entity_list:
|
||||
if visitor.visit_needed(entity):
|
||||
if entity.module != module:
|
||||
@ -2321,47 +2322,73 @@ class QAPISchemaModularCVisitor(QAPISchemaVisitor):
|
||||
self._what = what
|
||||
self._blurb = blurb
|
||||
self._pydoc = pydoc
|
||||
self._genc = None
|
||||
self._genh = None
|
||||
self._module = {}
|
||||
self._main_module = None
|
||||
|
||||
@staticmethod
|
||||
def _is_user_module(name):
|
||||
return name and not name.startswith('./')
|
||||
|
||||
@staticmethod
|
||||
def _is_builtin_module(name):
|
||||
return not name
|
||||
|
||||
def _module_basename(self, what, name):
|
||||
if name is None:
|
||||
return re.sub(r'-', '-builtin-', what)
|
||||
basename = os.path.join(os.path.dirname(name),
|
||||
self._prefix + what)
|
||||
if name == self._main_module:
|
||||
return basename
|
||||
return basename + '-' + os.path.splitext(os.path.basename(name))[0]
|
||||
ret = '' if self._is_builtin_module(name) else self._prefix
|
||||
if self._is_user_module(name):
|
||||
dirname, basename = os.path.split(name)
|
||||
ret += what
|
||||
if name != self._main_module:
|
||||
ret += '-' + os.path.splitext(basename)[0]
|
||||
ret = os.path.join(dirname, ret)
|
||||
else:
|
||||
name = name[2:] if name else 'builtin'
|
||||
ret += re.sub(r'-', '-' + name + '-', what)
|
||||
return ret
|
||||
|
||||
def _add_module(self, name, blurb):
|
||||
if self._main_module is None and name is not None:
|
||||
self._main_module = name
|
||||
genc = QAPIGenC(blurb, self._pydoc)
|
||||
genh = QAPIGenH(blurb, self._pydoc)
|
||||
self._module[name] = (genc, genh)
|
||||
self._set_module(name)
|
||||
|
||||
def _add_user_module(self, name, blurb):
|
||||
assert self._is_user_module(name)
|
||||
if self._main_module is None:
|
||||
self._main_module = name
|
||||
self._add_module(name, blurb)
|
||||
|
||||
def _add_system_module(self, name, blurb):
|
||||
self._add_module(name and './' + name, blurb)
|
||||
|
||||
def _set_module(self, name):
|
||||
self._genc, self._genh = self._module[name]
|
||||
|
||||
def write(self, output_dir, opt_builtins=False):
|
||||
for name in self._module:
|
||||
if name is None and not opt_builtins:
|
||||
if self._is_builtin_module(name) and not opt_builtins:
|
||||
continue
|
||||
basename = self._module_basename(self._what, name)
|
||||
(genc, genh) = self._module[name]
|
||||
genc.write(output_dir, basename + '.c')
|
||||
genh.write(output_dir, basename + '.h')
|
||||
|
||||
def _begin_module(self, name):
|
||||
def _begin_user_module(self, name):
|
||||
pass
|
||||
|
||||
def visit_module(self, name):
|
||||
if name in self._module:
|
||||
self._set_module(name)
|
||||
return
|
||||
self._add_module(name, self._blurb)
|
||||
self._begin_module(name)
|
||||
elif self._is_builtin_module(name):
|
||||
# The built-in module has not been created. No code may
|
||||
# be generated.
|
||||
self._genc = None
|
||||
self._genh = None
|
||||
else:
|
||||
self._add_user_module(name, self._blurb)
|
||||
self._begin_user_module(name)
|
||||
|
||||
def visit_include(self, name, info):
|
||||
basename = self._module_basename(self._what, name)
|
||||
|
@ -142,13 +142,15 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
|
||||
self._event_enum_members = []
|
||||
self._event_emit_name = c_name(prefix + 'qapi_event_emit')
|
||||
|
||||
def _begin_module(self, name):
|
||||
def _begin_user_module(self, name):
|
||||
events = self._module_basename('qapi-events', name)
|
||||
types = self._module_basename('qapi-types', name)
|
||||
visit = self._module_basename('qapi-visit', name)
|
||||
self._genc.add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "%(prefix)sqapi-events.h"
|
||||
#include "%(prefix)sqapi-emit-events.h"
|
||||
#include "%(events)s.h"
|
||||
#include "%(visit)s.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
@ -156,26 +158,34 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
|
||||
#include "qapi/qmp-event.h"
|
||||
|
||||
''',
|
||||
visit=visit, prefix=self._prefix))
|
||||
events=events, visit=visit,
|
||||
prefix=self._prefix))
|
||||
self._genh.add(mcgen('''
|
||||
#include "qapi/util.h"
|
||||
#include "%(types)s.h"
|
||||
|
||||
''',
|
||||
types=types))
|
||||
|
||||
def visit_end(self):
|
||||
(genc, genh) = self._module[self._main_module]
|
||||
genh.add(gen_enum(self._event_enum_name,
|
||||
self._event_enum_members))
|
||||
genc.add(gen_enum_lookup(self._event_enum_name,
|
||||
self._event_enum_members))
|
||||
genh.add(mcgen('''
|
||||
self._add_system_module('emit', ' * QAPI Events emission')
|
||||
self._genc.preamble_add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "%(prefix)sqapi-emit-events.h"
|
||||
''',
|
||||
prefix=self._prefix))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
#include "qapi/util.h"
|
||||
'''))
|
||||
self._genh.add(gen_enum(self._event_enum_name,
|
||||
self._event_enum_members))
|
||||
self._genc.add(gen_enum_lookup(self._event_enum_name,
|
||||
self._event_enum_members))
|
||||
self._genh.add(mcgen('''
|
||||
|
||||
void %(event_emit)s(%(event_enum)s event, QDict *qdict);
|
||||
''',
|
||||
event_emit=self._event_emit_name,
|
||||
event_enum=self._event_enum_name))
|
||||
event_emit=self._event_emit_name,
|
||||
event_enum=self._event_enum_name))
|
||||
|
||||
def visit_event(self, name, info, ifcond, arg_type, boxed):
|
||||
with ifcontext(ifcond, self._genh, self._genc):
|
||||
@ -183,7 +193,9 @@ void %(event_emit)s(%(event_enum)s event, QDict *qdict);
|
||||
self._genc.add(gen_event_send(name, arg_type, boxed,
|
||||
self._event_enum_name,
|
||||
self._event_emit_name))
|
||||
self._event_enum_members.append(QAPISchemaMember(name, ifcond))
|
||||
# Note: we generate the enum member regardless of @ifcond, to
|
||||
# keep the enumeration usable in target-independent code.
|
||||
self._event_enum_members.append(QAPISchemaMember(name))
|
||||
|
||||
|
||||
def gen_events(schema, output_dir, prefix):
|
||||
|
@ -183,7 +183,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
|
||||
QAPISchemaModularCVisitor.__init__(
|
||||
self, prefix, 'qapi-types', ' * Schema-defined QAPI types',
|
||||
__doc__)
|
||||
self._add_module(None, ' * Built-in QAPI types')
|
||||
self._add_system_module(None, ' * Built-in QAPI types')
|
||||
self._genc.preamble_add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/dealloc-visitor.h"
|
||||
@ -194,7 +194,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
|
||||
#include "qapi/util.h"
|
||||
'''))
|
||||
|
||||
def _begin_module(self, name):
|
||||
def _begin_user_module(self, name):
|
||||
types = self._module_basename('qapi-types', name)
|
||||
visit = self._module_basename('qapi-visit', name)
|
||||
self._genc.preamble_add(mcgen('''
|
||||
|
@ -284,7 +284,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
|
||||
QAPISchemaModularCVisitor.__init__(
|
||||
self, prefix, 'qapi-visit', ' * Schema-defined QAPI visitors',
|
||||
__doc__)
|
||||
self._add_module(None, ' * Built-in QAPI visitors')
|
||||
self._add_system_module(None, ' * Built-in QAPI visitors')
|
||||
self._genc.preamble_add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
@ -298,7 +298,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
|
||||
''',
|
||||
prefix=prefix))
|
||||
|
||||
def _begin_module(self, name):
|
||||
def _begin_user_module(self, name):
|
||||
types = self._module_basename('qapi-types', name)
|
||||
visit = self._module_basename('qapi-visit', name)
|
||||
self._genc.preamble_add(mcgen('''
|
||||
|
@ -1,7 +1,3 @@
|
||||
stub-obj-y += arch-query-cpu-def.o
|
||||
stub-obj-y += arch-query-cpu-model-expansion.o
|
||||
stub-obj-y += arch-query-cpu-model-comparison.o
|
||||
stub-obj-y += arch-query-cpu-model-baseline.o
|
||||
stub-obj-y += bdrv-next-monitor-owned.o
|
||||
stub-obj-y += blk-commit-all.o
|
||||
stub-obj-y += blockdev-close-all-bdrv-states.o
|
||||
|
@ -1,11 +0,0 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *modela,
|
||||
CpuModelInfo *modelb,
|
||||
Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela,
|
||||
CpuModelInfo *modelb,
|
||||
Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type,
|
||||
CpuModelInfo *mode,
|
||||
Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-events.h"
|
||||
#include "qapi/qapi-emit-events.h"
|
||||
#include "qemu-common.h"
|
||||
#include "monitor/monitor.h"
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "sysemu/kvm.h"
|
||||
#include "fpu/softfloat.h"
|
||||
#include "qemu/range.h"
|
||||
#include "qapi/qapi-commands-target.h"
|
||||
|
||||
#define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
|
||||
|
||||
@ -6733,7 +6734,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
|
||||
*cpu_list = entry;
|
||||
}
|
||||
|
||||
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
|
||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||
{
|
||||
CpuDefinitionInfoList *cpu_list = NULL;
|
||||
GSList *list;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/boards.h"
|
||||
#include "kvm_arm.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qapi-commands-target.h"
|
||||
|
||||
static GICCapability *gic_cap_new(int version)
|
||||
{
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "qapi/visitor.h"
|
||||
#include "qom/qom-qobject.h"
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "qapi/qapi-commands-target.h"
|
||||
|
||||
#include "standard-headers/asm-x86/kvm_para.h"
|
||||
|
||||
@ -3790,7 +3791,7 @@ static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
|
||||
*cpu_list = entry;
|
||||
}
|
||||
|
||||
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
|
||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||
{
|
||||
CpuDefinitionInfoList *cpu_list = NULL;
|
||||
GSList *list = get_sorted_cpu_model_list();
|
||||
@ -3918,6 +3919,7 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp)
|
||||
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* Return a QDict containing keys for all properties that can be included
|
||||
* in static expansion of CPU models. All properties set by x86_cpu_load_def()
|
||||
* must be included in the dictionary.
|
||||
@ -4065,7 +4067,7 @@ out:
|
||||
}
|
||||
|
||||
CpuModelExpansionInfo *
|
||||
arch_query_cpu_model_expansion(CpuModelExpansionType type,
|
||||
qmp_query_cpu_model_expansion(CpuModelExpansionType type,
|
||||
CpuModelInfo *model,
|
||||
Error **errp)
|
||||
{
|
||||
@ -4120,6 +4122,7 @@ out:
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif /* !CONFIG_USER_ONLY */
|
||||
|
||||
static gchar *x86_gdb_arch_name(CPUState *cs)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "sysemu/kvm.h"
|
||||
#include "sysemu/sev.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qapi-commands-target.h"
|
||||
|
||||
#define SEV_POLICY_NODBG 0x1
|
||||
#define SEV_POLICY_NOKS 0x2
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "qemu/cutils.h"
|
||||
#include "disas/capstone.h"
|
||||
#include "fpu/softfloat.h"
|
||||
#include "qapi/qapi-commands-target.h"
|
||||
|
||||
//#define PPC_DUMP_CPU
|
||||
//#define PPC_DEBUG_SPR
|
||||
@ -10201,7 +10202,7 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
|
||||
*first = entry;
|
||||
}
|
||||
|
||||
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
|
||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||
{
|
||||
CpuDefinitionInfoList *cpu_list = NULL;
|
||||
GSList *list;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#endif
|
||||
#include "qapi/qapi-commands-target.h"
|
||||
|
||||
#define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \
|
||||
{ \
|
||||
@ -457,7 +458,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
|
||||
*cpu_list = entry;
|
||||
}
|
||||
|
||||
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
|
||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||
{
|
||||
struct CpuDefinitionInfoListData list_data = {
|
||||
.list = NULL,
|
||||
@ -591,7 +592,7 @@ static void cpu_info_from_model(CpuModelInfo *info, const S390CPUModel *model,
|
||||
}
|
||||
}
|
||||
|
||||
CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type,
|
||||
CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
|
||||
CpuModelInfo *model,
|
||||
Error **errp)
|
||||
{
|
||||
@ -630,7 +631,7 @@ static void list_add_feat(const char *name, void *opaque)
|
||||
*last = entry;
|
||||
}
|
||||
|
||||
CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *infoa,
|
||||
CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *infoa,
|
||||
CpuModelInfo *infob,
|
||||
Error **errp)
|
||||
{
|
||||
@ -703,7 +704,7 @@ CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *infoa,
|
||||
return compare_info;
|
||||
}
|
||||
|
||||
CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *infoa,
|
||||
CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa,
|
||||
CpuModelInfo *infob,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -1,3 +1,4 @@
|
||||
module None
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qmp-event.h"
|
||||
#include "test-qapi-events.h"
|
||||
#include "test-qapi-emit-events.h"
|
||||
|
||||
typedef struct TestEventData {
|
||||
QDict *expect;
|
||||
|
@ -1271,7 +1271,6 @@ static void test_visitor_in_qmp_introspect(TestInputVisitorData *data,
|
||||
const void *unused)
|
||||
{
|
||||
do_test_visitor_in_qmp_introspect(data, &test_qmp_schema_qlit);
|
||||
do_test_visitor_in_qmp_introspect(data, &qmp_schema_qlit);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
Loading…
Reference in New Issue
Block a user