OSDN Git Service

qmiga/qemu.git
10 years agoaio: Fix use-after-free in cancellation path
Fam Zheng [Wed, 21 May 2014 02:42:13 +0000 (10:42 +0800)]
aio: Fix use-after-free in cancellation path

The current flow of canceling a thread from THREAD_ACTIVE state is:

  1) Caller wants to cancel a request, so it calls thread_pool_cancel.

  2) thread_pool_cancel waits on the conditional variable
     elem->check_cancel.

  3) The worker thread changes state to THREAD_DONE once the task is
     done, and notifies elem->check_cancel to allow thread_pool_cancel
     to continue execution, and signals the notifier (pool->notifier) to
     allow callback function to be called later. But because of the
     global mutex, the notifier won't get processed until step 4) and 5)
     are done.

  4) thread_pool_cancel continues, leaving the notifier signaled, it
     just returns to caller.

  5) Caller thinks the request is already canceled successfully, so it
     releases any related data, such as freeing elem->common.opaque.

  6) In the next main loop iteration, the notifier handler,
     event_notifier_ready, is called. It finds the canceled thread in
     THREAD_DONE state, so calls elem->common.cb, with an (likely)
     dangling opaque pointer. This is a use-after-free.

Fix it by calling event_notifier_ready before leaving
thread_pool_cancel.

Test case update: This change will let cancel complete earlier than
test-thread-pool.c expects, so update the code to check this case: if
it's already done, done_cb sets .aiocb to NULL, skip calling
bdrv_aio_cancel on them.

Reported-by: Ulrich Obergfell <uobergfe@redhat.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: Fix memory leak in COW error path
Kevin Wolf [Mon, 19 May 2014 15:56:01 +0000 (17:56 +0200)]
qcow2: Fix memory leak in COW error path

This triggers if bs->drv becomes NULL in a concurrent request. This is
currently only the case when corruption prevention kicks in (i.e. at
most once per image, and after that it produces I/O errors).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoQemuOpt: add unit tests
Leandro Dorileo [Mon, 19 May 2014 21:53:55 +0000 (18:53 -0300)]
QemuOpt: add unit tests

Cover basic aspects and API usage for QemuOpt. The current implementation
covers the API's planned to be changed by Chunyan Liu in his QEMUOptionParameter
replacement/cleanup job.

Other APIs should be covered in future improvements.

[Squashing in a small fix "QemuOpt: use qemu_find_opts_err() to avoid
output on stderr in tests".

qemu_find_opts() calls error_report() instead of propagating the Error
object.  It is undesirable to clutter test case output with error
messages from a passing test.

Use qemu_find_opts_err() to avoid the output on stderr.
--Stefan]

Signed-off-by: Leandro Dorileo <l@dorileo.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Handle cache mode option in 091
Fam Zheng [Tue, 20 May 2014 01:10:32 +0000 (09:10 +0800)]
qemu-iotests: Handle cache mode option in 091

We should allow testing this on tmpfs. Any cache setting in iotests
should try to obey $CACHEMODE.

The cache mode is still "none" by default but overridable

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-9' into staging
Peter Maydell [Wed, 28 May 2014 09:33:05 +0000 (10:33 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-9' into staging

input: add event routing and multiseat support.
input: misc bugfixes and minor improvements.

# gpg: Signature made Mon 26 May 2014 07:44:29 BST using RSA key ID D3E87138
# gpg: Can't check signature: public key not found

* remotes/kraxel/tags/pull-input-9:
  docs: add multiseat.txt
  usb: add input routing support for tablet and keyboard
  sdl: pass key event source to input layer
  input: bind devices and input routing
  input: switch hid mouse and tablet to the new input layer api.
  input: switch hid keyboard to new input layer api.
  input: keymap: add meta keys
  input: add name to input_event_key_number
  input: add qemu_input_key_number_to_qcode
  input (curses): mask keycodes to remove modifier bits

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-05-26' into staging
Peter Maydell [Tue, 27 May 2014 21:45:03 +0000 (22:45 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-05-26' into staging

trivial patches for 2014-05-26

# gpg: Signature made Mon 26 May 2014 08:17:08 BST using RSA key ID A4C3D7DB
# gpg: Can't check signature: public key not found

* remotes/mjt/tags/trivial-patches-2014-05-26: (23 commits)
  libcacard: remove useless initializers
  net: cadence_gem: Fix top comment
  bsd-user: replace fprintf(stderr, ...) with error_report()
  audio: replace fprintf(stderr, ...) with error_report() in audio
  libcacard: fix wrong array expansion logic
  libcacard/vcard_emul_nss: Drop a redundant conditional
  libcacard: Convert two leftover realloc() to GLib
  libcacard/vreader: Tighten assertion to clarify intent
  libcacard/vreader: Drop broken recovery from failed assertion
  libcacard: Plug memory leaks around vreader_get_reader_list()
  libcacard/vscclient: Bury some dead code
  vl: fix 'name' option to work with -readconfig
  configure: Put tempfiles in a subdir of the build directory
  dma-helpers: avoid calling dma_bdrv_unmap() twice
  arch_init: replace fprintf(stderr, ...) with error_report()
  pci: move dereferencing of root only after verifying valid root pointer
  jazz_led: Add missing break in switch case
  bswap.h: Rename ldl_p, stl_p, etc to ldl_he_p, stl_he_p, etc
  configure: Automatically select GTK+ 3.0 if GTK+ 2.0 is unavailable
  nbd: Miscellaneous typo fixes.
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mwalle/tags/lm32-semihosting/20140524' into...
Peter Maydell [Tue, 27 May 2014 21:11:25 +0000 (22:11 +0100)]
Merge remote-tracking branch 'remotes/mwalle/tags/lm32-semihosting/20140524' into staging

* remotes/mwalle/tags/lm32-semihosting/20140524:
  lm32: remove lm32_sys
  test: lm32: use semihosting for testing
  target-lm32: add semihosting support
  test: lm32: make test cases independent

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/tcg-mips' into staging
Peter Maydell [Tue, 27 May 2014 17:31:02 +0000 (18:31 +0100)]
Merge remote-tracking branch 'remotes/rth/tcg-mips' into staging

* remotes/rth/tcg-mips: (24 commits)
  tcg-mips: Enable direct chaining of TBs
  tcg-mips: Simplify movcond
  tcg-mips: Simplify brcond2
  tcg-mips: Improve setcond eq/ne vs zeros
  tcg-mips: Simplify setcond2
  tcg-mips: Simplify brcond
  tcg-mips: Simplify setcond
  tcg-mips: Commonize opcode implementations
  tcg-mips: Improve add2/sub2
  tcg-mips: Hoist args loads
  tcg-mips: Fix subtract immediate range
  tcg-mips: Name the opcode enumeration
  tcg-mips: Use EXT for AND on mips32r2
  tcg-mips: Use T9 for TCG_TMP1
  tcg-mips: Introduce TCG_TMP0, TCG_TMP1
  tcg-mips: Rearrange register allocation
  tcg-mips: Convert to new_ldst
  tcg-mips: Convert to new qemu_l/st helpers
  tcg-mips: Move softmmu slow path out of line
  tcg-mips: Split large ldst offsets
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/fix-tci' into staging
Peter Maydell [Tue, 27 May 2014 13:44:03 +0000 (14:44 +0100)]
Merge remote-tracking branch 'remotes/rth/fix-tci' into staging

* remotes/rth/fix-tci:
  tci: Fix tcg_out_call

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Fix segfault on startup when KVM enabled
Christoffer Dall [Tue, 27 May 2014 12:37:43 +0000 (14:37 +0200)]
target-arm: Fix segfault on startup when KVM enabled

Commit 50a2c6e55fa introduced a bug where QEMU would segfault on startup
when using KVM on ARM hosts, because kvm_arm_reset_cpu() accesses
cpu->cpreg_reset_values, which is not allocated before
kvm_arch_init_vcpu(). Fix this by not calling cpu_reset() until after
qemu_init_vcpu().

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Faerber <afaerber@suse.de>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Message-id: 1401194263-13010-1-git-send-email-christoffer.dall@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agodocs: add multiseat.txt
Gerd Hoffmann [Tue, 20 May 2014 07:17:01 +0000 (09:17 +0200)]
docs: add multiseat.txt

Howto on setting up multiseat for guests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb: add input routing support for tablet and keyboard
Gerd Hoffmann [Mon, 19 May 2014 13:26:51 +0000 (15:26 +0200)]
usb: add input routing support for tablet and keyboard

Add display property to the keyboard.
Add display and head properties to the tablet.

If properties are set bind device to the display specified to
setup input routing.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agosdl: pass key event source to input layer
Gerd Hoffmann [Tue, 20 May 2014 06:11:25 +0000 (08:11 +0200)]
sdl: pass key event source to input layer

So the input layer knows where the input is coming from
and input routing works correctly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: bind devices and input routing
Gerd Hoffmann [Mon, 19 May 2014 13:18:37 +0000 (15:18 +0200)]
input: bind devices and input routing

Add function to bind input devices to display devices.  Implementing
input routing on top of this:  Events coming from the display device in
question are routed to the input device bound to it (if there is one).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: switch hid mouse and tablet to the new input layer api.
Gerd Hoffmann [Mon, 19 May 2014 13:02:21 +0000 (15:02 +0200)]
input: switch hid mouse and tablet to the new input layer api.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: switch hid keyboard to new input layer api.
Gerd Hoffmann [Tue, 11 Mar 2014 12:52:27 +0000 (13:52 +0100)]
input: switch hid keyboard to new input layer api.

Minimal patch to get the switchover done.  We continue processing ps/2
scancodes for now as they are part of the live migration stream.  Fixing
that, then mapping directly from QKeyValue to HID keycodes is left as
excercise for another day.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keymap: add meta keys
Gerd Hoffmann [Wed, 21 May 2014 11:54:32 +0000 (13:54 +0200)]
input: keymap: add meta keys

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: add name to input_event_key_number
Gerd Hoffmann [Wed, 21 May 2014 11:49:59 +0000 (13:49 +0200)]
input: add name to input_event_key_number

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: add qemu_input_key_number_to_qcode
Gerd Hoffmann [Wed, 21 May 2014 11:28:32 +0000 (13:28 +0200)]
input: add qemu_input_key_number_to_qcode

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput (curses): mask keycodes to remove modifier bits
Andrew Oates [Sat, 24 May 2014 00:16:09 +0000 (20:16 -0400)]
input (curses): mask keycodes to remove modifier bits

Without the mask, control bits are passed on in the keycode, generating
incorrect PS/2 sequences when SHIFT, ALT, etc are held down.

Cc: qemu-stable@nongnu.org
Signed-off-by: Andrew Oates <andrew@aoates.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agolibcacard: remove useless initializers
Michael Tokarev [Thu, 8 May 2014 17:17:38 +0000 (21:17 +0400)]
libcacard: remove useless initializers

libcacard has many functions which initializes local variables
at declaration time, which are always assigned some values later
(often right after declaration).  Clean up these initializers.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agonet: cadence_gem: Fix top comment
Peter Crosthwaite [Wed, 7 May 2014 09:17:31 +0000 (02:17 -0700)]
net: cadence_gem: Fix top comment

To indicate Cadence GEM not Xilinx.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agobsd-user: replace fprintf(stderr, ...) with error_report()
Le Tan [Fri, 9 May 2014 23:55:22 +0000 (07:55 +0800)]
bsd-user: replace fprintf(stderr, ...) with error_report()

Replace fprintf(stderr,...) with error_report() in files bsd-user/*.
The trailing "\n"s of the @fmt argument have been removed
because @fmt of error_report() should not contain newline.

Signed-off-by: Le Tan <tamlokveer@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoaudio: replace fprintf(stderr, ...) with error_report() in audio
Le Tan [Fri, 9 May 2014 23:55:20 +0000 (07:55 +0800)]
audio: replace fprintf(stderr, ...) with error_report() in audio

Replace fprintf(stderr,...) with error_report() in files audio/*.
The trailing "\n"s of the @fmt argument have been removed
because @fmt of error_report() should not contain newline.

Signed-off-by: Le Tan <tamlokveer@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard: fix wrong array expansion logic
Michael Tokarev [Fri, 23 May 2014 20:47:39 +0000 (00:47 +0400)]
libcacard: fix wrong array expansion logic

The currrent code in libcacard/vcard_emul_nss.c:vcard_emul_options()
has a weird bug in variable usage around expanding opts->vreader
array.

There's a helper variable, vreaderOpt, which is first needlessly
initialized to NULL, next, conditionally, only we have to expand
opts->vreader, receives array expansion from g_renew(), and next,
even if we don't actually perform expansion, the value of this
variable is assigned to the actual array, opts->vreader, which
was supposed to be expanded.

So, since we expand the array by READER_STEP increments, only
once in READER_STEP (=4) the code will work, in other 3/4 times
it will fail badly.

Fix this by not using this temp variable when expanding the
array, and by dropping the useless =NULL initializer too -
if it wasn't in place initially, compiler would have warned
us about this problem at the beginning.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
10 years agolm32: remove lm32_sys
Michael Walle [Tue, 22 Apr 2014 18:18:44 +0000 (20:18 +0200)]
lm32: remove lm32_sys

Since we have now semihosting on the lm32 target, this device is no longer
needed. Remove it.

Signed-off-by: Michael Walle <michael@walle.cc>
10 years agotest: lm32: use semihosting for testing
Michael Walle [Tue, 22 Apr 2014 18:18:43 +0000 (20:18 +0200)]
test: lm32: use semihosting for testing

Instead of the lm32-sys device, use semihosting to print to the host
console and exit the test.

Signed-off-by: Michael Walle <michael@walle.cc>
10 years agotarget-lm32: add semihosting support
Michael Walle [Tue, 22 Apr 2014 18:18:42 +0000 (20:18 +0200)]
target-lm32: add semihosting support

Intercept certain system calls if semihosting is enabled. This should
behave like the GDB simulator.

Signed-off-by: Michael Walle <michael@walle.cc>
10 years agotest: lm32: make test cases independent
Michael Walle [Tue, 22 Apr 2014 18:18:41 +0000 (20:18 +0200)]
test: lm32: make test cases independent

Make test cases independent from from each other. Eg. if a test case needs
a specific value in register A, don't rely on the fact that it is already
set by the preceding test case.

Signed-off-by: Michael Walle <michael@walle.cc>
10 years agotcg-mips: Enable direct chaining of TBs
Richard Henderson [Thu, 24 Apr 2014 19:39:20 +0000 (19:39 +0000)]
tcg-mips: Enable direct chaining of TBs

Now that the code_gen_buffer is constrained to not cross 256mb
regions, we are assured that we can use J to reach another TB.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Simplify movcond
Richard Henderson [Wed, 16 Apr 2014 05:53:12 +0000 (22:53 -0700)]
tcg-mips: Simplify movcond

Use the same table to fold comparisons as with setcond.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Simplify brcond2
Richard Henderson [Wed, 16 Apr 2014 05:47:22 +0000 (22:47 -0700)]
tcg-mips: Simplify brcond2

Emitting a single branch instead of (up to) 3, using setcond2
to generate the composite compare.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Improve setcond eq/ne vs zeros
Richard Henderson [Wed, 16 Apr 2014 05:41:46 +0000 (22:41 -0700)]
tcg-mips: Improve setcond eq/ne vs zeros

The original code results in one too many insns per zero
present in the input.  And since comparing 64-bit numbers
vs zero is common...

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Simplify setcond2
Richard Henderson [Wed, 16 Apr 2014 05:34:30 +0000 (22:34 -0700)]
tcg-mips: Simplify setcond2

Using tcg_unsigned_cond and tcg_high_cond.
Also, move the function up in the file for future cleanups.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Simplify brcond
Richard Henderson [Wed, 16 Apr 2014 05:20:57 +0000 (22:20 -0700)]
tcg-mips: Simplify brcond

Use the same table to fold comparisons as with setcond.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Simplify setcond
Richard Henderson [Wed, 16 Apr 2014 05:10:09 +0000 (22:10 -0700)]
tcg-mips: Simplify setcond

Use a table to fold comparisons to less-than.
Also, move the function up in the file for futher simplifications.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Commonize opcode implementations
Richard Henderson [Wed, 16 Apr 2014 03:30:46 +0000 (20:30 -0700)]
tcg-mips: Commonize opcode implementations

Most opcodes fall in to one of a couple of patterns.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Improve add2/sub2
Richard Henderson [Thu, 24 Apr 2014 02:56:44 +0000 (02:56 +0000)]
tcg-mips: Improve add2/sub2

Reduce insn count from 5 to either 3 or 4.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Hoist args loads
Richard Henderson [Wed, 16 Apr 2014 02:05:52 +0000 (19:05 -0700)]
tcg-mips: Hoist args loads

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Fix subtract immediate range
Richard Henderson [Wed, 16 Apr 2014 01:54:07 +0000 (18:54 -0700)]
tcg-mips: Fix subtract immediate range

Since we must use ADDUI, we would generate incorrect code for -32768.
Leaving off subtract of +32768 makes things easier for a follow-on patch.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Name the opcode enumeration
Richard Henderson [Tue, 15 Apr 2014 16:30:47 +0000 (09:30 -0700)]
tcg-mips: Name the opcode enumeration

And use it in the opcode emission functions.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Use EXT for AND on mips32r2
Richard Henderson [Tue, 15 Apr 2014 16:27:40 +0000 (09:27 -0700)]
tcg-mips: Use EXT for AND on mips32r2

At the same time, tidy deposit by introducing tcg_out_opc_bf.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Use T9 for TCG_TMP1
Richard Henderson [Tue, 15 Apr 2014 16:10:16 +0000 (09:10 -0700)]
tcg-mips: Use T9 for TCG_TMP1

T0 is an argument register for the n32 and n64 abis.  T9 is the call
address register for the abis, and is more directly under the control
of the backend.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Introduce TCG_TMP0, TCG_TMP1
Richard Henderson [Tue, 15 Apr 2014 16:07:52 +0000 (09:07 -0700)]
tcg-mips: Introduce TCG_TMP0, TCG_TMP1

Use these instead of hard-coding the registers to use for temporaries.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Rearrange register allocation
Richard Henderson [Tue, 15 Apr 2014 16:03:59 +0000 (09:03 -0700)]
tcg-mips: Rearrange register allocation

Use FP (also known as S8) as a normal call-saved register.

Include T0 in the allocation order and call-clobbered list
even though it's currently used as a TCG temporary.

Put the argument registers at the end of the allocation order.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Convert to new_ldst
Richard Henderson [Mon, 14 Apr 2014 18:10:11 +0000 (18:10 +0000)]
tcg-mips: Convert to new_ldst

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Convert to new qemu_l/st helpers
Richard Henderson [Mon, 14 Apr 2014 16:59:41 +0000 (16:59 +0000)]
tcg-mips: Convert to new qemu_l/st helpers

In addition, fill delay slots calling the helpers and tail
call to the store helpers.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Move softmmu slow path out of line
Richard Henderson [Fri, 2 May 2014 22:01:31 +0000 (15:01 -0700)]
tcg-mips: Move softmmu slow path out of line

At the same time, tidy up the call helpers, avoiding a memory reference.
Split out several subroutines.  Use TCGMemOp constants.  Make endianness
selectable at runtime.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Split large ldst offsets
Richard Henderson [Sun, 23 Mar 2014 17:45:23 +0000 (17:45 +0000)]
tcg-mips: Split large ldst offsets

Use this to reduce goto_tb by one insn.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Fill the exit_tb delay slot
Richard Henderson [Sun, 23 Mar 2014 17:15:21 +0000 (17:15 +0000)]
tcg-mips: Fill the exit_tb delay slot

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Use J and JAL opcodes
Richard Henderson [Sun, 23 Mar 2014 16:57:18 +0000 (16:57 +0000)]
tcg-mips: Use J and JAL opcodes

For userland builds calls will normally be in range,
and for the exit_tb opcode the branch to the epilogue.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Constrain the code_gen_buffer to be within one 256mb segment
Richard Henderson [Thu, 24 Apr 2014 16:16:07 +0000 (09:16 -0700)]
tcg-mips: Constrain the code_gen_buffer to be within one 256mb segment

This assures us use of J for exit_tb and goto_tb, and JAL for calling
into the generated bswap helpers.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Layout executable and code_gen_buffer
Richard Henderson [Thu, 24 Apr 2014 15:25:03 +0000 (08:25 -0700)]
tcg-mips: Layout executable and code_gen_buffer

Choosing good addresses for them means we can use JAL for helper calls.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agolibcacard/vcard_emul_nss: Drop a redundant conditional
Markus Armbruster [Fri, 23 May 2014 11:24:39 +0000 (13:24 +0200)]
libcacard/vcard_emul_nss: Drop a redundant conditional

Bailing out when PK11_FindGenericObjects() returns null ensures the
loop that follows it executes at least once.  The "loop did not
execute" test right after it is useless.  Drop it.

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard: Convert two leftover realloc() to GLib
Markus Armbruster [Fri, 23 May 2014 11:24:37 +0000 (13:24 +0200)]
libcacard: Convert two leftover realloc() to GLib

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/vreader: Tighten assertion to clarify intent
Markus Armbruster [Fri, 23 May 2014 11:24:36 +0000 (13:24 +0200)]
libcacard/vreader: Tighten assertion to clarify intent

Bonus: hushes up Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/vreader: Drop broken recovery from failed assertion
Markus Armbruster [Fri, 23 May 2014 11:24:35 +0000 (13:24 +0200)]
libcacard/vreader: Drop broken recovery from failed assertion

We suppress some code when we got unexpected status and assertion
checking is off:

     assert(card_status == VCARD_DONE);
     if (card_status == VCARD_DONE) {
         int size = MIN(*receive_buf_len, response->b_total_len);
         memcpy(receive_buf, response->b_data, size);
         *receive_buf_len = size;
    }

Such "recovery" is of dubious value even when it works.  This one
doesn't: it fails to assign to receive_buf[] and *receive_buf_len,
which the callers expect.

Make the code unconditional.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard: Plug memory leaks around vreader_get_reader_list()
Markus Armbruster [Fri, 23 May 2014 11:24:34 +0000 (13:24 +0200)]
libcacard: Plug memory leaks around vreader_get_reader_list()

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/vscclient: Bury some dead code
Markus Armbruster [Fri, 23 May 2014 11:24:33 +0000 (13:24 +0200)]
libcacard/vscclient: Bury some dead code

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: fix 'name' option to work with -readconfig
Dr. David Alan Gilbert [Tue, 6 May 2014 11:15:55 +0000 (12:15 +0100)]
vl: fix 'name' option to work with -readconfig

The 'name' option silently failed when used in config files
( http://lists.gnu.org/archive/html/qemu-devel/2014-04/msg00378.html )

-readconfig stores the configuration read in QemuOpts.  Command line
option parsing should do the same, and no more.  In particular it should
not act upon the option.  That needs to be done separately, where both
command line and -readconfig settings are visible in QemuOpts.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reported-by: William Dauchy <william@gandi.net>
Tested-by: William Dauchy <william@gandi.net>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(mjt: added commit message by ambru@ and subject prefix)

10 years agoconfigure: Put tempfiles in a subdir of the build directory
Peter Maydell [Fri, 23 May 2014 16:07:24 +0000 (17:07 +0100)]
configure: Put tempfiles in a subdir of the build directory

When libtool support was added to configure, the new temporary files
were left out of the list of files cleaned up on exit; this results
in a lot of stale .lo files being left around in /tmp. Worse, libtool
creates a /tmp/.libs directory which we can't easily clean up.

Put all our temporary files in a single temporary directory created
as a subdirectory of the build directory, so we can easily clean it up,
and don't need fragile or complicated code for creation to avoid it
clashing with temporary directories from other instances of QEMU
configure or being subject to attack from adversaries who can write
to /tmp.

Since the temporaries now live in the build tree, we have no
need to jump through hoops with a trap handler to try to remove
them when configure exits; this fixes some weird bugs where hitting
^C during a configure run wouldn't actually make it stop, because
we would run the trap handler but then not stop. (It is possible
to get the trap handler semantics right but it is convoluted largely
because of bugs in dash, so it is simpler to just avoid it.)

Note that "temporary files go in the build directory, not /tmp" is
the way autoconf behaves.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agodma-helpers: avoid calling dma_bdrv_unmap() twice
Jules Wang [Fri, 23 May 2014 03:44:05 +0000 (11:44 +0800)]
dma-helpers: avoid calling dma_bdrv_unmap() twice

Calling dma_bdrv_unmap() twice is not necessary and may cause
potential problems if some code changes.

Signed-off-by: Jules Wang <junqing.wang@cs2c.com.cn>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoarch_init: replace fprintf(stderr, ...) with error_report()
Le Tan [Wed, 21 May 2014 00:10:38 +0000 (08:10 +0800)]
arch_init: replace fprintf(stderr, ...) with error_report()

Replace fprintf(stderr,...) with error_report() in the file
arch_init.c. The trailing "\n"s of the @fmt argument have been removed
because @fmt of error_report() should not contain newline.

Signed-off-by: Le Tan <tamlokveer@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agopci: move dereferencing of root only after verifying valid root pointer
Saravanakumar [Thu, 22 May 2014 11:33:50 +0000 (17:03 +0530)]
pci: move dereferencing of root only after verifying valid root pointer

Signed-off-by: Saravanakumar <saravanakumar.punith@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agojazz_led: Add missing break in switch case
Saravanakumar [Wed, 21 May 2014 10:41:40 +0000 (16:11 +0530)]
jazz_led: Add missing break in switch case

Signed-off-by: Saravanakumar <saravanakumar.punith@gmail.com>
Reviewed-by: Paolo Bonizni <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agobswap.h: Rename ldl_p, stl_p, etc to ldl_he_p, stl_he_p, etc
Peter Maydell [Fri, 2 May 2014 17:32:38 +0000 (18:32 +0100)]
bswap.h: Rename ldl_p, stl_p, etc to ldl_he_p, stl_he_p, etc

We have an unfortunate naming clash between the functions
ldl_p, stl_p, etc defined in bswap.h (which have semantics
"load/store in host endianness") and the #defines of the same
name in cpu-all.h (which have the semantics "load/store in
target endianness").

Fortunately it turns out that the only users of the bswap.h
functions are all within bswap.h itself, so we can simply
rename them to include a _he_ infix for "host endianness".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: Automatically select GTK+ 3.0 if GTK+ 2.0 is unavailable
Stefan Weil [Sat, 17 May 2014 14:29:18 +0000 (16:29 +0200)]
configure: Automatically select GTK+ 3.0 if GTK+ 2.0 is unavailable

The configure option --with-gtkabi=3.0 is still supported, but no longer
needed when GTK+-2.0 is missing. When no GTK+ ABI is selected by the
user, configure first tries 2.0, then 3.0.

For some platforms (e.g. Windows) newer binaries of GTK+ are only
available for GTK+ 3.0. Now building on these platforms is a little bit
easier.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agonbd: Miscellaneous typo fixes.
Hani Benhabiles [Mon, 12 May 2014 23:35:16 +0000 (00:35 +0100)]
nbd: Miscellaneous typo fixes.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agonbd: Close socket on negotiation failure.
Hani Benhabiles [Mon, 12 May 2014 23:35:15 +0000 (00:35 +0100)]
nbd: Close socket on negotiation failure.

Otherwise, the nbd client may hang waiting for the server response.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoiohandler.c: Properly initialize sigaction struct
Peter Maydell [Fri, 16 May 2014 13:00:03 +0000 (14:00 +0100)]
iohandler.c: Properly initialize sigaction struct

The code in qemu_init_child_watch() wasn't clearing the 'struct
sigaction' before passing it to sigaction(); this meant that we
would block a random set of signals while executing the SIGCHLD
handler. Initialize properly by using memset() on the struct,
as we do in similar cases elsewhere.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard: g_malloc cleanups
Michael Tokarev [Thu, 8 May 2014 15:51:01 +0000 (19:51 +0400)]
libcacard: g_malloc cleanups

This patch replaces g_malloc() in libcacard into g_new()
or g_new0() where appropriate (removing some init-to-zero
surrounding code), g_malloc+memcpy into g_memdup() and the
like.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Alon Levy <alevy@redhat.com>
10 years agotci: Fix tcg_out_call
Richard Henderson [Thu, 22 May 2014 20:25:34 +0000 (13:25 -0700)]
tci: Fix tcg_out_call

Broken since dddbb2e1e3f8137d7e3f1faf9758c66cca0c94ea.
Do all the rest of the things that tcg_out_op did before
and after the big switch statement.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Thu, 22 May 2014 18:04:48 +0000 (19:04 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  qapi: zero-initialize all QMP command parameters
  scripts/qapi.py: Avoid syntax not supported by Python 2.4
  doc: add "setup" to list of migration states

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-chardev-2' into staging
Peter Maydell [Thu, 22 May 2014 17:14:01 +0000 (18:14 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-chardev-2' into staging

purge error_is_set()

# gpg: Signature made Wed 21 May 2014 11:43: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-chardev-2:
  error: error_is_set() is finally unused; remove
  char: Explain qmp_chardev_add()'s unusual error handling
  char: Clean up fragile use of error_is_set()
  char: Use return values instead of error_is_set(errp)
  qemu-socket: Clean up inet_connect_opts()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-audio-5' into staging
Peter Maydell [Thu, 22 May 2014 16:05:36 +0000 (17:05 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-5' into staging

audio: two intel-hda fixes.

# gpg: Signature made Wed 21 May 2014 09:49:39 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-5:
  hw/audio/intel-hda: Avoid shift into sign bit
  audio/intel-hda: support FIFORDY

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20140520' into staging
Peter Maydell [Thu, 22 May 2014 15:14:01 +0000 (16:14 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140520' into staging

some s390 patches:

- Enable irqfds on s390 via the new adapter interrupt routing type.
  As a prereq, fix the kvm enable_cap helpers for some compilers and
  split the s390 flic into kvm and non-kvm parts.
- Enable software and hardware debugging support on s390. This needs a
  kernel headers update.

# gpg: Signature made Tue 20 May 2014 12:30:54 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20140520:
  s390x/kvm: hw debugging support via guest PER facility
  s390x/kvm: software breakpoint support
  s390x: remove duplicate definitions of DIAG 501
  linux-headers: update
  s390x/virtio-ccw: wire up irq routing and irqfds
  s390x/virtio-ccw: reference-counted indicators
  s390x: add I/O adapter registration
  s390x: split flic into kvm and non-kvm parts
  kvm: Fix enable_cap helpers on older gcc

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/bonzini/scsi-next' into staging
Peter Maydell [Thu, 22 May 2014 14:27:46 +0000 (15:27 +0100)]
Merge remote-tracking branch 'remotes/bonzini/scsi-next' into staging

* remotes/bonzini/scsi-next:
  megasas: remove buildtime strings
  block: iscsi build fix if LIBISCSI_FEATURE_IOVECTOR is not defined
  virtio-scsi: Plug memory leak on virtio_scsi_push_event() error path
  scsi: Document intentional fall through in scsi_req_length()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoqapi: zero-initialize all QMP command parameters
Michael Roth [Tue, 20 May 2014 17:20:39 +0000 (12:20 -0500)]
qapi: zero-initialize all QMP command parameters

In general QMP command parameter values are specified by consumers of the
QMP/HMP interface, but in the case of optional parameters these values may
be left uninitialized.

It is considered a bug for code to make use of optional parameters that have
not been flagged as being present by the marshalling code (via corresponding
has_<parameter> parameter), however our marshalling code will still pass
these uninitialized values on to the corresponding QMP function (to then
be ignored). Some compilers (clang in particular) consider this unsafe
however, and generate warnings as a result. As reported by Peter Maydell:

  This is something clang's -fsanitize=undefined spotted. The
  code generated by qapi-commands.py in qmp-marshal.c for
  qmp_marshal_* functions where there are some optional
  arguments looks like this:

      bool has_force = false;
      bool force;

      mi = qmp_input_visitor_new_strict(QOBJECT(args));
      v = qmp_input_get_visitor(mi);
      visit_type_str(v, &device, "device", errp);
      visit_start_optional(v, &has_force, "force", errp);
      if (has_force) {
          visit_type_bool(v, &force, "force", errp);
      }
      visit_end_optional(v, errp);
      qmp_input_visitor_cleanup(mi);

      if (error_is_set(errp)) {
          goto out;
      }
      qmp_eject(device, has_force, force, errp);

  In the case where has_force is false, we never initialize
  force, but then we use it by passing it to qmp_eject.
  I imagine we don't then actually use the value, but clang
  complains in particular for 'bool' variables because the value
  that ends up being loaded from memory for 'force' is not either
  0 or 1 (being uninitialized stack contents).

Fix this by initializing all QMP command parameters to {0} in the
marshalling code prior to passing them on to the QMP functions.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoscripts/qapi.py: Avoid syntax not supported by Python 2.4
Luiz Capitulino [Tue, 20 May 2014 17:50:19 +0000 (13:50 -0400)]
scripts/qapi.py: Avoid syntax not supported by Python 2.4

The Python "except Foo as x" syntax was only introduced in
Python 2.6, but we aim to support Python 2.4 and later.
Use the old-style "except Foo, x" syntax instead, thus
fixing configure/compile on systems with older Python.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoerror: error_is_set() is finally unused; remove
Markus Armbruster [Mon, 19 May 2014 16:57:38 +0000 (18:57 +0200)]
error: error_is_set() is finally unused; remove

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agochar: Explain qmp_chardev_add()'s unusual error handling
Markus Armbruster [Mon, 19 May 2014 16:57:36 +0000 (18:57 +0200)]
char: Explain qmp_chardev_add()'s unusual error handling

Character backend open hasn't been fully converted to the Error API.
Some opens fail without setting an error.  qmp_chardev_add() needs to
detect when that happens, and set a generic error.  Explain that in a
comment, and inline error_is_set() for clarity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agochar: Clean up fragile use of error_is_set()
Markus Armbruster [Mon, 19 May 2014 16:57:35 +0000 (18:57 +0200)]
char: Clean up fragile use of error_is_set()

Using error_is_set(ERRP) to find out whether a function failed is
either wrong, fragile, or unnecessarily opaque.  It's wrong when ERRP
may be null, because errors go undetected when it is.  It's fragile
when proving ERRP non-null involves a non-local argument.  Else, it's
unnecessarily opaque (see commit 84d18f0).

The error_is_set(errp) in qemu_chr_new_from_opts() is merely fragile,
because the callers never pass a null errp argument.

Make the code more robust and more obviously correct: receive the
error in a local variable, then propagate it through the parameter.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agochar: Use return values instead of error_is_set(errp)
Markus Armbruster [Mon, 19 May 2014 16:57:34 +0000 (18:57 +0200)]
char: Use return values instead of error_is_set(errp)

Using error_is_set(errp) to check whether a function call failed is
fragile: it breaks when errp is null.  Check perfectly suitable return
values instead when possible.  As far as I can tell, errp can't be
null there, but this is more robust and more obviously correct

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoqemu-socket: Clean up inet_connect_opts()
Markus Armbruster [Mon, 19 May 2014 16:57:37 +0000 (18:57 +0200)]
qemu-socket: Clean up inet_connect_opts()

Separate the search for a working addrinfo from the code that does
something with it.  Makes for a clearer search loop.

Use a local Error * to simplify resetting the error in the search
loop.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agodoc: add "setup" to list of migration states
Peter Feiner [Fri, 16 May 2014 14:40:47 +0000 (10:40 -0400)]
doc: add "setup" to list of migration states

On a slow VM (e.g., nested), you see the "setup" state when you query the
migration status.

Signed-off-by: Peter Feiner <peter@gridcentric.ca>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomegasas: remove buildtime strings
Olaf Hering [Thu, 3 Apr 2014 13:47:34 +0000 (15:47 +0200)]
megasas: remove buildtime strings

Using __DATE__ or __TIME__ in binary pkgs changes the checksum of
compiled binaries if they get rebuilt, even if there are no other
source changes.  Replace the dynamic strings with some equally
informative static strings.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agos390x/kvm: hw debugging support via guest PER facility
David Hildenbrand [Mon, 3 Sep 2012 11:09:10 +0000 (13:09 +0200)]
s390x/kvm: hw debugging support via guest PER facility

This patch makes use of the hw debugging support in kvm (provided by the guest's
PER facility) on s390. It enables the following features, available using the
gdbserver:
- single-stepping
- hw breakpoints
- hw watchpoints

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x/kvm: software breakpoint support
David Hildenbrand [Tue, 25 Feb 2014 14:53:00 +0000 (15:53 +0100)]
s390x/kvm: software breakpoint support

This patch allows to insert and remove sw breakpoints using the QEMU gdbserver
on s390 as well as to interrupt execution on a breakpoint hit when running
with KVM enabled.

Whenever a software breakpoint is inserted, common code calls kvm ioctl
KVM_UPDATE_GUEST_DEBUG. As this method's default on s390 is to return an error
if not implement, the insertion will fail. Therefore, KVM also has to be
updated in order to make use of software breakpoints.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x: remove duplicate definitions of DIAG 501
David Hildenbrand [Tue, 25 Feb 2014 14:58:45 +0000 (15:58 +0100)]
s390x: remove duplicate definitions of DIAG 501

When restoring the previously saved instruction in
kvm_arch_remove_sw_breakpoint(), we only restored one byte. Let's use
the sizeof() operator to make sure we restore the entire instruction.

While we are at it, let's remove the duplicate definitions of DIAG 501
and replace its size (used when reading/writing the instruction) with
a sizeof() operator to make the code self explaining and less error-prone.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agolinux-headers: update
Jens Freimann [Mon, 12 May 2014 08:03:46 +0000 (10:03 +0200)]
linux-headers: update

Sync linux-headers with kvm/next (87c00572ba05aa8c9db118da75c608f47eb10b9e)

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x/virtio-ccw: wire up irq routing and irqfds
Cornelia Huck [Mon, 15 Jul 2013 15:45:03 +0000 (17:45 +0200)]
s390x/virtio-ccw: wire up irq routing and irqfds

Make use of the new s390 adapter irq routing support to enable real
in-kernel irqfds for virtio-ccw with adapter interrupts.

Note that s390 doesn't provide the common KVM_CAP_IRQCHIP capability, but
rather needs KVM_CAP_S390_IRQCHIP to be enabled. This is to ensure backward
compatibility.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x/virtio-ccw: reference-counted indicators
Cornelia Huck [Thu, 1 Aug 2013 15:27:00 +0000 (17:27 +0200)]
s390x/virtio-ccw: reference-counted indicators

Make code using the same indicators point to a single allocated structure
that is freed when the last user goes away.

This will be used by the irqfd code to unmap addresses after the last user
is gone.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x: add I/O adapter registration
Cornelia Huck [Mon, 15 Jul 2013 15:45:03 +0000 (17:45 +0200)]
s390x: add I/O adapter registration

Register an I/O adapter interrupt source for when virtio-ccw devices start
using adapter interrupts.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x: split flic into kvm and non-kvm parts
Cornelia Huck [Thu, 17 Apr 2014 13:59:48 +0000 (15:59 +0200)]
s390x: split flic into kvm and non-kvm parts

Introduce a common parent class for both cases, where kvm and non-kvm
can hook up callbacks. This will be used by follow-on patches for
adapter registration and mapping.

We now always have a flic, regardless of whether we use kvm; the
non-kvm implementation just doesn't do anything.

Reviewed-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agokvm: Fix enable_cap helpers on older gcc
Alexander Graf [Mon, 12 May 2014 09:51:37 +0000 (11:51 +0200)]
kvm: Fix enable_cap helpers on older gcc

Commit 40f1ee27aa1 introduced handy helpers for enable_cap calls on
vcpu and vm level. Unfortunately some older gcc versions (4.7.1, 4.6)
seem to choke on signedness detection in inline created variables:

target-ppc/kvm.c: In function 'kvmppc_booke_watchdog_enable':
target-ppc/kvm.c:1302:21: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
target-ppc/kvm.c: In function 'kvmppc_set_papr':
target-ppc/kvm.c:1504:21: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]

However - thanks to Thomas Huth for the suggestion - we can just cast the
offending potentially 0 value to a signed type, making the comparison signed.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Tue, 20 May 2014 10:57:52 +0000 (11:57 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches

# gpg: Signature made Mon 19 May 2014 15:21:14 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (22 commits)
  block: optimize zero writes with bdrv_write_zeroes
  blockdev: add a function to parse enum ids from strings
  util: add qemu_iovec_is_zero
  qcow1: Stricter backing file length check
  qcow1: Validate image size (CVE-2014-0223)
  qcow1: Validate L2 table size (CVE-2014-0222)
  qcow1: Check maximum cluster size
  qcow1: Make padding in the header explicit
  curl: Add usage documentation
  curl: Add sslverify option
  curl: Remove broken parsing of options from url
  curl: Fix build when curl_multi_socket_action isn't available
  qemu-iotests: Fix blkdebug in VM drive in 030
  qemu-iotests: Fix core dump suppression in test 039
  iotests: Add test for the JSON protocol
  block: Allow JSON filenames
  check-qdict: Add test for qdict_join()
  qdict: Add qdict_join()
  block: add test for vhdx image created by Disk2VHD
  block: vhdx - account for identical header sections
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoblock: iscsi build fix if LIBISCSI_FEATURE_IOVECTOR is not defined
Jeff Cody [Mon, 19 May 2014 21:13:06 +0000 (17:13 -0400)]
block: iscsi build fix if LIBISCSI_FEATURE_IOVECTOR is not defined

Commit b03c380 introduced the function
iscsi_allocationmap_is_allocated(), however it is only used within a
code block that is conditionally compiled.  This produces a warning
(error with -werror) of "defined but not used" for the the function, if
LIBISCSI_FEATURE_IOVECTOR is not defined.

This wraps iscsi_allocationmap_is_allocated() in the same conditional.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agohw/audio/intel-hda: Avoid shift into sign bit
Peter Maydell [Fri, 9 May 2014 13:22:53 +0000 (14:22 +0100)]
hw/audio/intel-hda: Avoid shift into sign bit

Add a U suffix to avoid shifting into the sign bit (which is
undefined behaviour in C).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoaudio/intel-hda: support FIFORDY
Stanislav Vorobiov [Tue, 29 Apr 2014 12:48:47 +0000 (16:48 +0400)]
audio/intel-hda: support FIFORDY

linux kernel 3.12 has changed intel-hda
driver to always check for FIFORDY, this
causes long hangs in guest since QEMU
always has this bit set to 0. We now simply set
it to 1 always, since we're synchronous anyway
and always ready to receive the stream

Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Mon, 19 May 2014 13:10:00 +0000 (14:10 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  qapi: skip redundant includes
  monitor: Add netdev_del id argument completion.
  monitor: Add netdev_add type argument completion.
  monitor: Add set_link arguments completion.
  monitor: Add chardev-add backend argument completion.
  monitor: Add chardev-remove command completion.
  monitor: Convert sendkey to use command_completion.
  qapi: Show qapi-commands.py invocation in qapi-code-gen.txt
  qapi: Replace uncommon use of the error API by the common one
  tests: Don't call visit_end_struct() after visit_start_struct() fails
  hw: Don't call visit_end_struct() after visit_start_struct() fails
  hmp: Call visit_end_struct() after visit_start_struct() succeeds
  qapi: Un-inline visit of implicit struct
  qapi-visit.py: Clean up a sloppy use of field prefix
  qapi: Clean up shadowing of parameters and locals in inner scopes
  qapi-visit.py: Clean up confusing push_indent() / pop_indent() use
  qapi: Replace start_optional()/end_optional() by optional()
  qapi: Remove unused Visitor callbacks start_handle(), end_handle()
  qapi: Normalize marshalling's visitor initialization and cleanup
  qapi: Update qapi-code-gen.txt example to match current code

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>