Commit Graph

15372 Commits

Author SHA1 Message Date
Michael Roth 13a286d57b guest agent: command state class
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:15 -03:00
Michael Roth ac32c78076 qerror: add QERR_JSON_PARSE_ERROR to qerror.c
Missing from previous addition of error to qerror.h. Needed for
qerror_format() and friends.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:15 -03:00
Michael Roth b84da83195 qapi: add QAPI code generation documentation
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:15 -03:00
Michael Roth 69ed8366b1 qapi: add test-qmp-commands, tests for gen. marshalling/dispatch code
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth 640e540446 qapi: add test-visitor, tests for gen. visitor code
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth 501e510449 qapi: test schema used for unit tests
This is how QMP commands/parameters/types would be defined. We use a
subset of that functionality here to implement functions/types for unit
testing.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth c17d9908a9 qapi: add qapi-commands.py code generator
This is the code generator for qapi command marshaling/dispatch.
Currently only generators for synchronous qapi/qmp functions are
supported. This script generates the following files:

  $(prefix)qmp-marshal.c: command marshal/dispatch functions for each
                          QMP command defined in the schema. Functions
                          generated by qapi-visit.py are used to
                          convert qobjects recieved from the wire into
                          function parameters, and uses the same
                          visiter functions to convert native C return
                          values to qobjects from transmission back
                          over the wire.

  $(prefix)qmp-commands.h: Function prototypes for the QMP commands
                           specified in the schema.

$(prefix) is used in the same manner as with qapi-types.py

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth 06d64c62dd qapi: add qapi-visit.py code generator
This is the code generator for qapi visiter functions used to
marshal/unmarshal/dealloc qapi types. It generates the following 2
files:

  $(prefix)qapi-visit.c: visiter function for a particular c type, used
                         to automagically convert qobjects into the
                         corresponding C type and vice-versa, and well
                         as for deallocation memory for an existing C
                         type

  $(prefix)qapi-visit.h: declarations for previously mentioned visiter
                         functions

$(prefix) is used as decribed for qapi-types.py

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth fb3182ce6e qapi: add qapi-types.py code generator
This is the code generator for qapi types. It will generation the
following files:

  $(prefix)qapi-types.h - C types corresponding to types defined in
                          the schema you pass in
  $(prefix)qapi-types.c - Cleanup functions for the above C types

The $(prefix) is used to as a namespace to keep the generated code from
one schema/code-generation separated from others so code and be
generated from multiple schemas with clobbering previously created code.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth 0f923be253 qapi: add qapi.py helper libraries
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth e89ac222aa qapi: add ordereddict.py helper library
We need this to parse dictionaries with schema ordering intact so that C
prototypes can be generated deterministically.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth ab02ab2aa7 qapi: add QMP dispatch functions
Given an object recieved via QMP, this code uses the dispatch table
provided by qmp_registry.c to call the corresponding marshalling/dispatch
function and format return values/errors for delivery to the QMP.
Currently only synchronous QMP functions are supported, but this will
also be used for async QMP functions and QMP guest proxy dispatch as
well.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth 43c20a43ca qapi: add QMP command registration/lookup functions
Registration/lookup functions for that provide a lookup table for
dispatching QMP commands.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:14 -03:00
Michael Roth d5f3c29cf8 qapi: add QAPI dealloc visitor
Type of Visitor class that can be passed into a qapi-generated C
type's visitor function to free() any heap-allocated data types.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Michael Roth e4e6aa14ed qapi: add QMP output visitor
Type of Visiter class that serves as the inverse of the input visitor:
it takes a series of native C types and uses their values to construct a
corresponding QObject. The command marshaling/dispatcher functions will
use this to convert the output of QMP functions into a QObject that can
be sent over the wire.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Michael Roth c40cc0a0dd qapi: add QMP input visitor
A type of Visiter class that is used to walk a qobject's
structure and assign each entry to the corresponding native C type.
Command marshaling function will use this to pull out QMP command
parameters recieved over the wire and pass them as native arguments
to the corresponding C functions.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Michael Roth 2345c77c6d qapi: add QAPI visitor core
Base definitions/includes for Visiter interface used by generated
visiter/marshalling code.

Includes a GenericList type. Our lists require an embedded element.
Since these types are generated, if you want to use them in a different
type of data structure, there's no easy way to add another embedded
element. The solution is to have non-embedded lists and that what this is.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Michael Roth c7aa841e9f qapi: add module init types for qapi
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Michael Roth 54d83804a1 qlist: add qlist_first()/qlist_next()
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Anthony Liguori e18df14185 Add hard build dependency on glib
GLib is an extremely common library that has a portable thread implementation
along with tons of other goodies.

GLib and GObject have a fantastic amount of infrastructure we can leverage in
QEMU including an object oriented programming infrastructure.

Short term, it has a very nice thread pool implementation that we could leverage
in something like virtio-9p.  It also has a test harness implementation that
this series will use.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Luiz Capitulino d3608b7cc6 Error: Fix build when qemu-common.h is not included
Commit e4ea5e2d0e added the use of
the macro GCC_FMT_ATTR to error.h, however compiler.h is not
included by error.h

This will cause a build error when files including error.h
don't include qemu-common.h (or compiler.h). Not an issue today
because the only file including it is json-parser.h and it does
include qemu-common.h, but let's get it fixed.

Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Luiz Capitulino 5c0263204d Introduce compiler.h header file
This moves compiler related macros from qemu-common.h to compiler.h.

The reason for this change is that there are simple header files that
depend only on the compiler macros, so including qemu-common.h is overkill.

Besides, qemu-common.h is bloated and will benefit from some splitting.

Please, also note that the QEMU_BUILD_BUG_ON() macro is being fixed to
not use double underscores as a prefix and the license text was added
by Vassili Karpov (malc), who is one of the authors of the new file.

Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:13 -03:00
Jes Sorensen d967b2f14f QMP: add snapshot-blkdev-sync command
Add QMP bits for snapshot_blkdev command. This is the same as
snapshot_blkdev in the human monitor. The command is synchronous.

In the future async commands and or a break down of the functionality
into multiple commands might be added.

Also change the 'snapshot_file' argument to 'snapshot-file' in
the human monitor, so that it matches QMP.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-21 16:48:11 -03:00
Blue Swirl 6c916eda22 Update OpenBIOS images for Sparc32 and Sparc64
Update Sparc32 and Sparc64 OpenBIOS images to SVN revision 1045.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 22:06:33 +00:00
Blue Swirl b14ef7c9ab Fix unassigned memory access handling
cea5f9a28f exposed bugs in unassigned memory
access handling. Fix them by always passing CPUState to the handlers.

Reported-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 21:28:08 +00:00
Blue Swirl 21673cdecb Avoid CPU endian memory accesses in devices
Don't compile virtio.c in hwlib, it depends on memory accesses
performed in CPU endianness.

Make loads and stores in CPU endianness unavailable to devices
and poison them to avoid further bugs.

Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 21:22:43 +00:00
Tsuneo Saito b5176d279a SPARC64: treat UA2007 ASI_BLK_* as translating ASIs.
UA2007 ASI_BLK_* should be added in is_translating_asi().

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 21:11:08 +00:00
Blue Swirl d0510af26d checkpatch: Fix bracing false positives on #if
789f88d0b2 only fixed #else,
fix also #if.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 21:07:24 +00:00
Stefan Weil ea15fb0672 tcg/mips: Fix regression caused by typo (copy + paste bug)
cppcheck reports an error:
qemu/tcg/mips/tcg-target.c:1487: error: Invalid number of character (()

The unpatched code won't compile on mips hosts starting with commit
cea5f9a28f.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 21:03:37 +00:00
Hervé Poussineau cd3e2409a3 ds1225y: convert to qdev device, and use it in MIPS Jazz emulation
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 20:54:51 +00:00
Hervé Poussineau d43ed9ec25 ds1225y: use trace framework
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 20:54:50 +00:00
Hervé Poussineau 86f25c7c37 ds1225y: Remove protection stuff, which doesn't belong to this device
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 20:54:49 +00:00
Tsuneo Saito b7d69dc233 SPARC64: add missing break on fmovdcc
"break" is missing on V9 fmovdcc (%icc).

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 20:44:50 +00:00
Tsuneo Saito afcb737512 SPARC64: fix VIS1 SIMD signed compare instructions
The destination registers of SIMD signed compare instructions
(fcmp*<16|32>) are not FP registers but general purpose r registers.
Comparisons should be freg_rs1 CMP freg_rs2, that were reversed.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-07-20 20:44:23 +00:00
Blue Swirl a3ce3668cc Merge branch 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
* 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Fix BASEPRI, BASEPRI_MAX, and FAULTMASK access
  target-arm: Minimal implementation of performance counters
  Revert "Makefile.target: Allow target helpers to be in any *_helper.c file"
  Revert "target-arm: Use global env in neon_helper.c helpers"
  target-arm: Pass fp status pointer explicitly to neon fp helpers
  target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
  target-arm: Add helper function to generate code to get fpstatus pointer
  Revert "target-arm: Use global env in iwmmxt_helper.c helpers"

Conflicts:
	Makefile.target
2011-07-20 20:23:01 +00:00
Anthony Liguori 03ff09580e Merge remote-tracking branch 'agraf/xen-next' into staging 2011-07-19 08:04:35 -05:00
Anthony Liguori b4dabf9587 Merge remote-tracking branch 'kraxel/usb.19' into staging 2011-07-19 08:03:20 -05:00
Anthony Liguori de20fbcac9 Merge remote-tracking branch 'spice/spice.v38' into staging 2011-07-19 08:02:35 -05:00
Anthony Liguori 6734529435 Merge remote-tracking branch 'mst/for_anthony' into staging 2011-07-19 07:43:54 -05:00
Anthony Liguori 81773a5055 Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging 2011-07-19 07:43:51 -05:00
Amit Shah 0219d73283 virtio-console: Prevent abort()s in case of host chardev close
A host chardev could close just before the guest sends some data to be
written.  This will cause an -EPIPE error.  This shouldn't be propagated
to virtio-serial-bus.

Ideally we should close the port once -EPIPE is received, but since the
chardev interface doesn't return such meaningful values to its users,
all we get is -1 for any kind of error.  Just return 0 for now and wait
for chardevs to return better error messages to act better on the return
messages.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-07-18 15:30:15 +05:30
Amit Shah 95c9cde2df virtio-serial-bus: Fix trailing \n in error_report string
Markus fixed offenders in the file but one instance sneaked in via
another patch.  Fix it.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-07-18 15:30:15 +05:30
Amit Shah d02e4fa4a8 virtio-console: Add some trace events
Add some trace events for messages passed between the char layer and the
virtio-serial bus.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-07-18 15:30:14 +05:30
Amit Shah 49e3fdd7f2 virtio-serial-bus: Add trace events
Add some trace events for messages passed between the guest and host.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-07-18 15:30:14 +05:30
Michael S. Tsirkin c8eac1cfa1 virtio: fix indirect descriptor buffer overflow
We were previously allowing arbitrarily-long indirect descriptors, which
could lead to a buffer overflow in qemu-kvm process.

CVE-2011-2212

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-07-17 18:47:34 +03:00
Michael S. Tsirkin 0d2b962d16 xen: move to new pci initializers
move ids to pci info structure

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-07-17 18:47:34 +03:00
Anthony PERARD ce4fd422a6 hw/piix_pci.c: Fix PIIX3-xen to initialize ids
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-07-17 18:47:34 +03:00
Michael S. Tsirkin 33d5ad53c1 pci_ids: tweak names to match linux/pci_ids.h
Sync xen names to ones used by linux. Add
xen platform device id as well.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-07-17 18:47:34 +03:00
Michael S. Tsirkin c1be973ae1 vhost: fix double free on device stop
vhost dev stop failed to clear the log field.
Typically not an issue as dev start overwrites this field,
but if logging gets disabled before the following start,
it doesn't so this causes a double free.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-07-17 18:47:33 +03:00
Alexander Graf 25a118130f xen_console: fall back to qemu serial device
The new xen_console protocol changed the default xen_console output device
from whatever Qemu chose to whatever xenstore choses and "pty" as fallback.

This is not how Qemu works. It has its own serial redirection semantics. So
it xenstore doesn't contain information on what to do, Qemu is the place to
ask.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-07-17 01:54:25 +02:00