sdk/emulator/qemu.git
13 years agoguest-agent: fix build with OpenBSD
Anthony Liguori [Fri, 22 Jul 2011 19:14:17 +0000 (14:14 -0500)]
guest-agent: fix build with OpenBSD

FS-Freeze only works with Linux.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoxen: fix xen-mapcache build on non-Xen capable targets
Avi Kivity [Wed, 20 Jul 2011 09:14:06 +0000 (12:14 +0300)]
xen: fix xen-mapcache build on non-Xen capable targets

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Fri, 22 Jul 2011 16:07:08 +0000 (11:07 -0500)]
Merge remote-tracking branch 'origin/master' into staging

13 years agotarget-sparc: Fix compiler errors (format strings)
Stefan Weil [Fri, 22 Jul 2011 05:44:27 +0000 (07:44 +0200)]
target-sparc: Fix compiler errors (format strings)

This change is needed because commit 06e12b65
now uses an unsigned long long value
(uint64_t && unsigned long long => unsigned long long).

Cc: Tsuneo Saito <tsnsaito@gmail.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge remote-tracking branch 'spice/spice.v39' into staging
Anthony Liguori [Fri, 22 Jul 2011 14:24:07 +0000 (09:24 -0500)]
Merge remote-tracking branch 'spice/spice.v39' into staging

13 years agoMerge remote-tracking branch 'qmp/for-anthony' into staging
Anthony Liguori [Fri, 22 Jul 2011 14:23:53 +0000 (09:23 -0500)]
Merge remote-tracking branch 'qmp/for-anthony' into staging

13 years agoMerge remote-tracking branch 'kraxel/usb.21' into staging
Anthony Liguori [Fri, 22 Jul 2011 14:23:49 +0000 (09:23 -0500)]
Merge remote-tracking branch 'kraxel/usb.21' into staging

13 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 22 Jul 2011 14:23:43 +0000 (09:23 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

13 years agoUSB: add usb network redirection support
Hans de Goede [Tue, 19 Jul 2011 09:04:10 +0000 (11:04 +0200)]
USB: add usb network redirection support

This patch adds support for a usb-redir device, which takes a chardev
as a communication channel to an actual usbdevice using the usbredir protocol.

Compiling the usb-redir device requires usbredir-0.3 to be installed for
the usbredir protocol parser, usbredir-0.3 also contains a server for
redirecting usb traffic from an actual usb device. You can get the 0.3
release of usbredir here:
http://people.fedoraproject.org/~jwrdegoede/usbredir-0.3.tar.bz2
(getting a more formal site for it is a WIP)

Example usage:
1) Start usbredirserver for a usb device:
sudo usbredirserver 045e:0772
2) Start qemu with usb2 support + a chardev talking to usbredirserver +
   a usb-redir device using this chardev:
qemu ... \
  -readconfig docs/ich9-ehci-uhci.cfg \
  -chardev socket,id=usbredirchardev,host=localhost,port=4000 \
  -device usb-redir,chardev=usbredirchardev,id=usbredirdev

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ehci: trace: rename "next" to "nxt".
Gerd Hoffmann [Wed, 20 Jul 2011 13:44:01 +0000 (15:44 +0200)]
usb-ehci: trace: rename "next" to "nxt".

"next" is reserved in systemtap thus using this as a
trace parameter name causes trouble when trying to trace
with systemtap.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-uhci: fix irq handling on error.
Gerd Hoffmann [Fri, 8 Jul 2011 15:28:11 +0000 (17:28 +0200)]
usb-uhci: fix irq handling on error.

Spec on UHCI_STS_USBERR: "If the TD on which the error interrupt
occurred also had its IOC bit set, both this bit and Bit 0 are set."

Make UHCI emulation do that.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-hid: fixup changed tracking.
Gerd Hoffmann [Fri, 8 Jul 2011 11:19:01 +0000 (13:19 +0200)]
usb-hid: fixup changed tracking.

Remove leftover calls to usb_hid_changed().

Take care to update the changed flag after delivering a event via
GET_REPORT like we do when sending events via interrupt endpoint.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoSPARC64: implement addtional MMU faults related to nonfaulting load
Tsuneo Saito [Thu, 21 Jul 2011 15:16:33 +0000 (00:16 +0900)]
SPARC64: implement addtional MMU faults related to nonfaulting load

This patch implements MMU faults caused by TTE.NFO and TTE.E:
- access other than nonfaulting load to a page marked NFO should
  raise data_access_exception
- nonfaulting load to a page marked with E bit should raise
  data_access_exception

To distinguish nonfaulting loads, this patch extends (abuses?) the rw
argument of get_physical_address_data().  rw is set to 4 on nonfaulting
loads.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: implement MMU miss traps on nonfaulting loads
Tsuneo Saito [Thu, 21 Jul 2011 15:16:32 +0000 (00:16 +0900)]
SPARC64: implement MMU miss traps on nonfaulting loads

Nonfaulting loads should raise fast_data_access_MMU_miss traps as
normal loads do.  It is up to the guest OS kernel that detect MMU misses
on nonfaulting load instructions and make them complete without signaling.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: fix fault status overwritten on nonfaulting load
Tsuneo Saito [Thu, 21 Jul 2011 15:16:31 +0000 (00:16 +0900)]
SPARC64: fix fault status overwritten on nonfaulting load

cpu_get_phys_page_nofault() calls get_physical_address() twice,
that results in overwriting the fault status in the SFSR.
We need this change in order for nonfaulting loads to raising MMU faults
as normal loads do.
Also removed the call to cpu_get_physical_page_desc() since we are
going to modify nonfaulting loads raising MMU faults.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: split cpu_get_phys_page_debug() from cpu_get_phys_page_nofault()
Tsuneo Saito [Thu, 21 Jul 2011 15:16:30 +0000 (00:16 +0900)]
SPARC64: split cpu_get_phys_page_debug() from cpu_get_phys_page_nofault()

This patch makes cpu_get_phys_page_debug() independent from
cpu_get_phys_page_nofault() in advance of implementing nonfaulting load.
This also modifies cpu_get_phys_page_nofault() to be compiled only on
TARGET_SPARC64 because it is not required on SPARC32.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: introduce a convenience function for getting physical addresses
Tsuneo Saito [Thu, 21 Jul 2011 15:16:29 +0000 (00:16 +0900)]
SPARC64: introduce a convenience function for getting physical addresses

Introduce cpu_sparc_get_phys_page() to be used as a help for splitting
cpu_get_phys_page_debug() from cpu_get_phys_page_nofault().

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: SFSR cleanup and fix
Tsuneo Saito [Thu, 21 Jul 2011 15:16:28 +0000 (00:16 +0900)]
SPARC64: SFSR cleanup and fix

Add macros for SFSR fields and use macros instead of magic numbers.
Also fix the update of the register fields on MMU faults.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: TTE bits cleanup
Tsuneo Saito [Thu, 21 Jul 2011 15:16:27 +0000 (00:16 +0900)]
SPARC64: TTE bits cleanup

Add macros for TTE bits and modify to use macros instead of
magic numbers.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoguest agent: add guest agent RPCs/commands
Michael Roth [Tue, 19 Jul 2011 20:41:55 +0000 (15:41 -0500)]
guest agent: add guest agent RPCs/commands

This adds the initial set of QMP/QAPI commands provided by the guest
agent:

guest-sync
guest-ping
guest-info
guest-shutdown
guest-file-open
guest-file-read
guest-file-write
guest-file-seek
guest-file-flush
guest-file-close
guest-fsfreeze-freeze
guest-fsfreeze-thaw
guest-fsfreeze-status

The input/output specification for these commands are documented in the
schema.

Example usage:

  host:
    qemu -device virtio-serial \
         -chardev socket,path=/tmp/vs0.sock,server,nowait,id=qga0 \
         -device virtserialport,chardev=qga0,name=org.qemu.quest_agent.0
         ...

    echo "{'execute':'guest-info'}" | socat stdio unix-connect:/tmp/qga0.sock

  guest:
    qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0 \
            -p /var/run/qemu-guest-agent.pid -d

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoguest agent: qemu-ga daemon
Michael Roth [Wed, 20 Jul 2011 20:19:37 +0000 (15:19 -0500)]
guest agent: qemu-ga daemon

This is the actual guest daemon, it listens for requests over a
virtio-serial/isa-serial/unix socket channel and routes them through
to dispatch routines, and writes the results back to the channel in
a manner similar to QMP.

A shorthand invocation:

  qemu-ga -d

Is equivalent to:

  qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0 \
          -f /var/run/qemu-ga.pid -d

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoguest agent: command state class
Michael Roth [Tue, 19 Jul 2011 20:41:53 +0000 (15:41 -0500)]
guest agent: command state class

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqerror: add QERR_JSON_PARSE_ERROR to qerror.c
Michael Roth [Tue, 19 Jul 2011 20:41:52 +0000 (15:41 -0500)]
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>
13 years agoqapi: add QAPI code generation documentation
Michael Roth [Tue, 19 Jul 2011 19:50:46 +0000 (14:50 -0500)]
qapi: add QAPI code generation documentation

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add test-qmp-commands, tests for gen. marshalling/dispatch code
Michael Roth [Tue, 19 Jul 2011 19:50:45 +0000 (14:50 -0500)]
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>
13 years agoqapi: add test-visitor, tests for gen. visitor code
Michael Roth [Tue, 19 Jul 2011 19:50:44 +0000 (14:50 -0500)]
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>
13 years agoqapi: test schema used for unit tests
Michael Roth [Tue, 19 Jul 2011 19:50:43 +0000 (14:50 -0500)]
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>
13 years agoqapi: add qapi-commands.py code generator
Michael Roth [Tue, 19 Jul 2011 19:50:42 +0000 (14:50 -0500)]
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>
13 years agoqapi: add qapi-visit.py code generator
Michael Roth [Tue, 19 Jul 2011 19:50:41 +0000 (14:50 -0500)]
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>
13 years agoqapi: add qapi-types.py code generator
Michael Roth [Tue, 19 Jul 2011 19:50:40 +0000 (14:50 -0500)]
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>
13 years agoqapi: add qapi.py helper libraries
Michael Roth [Tue, 19 Jul 2011 19:50:39 +0000 (14:50 -0500)]
qapi: add qapi.py helper libraries

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add ordereddict.py helper library
Michael Roth [Tue, 19 Jul 2011 19:50:38 +0000 (14:50 -0500)]
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>
13 years agoqapi: add QMP dispatch functions
Michael Roth [Tue, 19 Jul 2011 19:50:37 +0000 (14:50 -0500)]
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>
13 years agoqapi: add QMP command registration/lookup functions
Michael Roth [Tue, 19 Jul 2011 19:50:36 +0000 (14:50 -0500)]
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>
13 years agoqapi: add QAPI dealloc visitor
Michael Roth [Tue, 19 Jul 2011 19:50:35 +0000 (14:50 -0500)]
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>
13 years agoqapi: add QMP output visitor
Michael Roth [Tue, 19 Jul 2011 19:50:34 +0000 (14:50 -0500)]
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>
13 years agoqapi: add QMP input visitor
Michael Roth [Tue, 19 Jul 2011 19:50:33 +0000 (14:50 -0500)]
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>
13 years agoqapi: add QAPI visitor core
Michael Roth [Tue, 19 Jul 2011 19:50:32 +0000 (14:50 -0500)]
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>
13 years agoqapi: add module init types for qapi
Michael Roth [Tue, 19 Jul 2011 19:50:31 +0000 (14:50 -0500)]
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>
13 years agoqlist: add qlist_first()/qlist_next()
Michael Roth [Tue, 19 Jul 2011 19:50:30 +0000 (14:50 -0500)]
qlist: add qlist_first()/qlist_next()

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoAdd hard build dependency on glib
Anthony Liguori [Tue, 19 Jul 2011 19:50:29 +0000 (14:50 -0500)]
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>
13 years agoError: Fix build when qemu-common.h is not included
Luiz Capitulino [Mon, 11 Jul 2011 18:01:57 +0000 (15:01 -0300)]
Error: Fix build when qemu-common.h is not included

Commit e4ea5e2d0e0e4c5188ab45b66f3195062ae059dc 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>
13 years agoIntroduce compiler.h header file
Luiz Capitulino [Mon, 11 Jul 2011 17:24:44 +0000 (14:24 -0300)]
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>
13 years agoQMP: add snapshot-blkdev-sync command
Jes Sorensen [Mon, 11 Jul 2011 18:01:09 +0000 (20:01 +0200)]
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>
13 years agoUpdate OpenBIOS images for Sparc32 and Sparc64
Blue Swirl [Wed, 20 Jul 2011 22:06:33 +0000 (22:06 +0000)]
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>
13 years agoFix unassigned memory access handling
Blue Swirl [Sun, 3 Jul 2011 08:53:46 +0000 (08:53 +0000)]
Fix unassigned memory access handling

cea5f9a28faa528b6b1b117c9ab2d8828f473fef 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>
13 years agoAvoid CPU endian memory accesses in devices
Blue Swirl [Thu, 14 Jul 2011 15:22:20 +0000 (15:22 +0000)]
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>
13 years agoSPARC64: treat UA2007 ASI_BLK_* as translating ASIs.
Tsuneo Saito [Mon, 18 Jul 2011 05:32:18 +0000 (14:32 +0900)]
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>
13 years agocheckpatch: Fix bracing false positives on #if
Blue Swirl [Fri, 15 Jul 2011 20:09:10 +0000 (20:09 +0000)]
checkpatch: Fix bracing false positives on #if

789f88d0b21fedfd4251d56bb7a9fbfbda7a4ac7 only fixed #else,
fix also #if.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/mips: Fix regression caused by typo (copy + paste bug)
Stefan Weil [Wed, 20 Jul 2011 18:56:36 +0000 (20:56 +0200)]
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
cea5f9a28faa528b6b1b117c9ab2d8828f473fef.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agods1225y: convert to qdev device, and use it in MIPS Jazz emulation
Hervé Poussineau [Mon, 18 Jul 2011 21:34:22 +0000 (23:34 +0200)]
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>
13 years agods1225y: use trace framework
Hervé Poussineau [Mon, 18 Jul 2011 21:34:21 +0000 (23:34 +0200)]
ds1225y: use trace framework

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agods1225y: Remove protection stuff, which doesn't belong to this device
Hervé Poussineau [Mon, 18 Jul 2011 21:34:20 +0000 (23:34 +0200)]
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>
13 years agoSPARC64: add missing break on fmovdcc
Tsuneo Saito [Mon, 18 Jul 2011 06:36:57 +0000 (15:36 +0900)]
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>
13 years agoSPARC64: fix VIS1 SIMD signed compare instructions
Tsuneo Saito [Mon, 18 Jul 2011 06:00:00 +0000 (15:00 +0900)]
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>
13 years agoMerge branch 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Wed, 20 Jul 2011 20:23:01 +0000 (20:23 +0000)]
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

13 years agoAdd missing documentation for qemu-img -p
Jes Sorensen [Tue, 19 Jul 2011 13:01:34 +0000 (15:01 +0200)]
Add missing documentation for qemu-img -p

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqxl: upon reset, if spice worker is stopped, the command rings can be not empty
Yonit Halperin [Tue, 12 Jul 2011 08:51:58 +0000 (11:51 +0300)]
qxl: upon reset, if spice worker is stopped, the command rings can be not empty

Spice worker does no longer process commands when it is stopped.
Otherwise, it might crash during migration when attempting to process
commands while the guest is not completely loaded.

Cc: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agospice: add sanity check for spice ports
Gerd Hoffmann [Thu, 7 Jul 2011 15:04:17 +0000 (17:04 +0200)]
spice: add sanity check for spice ports

Make sure at least one port (port=.. or tls-port=...)
is specified.  Also apply range checks to the port numbers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoqcow2: Use Qcow2Cache in writeback mode during loadvm/savevm
Kevin Wolf [Tue, 19 Jul 2011 11:01:48 +0000 (13:01 +0200)]
qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm

In snapshotting there is no guest involved, so we can safely use a writeback
mode and do the flushes in the right place (i.e. at the very end). This
improves the time that creating/restoring an internal snapshot takes with an
image in writethrough mode.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: add bdrv_get_allocated_file_size() operation
Fam Zheng [Tue, 12 Jul 2011 11:56:39 +0000 (19:56 +0800)]
block: add bdrv_get_allocated_file_size() operation

qemu-img.c wants to count allocated file size of image. Previously it
counts a single bs->file by 'stat' or Window API. As VMDK introduces
multiple file support, the operation becomes format specific with
platform specific meanwhile.

The functions are moved to block/raw-{posix,win32}.c and qemu-img.c calls
bdrv_get_allocated_file_size to count the bs. And also added VMDK code
to count his own extents.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: fix coding style
Fam Zheng [Tue, 12 Jul 2011 11:56:38 +0000 (19:56 +0800)]
VMDK: fix coding style

Conform coding style in vmdk.c to pass scripts/checkpatch.pl checks.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: create different subformats
Fam Zheng [Tue, 19 Jul 2011 00:45:23 +0000 (08:45 +0800)]
VMDK: create different subformats

Add create option 'format', with enums:
    monolithicSparse
    monolithicFlat
    twoGbMaxExtentSparse
    twoGbMaxExtentFlat
Each creates a subformat image file. The default is monolithicSparse.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: open/read/write for monolithicFlat image
Fam Zheng [Tue, 19 Jul 2011 00:38:22 +0000 (08:38 +0800)]
VMDK: open/read/write for monolithicFlat image

Parse vmdk decriptor file and open mono flat image.
Read/write the flat extent.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: change get_cluster_offset return type
Fam Zheng [Tue, 12 Jul 2011 11:56:35 +0000 (19:56 +0800)]
VMDK: change get_cluster_offset return type

The return type of get_cluster_offset was an offset that use 0 to denote
'not allocated', this will be no longer true for flat extents, as we see
flat extent file as a single huge cluster whose offset is 0 and length
is the whole file length.
So now we use int return value, 0 means success and otherwise offset
invalid.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: move 'static' cid_update flag to bs field
Fam Zheng [Tue, 12 Jul 2011 11:56:34 +0000 (19:56 +0800)]
VMDK: move 'static' cid_update flag to bs field

Cid_update is the flag for updating CID on first write after opening the
image. This should be per image open rather than per program life cycle,
so change it from static var of vmdk_write to a field in BDRVVmdkState.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: flush multiple extents
Fam Zheng [Tue, 12 Jul 2011 11:56:33 +0000 (19:56 +0800)]
VMDK: flush multiple extents

Flush all the file that referenced by the image.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: add field BDRVVmdkState.desc_offset
Fam Zheng [Tue, 12 Jul 2011 11:56:32 +0000 (19:56 +0800)]
VMDK: add field BDRVVmdkState.desc_offset

There are several occurrence of magic number 0x200 as the descriptor
offset within mono sparse image file. This is not the case for images
with separate descriptor file. So a field is added to BDRVVmdkState to
hold the correct value.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: separate vmdk_open by format version
Fam Zheng [Tue, 12 Jul 2011 11:56:31 +0000 (19:56 +0800)]
VMDK: separate vmdk_open by format version

Separate vmdk_open by subformats to:
* vmdk_open_vmdk3
* vmdk_open_vmdk4

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: probe for monolithicFlat images
Fam Zheng [Tue, 12 Jul 2011 11:56:30 +0000 (19:56 +0800)]
VMDK: probe for monolithicFlat images

Probe as the same behavior as VMware does.
Recognize image as monolithicFlat descriptor file when the file is text
and the first effective line (not '#' leaded comment or space line) is
either 'version=1' or 'version=2'. No space or upper case charactors
accepted.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: bugfix, align offset to cluster in get_whole_cluster
Fam Zheng [Tue, 12 Jul 2011 11:56:29 +0000 (19:56 +0800)]
VMDK: bugfix, align offset to cluster in get_whole_cluster

In get_whole_cluster, the offset is not aligned to cluster when reading
from backing_hd. When the first write to child is not at the cluster
boundary, wrong address data from parent is copied to child.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: introduce VmdkExtent
Fam Zheng [Tue, 12 Jul 2011 11:56:28 +0000 (19:56 +0800)]
VMDK: introduce VmdkExtent

Introduced VmdkExtent array into BDRVVmdkState, enable holding multiple
image extents for multiple file image support.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-config: Document -drive options
Luiz Capitulino [Tue, 12 Jul 2011 20:35:09 +0000 (17:35 -0300)]
qemu-config: Document -drive options

Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-options.hx: Document missing -drive options
Luiz Capitulino [Tue, 12 Jul 2011 20:35:08 +0000 (17:35 -0300)]
qemu-options.hx: Document missing -drive options

They are 'werror', 'rerror' and 'readonly'.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi-disk: Mask out serial number EVPD
Hannes Reinecke [Mon, 11 Jul 2011 13:02:26 +0000 (15:02 +0200)]
scsi-disk: Mask out serial number EVPD

If the serial number is not set we should mask it out in the
list of supported VPD pages and mark it as not supported.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi-disk: Fixup debugging statement
Hannes Reinecke [Mon, 11 Jul 2011 13:02:25 +0000 (15:02 +0200)]
scsi-disk: Fixup debugging statement

A debugging statement wasn't converted to the new interface.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi: Add 'hba_private' to SCSIRequest
Hannes Reinecke [Mon, 11 Jul 2011 13:02:24 +0000 (15:02 +0200)]
scsi: Add 'hba_private' to SCSIRequest

'tag' is just an abstraction to identify the command
from the driver. So we should make that explicit by
replacing 'tag' with a driver-defined pointer 'hba_private'.
This saves the lookup for driver handling several commands
in parallel.
'tag' is still being kept for tracing purposes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoMerge remote-tracking branch 'agraf/xen-next' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:04:35 +0000 (08:04 -0500)]
Merge remote-tracking branch 'agraf/xen-next' into staging

13 years agoMerge remote-tracking branch 'kraxel/usb.19' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:03:20 +0000 (08:03 -0500)]
Merge remote-tracking branch 'kraxel/usb.19' into staging

13 years agoMerge remote-tracking branch 'spice/spice.v38' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:02:35 +0000 (08:02 -0500)]
Merge remote-tracking branch 'spice/spice.v38' into staging

13 years agoMerge remote-tracking branch 'mst/for_anthony' into staging
Anthony Liguori [Tue, 19 Jul 2011 12:43:54 +0000 (07:43 -0500)]
Merge remote-tracking branch 'mst/for_anthony' into staging

13 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Tue, 19 Jul 2011 12:43:51 +0000 (07:43 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

13 years agoiov: Update parameter usage in iov_(to|from)_buf()
Hannes Reinecke [Mon, 11 Jul 2011 13:02:23 +0000 (15:02 +0200)]
iov: Update parameter usage in iov_(to|from)_buf()

iov_to_buf() has an 'offset' parameter, iov_from_buf() hasn't.
This patch adds the missing parameter to iov_from_buf().
It also renames the 'offset' parameter to 'iov_off' to
emphasize it's the offset into the iovec and not the buffer.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-io: Fix if scoping bug
Devin Nakamura [Mon, 11 Jul 2011 15:20:25 +0000 (11:20 -0400)]
qemu-io: Fix if scoping bug

Fix a bug caused by lack of braces in if statement

Lack of braces means that if(count & 0x1ff) is never reached

Signed-off-by: Devin Nakamura <devin122@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-io: Fix formatting
Devin Nakamura [Mon, 11 Jul 2011 15:22:16 +0000 (11:22 -0400)]
qemu-io: Fix formatting

Replaced tabs with spaces, 8 space indentations with 4 space
indentation, and other fixes to better adhere to CODING_STYLE

Signed-off-by: Devin Nakamura <devin122@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agosheepdog: add full data preallocation support
MORITA Kazutaka [Tue, 5 Jul 2011 18:38:48 +0000 (03:38 +0900)]
sheepdog: add full data preallocation support

This introduces qemu-img create option for sheepdog which allows the
data to be fully preallocated (note that sheepdog always preallocates
metadata).

The option is disabled by default and you need to enable it like the
following:

qemu-img create sheepdog:test -o preallocation=full 1G

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovirtio-console: Prevent abort()s in case of host chardev close
Amit Shah [Thu, 7 Jul 2011 12:05:27 +0000 (17:35 +0530)]
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>
13 years agovirtio-serial-bus: Fix trailing \n in error_report string
Amit Shah [Thu, 7 Jul 2011 12:46:13 +0000 (18:16 +0530)]
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>
13 years agovirtio-console: Add some trace events
Amit Shah [Tue, 5 Jul 2011 11:07:49 +0000 (16:37 +0530)]
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>
13 years agovirtio-serial-bus: Add trace events
Amit Shah [Tue, 5 Jul 2011 11:06:39 +0000 (16:36 +0530)]
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>
13 years agovirtio: fix indirect descriptor buffer overflow
Michael S. Tsirkin [Mon, 20 Jun 2011 10:42:27 +0000 (13:42 +0300)]
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>
13 years agoxen: move to new pci initializers
Michael S. Tsirkin [Sun, 26 Jun 2011 13:30:45 +0000 (16:30 +0300)]
xen: move to new pci initializers

move ids to pci info structure

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agohw/piix_pci.c: Fix PIIX3-xen to initialize ids
Anthony PERARD [Wed, 22 Jun 2011 15:58:31 +0000 (16:58 +0100)]
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>
13 years agopci_ids: tweak names to match linux/pci_ids.h
Michael S. Tsirkin [Sun, 26 Jun 2011 13:17:27 +0000 (16:17 +0300)]
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>
13 years agovhost: fix double free on device stop
Michael S. Tsirkin [Tue, 21 Jun 2011 17:34:17 +0000 (20:34 +0300)]
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>
13 years agoxen_console: fall back to qemu serial device
Alexander Graf [Sun, 3 Jul 2011 07:44:48 +0000 (09:44 +0200)]
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>
13 years agoxen_console: support the new extended xenstore protocol
Stefano Stabellini [Thu, 30 Jun 2011 17:26:29 +0000 (18:26 +0100)]
xen_console: support the new extended xenstore protocol

Since CS 21994 on xen-unstable.hg and CS
466608f3a32e1f9808acdf832a5843af37e5fcec on qemu-xen-unstable.git, few
changes have been introduced to the PV console xenstore protocol, as
described by the document docs/misc/console.txt under xen-unstable.hg.

From the Qemu point of view, very few modifications are needed to
correctly support the protocol: read from xenstore the "output" node
that tell us what the output of the PV console is going to be.
In case the output is a tty, write to xenstore the device name.

Changes in v2:

- fix error paths: free malloc'ed strings and close the xenstore
connection before returning;

- remove useless snprintf in xenstore_store_pv_console_info if i == 0.

Changes in v3:

- replace xs_daemon_open/xs_daemon_close with xs_open/xs_close.

Changes in v4:

- add a compatibility implementation of xs_open/xs_close.

Changes in v5:

- fix code style.

[agraf] fix build error due to missing stub

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agocheckpatch: don't error out on },{ lines
Alexander Graf [Wed, 29 Jun 2011 06:04:27 +0000 (08:04 +0200)]
checkpatch: don't error out on },{ lines

When having code like this:

    static PCIDeviceInfo piix_ide_info[] = {
        {
            .qdev.name    = "piix3-ide",
            .qdev.size    = sizeof(PCIIDEState),
            .qdev.no_user = 1,
            .no_hotplug   = 1,
            .init         = pci_piix_ide_initfn,
            .vendor_id    = PCI_VENDOR_ID_INTEL,
            .device_id    = PCI_DEVICE_ID_INTEL_82371SB_1,
            .class_id     = PCI_CLASS_STORAGE_IDE,
        },{
            .qdev.name    = "piix4-ide",
            .qdev.size    = sizeof(PCIIDEState),
            .qdev.no_user = 1,
            .no_hotplug   = 1,
            .init         = pci_piix_ide_initfn,
            .vendor_id    = PCI_VENDOR_ID_INTEL,
            .device_id    = PCI_DEVICE_ID_INTEL_82371AB,
            .class_id     = PCI_CLASS_STORAGE_IDE,
        },{
            /* end of list */
        }
    };

checkpatch currently errors out, claiming that spaces need to follow
commas. However, this particular style of defining structs is pretty
common in qemu code and very readable. So let's declare it as supported
for the above case.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen_disk: treat "aio" as "raw"
Stefano Stabellini [Thu, 30 Jun 2011 14:42:31 +0000 (15:42 +0100)]
xen_disk: treat "aio" as "raw"

Sometimes the toolstack uses "aio" without an additional format
identifier, in such cases use "raw".

Updated in v2:

- fix code style.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoqemu_ram_ptr_length: take ram_addr_t as arguments
Stefano Stabellini [Mon, 27 Jun 2011 17:26:06 +0000 (18:26 +0100)]
qemu_ram_ptr_length: take ram_addr_t as arguments

qemu_ram_ptr_length should take ram_addr_t as argument rather than
target_phys_addr_t because is doing comparisons with RAMBlock addresses.

cpu_physical_memory_map should create a ram_addr_t address to pass to
qemu_ram_ptr_length from PhysPageDesc phys_offset.

Remove code after abort() in qemu_ram_ptr_length.

Changes in v2:

- handle 0 size in qemu_ram_ptr_length;

- rename addr1 to raddr;

- initialize raddr to ULONG_MAX.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>