Commit graph

19213 commits

Author SHA1 Message Date
Paolo Bonzini b9f8978cc4 qmp: add and use q type specifier
"O" is being used by the transaction and qom-set commands to mean "any
QObject", but it really means "do not validate the argument list".
Add a new specifier with the correct meaning.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:15:28 -03:00
Paolo Bonzini e38ac9621c qapi: add strict mode to input visitor
While QMP in general is designed so that it is possible to ignore
unknown arguments, in the case of the QMP server it is better to
reject them to detect bad clients.  In fact, we're already doing
this at the top level in the argument checker.  To extend this to
complex structures, add a mode to the input visitor where it checks
for unvisited keys and raises an error if it finds one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:15:13 -03:00
Paolo Bonzini 4faaec6acf qapi: place outermost object on qiv stack
This is a slight change in the implementation of QMPInputVisitor
that helps when adding strict mode.

Const QObjects cannot be inc/decref-ed, and that's why QMPInputVisitor
relies heavily on weak references to inner objects.  I'm not removing
the weak references now, but since refcount+const is a lost battle in C
(C++ has "mutable") I think removing const is fine in this case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:15:08 -03:00
Paolo Bonzini 3a86a0fa76 qapi: untangle next_list
Right now, the semantics of next_list are complicated.  The caller must:

* call start_list

* call next_list for each element *including the first*

* on the first call to next_list, the second argument should point to
NULL and the result is the head of the list.  On subsequent calls,
the second argument should point to the last node (last result of
next_list) and next_list itself tacks the element at the tail of the
list.

This works for both input and output visitor, but having the visitor
write memory when it is only reading the list is ugly.  Plus, relying
on *list to detect the first call is tricky and undocumented.

We can initialize so->entry in next_list instead of start_list, leaving
it NULL in start_list.  This way next_list sees clearly whether it is
on the first call---as a bonus, it discriminates the cases based on
internal state of the visitor rather than external state.  We can
also pull the assignment of the list head from generated code up to
next_list.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:14:19 -03:00
Paolo Bonzini 69b50071d8 qapi: allow freeing partially-allocated objects
Objects going through the dealloc visitor can be only partially allocated.
Detect the situation and avoid a segfault.  This also helps with the
input visitor, when there are errors.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:14:06 -03:00
Paolo Bonzini b6f0474fc0 qapi: shortcut visits on errors
We can exit very soon if we enter a visitor with a preexisting error.
This simplifies some cases because we will not have to deal with
obj being non-NULL while *obj is NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:13:57 -03:00
Paolo Bonzini 8b714d3747 qapi: fix memory leak on error
QmpInputVisitor would leak the malloced struct if the stack was
overflowed.  This can be easily fixed using error_propagate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:13:48 -03:00
Paolo Bonzini 2c7ff93359 qapi: fail hard on stack imbalance
QmpOutputVisitor will segfault if an imbalanced end function is
called.  So we can abort in QmpInputVisitor too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:13:39 -03:00
Paolo Bonzini 3dcf71f632 qapi: add a test case for type errors
There is no test case for parse errors, add one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:12:20 -03:00
Paolo Bonzini 9e9eace89e qapi: add struct-errors test case to test-qmp-output-visitor
This test case verifies that invalid native enums are caught, and causes
qapi to tear down the QObject tree under construction, exercising the
previous patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:11:00 -03:00
Laszlo Ersek f24582d6ad qapi: fix double free in qmp_output_visitor_cleanup()
Stack entries in QmpOutputVisitor are navigation links (weak references),
except the bottom (ie. least recently added) entry, which owns the root
QObject [1]. Make qmp_output_visitor_cleanup() drop the stack entries,
then release the QObject tree by the root.

Attempting to serialize an invalid enum inside a dictionary is an example
for triggering the double free.

[1] http://lists.nongnu.org/archive/html/qemu-devel/2012-03/msg03276.html

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:11:00 -03:00
Anthony Liguori 8a22565b7c Merge remote-tracking branch 'mdroth/qga-pull-3-26-12' into staging
* mdroth/qga-pull-3-26-12:
  qemu-ga: fix bsd build, and re-org linux-specific implementations
2012-03-26 15:17:51 -05:00
Anthony Liguori 29b18b7a53 Merge remote-tracking branch 'stefanha/trivial-patches' into staging
* stefanha/trivial-patches:
  trace-events: Fix broken build caused by wrong format specifier
  test: add test-qmp-commands to make check
  qapi: remove print statements from test-qmp-commands
  test: remove qemu-ga reference
  vl.c: fix '-cpu ?' segfault
2012-03-26 15:08:26 -05:00
Anthony Liguori 3d032f0f5a Merge remote-tracking branch 'spice/spice.v51' into staging
* spice/spice.v51:
  ui/spice-display: use uintptr_t when casting qxl physical addresses
  ui/spice-display.c: Fix compilation warnings on 32 bit hosts
2012-03-26 15:08:15 -05:00
Michael Roth 81fe74dc1c test: remove qemu-ga reference
This was added by mistake a while back.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-26 14:21:14 -05:00
Miroslav Rezanina 3017b72cd0 Man page: Add -global description
There's only TODO information in qemu man page for -global option. This is a basic description of this option with simple example.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>

v4:
 - break long line

v3:
 - add use case description
 - use prop instead of property

v2:
 - Use better value in example
Patch:
--
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-26 14:21:14 -05:00
Federico Simoncelli c9da228b49 qapi: add c_fun to escape function names
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-26 13:21:46 -05:00
Stefan Weil 95b752bc32 trace-events: Fix broken build caused by wrong format specifier
mem is an uint64_t value, so %lx was wrong.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-26 12:34:20 +01:00
Michael Roth 2db5b068ac test: add test-qmp-commands to make check
All the deps are here but the test was never added to the list of tests
for make check

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-26 11:28:38 +01:00
Michael Roth 151c569325 qapi: remove print statements from test-qmp-commands
This is necessary for nicer make check integration.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-26 11:28:38 +01:00
Michael Roth 3ac805d922 test: remove qemu-ga reference
This was added by mistake a while back.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-26 11:28:37 +01:00
Eduardo Habkost 1d6528af68 vl.c: fix '-cpu ?' segfault
Fix stupid copy&paste mistake at commit
ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but kept
"optarg" on the cpu_list() call.

Reported-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-26 11:28:37 +01:00
Michael Roth e72c3f2ed9 qemu-ga: fix bsd build, and re-org linux-specific implementations 2012-03-25 14:34:20 -05:00
Richard Henderson cb1977d308 tcg-sparc: Add debug_frame support.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 19:57:58 +00:00
Richard Henderson e7bd630064 tcg-hppa: Add debug_frame support.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 19:57:46 +00:00
Richard Henderson abbb3eae10 tcg: Allow ELF_HOST_FLAGS and ELF_OSABI overrides in gdb-jit.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 19:57:32 +00:00
Richard Henderson 5872bbf24e tcg: Add debug_info to JIT ELF image.
This allows us to actually supply a function name in softmmu builds;
gdb doesn't pick up the minimal symbol table otherwise.  Also add a
bit of documentation and statically generate more of the ELF image.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 19:57:12 +00:00
Richard Henderson 55fddd6611 target-alpha: Use noreturn marker in helper.h.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:08:03 +00:00
Richard Henderson 743434099d target-alpha: Make use of fp_status.flush_inputs_to_zero.
This softfp feature post-dates the last major update to the Alpha
fpu translation.  We can make use of this to eliminate at least
one helper function that was performing this operation by hand.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:58 +00:00
Richard Henderson c30827555d target-alpha: Move memory helpers to mem_helper.c.
This completes the transition away from AREG0.  This patch must
be last because it requires CONFIG_TCG_PASS_AREG0 set too.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:32 +00:00
Richard Henderson 69163fbb0c target-alpha: Move palcode support helpers to sys_helper.c.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:31 +00:00
Richard Henderson 2958620f67 target-alpha: Move integer overflow helpers to int_helper.c.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:30 +00:00
Richard Henderson a44a27775a target-alpha: Move fpcr helpers from op_helper.c to helper.c.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:28 +00:00
Richard Henderson 4a58aedff4 target-alpha: Move floating-point helpers to fpu_helper.c.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:27 +00:00
Richard Henderson b9f0923eb7 target-alpha: Move exception helpers to helper.c.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:26 +00:00
Richard Henderson 0be034bc2c target-alpha: Move integer helpers to int_helper.c.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:26 +00:00
Richard Henderson 7b74505331 alpha-linux-user: Initialize fpu to round-to-normal.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 17:07:25 +00:00
Meador Inge cdb432b202 gdbserver: Don't send a GDB syscall until the system CPU is stopped
Fix an issue where the GDB server implementation was sending GDB syscall
requests while the system CPU was still running.  Syscall requests must
be sent while the CPU is stopped otherwise replies from the GDB client
might get dropped and the GDB server might be incorrectly transitioned
into a 'RUN_STATE_PAUSED' state.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
[PMM: trivial rebase, reinstated comma after last item in RSState enum]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 14:12:27 +00:00
Michael Tokarev 3179d694a8 Support utf8 chars in pod docs
We've at least one UTF8 char in the qemu texi doc:

 $ grep Tibor qemu-doc.texi
 by Tibor "TS" Schütz.
 $ man ./qemu.1 | grep Tibor
        by Tibor "TS" SchA~Xtz.

This patch allows utf8 in man/pod docs.

Initially it was split into two parts and sent on 2012-02-02.
Resending it again (3rd time) now in merged form.  If any
other generalizations of $(POD2MAN) are needed it can be done
in a separate patch.  Current form of $(POD2MAN) is choosen
to be able to easily change it if some implementation does
not support utf8 or resulting output has issues with local
man(1) program/macros.

First, add @documentencoding in scripts/texi2pod.pl:

Currently our texi2pod ignores @documentencoding even if it is set
properly in *.texi files.  This results in a mojibake in documents
generated from qemu.pod (which is generated from qemu-doc.texi by
texi2pod), because the rest of the tools assumes ASCII encoding.

This patch recognizes first @documentencoding in input and places
it at the beginning of output as =encoding directive.

Second, run pod2man with --utf8 option to enable utf8 in manpages:

This option makes no difference for manpages which contains only
ascii chars.  But for manpages with actual UTF8 characters (qemu
docs contains these), this change allows to see real characters
instead of mojibakes or substitutes.

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 14:10:25 +00:00
Richard Henderson 813da6277c tcg: Use the GDB JIT debugging interface.
This allows us to generate unwind info for the dynamicly generated
code in the code_gen_buffer.  Only i386 is converted at this point.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 13:07:48 +00:00
Gerd Hoffmann 08c4ea294f fix screendump
Commit 45efb16124 optimized a bit too
much.  We can skip the vga_invalidate_display() in case no console
switch happened because we don't need a full redraw then.  We can *not*
skip vga_hw_update() though, because the screen content will be stale
then in case nobody else calls vga_hw_update().

Trigger: vga textmode with vnc display and no client connected.

Reported-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Tested-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 13:06:41 +00:00
Stefan Weil bc09845431 target-sparc: Add compiler attribute to some functions which don't return
helper_raise_exception does not return, nor does do_unaligned_access.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 13:02:56 +00:00
Stefan Weil 59821ae802 target-mips: Add compiler attribute to some functions which don't return
helper_raise_exception_err does not return, nor do helper_raise_exception
and do_unaligned_access.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 13:02:43 +00:00
Stefan Weil 1367ff497a Add support for target helper functions which don't return
Most functions which handle exceptions don't return.

With a compiler attribute (added by QEMU_NORETURN),
gcc can optimize the code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 13:01:46 +00:00
Avi Kivity 4daa187d49 scripts: add gdb support script
Add a script that enhances gdb to be aware of QEMU data structures.

This patch adds a single gdb command, 'qemu mtree'.  The command is
similar to the monitor's 'info mtree', except that it prints MemoryRegion
addresses, and except for working from a core dump as well as a live instance.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24 12:57:02 +00:00
Alon Levy a13ccc991a ui/spice-display: use uintptr_t when casting qxl physical addresses
The current intptr_t casts are a problem when the address's highest
bit is 1, and it is cast to a intptr_t and then to uint64_t, such
as at:
     surface.mem        = (intptr_t)ssd->buf;

This causes the sign bit to be extended which causes a wrong address to
be passed on to spice, which then complains when it gets the wrong
slot_id number, since the slot_id is taken from the higher bits.

The assertion happens early - during the first primary surface creation.

This fixes running "-vga qxl -spice" with 32 bit compiled
qemu-system-i386.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-22 14:29:13 +01:00
Peter Maydell 34d14c6d8c ui/spice-display.c: Fix compilation warnings on 32 bit hosts
Fix compilation failures ("cast from pointer to integer of
different size [-Werror=pointer-to-int-cast]") by using
uintptr_t instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-22 14:29:12 +01:00
Anthony Liguori 33cf629a37 Merge remote-tracking branch 'sstabellini/saverestore-8' into staging
* sstabellini/saverestore-8:
  xen: do not allocate RAM during INMIGRATE runstate
  xen mapcache: check if memory region has moved.
  xen: record physmap changes to xenstore
  Set runstate to INMIGRATE earlier
  Introduce "xen-save-devices-state"
  cirrus_vga: do not reset videoram

Conflicts:
	qapi-schema.json

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-19 13:39:42 -05:00
Anthony Liguori b85a4ec8a7 Merge remote-tracking branch 'stefanha/trivial-patches' into staging
* stefanha/trivial-patches:
  qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()
  ioapic: fix build with DEBUG_IOAPIC
  .gitignore: add qemu-bridge-helper and option rom build products
  cleanup obsolete typedef
  monitor: Remove unused bool field 'qapi' in mon_cmd_t struct
  ds1338: Add missing break statement
  vnc: Fix packed boolean struct members
  Remove type field in ModuleEntry as it's not used
2012-03-19 13:37:41 -05:00
Anthony Liguori dfebfcf02f Merge remote-tracking branch 'spice/spice.v50' into staging
* spice/spice.v50:
  spice: fix broken initialization
  hw/qxl.c: Fix compilation failures on 32 bit hosts
  qxl/qxl_render.c: add trace events
  qxl: switch qxl.c to trace-events
  qxl: init_pipe_signaling: exit on failure
  monitor: fix client_migrate_info error handling
  spice: set spice uuid and name
2012-03-19 13:37:23 -05:00