sdk/emulator/qemu.git
8 years agotarget-xtensa: xtfpga: attach FLASH to system IO
Max Filippov [Sun, 27 Sep 2015 15:21:19 +0000 (18:21 +0300)]
target-xtensa: xtfpga: attach FLASH to system IO

XTFPGA FLASH is tied to XTFPGA system IO block. It's not very important
for systems with MMU where system IO block is visible at single
location, but it's important for noMMU systems, where system IO block is
accessible through two separate physical address ranges.

Map XTFPGA FLASH to system IO block and fix offsets used for mapping.
Create and initialize FLASH device with series of qdev_prop_set_* as
that's the preferred interface now. Keep initialization in a separate
function.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
8 years agotarget-xtensa: use CPU_LOG_MMU for MMU event logging
Max Filippov [Mon, 21 Sep 2015 17:37:07 +0000 (20:37 +0300)]
target-xtensa: use CPU_LOG_MMU for MMU event logging

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
8 years agotarget-xtensa: add window overflow check to L32E/S32E
Max Filippov [Sun, 19 Jul 2015 07:02:37 +0000 (10:02 +0300)]
target-xtensa: add window overflow check to L32E/S32E

Despite L32E and S32E primary use is for window underflow and overflow
exception handlers they are just normal instructions, and thus need to
check for window overflow.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
8 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20151021-v2' into staging
Peter Maydell [Wed, 21 Oct 2015 14:07:42 +0000 (15:07 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20151021-v2' into staging

More s390x patches. The first ones are fixes: A regression, missed
compat and a missed part of the SIMD support. The others contain
optimizations and cleanup.

# gpg: Signature made Wed 21 Oct 2015 11:24:48 BST using RSA key ID C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"

* remotes/cohuck/tags/s390x-20151021-v2:
  s390x/cmma: clean up cmma reset
  s390x: reset crypto only on clear reset and QEMU reset
  s390x: machine reset function with new ipl cpu handling
  s390x/ipl: we always have an ipl device
  s390x: unify device reset during subsystem_reset()
  s390x: flagify mcic values
  s390x/kvm: Fix vector validity bit in device machine checks
  s390x/virtio-ccw: fix 2.4 virtio compat
  util/qemu-config: fix missing machine command line options

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agos390x/cmma: clean up cmma reset
David Hildenbrand [Tue, 21 Jul 2015 09:11:11 +0000 (11:11 +0200)]
s390x/cmma: clean up cmma reset

The cmma reset is per VM, so we don't need a cpu object. We can
directly make use of kvm_state, as it is already available when
the reset is called. By moving the cmma reset in our machine reset
function, we can avoid a manual reset handler.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x: reset crypto only on clear reset and QEMU reset
David Hildenbrand [Wed, 30 Sep 2015 11:48:45 +0000 (13:48 +0200)]
s390x: reset crypto only on clear reset and QEMU reset

Initializing VM crypto in initial cpu reset has multiple problems

1. We call the exact same function #VCPU times, although one time is enough
2. On SIGP initial cpu reset, we exchange the wrapping key while
   other VCPUs are running. Bad!
3. It is simply wrong. According to the Pop, a reset happens only during a
   clear reset.

So, we have to reset the keys
- on modified clear reset
- on load clear (QEMU reset - via machine reset)
- on qemu start (via machine reset)

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x: machine reset function with new ipl cpu handling
David Hildenbrand [Tue, 21 Jul 2015 11:47:32 +0000 (13:47 +0200)]
s390x: machine reset function with new ipl cpu handling

Current implementation depends on the order of resets getting triggered.

If a cpu reset is triggered after the ipl device reset, the CPU is stopped and
the VM will not run. In fact, that hinders us from converting the ipl device
into a TYPE_DEVICE. Let's change that by manually configuring the ipl cpu
during a system reset, so we have full control and can demangle that code.

Also remove the superflous cpu parameter from s390_update_iplstate on the way.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/ipl: we always have an ipl device
David Hildenbrand [Thu, 25 Jun 2015 07:55:55 +0000 (09:55 +0200)]
s390x/ipl: we always have an ipl device

Both s390 machines unconditionally create an ipl device, so no need to
handle the missing case.

Now we can also change s390_ipl_update_diag308() to return void.

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x: unify device reset during subsystem_reset()
David Hildenbrand [Tue, 21 Jul 2015 08:58:38 +0000 (10:58 +0200)]
s390x: unify device reset during subsystem_reset()

We have to manually reset several devices that are not on a bus: Let's
collect them in an array.

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agoMerge remote-tracking branch 'remotes/berrange/tags/io-channel-3-for-upstream' into...
Peter Maydell [Tue, 20 Oct 2015 15:51:43 +0000 (16:51 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/io-channel-3-for-upstream' into staging

Merge io-channels-3 partial branch

# gpg: Signature made Tue 20 Oct 2015 16:36:10 BST using RSA key ID 15104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"

* remotes/berrange/tags/io-channel-3-for-upstream:
  util: pull Buffer code out of VNC module
  coroutine: move into libqemuutil.a library
  osdep: add qemu_fork() wrapper for safely handling signals
  ui: convert VNC startup code to use SocketAddress
  sockets: allow port to be NULL when listening on IP address
  sockets: move qapi_copy_SocketAddress into qemu-sockets.c
  sockets: add helpers for creating SocketAddress from a socket

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agos390x: flagify mcic values
Cornelia Huck [Thu, 8 Oct 2015 13:05:46 +0000 (15:05 +0200)]
s390x: flagify mcic values

Instead of using magic values when building the machine check
interruption code, add some defines as by chapter 11-14 in the PoP.

This should make it easier to catch problems like the missing vector
register validity bit ("s390x/kvm: Fix vector validity bit in device
machine checks"), and less hassle should we want to generate machine
checks beyond the channel reports we currently support.

Acked-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/kvm: Fix vector validity bit in device machine checks
Christian Borntraeger [Wed, 7 Oct 2015 08:29:42 +0000 (10:29 +0200)]
s390x/kvm: Fix vector validity bit in device machine checks

Device hotplugs trigger a crw machine check. All machine checks
have validity bits for certain register types. With vector support
we also have to claim that vector registers are valid.
This is a band-aid suitable for stable. Long term we should
create the full  mcic value dynamically depending on the active
features in the kernel interrupt handler.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/virtio-ccw: fix 2.4 virtio compat
Cornelia Huck [Thu, 8 Oct 2015 13:11:34 +0000 (15:11 +0200)]
s390x/virtio-ccw: fix 2.4 virtio compat

Commit 542571d5 ("virtio-ccw: enable virtio-1") missed some virtio
devices for the 2.4 compat handling. Add them.

Fixes: 542571d5 ("virtio-ccw: enable virtio-1")
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
8 years agoutil/qemu-config: fix missing machine command line options
Tony Krowiak [Mon, 12 Oct 2015 15:36:21 +0000 (11:36 -0400)]
util/qemu-config: fix missing machine command line options

Commit 0a7cf217 ("util/qemu-config: fix regression of
qmp_query_command_line_options") aimed to restore parsing of global
machine options, but missed two: "aes-key-wrap" and
"dea-key-wrap" (which were present in the initial version of that
patch). Let's add them to the machine_opts again.

Fixes: 0a7cf217 ("util/qemu-config: fix regression of
                  qmp_query_command_line_options")
CC: Marcel Apfelbaum <marcel@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1444664181-28023-1-git-send-email-akrowiak@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agoutil: pull Buffer code out of VNC module
Daniel P. Berrange [Tue, 3 Mar 2015 17:13:42 +0000 (17:13 +0000)]
util: pull Buffer code out of VNC module

The Buffer code in the VNC server is useful for the IO channel
code, so pull it out into a shared module, QIOBuffer.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agocoroutine: move into libqemuutil.a library
Daniel P. Berrange [Tue, 1 Sep 2015 13:48:02 +0000 (14:48 +0100)]
coroutine: move into libqemuutil.a library

The coroutine files are currently referenced by the block-obj-y
variable. The coroutine functionality though is already used by
more than just the block code. eg migration code uses coroutine
yield. In the future the I/O channel code will also use the
coroutine yield functionality. Since the coroutine code is nicely
self-contained it can be easily built as part of the libqemuutil.a
library, making it widely available.

The headers are also moved into include/qemu, instead of the
include/block directory, since they are now part of the util
codebase, and the impl was never in the block/ directory
either.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoosdep: add qemu_fork() wrapper for safely handling signals
Daniel P. Berrange [Fri, 28 Aug 2015 13:40:01 +0000 (14:40 +0100)]
osdep: add qemu_fork() wrapper for safely handling signals

When using regular fork() the child process of course inherits
all the parents' signal handlers. If the child then proceeds
to close() any open file descriptors, it may break some of those
registered signal handlers. The child generally does not want to
ever run any of the signal handlers that the parent may have
installed in the short time before it exec's. The parent may also
have blocked various signals which the child process will want
enabled.

This introduces a wrapper qemu_fork() that takes care to sanitize
signal handling across fork. Before forking it blocks all signals
in the parent thread. After fork returns, the parent unblocks the
signals and carries on as usual. The child, however, resets all the
signal handlers back to their defaults before it unblocks signals.
The child process can now exec the binary in a "clean" signal
environment.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoui: convert VNC startup code to use SocketAddress
Daniel P. Berrange [Fri, 14 Aug 2015 17:56:44 +0000 (18:56 +0100)]
ui: convert VNC startup code to use SocketAddress

The VNC code is currently using QemuOpts to configure the
sockets connections / listeners it needs. Convert it to
use SocketAddress to bring it in line with modern QAPI
based code elsewhere in QEMU.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agosockets: allow port to be NULL when listening on IP address
Daniel P. Berrange [Tue, 1 Sep 2015 13:46:50 +0000 (14:46 +0100)]
sockets: allow port to be NULL when listening on IP address

If the port in the SocketAddress struct is NULL, it can allow
the kernel to automatically select a free port. This is useful
in particular in unit tests to avoid a race trying to find a
free port to run a test case on.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agosockets: move qapi_copy_SocketAddress into qemu-sockets.c
Daniel P. Berrange [Fri, 14 Aug 2015 17:18:41 +0000 (18:18 +0100)]
sockets: move qapi_copy_SocketAddress into qemu-sockets.c

The qapi_copy_SocketAddress method is going to be useful
in more places than just qemu-char.c, so move it into
the qemu-sockets.c file to allow its reuse.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agosockets: add helpers for creating SocketAddress from a socket
Daniel P. Berrange [Fri, 1 May 2015 16:36:20 +0000 (17:36 +0100)]
sockets: add helpers for creating SocketAddress from a socket

Add two helper methods that, given a socket file descriptor,
can return a populated SocketAddress struct containing either
the local or remote address information.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-20151020-1' into staging
Peter Maydell [Tue, 20 Oct 2015 11:56:45 +0000 (12:56 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20151020-1' into staging

virtio-input: ignore events until the guest driver is ready

# gpg: Signature made Tue 20 Oct 2015 08:10:00 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-input-20151020-1:
  virtio-input: ignore events until the guest driver is ready

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20151020-1' into staging
Peter Maydell [Tue, 20 Oct 2015 11:17:53 +0000 (12:17 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20151020-1' into staging

vga: enable virtio-vga for pseries, vmsvga cursor checks.

# gpg: Signature made Tue 20 Oct 2015 08:27:44 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-vga-20151020-1:
  vmsvga: more cursor checks
  ppc/spapr: Allow VIRTIO_VGA

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-fw_cfg-20151020-1' into staging
Peter Maydell [Tue, 20 Oct 2015 10:45:23 +0000 (11:45 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-fw_cfg-20151020-1' into staging

fw_cfg: add dma interface, add strings via cmdline.

# gpg: Signature made Tue 20 Oct 2015 07:07:34 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-fw_cfg-20151020-1:
  fw_cfg: Define a static signature to be returned on DMA port reads
  Enable fw_cfg DMA interface for x86
  Enable fw_cfg DMA interface for ARM
  Implement fw_cfg DMA interface
  fw_cfg DMA interface documentation
  fw_cfg: document fw_cfg_modify_iXX() update functions
  fw_cfg: insert string blobs via qemu cmdline

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151020-1' into staging
Peter Maydell [Tue, 20 Oct 2015 09:52:56 +0000 (10:52 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151020-1' into staging

usb: misc small tweaks.

# gpg: Signature made Tue 20 Oct 2015 08:24:09 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-usb-20151020-1:
  usb-audio: increate default buffer size
  usb: print device id in "info usb" monitor command
  usb-host: add wakeup call for iso xfers

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-10-14-v4-tag' into...
Peter Maydell [Tue, 20 Oct 2015 08:04:20 +0000 (09:04 +0100)]
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-10-14-v4-tag' into staging

qemu-ga patch queue

* add unit tests for qemu-ga
* add guest-exec support for posix/w32 guests
* added 'qemu-ga' target for w32. this allows us to do full MSI build,
  without overloading 'qemu-ga.exe' target with uneeded dependencies.
* number of s/g_new/g_malloc/ conversions for qga

v2:
* commit message and qapi documentation spelling fixes
* rename 'inp-data' guest-exec param to 'input-data'

v3:
* fix OSX build errors for test-qga by using PRId64
  format in place of glib's, and dropping use of G_SPAWN_DEFAULT
  macro for glib 2.22 compat
* fix win32 build warnings for 32-bit builds by avoid int casts
  of process HANDLEs

v4:
* assert connect_qga() doesn't fail
* only enable test-qga for linux hosts
* allow get-memory-block-info* to fail if memory blocks aren't exposed in
  sysfs

# gpg: Signature made Tue 20 Oct 2015 00:33:43 BST using RSA key ID F108B584
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"

* remotes/mdroth/tags/qga-pull-2015-10-14-v4-tag:
  qga: fix uninitialized value warning for win32
  qga: guest-exec simple stdin/stdout/stderr redirection
  qga: handle G_IO_STATUS_AGAIN in ga_channel_write_all()
  qga: handle possible SIGPIPE in guest-file-write
  qga: guest exec functionality
  qga: drop guest_file_init helper and replace it with static initializers
  tests: add a local test for guest agent
  qga: guest-get-memory-blocks shouldn't fail for unexposed memory blocks
  glib-compat: add 2.38/2.40/2.46 asserts
  qtest: add a few fd-level qmp helpers
  qga: do not override configuration verbosity
  qga: add QGA_CONF environment variable
  qga: Use g_new() & friends where that makes obvious sense
  build: qemu-ga: add 'qemu-ga' build target for w32

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agovmsvga: more cursor checks
Gerd Hoffmann [Tue, 29 Sep 2015 07:58:05 +0000 (09:58 +0200)]
vmsvga: more cursor checks

Check the cursor size more carefully.  Also switch to unsigned while
being at it, so they can't be negative.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoppc/spapr: Allow VIRTIO_VGA
Benjamin Herrenschmidt [Tue, 15 Sep 2015 05:51:29 +0000 (15:51 +1000)]
ppc/spapr: Allow VIRTIO_VGA

It works fine with the Linux driver out of the box

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb-audio: increate default buffer size
Gerd Hoffmann [Tue, 6 Oct 2015 13:31:56 +0000 (15:31 +0200)]
usb-audio: increate default buffer size

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb: print device id in "info usb" monitor command
Gerd Hoffmann [Tue, 6 Oct 2015 13:31:21 +0000 (15:31 +0200)]
usb: print device id in "info usb" monitor command

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb-host: add wakeup call for iso xfers
Gerd Hoffmann [Fri, 17 Jul 2015 07:12:57 +0000 (09:12 +0200)]
usb-host: add wakeup call for iso xfers

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agovirtio-input: ignore events until the guest driver is ready
Gerd Hoffmann [Fri, 16 Oct 2015 11:33:07 +0000 (13:33 +0200)]
virtio-input: ignore events until the guest driver is ready

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoqga: fix uninitialized value warning for win32
Michael Roth [Sat, 17 Oct 2015 15:31:16 +0000 (10:31 -0500)]
qga: fix uninitialized value warning for win32

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: guest-exec simple stdin/stdout/stderr redirection
Yuri Pudgorodskiy [Tue, 13 Oct 2015 15:41:23 +0000 (18:41 +0300)]
qga: guest-exec simple stdin/stdout/stderr redirection

Implemented with base64-encoded strings in qga json protocol.
Glib portable GIOChannel is used for data I/O.

Optinal stdin parameter of guest-exec command is now used as
stdin content for spawned subprocess.

If capture-output bool flag is specified, guest-exec redirects out/err
file descriptiors internally to pipes and collects subprocess
output.

Guest-exe-status is modified to return this collected data to requestor
in base64 encoding.

Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* switch from 'struct GuestIOExecData' to 'GuestIOExecData'
* s/TRUE/true/g, s/FALSE/false/g for gboolean return values
* s/inp_data/input_data/
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: handle G_IO_STATUS_AGAIN in ga_channel_write_all()
Yuri Pudgorodskiy [Tue, 13 Oct 2015 15:41:22 +0000 (18:41 +0300)]
qga: handle G_IO_STATUS_AGAIN in ga_channel_write_all()

glib may return G_IO_STATUS_AGAIN which is actually not an error.
Also fixed a bug when on incomplete write buf pointer was not adjusted.

Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: handle possible SIGPIPE in guest-file-write
Denis V. Lunev [Tue, 13 Oct 2015 15:41:21 +0000 (18:41 +0300)]
qga: handle possible SIGPIPE in guest-file-write

qemu-ga should not exit on guest-file-write to pipe without read end
but proper error code should be returned. The behavior of the
spawned process should be default thus SIGPIPE processing should be
reset to default after fork() but before exec().

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: guest exec functionality
Yuri Pudgorodskiy [Tue, 13 Oct 2015 15:41:20 +0000 (18:41 +0300)]
qga: guest exec functionality

Guest-exec rewritten in platform-independent style with glib spawn.

Child process is spawn asynchronously and exit status can later
be picked up by guest-exec-status command.

stdin/stdout/stderr of the child now is redirected to /dev/null
Later we will add ability to specify stdin in guest-exec command
and to get collected stdout/stderr with guest-exec-status.

Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
* use g_new0 in place of g_malloc for GuestExec struct
* commit msg spelling fixes
* s/inp-data/input-data
* document capture-input mode as false by default
* use GetProcessId() for pids on w32 instead of casting HANDLE
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: drop guest_file_init helper and replace it with static initializers
Denis V. Lunev [Tue, 13 Oct 2015 15:41:19 +0000 (18:41 +0300)]
qga: drop guest_file_init helper and replace it with static initializers

This just makes code shorter and better.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agotests: add a local test for guest agent
Marc-André Lureau [Fri, 2 Oct 2015 12:58:18 +0000 (14:58 +0200)]
tests: add a local test for guest agent

Add some local guest agent tests, as it is better than nothing, only
when CONFIG_POSIX (using unix sockets).

With the QGA_TEST_SIDE_EFFECTING environment variable, it will include
tests with side effects, such as freezing/thawing the FS or changing the
time.

(a better test would involve a managed VM (or container), but it might
be better to leave that off to autotest/avocado)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* use mkdtemp() in placeof g_mkdtemp() for glib 2.22 compat
* drop redundant/conflicting compat defines for
  g_assert_{true,false}, since glib-compat has them now.
* build fixes for OSX: use PRId64 instead of glib formats, drop
  g_spawn_default usage for glib compat
* assert connect_qga() doesn't fail
* only enable test-qga for linux hosts
* allow get-memory-block-info* to fail
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: guest-get-memory-blocks shouldn't fail for unexposed memory blocks
Michael Roth [Mon, 19 Oct 2015 21:38:25 +0000 (16:38 -0500)]
qga: guest-get-memory-blocks shouldn't fail for unexposed memory blocks

Some guests don't expose memory blocks via sysfs at all. This
shouldn't be a failure, instead just return an empty list. For
other access failures we still report an error.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoglib-compat: add 2.38/2.40/2.46 asserts
Marc-André Lureau [Fri, 2 Oct 2015 12:58:17 +0000 (14:58 +0200)]
glib-compat: add 2.38/2.40/2.46 asserts

Those are mostly useful for writing tests.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqtest: add a few fd-level qmp helpers
Marc-André Lureau [Fri, 2 Oct 2015 12:58:16 +0000 (14:58 +0200)]
qtest: add a few fd-level qmp helpers

Add a few functions to interact with qmp via a simple fd.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: do not override configuration verbosity
Marc-André Lureau [Fri, 2 Oct 2015 12:58:15 +0000 (14:58 +0200)]
qga: do not override configuration verbosity

Move the default verbosity settings before loading the configuration
file, or it will overwrite it. Found thanks to writing qga tests :)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: add QGA_CONF environment variable
Marc-André Lureau [Fri, 2 Oct 2015 12:58:14 +0000 (14:58 +0200)]
qga: add QGA_CONF environment variable

Having a environment variable allows to override default configuration
path, useful for testing. Note that this can't easily be an argument,
since loading config is done before parsing the arguments.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: Use g_new() & friends where that makes obvious sense
Markus Armbruster [Mon, 14 Sep 2015 11:50:44 +0000 (13:50 +0200)]
qga: Use g_new() & friends where that makes obvious sense

g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
for two reasons.  One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.

This commit only touches allocations with size arguments of the form
sizeof(T).  Same Coccinelle semantic patch as in commit b45c03f.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agobuild: qemu-ga: add 'qemu-ga' build target for w32
Michael Roth [Mon, 7 Sep 2015 23:47:05 +0000 (18:47 -0500)]
build: qemu-ga: add 'qemu-ga' build target for w32

Currently POSIX builds rely on 'qemu-ga' target to do qga-only
distributable build. On w32, as with most standalone binary targets,
we rely on 'qemu-ga.exe' target.

Unlike with POSIX, qemu-ga for w32 has a number of related targets
such as VSS DLL and MSI package. We can do the full distributable
qga-only build on w32 with:

  make qemu-ga.exe

or:

  make msi

To make that work, we tie VSS dependencies onto qemu-ga.exe.
However, in reality the DLL isn't part of the binary, so we use a
filter to pull them out of the LINK recipe, which attempts to link
against prereqs for binary targets. Additionally, it could be argued
that VSS is a separate distributable, and shouldn't be implied by
qemu-ga.exe binary target.

To avoid this, we can tie the VSS dependencies only to the 'msi'
target, but that would make it impossible to do a qga-only build of
the w32 distributable without building the 'msi' package, which was
supported in the past.

An alternative approach is to add a new target to build the whole
distributable. w32 allows us to use the same build target we use
on POSIX, 'qemu-ga', since the current binary-only target on w32
is 'qemu-ga.exe'.

To further simplify the build, we also make 'qemu-ga' build the MSI
package if the appropriate ./configure options are set, making the
full qga-only build the same on both POSIX and w32: `make qemu-ga`

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agofw_cfg: Define a static signature to be returned on DMA port reads
Kevin O'Connor [Thu, 8 Oct 2015 15:02:58 +0000 (17:02 +0200)]
fw_cfg: Define a static signature to be returned on DMA port reads

Return a static signature ("QEMU CFG") if the guest does a read to the
DMA address io register.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoEnable fw_cfg DMA interface for x86
Marc Marí [Thu, 8 Oct 2015 15:02:57 +0000 (17:02 +0200)]
Enable fw_cfg DMA interface for x86

Enable the fw_cfg DMA interface for all the x86 platforms.

Based on Gerd Hoffman's initial implementation.

Signed-off-by: Marc Marí <markmb@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoEnable fw_cfg DMA interface for ARM
Marc Marí [Thu, 8 Oct 2015 15:02:56 +0000 (17:02 +0200)]
Enable fw_cfg DMA interface for ARM

Enable the fw_cfg DMA interface for the ARM virt machine.

Based on Gerd Hoffman's initial implementation.

Signed-off-by: Marc Marí <markmb@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoImplement fw_cfg DMA interface
Marc Marí [Thu, 8 Oct 2015 15:02:55 +0000 (17:02 +0200)]
Implement fw_cfg DMA interface

Based on the specifications on docs/specs/fw_cfg.txt

This interface is an addon. The old interface can still be used as usual.

Based on Gerd Hoffman's initial implementation.

Signed-off-by: Marc Marí <markmb@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agofw_cfg DMA interface documentation
Marc Marí [Thu, 8 Oct 2015 15:02:54 +0000 (17:02 +0200)]
fw_cfg DMA interface documentation

Add fw_cfg DMA interface specification in the documentation.

Based on Gerd Hoffman's initial implementation.

Signed-off-by: Marc Marí <markmb@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agofw_cfg: document fw_cfg_modify_iXX() update functions
Gabriel L. Somlo [Thu, 8 Oct 2015 15:02:53 +0000 (17:02 +0200)]
fw_cfg: document fw_cfg_modify_iXX() update functions

Document the behavior of fw_cfg_modify_iXX() for leak-less updating
of integer-type blobs.

Currently only fw_cfg_modify_i16() is coded, but 32- and 64-bit versions
may be added later if necessary..

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agofw_cfg: insert string blobs via qemu cmdline
Gabriel L. Somlo [Tue, 29 Sep 2015 16:29:01 +0000 (12:29 -0400)]
fw_cfg: insert string blobs via qemu cmdline

Allow users to provide custom fw_cfg blobs with ascii string
payloads specified directly on the qemu command line.

Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Message-id: 1443544141-26568-1-git-send-email-somlo@cmu.edu
Reviewd-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/2015-10-19-tag' into staging
Peter Maydell [Mon, 19 Oct 2015 11:13:27 +0000 (12:13 +0100)]
Merge remote-tracking branch 'remotes/sstabellini/tags/2015-10-19-tag' into staging

Xen 2015-10-19

# gpg: Signature made Mon 19 Oct 2015 11:24:05 BST using RSA key ID 70E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"

* remotes/sstabellini/tags/2015-10-19-tag:
  xen-platform: Ensure xen is enabled when initializing
  pc: Require xen when initializing xenfv machine

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoxen-platform: Ensure xen is enabled when initializing
Eduardo Habkost [Mon, 28 Sep 2015 20:01:24 +0000 (17:01 -0300)]
xen-platform: Ensure xen is enabled when initializing

The xen-platform code crashes on reset if the xen backend is not
initialized, because it calls xc_hvm_set_mem_type(). Ensure xen-platform
won't be created without initializing the xen backend.

The assert can't be triggered by the user because the device is not
hotpluggable, and the only code creating it (at pc_xen_hvm_init())
already checks xen_enabled().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agopc: Require xen when initializing xenfv machine
Eduardo Habkost [Mon, 28 Sep 2015 20:01:23 +0000 (17:01 -0300)]
pc: Require xen when initializing xenfv machine

Without this check, the xen-platform device will crash on reset
if using the accel option with anything other than xen (e.g.
"-machine xenfv,accel=kvm").

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Mon, 19 Oct 2015 09:52:39 +0000 (10:52 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* KVM page size fix for PPC
* Support for Linux 4.4's new Hyper-V features
* Eliminate g_slice from areas I maintain
* checkpatch fix
* Peter's cpu_reload_memory_map() cleanups
* More changes to MAINTAINERS
* Require Python 2.6
* chardev creation fixes
* PCI requester id for ARM KVM
* cleanups and doc fixes
* Allow customization of the Hyper-V vendor id

# gpg: Signature made Mon 19 Oct 2015 09:13:10 BST using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"

* remotes/bonzini/tags/for-upstream: (49 commits)
  kvm: Allow the Hyper-V vendor ID to be specified
  kvm: Move x86-specific functions into target-i386/kvm.c
  kvm: Pass PCI device pointer to MSI routing functions
  hw/pci: Introduce pci_requester_id()
  kvm: Make KVM_CAP_SIGNAL_MSI globally available
  doc/rcu: fix g_free_rcu() usage example
  qemu-char: cleanup after completed conversion to cd->create
  qemu-char: convert ringbuf backend to data-driven creation
  qemu-char: convert vc backend to data-driven creation
  qemu-char: convert spice backend to data-driven creation
  qemu-char: convert console backend to data-driven creation
  qemu-char: convert stdio backend to data-driven creation
  qemu-char: convert testdev backend to data-driven creation
  qemu-char: convert braille backend to data-driven creation
  qemu-char: convert msmouse backend to data-driven creation
  qemu-char: convert mux backend to data-driven creation
  qemu-char: convert null backend to data-driven creation
  qemu-char: convert pty backend to data-driven creation
  qemu-char: convert UDP backend to data-driven creation
  qemu-char: convert socket backend to data-driven creation
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20151019-1' into staging
Peter Maydell [Mon, 19 Oct 2015 09:06:56 +0000 (10:06 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20151019-1' into staging

Remove macros IO_READ_PROTO and IO_WRITE_PROTO

# gpg: Signature made Mon 19 Oct 2015 09:19:21 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-audio-20151019-1:
  Remove macros IO_READ_PROTO and IO_WRITE_PROTO

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agokvm: Allow the Hyper-V vendor ID to be specified
Alex Williamson [Fri, 16 Oct 2015 15:38:22 +0000 (09:38 -0600)]
kvm: Allow the Hyper-V vendor ID to be specified

According to Microsoft documentation, the signature in the standard
hypervisor CPUID leaf at 0x40000000 identifies the Vendor ID and is
for reporting and diagnostic purposes only.  We can therefore allow
the user to change it to whatever they want, within the 12 character
limit.  Add a new hv-vendor-id option to the -cpu flag to allow
for this, ex:

 -cpu host,hv_time,hv-vendor-id=KeenlyKVM

Link: http://msdn.microsoft.com/library/windows/hardware/hh975392
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Message-Id: <20151016153356.28104.48612.stgit@gimli.home>
[Adjust error message to match the property name, use error_report. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agokvm: Move x86-specific functions into target-i386/kvm.c
Thomas Huth [Thu, 15 Oct 2015 18:30:20 +0000 (20:30 +0200)]
kvm: Move x86-specific functions into target-i386/kvm.c

The functions for checking xcrs, xsave and pit_state2 are
only used on x86, so they should reside in target-i386/kvm.c.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1444933820-6968-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agokvm: Pass PCI device pointer to MSI routing functions
Pavel Fedin [Thu, 15 Oct 2015 13:44:52 +0000 (16:44 +0300)]
kvm: Pass PCI device pointer to MSI routing functions

In-kernel ITS emulation on ARM64 will require to supply requester IDs.
These IDs can now be retrieved from the device pointer using new
pci_requester_id() function.

This patch adds pci_dev pointer to KVM GSI routing functions and makes
callers passing it.

x86 architecture does not use requester IDs, but hw/i386/kvm/pci-assign.c
also made passing PCI device pointer instead of NULL for consistency with
the rest of the code.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Message-Id: <ce081423ba2394a4efc30f30708fca07656bc500.1444916432.git.p.fedin@samsung.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agohw/pci: Introduce pci_requester_id()
Pavel Fedin [Thu, 15 Oct 2015 13:44:51 +0000 (16:44 +0300)]
hw/pci: Introduce pci_requester_id()

For GICv3 ITS implementation we are going to use requester IDs in KVM IRQ
routing code. This patch introduces reusable convenient way to obtain this
ID from the device pointer. The new function is now used in some places,
where the same calculation was used.

MemTxAttrs.stream_id also renamed to requester_id in order to better
reflect semantics of the field.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <5814bcb03a297f198e796b13ed9c35059c52f89b.1444916432.git.p.fedin@samsung.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agokvm: Make KVM_CAP_SIGNAL_MSI globally available
Pavel Fedin [Thu, 15 Oct 2015 13:44:50 +0000 (16:44 +0300)]
kvm: Make KVM_CAP_SIGNAL_MSI globally available

This capability is useful to determine whether we can use KVM ITS
emulation on ARM

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Message-Id: <ff4ccb09b837d37defd639b885526949a25276de.1444916432.git.p.fedin@samsung.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agodoc/rcu: fix g_free_rcu() usage example
Sergey Fedorov [Wed, 14 Oct 2015 15:46:44 +0000 (18:46 +0300)]
doc/rcu: fix g_free_rcu() usage example

The first argument of g_free_rcu() is a pointer to a structure.  But
foo_reclaim is used as a function name in the previous example along
with &foo as a pointer to the structure being reclaimed.  Make the
example consistent with the previous one.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-Id: <1444837604-13712-1-git-send-email-serge.fdrv@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: cleanup after completed conversion to cd->create
Paolo Bonzini [Mon, 12 Oct 2015 07:51:41 +0000 (09:51 +0200)]
qemu-char: cleanup after completed conversion to cd->create

All backends now return errors through Error*, so the "Failed to
create chardev" placeholder error can only be reached if the backend
is not available (and only from the chardev-add QMP command; instead,
the -chardev command line option fails earlier).

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert ringbuf backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:51:14 +0000 (15:51 +0200)]
qemu-char: convert ringbuf backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert vc backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:49:06 +0000 (15:49 +0200)]
qemu-char: convert vc backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert spice backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:45:47 +0000 (15:45 +0200)]
qemu-char: convert spice backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert console backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:42:04 +0000 (15:42 +0200)]
qemu-char: convert console backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert stdio backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:40:28 +0000 (15:40 +0200)]
qemu-char: convert stdio backend to data-driven creation

The backend now always returns errors via the Error* argument.
This avoids a double error message.  Before:

    qemu-system-x86_64: -chardev stdio,id=base: cannot use stdio with -daemonize
    qemu-system-x86_64: -chardev stdio,id=base: Failed to create chardev

After:

    qemu-system-x86_64: -chardev stdio,id=base: cannot use stdio with -daemonize

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert testdev backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:33:42 +0000 (15:33 +0200)]
qemu-char: convert testdev backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert braille backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:31:26 +0000 (15:31 +0200)]
qemu-char: convert braille backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert msmouse backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:29:15 +0000 (15:29 +0200)]
qemu-char: convert msmouse backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert mux backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:27:24 +0000 (15:27 +0200)]
qemu-char: convert mux backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert null backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:24:29 +0000 (15:24 +0200)]
qemu-char: convert null backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert pty backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:23:42 +0000 (15:23 +0200)]
qemu-char: convert pty backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert UDP backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:17:20 +0000 (15:17 +0200)]
qemu-char: convert UDP backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert socket backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:15:53 +0000 (15:15 +0200)]
qemu-char: convert socket backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert pipe backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:14:07 +0000 (15:14 +0200)]
qemu-char: convert pipe backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert parallel backend to data-driven creation
Paolo Bonzini [Mon, 12 Oct 2015 07:49:28 +0000 (09:49 +0200)]
qemu-char: convert parallel backend to data-driven creation

Conversion to Error * brings better error messages; before:

    qemu-system-x86_64: -chardev id=serial,backend=parallel,path=vl.c: Failed to create chardev

After:

    qemu-system-x86_64: -chardev id=serial,backend=parallel,path=vl.c: not a parallel port: Inappropriate ioctl for device

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoRemove macros IO_READ_PROTO and IO_WRITE_PROTO
Nutan Shinde [Wed, 7 Oct 2015 16:32:54 +0000 (22:02 +0530)]
Remove macros IO_READ_PROTO and IO_WRITE_PROTO

Signed-off-by: Nutan Shinde <nutanshinde1992@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agohw/ide/ahci.c: Fix shift left into sign bit
Peter Maydell [Fri, 16 Oct 2015 16:19:35 +0000 (17:19 +0100)]
hw/ide/ahci.c: Fix shift left into sign bit

Avoid undefined behaviour from shifting left into the sign bit:

hw/ide/ahci.c:551:36: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

(Unfortunately C's promotion rules mean that in the expression
"some_uint8_t_variable << 24" the LHS gets promoted to signed
int before shifting.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Sat, 17 Oct 2015 21:14:52 +0000 (22:14 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Fri 16 Oct 2015 14:36:50 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (29 commits)
  blkdebug: Don't confuse image as backing file
  qcow2: Remove forward declaration of QCowAIOCB
  qemu-nbd: always compile in --aio=MODE option
  blockdev: always compile in -drive aio= parsing
  raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
  block: auto-generated node-names
  util - add automated ID generation utility
  blkverify: Fix BDS leak in .bdrv_open error path
  block: Allow bdrv_unref_child(bs, NULL)
  block: Remove bdrv_swap()
  block: Add and use bdrv_replace_in_backing_chain()
  blockjob: Store device name at job creation
  block: Implement bdrv_append() without bdrv_swap()
  block: Introduce parents list
  block-backend: Add blk_set_bs()
  block/io: Make bdrv_requests_pending() public
  block: Split bdrv_move_feature_fields()
  block: Manage backing file references in bdrv_set_backing_hd()
  block: Convert bs->backing_hd to BdrvChild
  block: Remove bdrv_open_image()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20151016' into...
Peter Maydell [Sat, 17 Oct 2015 11:31:33 +0000 (12:31 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20151016' into staging

target-arm queue:
 * break TBs after ISB instructions
 * more support code for future implementation of EL2 and 64-bit EL3
 * tell guest if KVM is enabled in SMBIOS version string
 * implement OSLAR/OSLSR system registers
 * provide better help text for Sharp PDA machine names
 * rename imx25_pdk to imx25-pdk (since it has never been released
   with the underscore-version name)
 * fix MMIO writes in zynq_slcr
 * implement MDCR_EL2
 * virt: allow the guest to configure PCI BARs with zero PCI addresses
 * fix breakpoint handling code

# gpg: Signature made Fri 16 Oct 2015 14:56:15 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"

* remotes/pmaydell/tags/pull-target-arm-20151016:
  target-arm: Fix CPU breakpoint handling
  target-arm: Fix GDB breakpoint handling
  target-arm: implement arm_debug_target_el()
  hw/arm/virt: Allow zero address for PCI IO space
  target-arm: Add MDCR_EL2
  misc: zynq_slcr: Fix MMIO writes
  arm: imx25-pdk: Fix machine name
  target-arm: Provide model numbers for Sharp PDAs
  target-arm: Implement AArch64 OSLAR/OSLSR_EL1 sysregs
  hw/arm/virt: smbios: inform guest of kvm
  target-arm: Avoid calling arm_el_is_aa64() function for unimplemented EL
  target-arm: Break the TB after ISB to execute self-modified code correctly
  target-arm: Add missing 'static' attribute

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-cocoa-20151016' into staging
Peter Maydell [Fri, 16 Oct 2015 18:11:59 +0000 (19:11 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-cocoa-20151016' into staging

cocoa queue:
 * fixes for compiler warnings
 * fix mouse cursor flickering

# gpg: Signature made Fri 16 Oct 2015 11:09:46 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"

* remotes/pmaydell/tags/pull-cocoa-20151016:
  ui/cocoa.m: blinky mouse cursor fix
  ui/cocoa.m: addRemovableDevicesMenuItems() warning fix
  ui/cocoa.m: eliminate normalWindow warning

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-10-15' into staging
Peter Maydell [Fri, 16 Oct 2015 16:13:05 +0000 (17:13 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-10-15' into staging

QAPI patches

# gpg: Signature made Thu 15 Oct 2015 07:40:46 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-qapi-2015-10-15:
  qapi: Track location that created an implicit type
  qapi: Create simple union type member earlier
  qapi: Lazy creation of array types
  qapi: Don't use info as witness of implicit object type
  qapi: Drop redundant args-member-array test
  qapi: Drop redundant flat-union-reverse-define test
  qapi: Drop redundant returns-int test
  qapi: Move empty-enum to compile-time test
  qapi: Drop redundant alternate-good test
  qapi: Prepare for errors during check()
  qapi: Use predicate callback to determine visit filtering
  qapi: Fix regression with '-netdev help'

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20151015' into...
Peter Maydell [Fri, 16 Oct 2015 14:47:59 +0000 (15:47 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20151015' into staging

migration/next for 20151015

# gpg: Signature made Thu 15 Oct 2015 07:25:27 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20151015:
  migration: fix deadlock
  migration: announce VM's new home just before VM is runnable
  Migration: Generate the completed event only when we complete

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Fix CPU breakpoint handling
Sergey Fedorov [Tue, 13 Oct 2015 09:56:28 +0000 (12:56 +0300)]
target-arm: Fix CPU breakpoint handling

A QEMU breakpoint match is not definitely an architectural breakpoint
match. If an exception is generated unconditionally during translation,
it is hardly possible to ignore it in the debug exception handler.

Generate a call to a helper to check CPU breakpoints and raise an
exception only if any breakpoint matches architecturally.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Fix GDB breakpoint handling
Sergey Fedorov [Tue, 13 Oct 2015 09:56:27 +0000 (12:56 +0300)]
target-arm: Fix GDB breakpoint handling

GDB breakpoints have higher priority so they have to be checked first.
Should GDB breakpoint match, just return from the debug exception
handler.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoblkdebug: Don't confuse image as backing file
Fam Zheng [Fri, 16 Oct 2015 10:46:04 +0000 (18:46 +0800)]
blkdebug: Don't confuse image as backing file

The word "backing file" nowadays refers to the backing_hd in the
external snapshot sense (i.e. bs->backing_hd), instead of the file sense
(bs->file). Correct the comment to use the right term.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqcow2: Remove forward declaration of QCowAIOCB
Kevin Wolf [Fri, 10 Jul 2015 20:19:23 +0000 (22:19 +0200)]
qcow2: Remove forward declaration of QCowAIOCB

This struct doesn't exist any more since commit 3fc48d09 in August 2011,
it's about time to remove its forward declaration.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoqemu-nbd: always compile in --aio=MODE option
Stefan Hajnoczi [Thu, 23 Jul 2015 12:48:36 +0000 (13:48 +0100)]
qemu-nbd: always compile in --aio=MODE option

The --aio=MODE option enables Linux AIO or Windows overlapped I/O.

The #ifdef CONFIG_LINUX_AIO was a layering violation that also prevented
Windows overlapped I/O from being used.

Now that raw-posix.c prints an error when Linux AIO has not been
compiled in, we can unconditionally compile the option into qemu-nbd.

After this patch qemu-nbd --aio=native works on Windows.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblockdev: always compile in -drive aio= parsing
Stefan Hajnoczi [Thu, 23 Jul 2015 12:48:35 +0000 (13:48 +0100)]
blockdev: always compile in -drive aio= parsing

CONFIG_LINUX_AIO is an implementation detail of raw-posix.c.  Don't
mention CONFIG_LINUX_AIO in blockdev.c.  Let block drivers decide what
to do with BDRV_O_NATIVE_AIO.  They may print an error if it is
unsupported.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoraw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
Stefan Hajnoczi [Thu, 23 Jul 2015 12:48:34 +0000 (13:48 +0100)]
raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable

raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable.
It is confusing when aio=native performance is identical to aio=threads
because the binary was accidentally built without libaio.

Print a deprecation warning if -drive aio=native is used with a binary
that does not support libaio.  There are probably users using aio=native
who would be inconvenienced if QEMU suddenly refused to start their
guests.  In the future this will become an error.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: auto-generated node-names
Jeff Cody [Mon, 12 Oct 2015 23:36:50 +0000 (19:36 -0400)]
block: auto-generated node-names

If a node-name is not specified, automatically generate the node-name.

Generated node-names will use the "block" sub-system identifier.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoutil - add automated ID generation utility
Jeff Cody [Mon, 12 Oct 2015 23:36:49 +0000 (19:36 -0400)]
util - add automated ID generation utility

Multiple sub-systems in QEMU may find it useful to generate IDs
for objects that a user may reference via QMP or HMP.  This patch
presents a standardized way to do it, so that automatic ID generation
follows the same rules.

This patch enforces the following rules when generating an ID:

1.) Guarantee no collisions with a user-specified ID
2.) Identify the sub-system the ID belongs to
3.) Guarantee of uniqueness
4.) Spoiling predictability, to avoid creating an assumption
    of object ordering and parsing (i.e., we don't want users to think
    they can guess the next ID based on prior behavior).

The scheme for this is as follows (no spaces):

                # subsys D RR
Reserved char --|    |   | |
Subsystem String ----|   | |
Unique number (64-bit) --| |
Two-digit random number ---|

For example, a generated node-name for the block sub-system may look
like this:

    #block076

The caller of id_generate() is responsible for freeing the generated
node name string with g_free().

Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblkverify: Fix BDS leak in .bdrv_open error path
Kevin Wolf [Tue, 13 Oct 2015 12:15:53 +0000 (14:15 +0200)]
blkverify: Fix BDS leak in .bdrv_open error path

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
8 years agoblock: Allow bdrv_unref_child(bs, NULL)
Kevin Wolf [Tue, 13 Oct 2015 12:09:44 +0000 (14:09 +0200)]
block: Allow bdrv_unref_child(bs, NULL)

bdrv_unref() can be called with a NULL argument and doesn't do anything
then. Make bdrv_unref_child() consistent with it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
8 years agoblock: Remove bdrv_swap()
Kevin Wolf [Wed, 16 Sep 2015 14:18:38 +0000 (16:18 +0200)]
block: Remove bdrv_swap()

bdrv_swap() is unused now. Remove it and all functions that have
no other users than bdrv_swap(). In particular, this removes the
.bdrv_rebind callbacks from block drivers.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Add and use bdrv_replace_in_backing_chain()
Kevin Wolf [Tue, 15 Sep 2015 09:58:23 +0000 (11:58 +0200)]
block: Add and use bdrv_replace_in_backing_chain()

This cleans up the mess we left behind in the mirror code after the
previous patch. Instead of using bdrv_swap(), just change pointers.

The interface change of the mirror job that callers must consider is
that after job completion, their local BDS pointers still point to the
same node now. qemu-img must change its code accordingly (which makes it
easier to understand); the other callers stays unchanged because after
completion they don't do anything with the BDS, but just with the job,
and the job is still owned by the source BDS.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>