]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agochardev: add spice support to qapi
Gerd Hoffmann [Mon, 25 Feb 2013 11:39:06 +0000 (12:39 +0100)]
chardev: add spice support to qapi

This patch adds 'spicevmc' and 'spiceport' support to qapi and also
switches over the spice chardev initialization to the new qapi code
path.

11 years agochardev: add pipe support to qapi
Gerd Hoffmann [Mon, 25 Feb 2013 10:50:55 +0000 (11:50 +0100)]
chardev: add pipe support to qapi

This patch adds 'pipe' support to qapi and also switches over the
pipe chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: add console support to qapi
Gerd Hoffmann [Mon, 25 Feb 2013 10:48:06 +0000 (11:48 +0100)]
chardev: add console support to qapi

This patch adds 'console' support to qapi and also switches over the
console chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: switch pty init to qapi
Gerd Hoffmann [Mon, 25 Feb 2013 09:16:46 +0000 (10:16 +0100)]
chardev: switch pty init to qapi

This patch switches over the pty chardev initialization
to the new qapi code path.

Bonus: Taking QemuOpts out of the loop allows some nice
cleanups along the way.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: switch parallel init to qapi
Gerd Hoffmann [Fri, 22 Feb 2013 15:17:01 +0000 (16:17 +0100)]
chardev: switch parallel init to qapi

This patch switches over the parallel chardev initialization
to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: switch serial/tty init to qapi
Gerd Hoffmann [Fri, 22 Feb 2013 14:48:05 +0000 (15:48 +0100)]
chardev: switch serial/tty init to qapi

This patch switches over the serial chardev initialization
to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: add stdio support to qapi
Gerd Hoffmann [Thu, 21 Feb 2013 11:34:58 +0000 (12:34 +0100)]
chardev: add stdio support to qapi

This patch adds 'stdio' support to qapi and also switches over the
stdio chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: switch file init to qapi
Gerd Hoffmann [Thu, 21 Feb 2013 11:07:14 +0000 (12:07 +0100)]
chardev: switch file init to qapi

This patch switches over the 'file' chardev initialization
to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: add braille support to qapi
Gerd Hoffmann [Thu, 21 Feb 2013 11:56:10 +0000 (12:56 +0100)]
chardev: add braille support to qapi

This patch adds 'braille' support to qapi and also switches over
the braille chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: add msmouse support to qapi
Gerd Hoffmann [Thu, 21 Feb 2013 10:58:44 +0000 (11:58 +0100)]
chardev: add msmouse support to qapi

This patch adds 'msmouse' support to qapi and also switches over
the msmouse chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: switch null init to qapi
Gerd Hoffmann [Thu, 21 Feb 2013 10:41:26 +0000 (11:41 +0100)]
chardev: switch null init to qapi

This patch switches over the 'null' chardev initialization
to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: add mux chardev support to qapi
Gerd Hoffmann [Thu, 21 Feb 2013 15:16:42 +0000 (16:16 +0100)]
chardev: add mux chardev support to qapi

This adds mux chardev support to the qapi and also makes the qapi-based
chardev creation path handle the "mux=on" option correctly.

11 years agochardev: add support for qapi-based chardev initialization
Gerd Hoffmann [Thu, 21 Feb 2013 10:39:12 +0000 (11:39 +0100)]
chardev: add support for qapi-based chardev initialization

This patch add support for a new way to initialize chardev devices.
Instead of calling a initialization function with a QemuOpts we will
now create a (qapi) ChardevBackend, optionally call a function to
fill ChardevBackend from QemuOpts, then go create the chardev using
the new qapi code path which is also used by chardev-add.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoexec: make -mem-path filenames deterministic
Peter Feiner [Mon, 4 Mar 2013 18:54:25 +0000 (13:54 -0500)]
exec: make -mem-path filenames deterministic

Adds ramblocks' names to their backing files when using -mem-path.  Eases
introspection and debugging.

Signed-off-by: Peter Feiner <peter@gridcentric.ca>
Message-id: 1362423265-15855-1-git-send-email-peter@gridcentric.ca
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoAdd search path support for qemu data files.
Gerd Hoffmann [Fri, 8 Mar 2013 10:42:24 +0000 (11:42 +0100)]
Add search path support for qemu data files.

This patch allows to specify multiple directories where qemu should look
for data files.  To implement that the behavior of the -L switch is
slightly different now:  Instead of replacing the data directory the
path specified will be appended to the data directory list.  So when
specifiying -L multiple times all directories specified will be checked,
in the order they are specified on the command line, instead of just the
last one.

Additionally the default paths are always appended to the directory
data list.  This allows to specify a incomplete directory (such as the
seabios out/ directory) via -L.  Anything not found there will be loaded
from the default paths, so you don't have to create a symlink farm for
all the rom blobs.

For trouble-shooting a tracepoint has been added, logging which blob
has been loaded from which location.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1362739344-8068-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoBuild TPM passthrough for i386 and x86_64 targets
Stefan Berger [Wed, 27 Feb 2013 17:47:55 +0000 (12:47 -0500)]
Build TPM passthrough for i386 and x86_64 targets

Build the TPM passthrough driver only for i386 and x86_64 targets
using the default-configs files for those targets with softmmu.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Message-id: 1361987275-26289-8-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoAdd support for cancelling of a TPM command
Stefan Berger [Wed, 27 Feb 2013 17:47:54 +0000 (12:47 -0500)]
Add support for cancelling of a TPM command

This patch adds support for cancelling an executing TPM command.
In Linux for example a user can cancel a command through the TPM's
sysfs 'cancel' entry using

echo "1" > /sysfs/class/misc/tpm0/device/cancel

This patch propagates the cancellation of a command inside a VM
to the host TPM's sysfs entry.
It also uses the possibility to cancel the command before QEMU VM
shutdown or reboot, which helps in preventing QEMU from hanging while
waiting for the completion of the command.
To relieve higher layers or users from having to determine the TPM's
cancel sysfs entry, the driver searches for the entry in well known
locations.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Message-id: 1361987275-26289-7-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoAdd a TPM Passthrough backend driver implementation
Stefan Berger [Wed, 27 Feb 2013 17:47:53 +0000 (12:47 -0500)]
Add a TPM Passthrough backend driver implementation

This patch is based of off version 9 of Stefan Berger's patch series
  "QEMU Trusted Platform Module (TPM) integration"
and adds a new backend driver for it.

This patch adds a passthrough backend driver for passing commands sent to the
emulated TPM device directly to a TPM device opened on the host machine.
Thus it is possible to use a hardware TPM device in a system running on QEMU,
providing the ability to access a TPM in a special state (e.g. after a Trusted
Boot).

This functionality is being used in the acTvSM Trusted Virtualization Platform
which is available on [1].

Usage example:
  qemu-system-x86_64 -tpmdev passthrough,id=tpm0,path=/dev/tpm0 \
                     -device tpm-tis,tpmdev=tpm0 \
                     -cdrom test.iso -boot d

Some notes about the host TPM:
The TPM needs to be enabled and activated. If that's not the case one
has to go through the BIOS/UEFI and enable and activate that TPM for TPM
commands to work as expected.
It may be necessary to boot the kernel using tpm_tis.force=1 in the boot
command line or 'modprobe tpm_tis force=1' in case of using it as a module.

Regards,
Andreas Niederl, Stefan Berger

[1] http://trustedjava.sourceforge.net/

Signed-off-by: Andreas Niederl <andreas.niederl@iaik.tugraz.at>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Message-id: 1361987275-26289-6-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoBuild the TPM frontend code
Stefan Berger [Wed, 27 Feb 2013 17:47:52 +0000 (12:47 -0500)]
Build the TPM frontend code

Build the TPM frontend code that has been added so far.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Message-id: 1361987275-26289-5-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoAdd a debug register
Stefan Berger [Wed, 27 Feb 2013 17:47:51 +0000 (12:47 -0500)]
Add a debug register

This patch uses the possibility to add a vendor-specific register and
adds a debug register useful for dumping the TIS's internal state. This
register is only active in a debug build (#define DEBUG_TIS).

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Message-id: 1361987275-26289-4-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoAdd TPM (frontend) hardware interface (TPM TIS) to QEMU
Stefan Berger [Wed, 27 Feb 2013 17:47:50 +0000 (12:47 -0500)]
Add TPM (frontend) hardware interface (TPM TIS) to QEMU

This patch adds the main code of the TPM frontend driver, the TPM TIS
interface, to QEMU. The code is largely based on the previous implementation
for Xen but has been significantly extended to meet the standard's
requirements, such as the support for changing of localities and all the
functionality of the available flags.

Communication with the backend (i.e., for Xen or the libtpms-based one)
is cleanly separated through an interface which the backend driver needs
to implement.

Whenever the frontend has collected a complete packet, it will submit
a task to the backend, which then starts processing the command. Once
the result has been returned, the backend invokes a callback function
(tpm_tis_receive_cb()).

Testing the proper functioning of the different flags and localities
cannot be done from user space when running in Linux for example, since
access to the address space of the TPM TIS interface is not possible. Also
the Linux driver itself does not exercise all functionality. So, for
testing there is a fairly extensive test suite as part of the SeaBIOS patches
since from within the BIOS one can have full access to all the TPM's registers.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Message-id: 1361987275-26289-3-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoSupport for TPM command line options
Stefan Berger [Wed, 27 Feb 2013 17:47:49 +0000 (12:47 -0500)]
Support for TPM command line options

This patch adds support for TPM command line options.
The command line options supported here are

./qemu-... -tpmdev passthrough,path=<path to TPM device>,id=<id>
           -device tpm-tis,tpmdev=<id>,id=<other id>

and

./qemu-... -tpmdev help

where the latter works similar to -soundhw help and shows a list of
available TPM backends (for example 'passthrough').

Using the type parameter, the backend is chosen, i.e., 'passthrough' for the
passthrough driver. The interpretation of the other parameters along
with determining whether enough parameters were provided is pushed into
the backend driver, which needs to implement the interface function
'create' and return a TPMDriverOpts structure if the VM can be started or
'NULL' if not enough or bad parameters were provided.

Monitor support for 'info tpm' has been added. It for example prints the
following:

(qemu) info tpm
TPM devices:
 tpm0: model=tpm-tis
  \ tpm0: type=passthrough,path=/dev/tpm0,cancel-path=/sys/devices/pnp0/00:09/cancel

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Message-id: 1361987275-26289-2-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'quintela/migration.next' into staging
Anthony Liguori [Mon, 11 Mar 2013 13:30:34 +0000 (08:30 -0500)]
Merge remote-tracking branch 'quintela/migration.next' into staging

# By Paolo Bonzini (40) and others
# Via Juan Quintela
* quintela/migration.next: (46 commits)
  page_cache: dup memory on insert
  page_cache: fix memory leak
  Fix cache_resize to keep old entry age
  Fix page_cache leak in cache_resize
  migration: inline migrate_fd_close
  migration: eliminate s->migration_file
  migration: move contents of migration_close to migrate_fd_cleanup
  migration: move rate limiting to QEMUFile
  migration: small changes around rate-limiting
  migration: use qemu_ftell to compute bandwidth
  migration: use QEMUFile for writing outgoing migration data
  migration: use QEMUFile for migration channel lifetime
  qemu-file: simplify and export qemu_ftell
  qemu-file: add writable socket QEMUFile
  qemu-file: check exit status when closing a pipe QEMUFile
  qemu-file: fsync a writable stdio QEMUFile
  migration: merge qemu_popen_cmd with qemu_popen
  migration: use qemu_file_rate_limit consistently
  migration: remove useless qemu_file_get_error check
  migration: detect error before sleeping
  ...

11 years agoarm: fix compilation with CONFIG_FDT
Paolo Bonzini [Mon, 11 Mar 2013 10:31:26 +0000 (11:31 +0100)]
arm: fix compilation with CONFIG_FDT

A conflict was resolved the wrong way when merging commit 320ba5f (build:
always link device_tree.o into emulators if libfdt available, 2013-02-05).
This causes a build failure for the arm-softmmu target due to multiply
defined symbol.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1362997886-9470-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopage_cache: dup memory on insert
Peter Lieven [Mon, 25 Feb 2013 17:12:04 +0000 (19:12 +0200)]
page_cache: dup memory on insert

The page cache frees all data on finish, on resize and
if there is collision on insert. So it should be the caches
responsibility to dup the data that is stored in the cache.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agopage_cache: fix memory leak
Peter Lieven [Mon, 25 Feb 2013 17:12:03 +0000 (19:12 +0200)]
page_cache: fix memory leak

XBZRLE encoded migration introduced a MRU page cache
meachnism. Unfortunately, cached items where never freed in
case of a collision in the page cache on cache_insert().

This lead to out of memory conditions during XBZRLE migration
if the page cache was small and there where a lot of collisions
in the cache.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoFix cache_resize to keep old entry age
Orit Wasserman [Mon, 25 Feb 2013 17:12:02 +0000 (19:12 +0200)]
Fix cache_resize to keep old entry age

Instead of using cache_insert do the update itself

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoFix page_cache leak in cache_resize
Orit Wasserman [Mon, 25 Feb 2013 17:12:01 +0000 (19:12 +0200)]
Fix page_cache leak in cache_resize

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: inline migrate_fd_close
Paolo Bonzini [Fri, 22 Feb 2013 16:36:48 +0000 (17:36 +0100)]
migration: inline migrate_fd_close

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: eliminate s->migration_file
Paolo Bonzini [Fri, 22 Feb 2013 16:36:47 +0000 (17:36 +0100)]
migration: eliminate s->migration_file

The indirection is useless now.  Backends can open s->file directly.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: move contents of migration_close to migrate_fd_cleanup
Paolo Bonzini [Fri, 22 Feb 2013 16:36:46 +0000 (17:36 +0100)]
migration: move contents of migration_close to migrate_fd_cleanup

With this patch, the migration_file is not needed anymore.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: move rate limiting to QEMUFile
Paolo Bonzini [Fri, 22 Feb 2013 16:36:45 +0000 (17:36 +0100)]
migration: move rate limiting to QEMUFile

Rate limiting is now simply a byte counter; client call
qemu_file_rate_limit() manually to determine if they have to exit.
So it is possible and simple to move the functionality to QEMUFile.

This makes the remaining functionality of s->file redundant;
in the next patch we can remove it and write directly to s->migration_file.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: small changes around rate-limiting
Paolo Bonzini [Fri, 22 Feb 2013 16:36:44 +0000 (17:36 +0100)]
migration: small changes around rate-limiting

This patch extracts a few small changes from the next patch, which
are unrelated to adding generic rate-limiting functionality to
QEMUFile.  Make migration_set_rate_limit a simple accessor, and
use qemu_file_set_rate_limit consistently.  Also fix a typo where
INT_MAX should have been SIZE_MAX.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: use qemu_ftell to compute bandwidth
Paolo Bonzini [Fri, 22 Feb 2013 16:36:43 +0000 (17:36 +0100)]
migration: use qemu_ftell to compute bandwidth

Prepare for when s->bytes_xfer will be removed.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: use QEMUFile for writing outgoing migration data
Paolo Bonzini [Fri, 22 Feb 2013 16:36:42 +0000 (17:36 +0100)]
migration: use QEMUFile for writing outgoing migration data

Second, drop the file descriptor indirection, and write directly to the
QEMUFile.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: use QEMUFile for migration channel lifetime
Paolo Bonzini [Fri, 22 Feb 2013 16:36:41 +0000 (17:36 +0100)]
migration: use QEMUFile for migration channel lifetime

As a start, use QEMUFile to store the destination and close it.
qemu_get_fd gets a file descriptor that will be used by the write
callbacks.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoqemu-file: simplify and export qemu_ftell
Paolo Bonzini [Fri, 22 Feb 2013 16:36:40 +0000 (17:36 +0100)]
qemu-file: simplify and export qemu_ftell

Force a flush when qemu_ftell is called.  This simplifies the buffer magic
(it also breaks qemu_ftell for input QEMUFiles, but we never use it).

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoqemu-file: add writable socket QEMUFile
Paolo Bonzini [Fri, 22 Feb 2013 16:36:39 +0000 (17:36 +0100)]
qemu-file: add writable socket QEMUFile

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoqemu-file: check exit status when closing a pipe QEMUFile
Paolo Bonzini [Fri, 22 Feb 2013 16:36:38 +0000 (17:36 +0100)]
qemu-file: check exit status when closing a pipe QEMUFile

This is what exec_close does.  Move this to the underlying QEMUFile.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoqemu-file: fsync a writable stdio QEMUFile
Paolo Bonzini [Fri, 22 Feb 2013 16:36:37 +0000 (17:36 +0100)]
qemu-file: fsync a writable stdio QEMUFile

This is what fd_close does.  Prepare for switching to a QEMUFile.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: merge qemu_popen_cmd with qemu_popen
Paolo Bonzini [Fri, 22 Feb 2013 16:36:36 +0000 (17:36 +0100)]
migration: merge qemu_popen_cmd with qemu_popen

There is no reason for outgoing exec migration to do popen manually
anymore (the reason used to be that we needed the FILE* to make it
non-blocking).  Use qemu_popen_cmd.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: use qemu_file_rate_limit consistently
Paolo Bonzini [Fri, 22 Feb 2013 16:36:35 +0000 (17:36 +0100)]
migration: use qemu_file_rate_limit consistently

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: remove useless qemu_file_get_error check
Paolo Bonzini [Fri, 22 Feb 2013 16:36:34 +0000 (17:36 +0100)]
migration: remove useless qemu_file_get_error check

migration_put_buffer is never called if there has been an error.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: detect error before sleeping
Paolo Bonzini [Fri, 22 Feb 2013 16:36:33 +0000 (17:36 +0100)]
migration: detect error before sleeping

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: eliminate last_round
Paolo Bonzini [Fri, 22 Feb 2013 16:36:32 +0000 (17:36 +0100)]
migration: eliminate last_round

We will go around the loop exactly once after setting last_round.
Eliminate the variable altogether.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoqemu-file: make qemu_fflush and qemu_file_set_error private again
Paolo Bonzini [Fri, 22 Feb 2013 16:36:31 +0000 (17:36 +0100)]
qemu-file: make qemu_fflush and qemu_file_set_error private again

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoRename buffered_ to migration_
Juan Quintela [Fri, 22 Feb 2013 16:36:30 +0000 (17:36 +0100)]
Rename buffered_ to migration_

This is consistent once that we have moved everything to migration.c

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: yay, buffering is gone
Paolo Bonzini [Fri, 22 Feb 2013 16:36:29 +0000 (17:36 +0100)]
migration: yay, buffering is gone

Buffering was needed because blocking writes could take a long time
and starve other threads seeking to grab the big QEMU mutex.

Now that all writes (except within _complete callbacks) are done
outside the big QEMU mutex, we do not need buffering at all.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: run setup callbacks out of big lock
Paolo Bonzini [Fri, 22 Feb 2013 16:36:28 +0000 (17:36 +0100)]
migration: run setup callbacks out of big lock

Only the migration_bitmap_sync() call needs the iothread lock.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: run pending/iterate callbacks out of big lock
Paolo Bonzini [Fri, 22 Feb 2013 16:36:27 +0000 (17:36 +0100)]
migration: run pending/iterate callbacks out of big lock

This makes it possible to do blocking writes directly to the socket,
with no buffer in the middle.  For RAM, only the migration_bitmap_sync()
call needs the iothread lock.  For block migration, it is needed by
the block layer (including bdrv_drain_all and dirty bitmap access),
but because some code is shared between iterate and complete, all of
mig_save_device_dirty is run with the lock taken.

In the savevm case, the iterate callback runs within the big lock.
This is annoying because it complicates the rules.  Luckily we do not
need to do anything about it: the RAM iterate callback does not need
the iothread lock, and block migration never runs during savevm.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: reorder SaveVMHandlers members
Paolo Bonzini [Fri, 22 Feb 2013 16:36:26 +0000 (17:36 +0100)]
migration: reorder SaveVMHandlers members

This groups together the callbacks that later will have similar
locking rules.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoblock-migration: add lock
Paolo Bonzini [Fri, 22 Feb 2013 16:36:25 +0000 (17:36 +0100)]
block-migration: add lock

Some state is shared between the block migration code and its AIO
callbacks.  Once block migration will run outside the iothread,
the block migration code and the AIO callbacks will be able to
run concurrently.  Protect the critical sections with a separate
lock.  Do the same for completed_sectors, which can be used from
the monitor.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoblock-migration: document usage of state across threads
Paolo Bonzini [Fri, 22 Feb 2013 16:36:24 +0000 (17:36 +0100)]
block-migration: document usage of state across threads

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoblock-migration: small preparatory changes for locking
Paolo Bonzini [Fri, 22 Feb 2013 16:36:23 +0000 (17:36 +0100)]
block-migration: small preparatory changes for locking

Some small changes that will simplify the positioning of lock/unlock
primitives.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoblock-migration: remove variables that are never read
Paolo Bonzini [Fri, 22 Feb 2013 16:36:22 +0000 (17:36 +0100)]
block-migration: remove variables that are never read

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: cleanup migration (including thread) in the iothread
Paolo Bonzini [Fri, 22 Feb 2013 16:36:21 +0000 (17:36 +0100)]
migration: cleanup migration (including thread) in the iothread

Perform final cleanup in a bottom half, and add joining the thread to
the series of cleanup actions.

migrate_fd_error remains for connection error, but it doesn't need
to cleanup anything anymore.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: prepare to access s->state outside critical sections
Paolo Bonzini [Fri, 22 Feb 2013 16:36:20 +0000 (17:36 +0100)]
migration: prepare to access s->state outside critical sections

Accessing s->state outside the big QEMU lock will simplify a bit the
locking/unlocking of the iothread lock.

We need to keep the lock in migrate_fd_error and migrate_fd_completed,
however, because they call migrate_fd_cleanup.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: add migrate_set_state tracepoint
Kazuya Saito [Fri, 22 Feb 2013 16:36:19 +0000 (17:36 +0100)]
migration: add migrate_set_state tracepoint

Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: do not nest flushing of device data
Paolo Bonzini [Fri, 22 Feb 2013 16:36:18 +0000 (17:36 +0100)]
migration: do not nest flushing of device data

Completion of migration is currently done with a "nested" loop that
invokes buffered_flush: migrate_fd_completed is called by
buffered_file_thread, which calls migrate_fd_cleanup, which calls
buffered_close (via qemu_fclose), which flushes the buffer.

Simplify this, by reusing the buffered_flush call of buffered_file_thread.
Then if qemu_savevm_state_complete was called, and the buffer is empty
(including the QEMUFile buffer, for which we need the previous patch), we
are done.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: simplify error handling
Paolo Bonzini [Fri, 22 Feb 2013 16:36:17 +0000 (17:36 +0100)]
migration: simplify error handling

Always use qemu_file_get_error to detect errors, since that is how
QEMUFile itself drops I/O after an error occurs.  There is no need
to propagate and check return values all the time.

Also remove the "complete" member, since we know that it is set (via
migrate_fd_cleanup) only when the state changes.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: use qemu_file_set_error
Paolo Bonzini [Fri, 22 Feb 2013 16:36:16 +0000 (17:36 +0100)]
migration: use qemu_file_set_error

Remove the return value of buffered_flush, pass it via the error code
of s->file.  Once this is done, the error can be retrieved simply
via migrate_fd_close's call to qemu_fclose.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: flush all data to fd when buffered_flush is called
Paolo Bonzini [Fri, 22 Feb 2013 16:36:15 +0000 (17:36 +0100)]
migration: flush all data to fd when buffered_flush is called

Including data that resided in the QEMUFile's own buffer.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoqemu-file: temporarily expose qemu_file_set_error and qemu_fflush
Paolo Bonzini [Fri, 22 Feb 2013 16:36:14 +0000 (17:36 +0100)]
qemu-file: temporarily expose qemu_file_set_error and qemu_fflush

Right now, migration cannot entirely rely on QEMUFile's automatic
drop of I/O after an error, because it does its "real" I/O outside
the put_buffer callback.  To fix this until buffering is gone, expose
qemu_file_set_error which we will use in buffered_flush.

Similarly, buffered_flush is not a complete flush because some data may
still reside in the QEMUFile's own buffer.  This somewhat complicates the
process of closing the migration thread.  Again, when buffering is gone
buffered_flush will disappear and calling qemu_fflush will not be needed;
in the meanwhile, we expose the function for use in migration.c.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: use qemu_file_set_error to pass error codes back to qemu_savevm_state
Paolo Bonzini [Fri, 22 Feb 2013 16:36:13 +0000 (17:36 +0100)]
migration: use qemu_file_set_error to pass error codes back to qemu_savevm_state

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoqemu-file: pass errno from qemu_fflush via f->last_error
Paolo Bonzini [Fri, 22 Feb 2013 16:36:12 +0000 (17:36 +0100)]
qemu-file: pass errno from qemu_fflush via f->last_error

This is done by almost all callers of qemu_fflush, move the code
directly to qemu_fflush.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoblock-migration: remove useless calls to blk_mig_cleanup
Paolo Bonzini [Fri, 22 Feb 2013 16:36:11 +0000 (17:36 +0100)]
block-migration: remove useless calls to blk_mig_cleanup

Now that the cancel callback is called consistently for all errors,
we can avoid doing its work in the other callbacks.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: push qemu_savevm_state_cancel out of qemu_savevm_state_*
Paolo Bonzini [Fri, 22 Feb 2013 16:36:10 +0000 (17:36 +0100)]
migration: push qemu_savevm_state_cancel out of qemu_savevm_state_*

This is useful, because it lets us keep the cancellation callbacks
inside the big lock while pushing the others out.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: move more error handling to migrate_fd_cleanup
Paolo Bonzini [Fri, 22 Feb 2013 16:36:09 +0000 (17:36 +0100)]
migration: move more error handling to migrate_fd_cleanup

The next patch will add more cases where qemu_savevm_state_cancel
needs to be called; prepare for that already, the function can be
called twice with no ill effect.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: always use vm_stop_force_state
Paolo Bonzini [Fri, 22 Feb 2013 16:36:08 +0000 (17:36 +0100)]
migration: always use vm_stop_force_state

vm_stop_force_state does:

    if (runstate_is_running()) {
        vm_stop(state);
    } else {
        runstate_set(state);
    }

migration.c does:

    if (runstate_is_running()) {
        vm_stop(state);
    } else {
        vm_stop_force_state(state);
    }

The code run is the same even if we always use vm_stop_force_state in
migration.c.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: simplify while loop
Paolo Bonzini [Fri, 22 Feb 2013 16:36:07 +0000 (17:36 +0100)]
migration: simplify while loop

Unify the goto around the loop, with the exit condition at the end of it.
Both can be expressed as "while (ret >= 0)".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Mon, 11 Mar 2013 01:39:17 +0000 (20:39 -0500)]
Merge remote-tracking branch 'origin/master' into staging

* origin/master: (75 commits)
  tcg: Don't make exitreq flag a local temporary
  Makefile: Add subdir dependency on config-devices-all.mak
  make_device_config.sh: Emit dependency file to directory where included
  Revert "make_device_config.sh: Fix target path in generated dependency file"
  s390/virtio-ccw: remove redundant call to blockdev_mark_auto_del
  s390/css: Fix subchannel detection
  Allow virtio-net features for legacy s390 virtio bus
  s390: virtio-ccw maintainer
  s390: simplify kvm cpu init
  pseries: Add compatible property to root of device tree
  target-ppc: Move CPU aliases out of translate_init.c
  target-ppc: Report CPU aliases for QMP
  target-ppc: List alias names alongside CPU models
  target-ppc: Make host CPU a subclass of the host's CPU model
  PPC: xnu kernel expects FLUSH to be cleared on STOP
  PPC: Fix dma interrupt
  target-ppc: Fix PPC_DUMP_SPR_ACCESS build
  target-ppc: Synchronize FPU state with KVM
  target-ppc: Add mechanism for synchronizing SPRs with KVM
  Save memory allocation in the elf loader
  ...

11 years agoMerge remote-tracking branch 'bonzini/hw-dirs' into staging
Anthony Liguori [Mon, 11 Mar 2013 00:39:07 +0000 (19:39 -0500)]
Merge remote-tracking branch 'bonzini/hw-dirs' into staging

* bonzini/hw-dirs:
  sh: move files referencing CPU to hw/sh4/
  ppc: move more files to hw/ppc
  ppc: move files referencing CPU to hw/ppc/
  m68k: move files referencing CPU to hw/m68k/
  i386: move files referencing CPU to hw/i386/
  arm: move files referencing CPU to hw/arm/
  hw: move boards and other isolated files to hw/ARCH
  ppc: express FDT dependency of pSeries and e500 boards via default-configs/
  build: always link device_tree.o into emulators if libfdt available
  hw: include hw header files with full paths
  ppc: do not use ../ in include files
  vt82c686: vt82c686 is not a PCI host bridge
  virtio-9p: remove PCI dependencies from hw/9pfs/
  virtio-9p: use CONFIG_VIRTFS, not CONFIG_LINUX
  hw: move device-hotplug.o to toplevel, compile it once
  hw: move qdev-monitor.o to toplevel directory
  hw: move fifo.[ch] to libqemuutil
  hw: move char backends to backends/

Conflicts:
backends/baum.c
backends/msmouse.c
hw/a15mpcore.c
hw/arm/Makefile.objs
hw/arm/pic_cpu.c
hw/dataplane/event-poll.c
hw/dataplane/virtio-blk.c
include/char/baum.h
include/char/msmouse.h
qemu-char.c
vl.c

Resolve conflicts caused by header movements.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 11 Mar 2013 00:33:03 +0000 (19:33 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

# By Lei Li (2) and others
# Via Stefan Hajnoczi
* stefanha/trivial-patches:
  Fix the wrong description in qemu manual
  pci_host: Drop write-only address_space field
  rng-random: Use qemu_open / qemu_close
  configure: Require at least spice-protocol-0.12.3
  osdep: replace setsockopt by qemu_setsockopt
  lm32: remove unused function
  rtc-test: Fix test failures with recent glib
  configure: Create link to icon bitmap for out-of-tree builds

11 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Mon, 11 Mar 2013 00:30:45 +0000 (19:30 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

# By Paolo Bonzini (4) and Peter Lieven (2)
# Via Paolo Bonzini
* bonzini/scsi-next:
  scsi-disk: handle io_canceled uniformly and correctly
  scsi-disk: do not complete canceled UNMAP requests
  scsi: do not call scsi_read_data/scsi_write_data for a canceled request
  iscsi: look for pkg-config file too
  iscsi: add iscsi_truncate support
  iscsi: retry read, write, flush and unmap on unit attention check conditions

11 years agoqemu-char: fix win32 build
Blue Swirl [Sat, 9 Mar 2013 09:56:04 +0000 (09:56 +0000)]
qemu-char: fix win32 build

96c6384776d631839a9c8fe02bf135f9ba22586c did not adjust
Win32 #ifdeffery properly, breaking build in later commits. Fix.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 0ba5565b1ed44380c57d4a5fab86e9549f581ebf.1362822910.git.blauwirbel@gmail.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agobaum: fix build
Blue Swirl [Sat, 9 Mar 2013 09:56:03 +0000 (09:56 +0000)]
baum: fix build

08744c98115cfa144ed3493556024e400b2e2573 removed hw/baum.h
but did not adjust hw/baum.c, breaking build. Fix.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Message-id: c50406bda98f8b277e8b9004a0012fa5e5c124d0.1362822910.git.blauwirbel@gmail.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotcg: Don't make exitreq flag a local temporary
Richard Henderson [Tue, 5 Mar 2013 16:54:41 +0000 (08:54 -0800)]
tcg: Don't make exitreq flag a local temporary

The value is not actually live across basic blocks, so there's no
need for the local property.  This eliminates storing the temporary
to its home location at the branch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoMakefile: Add subdir dependency on config-devices-all.mak
Andreas Färber [Thu, 21 Feb 2013 15:26:47 +0000 (16:26 +0100)]
Makefile: Add subdir dependency on config-devices-all.mak

What 23bf49b5eca716aaad073f2b47613434e1515cb5 really seemed to try to
fix is that Makefile could recurse into *-softmmu/ subdirectories before
a new *-softmmu/config-devices.mak was generated from pci.mak.

Fix this by adding a dependency on config-all-devices.mak, which in turn
has dependencies on *-softmmu/config-devices.mak.

Reported-by: Gerhard Wiesinger <lists@wiesinger.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agomake_device_config.sh: Emit dependency file to directory where included
Andreas Färber [Thu, 21 Feb 2013 15:26:46 +0000 (16:26 +0100)]
make_device_config.sh: Emit dependency file to directory where included

Placing the config-devices.mak.d file alongside the config-devices.mak
file in *-softmmu/ lead to it getting included into through
*-softmmu/Makefile in addition to ./Makefile, leading to confusion.

Instead, emit it to ./%-config-devices.mak.d, where it is included.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoRevert "make_device_config.sh: Fix target path in generated dependency file"
Andreas Färber [Thu, 21 Feb 2013 15:26:45 +0000 (16:26 +0100)]
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 via
Makefile.target, the make_devices_config.sh call these dependencies are
for is in ./Makefile. Therefore revert to original behavior.

This should unbreak pci.mak dependencies not propagating.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 's390-for-upstream' of git://github.com/agraf/qemu
Blue Swirl [Sat, 9 Mar 2013 11:02:23 +0000 (11:02 +0000)]
Merge branch 's390-for-upstream' of git://github.com/agraf/qemu

* 's390-for-upstream' of git://github.com/agraf/qemu:
  s390/virtio-ccw: remove redundant call to blockdev_mark_auto_del
  s390/css: Fix subchannel detection
  Allow virtio-net features for legacy s390 virtio bus
  s390: virtio-ccw maintainer
  s390: simplify kvm cpu init

11 years agoMerge branch 'ppc-for-upstream' of git://github.com/agraf/qemu
Blue Swirl [Sat, 9 Mar 2013 11:02:07 +0000 (11:02 +0000)]
Merge branch 'ppc-for-upstream' of git://github.com/agraf/qemu

* 'ppc-for-upstream' of git://github.com/agraf/qemu: (66 commits)
  pseries: Add compatible property to root of device tree
  target-ppc: Move CPU aliases out of translate_init.c
  target-ppc: Report CPU aliases for QMP
  target-ppc: List alias names alongside CPU models
  target-ppc: Make host CPU a subclass of the host's CPU model
  PPC: xnu kernel expects FLUSH to be cleared on STOP
  PPC: Fix dma interrupt
  target-ppc: Fix PPC_DUMP_SPR_ACCESS build
  target-ppc: Synchronize FPU state with KVM
  target-ppc: Add mechanism for synchronizing SPRs with KVM
  Save memory allocation in the elf loader
  pseries: Implement h_read hcall
  target-ppc: Change "POWER7" CPU alias
  target-ppc: Fix remaining microcontroller typos among models
  target-ppc: Split model definitions out of translate_init.c
  target-ppc: Update Coding Style for CPU models
  target-ppc: Turn descriptive CPU model comments into device descriptions
  target-ppc: Turn descriptive CPU family comments into device descriptions
  target-ppc: Set remaining fields on CPU family classes
  target-ppc: Register all types for TARGET_PPCEMB
  ...

11 years agos390/virtio-ccw: remove redundant call to blockdev_mark_auto_del
Christian Borntraeger [Fri, 22 Feb 2013 09:01:33 +0000 (09:01 +0000)]
s390/virtio-ccw: remove redundant call to blockdev_mark_auto_del

blockdev_mark_auto_del is already called in virtio-blk-exit.
Remove the redundant call.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390/css: Fix subchannel detection
Christian Borntraeger [Fri, 22 Feb 2013 09:01:32 +0000 (09:01 +0000)]
s390/css: Fix subchannel detection

We have to consider the m bit to find the real channel subsystem when
determining the last subchannel.

If we fail to take this into account, removal of a subchannel in
the middle of a big list of devices will stop device detection after
a reboot.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoAllow virtio-net features for legacy s390 virtio bus
Christian Borntraeger [Thu, 7 Mar 2013 16:21:41 +0000 (17:21 +0100)]
Allow virtio-net features for legacy s390 virtio bus

Enable all virtio-net features for the legacy s390 virtio bus. This also fixes
kernel BUG at /usr/src/packages/BUILD/kernel-default-3.0.58/linux-3.0/drivers/s390/kvm/kvm_virtio.c:121!

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390: virtio-ccw maintainer
Cornelia Huck [Tue, 5 Mar 2013 02:22:01 +0000 (02:22 +0000)]
s390: virtio-ccw maintainer

Add myself as maintainer for virtio-ccw and the s390-ccw-virtio machine.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
[agraf: add myself for virtio-ccw machine]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390: simplify kvm cpu init
Christian Borntraeger [Mon, 4 Feb 2013 22:53:25 +0000 (22:53 +0000)]
s390: simplify kvm cpu init

There is no special code right now and the reset ioctl is done later
on in the the reset handler anyway. Lets simplify the cpu init.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Add compatible property to root of device tree
David Gibson [Mon, 25 Feb 2013 19:27:12 +0000 (19:27 +0000)]
pseries: Add compatible property to root of device tree

Currently, for the pseries machine the device tree supplied by qemu to SLOF
and from there to the guest does not include a 'compatible property' at the
root level.  Usually that works fine, since in this case the compatible
property doesn't really give any information not already found in the
'device_type' or 'model' properties.

However, the lack of 'compatible' confuses the bootloader install in the
SLES11 SP2 and SLES11 SP3 installers.  This patch therefore adds a token
'compatible' property to work around that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-stable@nongnu.org
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Move CPU aliases out of translate_init.c
Andreas Färber [Mon, 25 Feb 2013 03:43:17 +0000 (03:43 +0000)]
target-ppc: Move CPU aliases out of translate_init.c

Move array of CPU aliases to cpu-models.c, alongside model definitions.
This requires to zero-terminate the aliases array since ARRAY_SIZE() can
no longer be used in translate_init.c then.

Suggested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Report CPU aliases for QMP
Andreas Färber [Sat, 23 Feb 2013 07:52:24 +0000 (07:52 +0000)]
target-ppc: Report CPU aliases for QMP

The QMP query-cpu-definitions implementation iterated over CPU classes
only, which were getting less and less as aliases were extracted.

Keep them in QMP as valid -cpu arguments even if not guaranteed stable.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: List alias names alongside CPU models
Andreas Färber [Sat, 23 Feb 2013 07:34:28 +0000 (07:34 +0000)]
target-ppc: List alias names alongside CPU models

Revert adding a separate -cpu ? output section for aliases and list them
per CPU subclass.

Requested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Make host CPU a subclass of the host's CPU model
Andreas Färber [Sat, 23 Feb 2013 11:22:12 +0000 (11:22 +0000)]
target-ppc: Make host CPU a subclass of the host's CPU model

This avoids assigning individual class fields and contributors
forgetting to add field assignments in KVM-only code.

ppc_cpu_class_find_by_pvr() requires the CPU model classes to be
registered, so defer host CPU type registration to kvm_arch_init().

Only register the host CPU type if there is a class with matching PVR.
This lets us drop error handling from instance_init.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: xnu kernel expects FLUSH to be cleared on STOP
Amadeusz Sławiński [Thu, 21 Feb 2013 07:34:11 +0000 (07:34 +0000)]
PPC: xnu kernel expects FLUSH to be cleared on STOP

otherwise it gets stuck in a loop
so clear it when unsetting run when flush is set

void
IODBDMAStop( volatile IODBDMAChannelRegisters *registers)
{

IOSetDBDMAChannelControl( registers,
IOClearDBDMAChannelControlBits( kdbdmaRun )
| IOSetDBDMAChannelControlBits(  kdbdmaFlush ));

DBDMA: writel 0x0000000000000b00 <= 0xa0002000
DBDMA: channel 0x16 reg 0x0
DBDMA:     status 0x00002000

while( IOGetDBDMAChannelStatus( registers) & (
kdbdmaActive | kdbdmaFlush))
eieio();

DBDMA: readl 0x0000000000000b04 => 0x00002000
DBDMA: channel 0x16 reg 0x1
DBDMA: readl 0x0000000000000b04 => 0x00002000
DBDMA: channel 0x16 reg 0x1
DBDMA: readl 0x0000000000000b04 => 0x00002000
DBDMA: channel 0x16 reg 0x1
DBDMA: readl 0x0000000000000b04 => 0x00002000
DBDMA: channel 0x16 reg 0x1
it continues to get printed

}

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
[agraf: replace tabs with spaces]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Fix dma interrupt
Amadeusz Sławiński [Thu, 21 Feb 2013 07:34:10 +0000 (07:34 +0000)]
PPC: Fix dma interrupt

In openbios (drivers/ide.c) they are set to

0000000d 00000000 00000002 00000000
0000000e 00000000 00000003 00000000
0000000f 00000000 00000004 00000000
(The last one seems to be not implemented in qemu)

It follows convention of how they are set on real machines,
both ide and dma ones are increased

Real machine one:
http://web.archive.org/web/20090107151044/http://penguinppc.org/historical/dev-trees-html/g4_agp_500_2.html
00000013 00000001 0000000b 00000000
00000014 00000001 0000000c 00000000
00000015 00000001 0000000d 00000000

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Fix PPC_DUMP_SPR_ACCESS build
Andreas Färber [Wed, 20 Feb 2013 18:24:57 +0000 (18:24 +0000)]
target-ppc: Fix PPC_DUMP_SPR_ACCESS build

A victim of the d523dd00a7d73b28f2e99acf45a4b3f92e56e40a AREG0
conversion, insert the missing cpu_env arguments.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Synchronize FPU state with KVM
David Gibson [Wed, 20 Feb 2013 16:41:51 +0000 (16:41 +0000)]
target-ppc: Synchronize FPU state with KVM

Currently qemu does not get and put the state of the floating point and
vector registers to KVM.  This is obviously a problem for savevm, as well
as possibly being problematic for debugging of FP-using guests.

This patch fixes this by using new extensions to the ONE_REG interface to
synchronize the qemu floating point state with KVM.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Add mechanism for synchronizing SPRs with KVM
David Gibson [Wed, 20 Feb 2013 16:41:50 +0000 (16:41 +0000)]
target-ppc: Add mechanism for synchronizing SPRs with KVM

Currently when runing under KVM on ppc, we synchronize a certain number of
vital SPRs to KVM through the SET_SREGS call.  This leaves out quite a lot
of important SPRs which are maintained in KVM.  It would be helpful to
have their contents in qemu for debugging purposes, and when we implement
migration it will be vital, since they include important guest state that
will need to be restored on the target.

This patch sets up for synchronization of any registers supported by the
KVM ONE_REG calls.  A new variant on spr_register() allows a ONE_REG id to
be stored with the SPR information.  When we set/get information to KVM
we also synchronize any SPRs so registered.

For now we set this mechanism up to synchronize a handful of important
registers that already have ONE_REG IDs, notably the DAR and DSISR.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoSave memory allocation in the elf loader
Fabien Chouteau [Tue, 19 Feb 2013 04:41:11 +0000 (04:41 +0000)]
Save memory allocation in the elf loader

The current elf loader uses too much memory. For example, I have a
executable with a bss section of 400 MB and I set the ram size to 512
MB. Qemu uses about 780MB of RAM (which is fine), but there's a peak at
1.6 GB during initialization (this is not fine).

This patch fixes two things:
 1) do not allocate each elf program twice.
 2) do not allocate memory for areas that are only zeros.

For this we need a new field in Rom: "datasize" which is the size of the
allocated data. If datasize is less than romsize, it means that the area
from datasize to romsize is filled with zeros.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Implement h_read hcall
Erlon Cruz [Mon, 18 Feb 2013 05:00:32 +0000 (05:00 +0000)]
pseries: Implement h_read hcall

This h_call is useful for DLPAR in future amongst other things. Given an index
it fetches the corresponding PTE stored in the htab.

Signed-off-by: Erlon Cruz <erlon.cruz@br.flextronics.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Change "POWER7" CPU alias
Andreas Färber [Sun, 17 Feb 2013 23:16:51 +0000 (23:16 +0000)]
target-ppc: Change "POWER7" CPU alias

Let it resolve to v2.3 rather than v2.0.

Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>