qapi.py: Maintain a list of union types
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
qapi: Anonymous unions
The discriminator for anonymous unions is the data type. This allows tohave a union type that allows both of these:
{ 'file': 'my_existing_block_device_id' } { 'file': { 'filename': '/tmp/mydisk.qcow2', 'read-only': true } }...
qapi: Flat unions with arbitrary discriminator
Instead of the rather verbose syntax that distinguishes base andsubclass fields...
{ "type": "file", "read-only": true, "data": { "filename": "test" } }
...we can now have both in the same namespace, allowing a more direct...
qapi-types.py: Implement 'base' for unions
The new 'base' key in a union definition refers to a struct type, whichis inlined into the union definition and can represent fields common toall kinds.
For example the following schema definition...
{ 'type': 'BlockOptionsBase', 'data': { 'read-only': 'bool' } }...
qapi-visit.py: Split off generate_visit_struct_fields()
qapi-visit.py: Implement 'base' for unions
This implements the visitor part of base types for unions. Parsed intoQMP, this example schema definition...
{ 'type': 'BlockOptionsBase', 'data': { 'read-only': 'bool' } } { 'type': 'BlockOptionsQcow2, 'data': { 'lazy-refcounts': 'bool' } }...
Merge remote-tracking branch 'stefanha/tracing' into staging
cleanup-trace-events.pl: New
Simple script to drop unused events and fix up source file comments.The next few commits put it to use.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qapi: qapi-commands: fix possible leaks on visitor dealloc
In qmp-marshal.c the dealloc visitor calls use the same errppointer of the input visitor calls. This means that if any ofthe input visitor calls fails, then the dealloc visitor willreturn early, before freeing the object's memory....
qapi.py: Avoid code duplication
The code that interprets the read JSON expression and appends types tothe respective global variables was duplicated. We can avoid that bysplitting off the part that reads from the file.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
qapi.py: Allow top-level type reference for command definitions
If 'data' for a command definition isn't a dict, but a string, it istaken as a (struct) type name and the fields of this struct are directlyused as parameters.
This is useful for transactionable commands that can use the same type...
main: use TARGET_ARCH only for the target-specific #define
Everything else needs to match the executable name, which isTARGET_NAME.
Before: $ sh4eb-linux-user/qemu-sh4eb --help usage: qemu-sh4 [options] program [arguments...] Linux CPU emulator (compiled for sh4 emulation)...
build: rename TARGET_ARCH2 to TARGET_NAME
Do not introduce any new use yet.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Message-id: 1370349928-20419-3-git-send-email-pbonzini@redhat.comSigned-off-by: Peter Maydell <peter.maydell@linaro.org>
build: do not use TARGET_ARCH
TARGET_ARCH is generally wrong to use, there are better variablesprovided in config-target.mak. The right one is usually TARGET_NAME(previously TARGET_ARCH2), but for bsd-user we can also use TARGET_ABI_DIRfor consistency with linux-user....
block: add block driver read only whitelist
We may want to include a driver in the whitelist for read only taskssuch as diagnosing or exporting guest data (with libguestfs as a goodexample). This patch introduces a readonly whitelist option, and forbackward compatibility, the old configure option --block-drv-whitelist...
qapi: pad GenericList value fields to 64 bits
With the introduction of native list types, we now have types such asint64List where the 'value' field is not a pointer, but the actual64-bit value.
On 32-bit architectures, this can lead to situations where 'next' field...
qapi: qapi-types.py, native list support
Teach type generators about native types so they can generate theappropriate linked list types.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Reviewed-by: Amos Kong <akong@redhat.com>...
qapi: qapi-visit.py, fix list handling for union types
Currently we assume non-list types when generating visitor routines forunion types. This is broken, since values like ['Type'] need to mappedto 'TypeList'.
We already have a type_name() function to handle this that we use for...
qapi: qapi-visit.py, native list support
Teach visitor generators about native types so they can generate theappropriate visitor routines.
trace: Add ftrace tracing backend
This patch adds a ftrace tracing backend which sends trace event toftrace marker file. You can effectively compare qemu trace data andkernel(especially, kvm.ko when using KVM) trace data.The ftrace backend is restricted to Linux only....
vmxcap: Augment reported information
Parse the Basic VMX Information MSR and add the bit for the new postedinterrupts.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Gleb Natapov <gleb@redhat.com>
vmxcap: Report APIC register emulation and RDTSCP control
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
vmxcap: Update according to SDM of January 2013
This adds reporting of VMCS shadowing, #VE, IA32_SMBASE, unrestrictedVMWRITE and fixes the range of the MSEG revision ID.
vmxcap: Open MSR file in unbuffered mode
Python may otherwise decide to to read larger chunks, applying the seekonly on the software buffer. This will return results from the wrongMSRs.
trace: [tracetool] Explicitly identify public backends
Public backends are those printed by "--list-backends" and thus considered validby the configure script.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
trace: Provide a generic tracing event descriptor
Uses tracetool to generate a backend-independent tracing event description(struct TraceEvent).
The values for such structure are generated with the non-public "events" backend ("events-c" frontend).
The generation of the defines to check if an event is statically enabled is also...
trace: [simple] Port to generic event information and new control interface
The backend is forced to dump event numbers using 64 bits, as TraceEventID isan enum.
trace: [stderr] Port to generic event information and new control interface
Revert "make_device_config.sh: Fix target path in generated dependency file"
This reverts commit 23bf49b5eca716aaad073f2b47613434e1515cb5.
While *-softmmu/config-devices.mak.d is included through *.d pattern viaMakefile.target, the make_devices_config.sh call these dependencies are...
make_device_config.sh: Emit dependency file to directory where included
Placing the config-devices.mak.d file alongside the config-devices.makfile in -softmmu/ lead to it getting included into through-softmmu/Makefile in addition to ./Makefile, leading to confusion....
fix scripts/make_device_config.sh
Make it handle multiple include statements in a file:
(1) The printf needs a space so the include files will be separated. (2) Also $f can contain multiple failes, so redirection will not work and we have to use cat to process all files....
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
Conflicts: target-i386/kvm.c...
make_device_config.sh: Fix target path in generated dependency file
config-devices.mak.d is included from Makefile.target, i.e. from insidethe *-softmmu/ directory. It included the directory path, so neverapplied to the actual ./config-devices.mak. Symptoms were spurious...
vmxcap: bit 9 of VMX_PROCBASED_CTLS2 is 'virtual interrupt delivery'
Bit 9 of MSR_IA32_VMX_PROCBASED_CTLS2 isvirtual interrupt delivery.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
qemu-ga: sample fsfreeze hooks
Adds sample hook scripts for --fsfreeze-hook option of qemu-ga. - fsfreeze-hook : execute scripts in fsfreeze-hook.d/ - fsfreeze-hook.d/mysql-flush.sh.sample : quiesce MySQL before snapshot
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>...
powerpc: linux header sync script includes epapr_hcalls.h
epapr_hcalls.h is now referenced by kvm_para.h. so this is needed forQEMU to get compiled on powerpc.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>Signed-off-by: Alexander Graf <agraf@suse.de>
build: Use separate makefile for "trace/"
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>--Changes in v2:
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qapi: move include files to include/qobject/
exec: move include files to include/exec/
qapi: move inclusions of qemu-common.h from headers to .c files
qapi: remove qapi/qapi-types-core.h
The file is only including error.h and qerror.h. Prefer explicitinclusion of whatever files are needed.Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
get_maintainer.pl: update from linix 3.8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Avoid all systemtap reserved words
Over time various systemtap reserved words have been blacklistedin the trace backend generator. The list is not complete though,so there is continued risk of problems in the future. Preemptsuch problems by specifying the full list of systemtap keywords...
qapi-types.h: Don't include qemu-common.h
Needed to prevent build breakage when CPUState becomes a child ofDeviceState.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>[ehabkost: include <stdbool.h> too]Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>...
update-linux-headers.sh: Handle new kernel uapi/ directories
Recent kernels have moved to keeping the userspace headersin uapi/ subdirectories. This breaks the detection of whether anarchitecture has KVM support in the kernel because kvm.h hasmoved in the kernel source tree. Update the check to support...
s390/kvm_stat: correct sys_perf_event_open syscall number
Correct sys_perf_event_open syscall number for s390 architecture - the hardcoded syscall number 298 is for x86 but should be different for other architectures. In case we figure out via /proc/cpuinfo that we are running...
Merge remote-tracking branch 'qmp/queue/qmp' into staging
Update kernel header script to include vfio
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Acked-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qapi: do not protect enum values from namespace pollution
Enum values are always preceded by the uppercase name of the enum, sothey do not conflict with reserved words.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi: add "unix" to the set of reserved words
It is #defined to 1.
dtrace backend: add function to reserved words
Signed-off-by: Alon Levy <alevy@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
update-linux-headers.sh: Don't hard code list of architectures
Rather than hardcoding the list of architectures in the kernelheader update script, just import headers for every architecturewhich supports KVM (with a blacklist exception for ia64 whichhas KVM headers but is dead). This reduces the number of QEMU...
Merge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable
CHECKPATCH: Add --debug adv_dcs
Add debug options to find this issue. They were not listedin the help because the are not simple to understand the output of.
Signed-off-by: Don Slutz <Don@CloudSwitch.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
CHECKPATCH: Add --debug adv_checking
CHECKPATCH: Add --debug adv_apw
CHECKPATCH: Add warning for single else statement.
For an example:
WARNING: braces {} are necessary even for single statement blocks+ } else+ return env->regs[R_EAX];
total: 0 errors, 1 warnings, 41 lines checkedSigned-off-by: Don Slutz <Don@CloudSwitch.com>...
qapi: Fix potential NULL pointer segfault
Report from smatch:
qapi-visit.c:1640 visit_type_BlockdevAction(8) error: we previously assumed 'obj' could be null (see line 1639)qapi-visit.c:2432 visit_type_NetClientOptions(8) error: we previously assumed 'obj' could be null (see line 2431)...
qapi: generate list struct and visit_list for enum
Currently, if we define an 'enum' and use it in one command'sdata, list struct for enum could not be generated, but it'sused in qmp function.
For example: KeyCodesList could not be generated.
qapi-schema.json:...
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
trace: Fix "Qemu" -> "QEMU"
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
update-linux-headers.sh: Pull in asm-generic/kvm_para.h
Add asm-generic/kvm_para.h to the set of non-architecture specificKVM kernel headers we copy into QEMU. This header may be includedby an architecture's kvm_para.h header.
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>...
trace/simple: Fix compiler warning for 32 bit hosts
gcc complains when a 32 bit pointer is casted to a 64 bit integer.
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
scripts: qapi-commands.py: qmp-commands.h: include qdict.h
qmp-commands.h declares several functions that have arguments oftype QDict. However, qdict.h is not included. This will cause abuild breakage when a file includes qmp-commands.h but doesn'tinclude qdict.h....
qapi: don't convert enum strings to lowercase
Next commit will introduce enum strings in camel case.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>
qapi: generate correct enum names for camel case enums
An enum like GenericError in the schema, should generateGENERIC_ERROR and not GENERICERROR.
qapi: qapi-types.h: don't include qapi/qapi-types-core.h
qapi-types.h needs only qemu-common.h. Including qapi-types-core.hcauses problems when qerror.h or error.h includes qapi-types.h.
qapi: avoid reserved keywords
Clang compiler complained about use of reserved word 'restrict' in SLIRPand QAPI.
Prefix C keywords with "q_", adjust SLIRP accordingly.
Reviewed-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qapi: qapi.py: allow the "'" character to be escaped
Support escaping the escape character, and make more robust (don't diefor '', handle ' without matching '.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
Merge remote-tracking branch 'stefanha/net' into staging
qapi: fix error propagation
Don't overwrite / leak previously set errors.Make traversal cope with missing mandatory sub-structs.Don't try to end a container that could not be started.
v1->v2:- unchanged
v2->v3:- instead of examining, assert that we never overwrite errors with...
qapi: generate C types for fixed-width integers
(Long line folded using parens:<http://www.python.org/dev/peps/pep-0008/#maximum-line-length>.)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
qapi: introduce "size" type
v1->v2:- fall back to uint64 rather than int
Simpletrace v2: Support multiple arguments, strings.
Existing simpletrace backend allows to trace at max 6 args and does notsupport strings. This newer tracelog format gets rid of fixed size recordsand therefore allows to trace variable number of args including strings....
Update simpletrace.py for new log format
Support new tracelog format for multiple arguments and strings.
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
build: add make dist target (v2)
Let's stop screwing up releases by having a script do the work that Anthony'sfat fingers can't seem to get right.
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>Reviewed-by: Eric Blake <eblake@redhat.com>Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>...
checkpatch: Add QEMU specific rule
The new rule detects two wrong variants of QEMU.It was tested with commit b5a8fe5e.
s390: make kvm_stat work on s390
Add s390_exit_reasons so kvm_stat doesn't crash when called on s390.Look for 'vendor_id' in /proc/cpuinfo as well, instead of just for'flags', so we can determine if we run on S390.
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>...
kvm: update vmxcap for EPT A/D, INVPCID, RDRAND, VMFUNC
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
qapi: add support for command options
Options allow for changes in commands behavior. This commit introducesthe QCO_NO_SUCCESS_RESP option, which causes a command to not emit asuccess response.
This is needed by commands such as qemu-ga's guest-shutdown, which...
scripts/qemu-binfmt-conf.sh: Fix shell syntax
The script is organized as a sequence of binfmt registrations, with acheck whether the to be registered architecture matches the host.
Add a missing fi for the SuperH section.
Reported-by: Alexander Graf <agraf@suse.de>...
tracetool: use Python 2.4-compatible exception handling syntax
The newer "except <exception-type> as <exception>:" syntax is notsupported by Python 2.4, we need to use "except <exception-type>,<exception>:".
Tested all trace backends with Python 2.4....
tracetool: use Python 2.4-compatible import() arguments
In Python 2.5 keyword arguments were added to import(). Avoid usingthem to achieve Python 2.4 compatibility.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu>
tracetool: avoid str.rpartition() Python 2.5 function
The str.rpartition() function is related to str.split() and is used forsplitting strings. It was introduced in Python 2.5 and therefore cannotbe used in tracetool as Python 2.4 compatibility is required....
tracetool: avoid pkgutil.iter_modules() Python 2.7 function
The pkgutil.iter_modules() function provides a way to enumerate childmodules. Unfortunately it's missing in Python <2.7 so we must implementsimilar behavior ourselves.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
create_config: remove *dir block
Now only the qemu_*dir variables will become #defines. The otherdirectory names aren't used by the C code.
That means the following #defines won't be available in C code anymore:
- CONFIG_QEMU_BINDIR - CONFIG_QEMU_LIBDIR...
create_config: simplify prefix=* block, remove CONFIG_QEMU_PREFIX
As now that block handles only the prefix variable, the code can be muchsimpler. This also removes the CONFIG_QEMU_PREFIX define as it is notused by any C code.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>...
create_config: separate section for qemu_*dir variables (v2)
The generic dir section will eventually go away and be replaced withqemu_ section. By now, both sections will be kept, while the variablesget renamed on config-host.mak.
With this patch, a XXXdir variable will become a CONFIG_QEMU_XXXDIR...
tracetool: Add support for the 'stderr' backend
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
tracetool: Add support for the 'simple' backend
tracetool: Add support for the 'ust' backend
tracetool: Add support for the 'dtrace' backend
tracetool: handle DTrace keywords 'in', 'next', 'self'
Language keywords cannot be used as argument names. The DTrace backendappends an underscore to the argument name in order to make the argumentname legal.
This patch adds 'in', 'next', and 'self' keywords to dtrace.py....
tracetool: Add module for the 'h' format