]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agoMerge remote-tracking branch 'bonzini/iommu-for-anthony' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:01:49 +0000 (10:01 -0700)]
Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging

# By Paolo Bonzini (10) and others
# Via Paolo Bonzini
* bonzini/iommu-for-anthony:
  exec: remove qemu_safe_ram_ptr
  icount: make it thread-safe
  icount: document (future) locking rules for icount
  icount: prepare the code for future races in calling qemu_clock_warp
  icount: reorganize icount_warp_rt
  icount: use cpu_get_icount() directly
  timer: add timer_mod_anticipate and timer_mod_anticipate_ns
  timer: extract timer_mod_ns_locked and timerlist_rearm
  timer: make qemu_clock_enable sync between disable and timer's cb
  qemu-thread: add QemuEvent
  timer: protect timers_state's clock with seqlock
  seqlock: introduce read-write seqlock
  vga: Mark relevant portio lists regions as coalesced MMIO flushing
  cirrus: Mark vga io region as coalesced MMIO flushing
  portio: Allow to mark portio lists as coalesced MMIO flushing
  compatfd: switch to QemuThread
  memory: fix 128 arithmetic in info mtree

Message-id: 1382024935-28297-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'bonzini/configure' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:01:37 +0000 (10:01 -0700)]
Merge remote-tracking branch 'bonzini/configure' into staging

# By Peter Maydell (3) and Ákos Kovács (2)
# Via Paolo Bonzini
* bonzini/configure:
  ui/Makefile.objs: delete unnecessary cocoa.o dependency
  default-configs/: CONFIG_GDBSTUB_XML removed
  Makefile.target: CONFIG_NO_* variables removed
  rules.mak: New string testing functions
  rules.mak: New logical functions for handling y/n values

10 years agoMerge remote-tracking branch 'spice/spice.v75' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:01:21 +0000 (10:01 -0700)]
Merge remote-tracking branch 'spice/spice.v75' into staging

# By Gerd Hoffmann (2) and others
# Via Gerd Hoffmann
* spice/spice.v75:
  spice: fix multihead support
  spice-display: add display channel id to the debug messages.
  Fix VNC SASL authentication when using a QXL device
  spice: replace use of deprecated API

Message-id: 1382006760-19388-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'filippov/tags/20131015-xtensa' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:01:08 +0000 (10:01 -0700)]
Merge remote-tracking branch 'filippov/tags/20131015-xtensa' into staging

xtensa queue 2013-10-15

# gpg: Signature made Tue 15 Oct 2013 06:27:41 AM PDT using RSA key ID F83FA044
# gpg: Can't check signature: public key not found

# By Max Filippov
# Via Max Filippov
* filippov/tags/20131015-xtensa:
  target-xtensa: add in_asm logging

Message-id: 1381844297-1728-1-git-send-email-jcmvbkbc@gmail.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoexec: remove qemu_safe_ram_ptr
Paolo Bonzini [Mon, 9 Sep 2013 15:49:45 +0000 (17:49 +0200)]
exec: remove qemu_safe_ram_ptr

This is not needed since the RAM list is not modified anymore by
qemu_get_ram_ptr.  Replace it with qemu_get_ram_block.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoicount: make it thread-safe
Paolo Bonzini [Thu, 3 Oct 2013 13:17:25 +0000 (15:17 +0200)]
icount: make it thread-safe

This lets threads other than the I/O thread use vm_clock even in -icount mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoicount: document (future) locking rules for icount
Paolo Bonzini [Mon, 7 Oct 2013 15:18:15 +0000 (17:18 +0200)]
icount: document (future) locking rules for icount

Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoicount: prepare the code for future races in calling qemu_clock_warp
Paolo Bonzini [Mon, 7 Oct 2013 15:30:02 +0000 (17:30 +0200)]
icount: prepare the code for future races in calling qemu_clock_warp

Computing the deadline of all vm_clocks is somewhat expensive and calls
out to qemu-timer.c; two reasons not to do it in the seqlock's write-side
critical section.  This however opens the door for races in setting and
reading vm_clock_warp_start.

To plug them, we need to cover the case where a new deadline slips in
between the call to qemu_clock_deadline_ns_all and the actual modification
of the icount_warp_timer.  Restrict changes to vm_clock_warp_start and
the icount_warp_timer's expiration time, to only move them back (which
would simply cause an early wakeup).

If a vm_clock timer is cancelled while CPUs are idle, this might cause the
icount_warp_timer to fire unnecessarily.  This is not a problem, after it
fires the timer becomes inactive and the next call to timer_mod_anticipate
will be precise.

In addition to this, we must deactivate the icount_warp_timer _before_
checking whether CPUs are idle.  This way, if the "last" CPU becomes idle
during the call to timer_del we will still set up the icount_warp_timer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoicount: reorganize icount_warp_rt
Paolo Bonzini [Mon, 7 Oct 2013 15:26:07 +0000 (17:26 +0200)]
icount: reorganize icount_warp_rt

To prepare for future code changes, move the increment of qemu_icount_bias
outside the "if" statement.

Also, hoist outside the if the check for timers that expired due to the
"warping".  The check is redundant when !runstate_is_running(), but
doing it this way helps because the code that increments qemu_icount_bias
will be a critical section.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoicount: use cpu_get_icount() directly
Paolo Bonzini [Mon, 7 Oct 2013 15:21:51 +0000 (17:21 +0200)]
icount: use cpu_get_icount() directly

This will help later when we will have to place these calls in
a critical section, and thus call a version of cpu_get_icount()
that does not take the lock.

Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agotimer: add timer_mod_anticipate and timer_mod_anticipate_ns
Paolo Bonzini [Thu, 3 Oct 2013 13:11:43 +0000 (15:11 +0200)]
timer: add timer_mod_anticipate and timer_mod_anticipate_ns

These let a user anticipate the deadline of a timer, atomically with
other sites that call the function.  This helps avoiding complicated
lock hierarchies.

Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agotimer: extract timer_mod_ns_locked and timerlist_rearm
Paolo Bonzini [Thu, 3 Oct 2013 13:06:39 +0000 (15:06 +0200)]
timer: extract timer_mod_ns_locked and timerlist_rearm

These will be reused in timer_mod_anticipate functions.

Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agotimer: make qemu_clock_enable sync between disable and timer's cb
Liu Ping Fan [Wed, 25 Sep 2013 06:21:00 +0000 (14:21 +0800)]
timer: make qemu_clock_enable sync between disable and timer's cb

After disabling the QemuClock, we should make sure that no QemuTimers
are still in flight. To implement that with light overhead, we resort
to QemuEvent. The caller of disabling will wait on QemuEvent of each
timerlist.

Note, qemu_clock_enable(foo,false) can _not_ be called from timer's cb.
Also, the callers of qemu_clock_enable() should be protected by the BQL.

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoqemu-thread: add QemuEvent
Paolo Bonzini [Wed, 25 Sep 2013 06:20:59 +0000 (14:20 +0800)]
qemu-thread: add QemuEvent

This emulates Win32 manual-reset events using futexes or conditional
variables.  Typical ways to use them are with multi-producer,
single-consumer data structures, to test for a complex condition whose
elements come from different threads:

    for (;;) {
        qemu_event_reset(ev);
        ... test complex condition ...
        if (condition is true) {
            break;
        }
        qemu_event_wait(ev);
    }

Or more efficiently (but with some duplication):

    ... evaluate condition ...
    while (!condition) {
        qemu_event_reset(ev);
        ... evaluate condition ...
        if (!condition) {
            qemu_event_wait(ev);
            ... evaluate condition ...
        }
    }

QemuEvent provides a very fast userspace path in the common case when
no other thread is waiting, or the event is not changing state.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agotimer: protect timers_state's clock with seqlock
Liu Ping Fan [Wed, 25 Sep 2013 06:20:58 +0000 (14:20 +0800)]
timer: protect timers_state's clock with seqlock

QEMU_CLOCK_VIRTUAL may be read outside BQL. This will make its
foundation, i.e. cpu_clock_offset exposed to race condition.
Using private lock to protect it.

After this patch, reading QEMU_CLOCK_VIRTUAL is thread safe
unless use_icount is true, in which case the existing callers
still rely on the BQL.

Lock rule: private lock innermost, ie BQL->"this lock"

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoseqlock: introduce read-write seqlock
Paolo Bonzini [Wed, 25 Sep 2013 06:20:57 +0000 (14:20 +0800)]
seqlock: introduce read-write seqlock

Seqlock implementation for QEMU. Usage idiom

reader:
    do {
        start = seqlock_read_begin(&sl);
        ...
    } while (seqlock_read_retry(&sl, start));

writer:
    seqlock_write_lock(&sl);
    ...
    seqlock_write_unlock(&sl);

initialization:
    seqlock_init(QemuSeqLock *sl, QemuMutex *mutex)

    mutex could be NULL if the caller will provide its own protection
    for concurrent write sides (typically using the BQL).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agovga: Mark relevant portio lists regions as coalesced MMIO flushing
Jan Kiszka [Tue, 2 Jul 2013 19:37:40 +0000 (21:37 +0200)]
vga: Mark relevant portio lists regions as coalesced MMIO flushing

This allows to remove the explicit qemu_flush_coalesced_mmio_buffer
calls.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agocirrus: Mark vga io region as coalesced MMIO flushing
Jan Kiszka [Tue, 2 Jul 2013 19:19:02 +0000 (21:19 +0200)]
cirrus: Mark vga io region as coalesced MMIO flushing

This allows to remove the explicit qemu_flush_coalesced_mmio_buffer
calls - the memory core will invoke them now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoportio: Allow to mark portio lists as coalesced MMIO flushing
Jan Kiszka [Tue, 2 Jul 2013 18:22:37 +0000 (20:22 +0200)]
portio: Allow to mark portio lists as coalesced MMIO flushing

This will enable us to remove all remaining explicit calls of
qemu_flush_coalesced_mmio_buffer in IO handlers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agocompatfd: switch to QemuThread
Jan Kiszka [Thu, 2 May 2013 08:21:18 +0000 (10:21 +0200)]
compatfd: switch to QemuThread

qemu_thread_create already does signal blocking and detaching for us.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: fix 128 arithmetic in info mtree
Alexey Kardashevskiy [Fri, 30 Aug 2013 08:10:38 +0000 (18:10 +1000)]
memory: fix 128 arithmetic in info mtree

mtree_print_mr() calls int128_get64() in 3 places but only 2 places
handle 2^64 correctly.

This fixes the third call of int128_get64().

Cc: qemu-stable@nongnu.org
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agospice: fix multihead support
Gerd Hoffmann [Fri, 11 Oct 2013 20:39:59 +0000 (22:39 +0200)]
spice: fix multihead support

This patch fixes spice display initialization to handle
multihead properly.

spice-core now keeps track of which QemuConsole has a spice
display channel attached to it and which has not.  It also
manages display channel ids.

spice-display looks at all QemuConsoles and will pick up any
graphic console not yet bound to a spice channel (which in practice
are all non-qxl graphic devices).

Result is that
 (a) you'll get a spice client window for each graphical device
     now (first only without this patch), and
 (b) mixing qxl and non-qxl vga cards works properly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agospice-display: add display channel id to the debug messages.
Gerd Hoffmann [Thu, 17 Oct 2013 10:11:43 +0000 (12:11 +0200)]
spice-display: add display channel id to the debug messages.

And s/__FUNCTION__/__func__/ while being at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoFix VNC SASL authentication when using a QXL device
Christophe Fergeau [Wed, 16 Oct 2013 15:52:33 +0000 (17:52 +0200)]
Fix VNC SASL authentication when using a QXL device

ui/vnc.c:vnc_display_open() and spice-server/server/reds.c:do_spice_init()
are both calling sasl_server_init(). If spice_server_set_sasl_appname()
hasn't been called, spice-server will call it with "spice" as an appname,
causing cyrus-sasl to try to use a /etc/sasl2/spice.conf config file rather
than the /etc/sasl2/qemu.conf file that QEMU uses.

When using -spice sasl on the command line, QEMU properly calls
spice_server_set_sasl_appname() to set the SASL appname as "qemu",
but when using a QXL device without using SPICE, spice_server_init()
is called from qemu_spice_add_interface() without setting the appname
to "qemu", which then causes the VNC code to try to use spice.conf
instead of qemu.conf.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agospice: replace use of deprecated API
Marc-André Lureau [Fri, 4 Oct 2013 11:10:46 +0000 (13:10 +0200)]
spice: replace use of deprecated API

hose API are deprecated since 0.11, and qemu depends on 0.12 already.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoui/Makefile.objs: delete unnecessary cocoa.o dependency
Peter Maydell [Thu, 10 Oct 2013 11:26:09 +0000 (19:26 +0800)]
ui/Makefile.objs: delete unnecessary cocoa.o dependency

Delete an unnecessary dependency for cocoa.o; we already have
a general rule that tells Make that we can build a .o file
from a .m source using an ObjC compiler, so this specific
rule is unnecessary. Further, it is using the dubious construct
"$(SRC_PATH)/$(obj)" to get at the source directory, which will
break when $(obj) is redefined as part of the preparation for
per-object library support.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agodefault-configs/: CONFIG_GDBSTUB_XML removed
Ákos Kovács [Fri, 13 Sep 2013 17:25:54 +0000 (18:25 +0100)]
default-configs/: CONFIG_GDBSTUB_XML removed

Makefile.target: Build gdbstub-xml.o only when
TARGET_XML_FILES is not empty.

Signed-off-by: Ákos Kovács <akoskovacs@gmx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoMakefile.target: CONFIG_NO_* variables removed
Ákos Kovács [Fri, 13 Sep 2013 17:25:53 +0000 (18:25 +0100)]
Makefile.target: CONFIG_NO_* variables removed

CONFIG_NO_* variables replaced with the lnot logical function

Signed-off-by: Ákos Kovács <akoskovacs@gmx.com>
[PMM: fixed a few CONFIG_NO_* uses that were missed]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agorules.mak: New string testing functions
Peter Maydell [Fri, 13 Sep 2013 17:25:52 +0000 (18:25 +0100)]
rules.mak: New string testing functions

Add new string testing functions which return a y/n result:
 eq : are two strings equal (ignoring leading/trailing space)?
 ne : are two strings unequal?
 isempty : is a string empty?
 notempty : is a string non-empty?

Based on an idea by Ákos Kovács <akoskovacs@gmx.com>.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agorules.mak: New logical functions for handling y/n values
Peter Maydell [Fri, 13 Sep 2013 17:25:51 +0000 (18:25 +0100)]
rules.mak: New logical functions for handling y/n values

Add new logical functions for handling y/n values like those we
use in CONFIG_FOO variables:
 lnot : logical NOT
 land : logical AND
 lor : logical OR
 lxor : logical XOR
 leqv : logical equality, inverse of lxor
 lif : like Make's $(if) but with an eq-like test

Based on an idea by Ákos Kovács <akoskovacs@gmx.com>.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agotarget-xtensa: add in_asm logging
Max Filippov [Sat, 17 Aug 2013 08:30:57 +0000 (12:30 +0400)]
target-xtensa: add in_asm logging

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agoMerge remote-tracking branch 'rth/tcg-ldst-6' into staging
Anthony Liguori [Mon, 14 Oct 2013 16:59:59 +0000 (09:59 -0700)]
Merge remote-tracking branch 'rth/tcg-ldst-6' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/tcg-ldst-6:
  target-alpha: Convert to new ldst opcodes
  tcg-ppc64: Support new ldst opcodes
  tcg-ppc: Support new ldst opcodes
  tcg-ppc64: Convert to le/be ldst helpers
  tcg-ppc: Convert to le/be ldst helpers
  tcg-ppc64: Use TCGMemOp within qemu_ldst routines
  tcg-ppc: Use TCGMemOp within qemu_ldst routines
  tcg-arm: Improve GUEST_BASE qemu_ld/st
  tcg-arm: Convert to new ldst opcodes
  tcg-arm: Tidy variable naming convention in qemu_ld/st
  tcg-arm: Convert to le/be ldst helpers
  tcg-arm: Use TCGMemOp within qemu_ldst routines
  tcg-i386: Support new ldst opcodes
  tcg-i386: Remove "cb" output restriction from qemu_st8 for i386
  tcg-i386: Tidy softmmu routines
  tcg-i386: Use TCGMemOp within qemu_ldst routines
  tcg: Use TCGMemOp for TCGLabelQemuLdst.opc

Message-id: 1381620683-4568-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'jliu/or32' into staging
Anthony Liguori [Mon, 14 Oct 2013 16:15:47 +0000 (09:15 -0700)]
Merge remote-tracking branch 'jliu/or32' into staging

# By Sebastian Macke
# Via Jia Liu
* jliu/or32:
  target-openrisc: Removes a non-conforming behavior for the first page of the memory
  target-openrisc: Correct handling of page faults.

Message-id: 1380789702-18935-1-git-send-email-proljc@gmail.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20131010.0' into staging
Anthony Liguori [Mon, 14 Oct 2013 16:14:30 +0000 (09:14 -0700)]
Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20131010.0' into staging

vfio-pci updates include:
 - Forgotten MSI affinity patch posted several months ago
 - Lazy option ROM loading to delay load until after device/bus resets
 - Error reporting cleanups
 - PCI hot reset support introduced with Linux v3.12 development kernels
 - Debug build fix for int128

The lazy ROM loading and hot reset should help VGA assignment as we can
now do a bus reset when there are multiple devices on the bus, ex.
multi-function graphics and audio cards.

# gpg: Signature made Thu 10 Oct 2013 11:26:39 AM PDT using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

# By Alex Williamson (7) and Alexey Kardashevskiy (1)
# Via Alex Williamson
* awilliam/tags/vfio-pci-for-qemu-20131010.0:
  vfio-pci: Fix endian issues in vfio_pci_size_rom()
  vfio-pci: Add dummy PCI ROM write accessor
  vfio: Fix debug output for int128 values
  vfio-pci: Implement PCI hot reset
  vfio-pci: Cleanup error_reports
  vfio-pci: Lazy PCI option ROM loading
  vfio-pci: Test device reset capabilities
  vfio-pci: Add support for MSI affinity

Message-id: 20131010184122.31667.28382.stgit@bling.home
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoexec: Fix prototype of phys_mem_set_alloc and related functions
Stefan Weil [Sun, 29 Sep 2013 18:56:45 +0000 (20:56 +0200)]
exec: Fix prototype of phys_mem_set_alloc and related functions

phys_mem_alloc and its assigned values qemu_anon_ram_alloc and
legacy_s390_alloc must have identical argument lists.

legacy_s390_alloc uses the size parameter to call mmap, so size_t is
good enough for all of them.

This patch fixes compiler errors on i686 Linux hosts:

  CC    alpha-softmmu/exec.o
exec.c:752:51: error:
 initialization from incompatible pointer type [-Werror]
exec.c: In function 'qemu_ram_alloc_from_ptr':
exec.c:1139:32: error:
 comparison of distinct pointer types lacks a cast [-Werror]
exec.c: In function 'qemu_ram_remap':
exec.c:1283:21: error:
 comparison of distinct pointer types lacks a cast [-Werror]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1380481005-32399-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agotarget-alpha: Convert to new ldst opcodes
Richard Henderson [Tue, 10 Sep 2013 20:11:56 +0000 (13:11 -0700)]
target-alpha: Convert to new ldst opcodes

Or, partially.  The fundamental primitives for the port are gen_load_mem
and gen_store_mem, which take a callback to emit the memory operation.
For that, we continue to use the original inline functions that forward
to the new ops, rather than replicate the same thing privately.

That said, all free-standing calls to tcg_gen_qemu_* have been converted.
The 32-bit floating-point references now use _i32 opcodes, eliminating
a truncate or extension.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Support new ldst opcodes
Richard Henderson [Tue, 10 Sep 2013 17:15:25 +0000 (10:15 -0700)]
tcg-ppc64: Support new ldst opcodes

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Support new ldst opcodes
Richard Henderson [Tue, 10 Sep 2013 17:00:27 +0000 (10:00 -0700)]
tcg-ppc: Support new ldst opcodes

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Convert to le/be ldst helpers
Richard Henderson [Tue, 10 Sep 2013 16:05:15 +0000 (09:05 -0700)]
tcg-ppc64: Convert to le/be ldst helpers

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Convert to le/be ldst helpers
Richard Henderson [Tue, 10 Sep 2013 15:54:04 +0000 (08:54 -0700)]
tcg-ppc: Convert to le/be ldst helpers

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Use TCGMemOp within qemu_ldst routines
Richard Henderson [Wed, 4 Sep 2013 00:05:37 +0000 (17:05 -0700)]
tcg-ppc64: Use TCGMemOp within qemu_ldst routines

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Use TCGMemOp within qemu_ldst routines
Richard Henderson [Wed, 4 Sep 2013 00:05:31 +0000 (17:05 -0700)]
tcg-ppc: Use TCGMemOp within qemu_ldst routines

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-arm: Improve GUEST_BASE qemu_ld/st
Richard Henderson [Thu, 12 Sep 2013 22:06:23 +0000 (15:06 -0700)]
tcg-arm: Improve GUEST_BASE qemu_ld/st

If we pull the code to emit the actual load/store into a subroutine,
we can share the reg+reg addressing mode code between softmmu and
usermode.  This lets us load GUEST_BASE into a temporary register
rather than attempting to add it piece-wise to the address.

Which lets us use movw+movt for armv7, rather than (up to) 4 adds.
Code size for pre-armv7 stays the same.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-arm: Convert to new ldst opcodes
Richard Henderson [Thu, 12 Sep 2013 17:17:45 +0000 (10:17 -0700)]
tcg-arm: Convert to new ldst opcodes

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-arm: Tidy variable naming convention in qemu_ld/st
Richard Henderson [Thu, 12 Sep 2013 16:07:38 +0000 (09:07 -0700)]
tcg-arm: Tidy variable naming convention in qemu_ld/st

s/addr_reg2/addrhi/
s/addr_reg/addrlo/
s/data_reg2/datahi/
s/data_reg/datalo/

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-arm: Convert to le/be ldst helpers
Richard Henderson [Thu, 12 Sep 2013 15:58:33 +0000 (08:58 -0700)]
tcg-arm: Convert to le/be ldst helpers

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-arm: Use TCGMemOp within qemu_ldst routines
Richard Henderson [Tue, 3 Sep 2013 23:16:47 +0000 (16:16 -0700)]
tcg-arm: Use TCGMemOp within qemu_ldst routines

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Support new ldst opcodes
Richard Henderson [Wed, 4 Sep 2013 16:35:37 +0000 (09:35 -0700)]
tcg-i386: Support new ldst opcodes

No support for helpers with non-default endianness yet,
but good enough to test the opcodes.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Remove "cb" output restriction from qemu_st8 for i386
Richard Henderson [Wed, 4 Sep 2013 15:51:07 +0000 (08:51 -0700)]
tcg-i386: Remove "cb" output restriction from qemu_st8 for i386

Once we form a combined qemu_st_i32 opcode, we won't be able to
have separate constraints based on size.  This one is fairly easy
to work around, since eax is available as a scratch register.

When storing variable data, this tends to merely exchange one mov
for another.  E.g.

-:  mov    %esi,%ecx
...
-:  mov    %cl,(%edx)
+:  mov    %esi,%eax
+:  mov    %al,(%edx)

Where we do have a regression is when storing constant data, in which
we may load the constant into edi, when only ecx/ebx ought to be used.

The proper way to recover this regression is to allow constants as
arguments to qemu_st_i32, so that we never load the constant data into
a register at all, must less the wrong register.  TBD.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Tidy softmmu routines
Richard Henderson [Wed, 4 Sep 2013 15:13:42 +0000 (08:13 -0700)]
tcg-i386: Tidy softmmu routines

Pass two TCGReg to tcg_out_tlb_load, rather than idx+args.

Move ldst_optimization routines just below tcg_out_tlb_load to avoid
the need for forward declarations.

Use TCGReg enum in preference to int where apprpriate.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Use TCGMemOp within qemu_ldst routines
Richard Henderson [Tue, 3 Sep 2013 20:54:21 +0000 (13:54 -0700)]
tcg-i386: Use TCGMemOp within qemu_ldst routines

Step one in the transition, with constants passed down from tcg_out_op.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Use TCGMemOp for TCGLabelQemuLdst.opc
Richard Henderson [Fri, 11 Oct 2013 21:32:06 +0000 (14:32 -0700)]
tcg: Use TCGMemOp for TCGLabelQemuLdst.opc

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoMerge remote-tracking branch 'mdroth/qga-pull-2013-10-10' into staging
Anthony Liguori [Fri, 11 Oct 2013 16:38:07 +0000 (09:38 -0700)]
Merge remote-tracking branch 'mdroth/qga-pull-2013-10-10' into staging

# By Mark Wu (2) and Tomoki Sekiyama (1)
# Via Michael Roth
* mdroth/qga-pull-2013-10-10:
  qemu-ga: Extend 'guest-info' command to expose flag 'success-response'
  qemu-ga: Add interface to traverse the qmp command list by QmpCommand
  qemu-ga: execute fsfreeze-freeze in reverse order of mounts

Message-id: 1381435782-25524-1-git-send-email-mdroth@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'rth/tcg-pull' into staging
Anthony Liguori [Fri, 11 Oct 2013 16:36:52 +0000 (09:36 -0700)]
Merge remote-tracking branch 'rth/tcg-pull' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/tcg-pull:
  exec: Add both big- and little-endian memory helpers
  tcg: Add qemu_ld_st_i32/64
  tcg: Add TCGMemOp
  configure: Remove CONFIG_QEMU_LDST_OPTIMIZATION
  tcg: Add tcg-be-ldst.h
  tcg: Add tcg-be-null.h
  exec: Delete is_tcg_gen_code and GETRA_EXT
  tcg-aarch64: Update to helper_ret_*_mmu routines
  tcg: Merge tcg_register_helper into tcg_context_init
  tcg: Add tcg-runtime.c helpers to all_helpers
  tcg: Put target helper data into an array.
  tcg: Remove stray semi-colons from target-*/helper.h
  tcg: Move helper registration into tcg_context_init
  target-m68k: Rename helpers.h to helper.h
  tcg: Use a GHashTable for tcg_find_helper
  tcg: Delete tcg_helper_get_name declaration
  tcg-hppa: Remove tcg backend

Message-id: 1381440525-6666-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoqdev-monitor: Group "device_add help" and "info qdm" by category
Markus Armbruster [Thu, 10 Oct 2013 13:00:21 +0000 (15:00 +0200)]
qdev-monitor: Group "device_add help" and "info qdm" by category

Output is a long, unsorted list.  Not very helpful.  Print one list
per device category instead, with a header line identifying the
category, plus a list of uncategorized devices.  Print each list in
case-insenitive alphabetical order.

Devices with multiple categories are listed multiple times.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Message-id: 1381410021-1538-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMostly revert "qemu-help: Sort devices by logical functionality"
Markus Armbruster [Thu, 10 Oct 2013 13:00:20 +0000 (15:00 +0200)]
Mostly revert "qemu-help: Sort devices by logical functionality"

This reverts most of commit 3d1237fb2ab4edb926c717767bb5e31d6053a7c5.

The commit claims to sort the output of "-device help" "by
functionality rather than alphabetical".  Issues:

* The output was unsorted before, not alphabetically sorted.
  Misleading, but harmless enough.

* The commit doesn't just sort the output of "-device help" as it
  claims, it adds categories to each line of "-device help", and it
  prints devices once per category.  In particular, devices without a
  category aren't shown anymore.  Maybe such devices should not exist,
  but they do.  Regression.

* Categories are also added to the output of "info qdm".  Silent
  change, not nice.  Output remains unsorted, unlike "-device help".

I'm going to reimplement the feature we actually want, without the
warts.  Reverting the flawed commit first should make it easier to
review.  However, I can't revert it completely, since DeviceClass
member categories has been put to use.  So leave that part in.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Message-id: 1381410021-1538-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoUse qemu-project.org domain name
Stefan Hajnoczi [Fri, 11 Oct 2013 12:52:38 +0000 (14:52 +0200)]
Use qemu-project.org domain name

qemu.org is held by a third-party and no core community contributor has
access to the DNS configuration.  This leaves the website exposed to
outages due to DNS issues or IP address changes.  For example, if the
web server IP address needs to change we cannot guarantee qemu.org will
point to it!

The newer qemu-project.org domain name is owned by Anthony Liguori
<anthony@codemonkey.ws>.  You can confirm this by querying the whois
information.  Also note that the #qemu IRC channel topic already
references qemu-project.org.

Short of having a dedicated legal entity to hold the domain name on
behalf of the community, qemu-project.org seems like the safest bet.

Let's replace references to qemu.org with qemu-project.org.

Note that git-submodule(1) does not detect URL changes.  The following
commands clear out and re-initialize all submodules to ensure you are
using the latest URLs:

  $ git submodule deinit . # you'll be warned if you have local changes
  $ rm -rf .git/modules    # also clear cached .git/ directories
  $ git submodule update --init

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1381495958-8306-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 11 Oct 2013 16:29:58 +0000 (09:29 -0700)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Max Reitz (30) and others
# Via Kevin Wolf
* kwolf/for-anthony: (61 commits)
  qemu-iotests: Add test for inactive L2 overlap
  qemu-io: Let "open" pass options to block driver
  vmdk: Fix vmdk_parse_extents
  blockdev: blockdev_init() error conversion
  blockdev: Don't disable COR automatically with blockdev-add
  blockdev: Remove 'media' parameter from blockdev_init()
  qemu-iotests: Check autodel behaviour for device_del
  blockdev: Remove IF_* check for read-only blockdev_init
  blockdev: Move virtio-blk device creation to drive_init
  blockdev: Move bus/unit/index processing to drive_init
  blockdev: Move parsing of 'boot' option to drive_init
  blockdev: Moving parsing of geometry options to drive_init
  blockdev: Move parsing of 'if' option to drive_init
  blockdev: Move parsing of 'media' option to drive_init
  blockdev: Pass QDict to blockdev_init()
  blockdev: Separate ID generation from DriveInfo creation
  blockdev: 'blockdev-add' QMP command
  blockdev: Introduce DriveInfo.enable_auto_del
  qapi-types/visit.py: Inheritance for structs
  qapi-types/visit.py: Pass whole expr dict for structs
  ...

Message-id: 1381503951-27985-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoqemu-iotests: Add test for inactive L2 overlap
Max Reitz [Fri, 11 Oct 2013 12:02:11 +0000 (14:02 +0200)]
qemu-iotests: Add test for inactive L2 overlap

Extend 060 by a test which creates a corrupted image with an active L2
entry pointing to an inactive L2 table and writes to the corresponding
guest offset.

Also, use overlap-check=all for all tests in 060.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-io: Let "open" pass options to block driver
Max Reitz [Fri, 11 Oct 2013 12:02:10 +0000 (14:02 +0200)]
qemu-io: Let "open" pass options to block driver

Add an option to the open command to specify runtime options for the
block driver used.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovmdk: Fix vmdk_parse_extents
Fam Zheng [Fri, 11 Oct 2013 11:48:29 +0000 (19:48 +0800)]
vmdk: Fix vmdk_parse_extents

An extra 'p++' after while loop when *p == '\n' will move p to unknown
data position, risking parsing junk data or memory access violation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblockdev: blockdev_init() error conversion
Kevin Wolf [Fri, 20 Sep 2013 09:33:11 +0000 (11:33 +0200)]
blockdev: blockdev_init() error conversion

This gives us meaningful error messages for the blockdev-add QMP
command.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Don't disable COR automatically with blockdev-add
Kevin Wolf [Thu, 19 Sep 2013 13:12:18 +0000 (15:12 +0200)]
blockdev: Don't disable COR automatically with blockdev-add

If a read-only device is configured with copy-on-read=on, the old code
only prints a warning and automatically disables copy on read. Make it
a real error for blockdev-add.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Remove 'media' parameter from blockdev_init()
Kevin Wolf [Thu, 19 Sep 2013 12:24:10 +0000 (14:24 +0200)]
blockdev: Remove 'media' parameter from blockdev_init()

The remaining users shouldn't be there with blockdev-add and are easy to
move to drive_init().

Bonus bug fix: As a side effect, CD-ROM drives can now use block drivers
on the read-only whitelist without explicitly specifying read-only=on,
even if a format is explicitly specified.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoqemu-iotests: Check autodel behaviour for device_del
Kevin Wolf [Wed, 18 Sep 2013 14:47:41 +0000 (16:47 +0200)]
qemu-iotests: Check autodel behaviour for device_del

Block devices creates with -drive and drive_add should automatically
disappear if the guest device is unplugged. blockdev-add ones shouldn't.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Remove IF_* check for read-only blockdev_init
Kevin Wolf [Fri, 13 Sep 2013 13:51:47 +0000 (15:51 +0200)]
blockdev: Remove IF_* check for read-only blockdev_init

IF_NONE allows read-only, which makes forbidding it in this place
for other types pretty much pointless.

Instead, make sure that all devices for which the check would have
errored out check in their init function that they don't get a read-only
BlockDriverState. This catches even cases where IF_NONE and -device is
used.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Move virtio-blk device creation to drive_init
Kevin Wolf [Fri, 13 Sep 2013 12:09:17 +0000 (14:09 +0200)]
blockdev: Move virtio-blk device creation to drive_init

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Move bus/unit/index processing to drive_init
Kevin Wolf [Tue, 10 Sep 2013 13:48:13 +0000 (15:48 +0200)]
blockdev: Move bus/unit/index processing to drive_init

This requires moving the automatic ID generation at the same time, so
let's do that as well.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Move parsing of 'boot' option to drive_init
Kevin Wolf [Mon, 9 Sep 2013 15:01:03 +0000 (17:01 +0200)]
blockdev: Move parsing of 'boot' option to drive_init

It's already ignored and only prints a deprecation message. No use in
making it available in new interfaces.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Moving parsing of geometry options to drive_init
Kevin Wolf [Mon, 9 Sep 2013 14:49:49 +0000 (16:49 +0200)]
blockdev: Moving parsing of geometry options to drive_init

This moves all of the geometry options (cyls/heads/secs/trans) to
drive_init so that they can only be accessed using legacy functions, but
never with anything blockdev-add related.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Move parsing of 'if' option to drive_init
Kevin Wolf [Wed, 28 Aug 2013 15:24:51 +0000 (17:24 +0200)]
blockdev: Move parsing of 'if' option to drive_init

It's always IF_NONE for blockdev-add.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Move parsing of 'media' option to drive_init
Kevin Wolf [Wed, 28 Aug 2013 15:00:13 +0000 (17:00 +0200)]
blockdev: Move parsing of 'media' option to drive_init

This moves as much as possible of the processing of the 'media' option
to drive_init so that it can only be accessed using legacy functions,
but never with anything blockdev-add related.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Pass QDict to blockdev_init()
Kevin Wolf [Tue, 10 Sep 2013 10:01:20 +0000 (12:01 +0200)]
blockdev: Pass QDict to blockdev_init()

Working on a QDict instead of a QemuOpts that accepts anything is more
in line with bdrv_open(). A QDict is what qmp_blockdev_add() already has
anyway, so this saves additional conversions. And last, but not least,
it allows later patches to easily extract legacy options into a
separate, typed QemuOpts for drive_init() (the untyped QemuOpts that
drive_init already has doesn't allow access to numbers, only strings,
and is therefore useless without conversion).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Separate ID generation from DriveInfo creation
Kevin Wolf [Thu, 11 Jul 2013 10:52:34 +0000 (12:52 +0200)]
blockdev: Separate ID generation from DriveInfo creation

blockdev-add shouldn't automatically generate IDs, but will keep most of
the DriveInfo creation code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: 'blockdev-add' QMP command
Kevin Wolf [Mon, 23 Sep 2013 13:26:03 +0000 (15:26 +0200)]
blockdev: 'blockdev-add' QMP command

For examples see the changes to qmp-commands.hx.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblockdev: Introduce DriveInfo.enable_auto_del
Kevin Wolf [Wed, 18 Sep 2013 13:14:47 +0000 (15:14 +0200)]
blockdev: Introduce DriveInfo.enable_auto_del

BlockDriverStates shouldn't be affected by an unplugged guest device,
except if created with the legacy -drive command line option or the
drive_add HMP command.

Make the automatic deletion as well as cancelling of jobs conditional on
an enable_auto_del boolean that is only set in drive_init().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
10 years agoqapi-types/visit.py: Inheritance for structs
Kevin Wolf [Thu, 19 Sep 2013 09:56:36 +0000 (11:56 +0200)]
qapi-types/visit.py: Inheritance for structs

This introduces a new 'base' key for struct definitions that refers to
another struct type. On the JSON level, the fields of the base type are
included directly into the same namespace as the fields of the defined
type, like with unions. On the C level, a pointer to a struct of the
base type is included.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoqapi-types/visit.py: Pass whole expr dict for structs
Kevin Wolf [Wed, 18 Sep 2013 15:22:02 +0000 (17:22 +0200)]
qapi-types/visit.py: Pass whole expr dict for structs

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agovmdk: refuse enabling zeroed grain with flat images
Fam Zheng [Fri, 11 Oct 2013 07:43:23 +0000 (15:43 +0800)]
vmdk: refuse enabling zeroed grain with flat images

This is a header flag and we needs sparse for the header.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovmdk: convert error code to use errp
Fam Zheng [Fri, 11 Oct 2013 07:43:22 +0000 (15:43 +0800)]
vmdk: convert error code to use errp

Convert "fprintf(stderr,..." and standardize error messages:

Remove a few local_error's and use errp.

Remove "VMDK:" or "Vmdk:" prefixes in error message and fix to upper
case.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agobuild: add command check-clean
Wenchao Xia [Thu, 26 Sep 2013 00:42:56 +0000 (08:42 +0800)]
build: add command check-clean

This command will package the clean operations in tests. Now root Makefile
simply calls the command and do not care the details of it any more. Original
the built binaries for test will not be removed, now they will be deleted
in clean operation.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agotests: build the helper program by default
Wenchao Xia [Thu, 26 Sep 2013 00:42:55 +0000 (08:42 +0800)]
tests: build the helper program by default

Usually we may configure and make, then goto ./tests/qemu-iotest,
check. In this case an error will happen since helper program
was not built. This patch simply build it by default. A better way
may be introducing Makefile in ./tests/qemu-iotest, but it is more
complicate to handle out of tree case, and a bit overkill
for a single file now, we can do that when more files come.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/raw-posix: Employ error parameter
Max Reitz [Fri, 11 Oct 2013 09:37:01 +0000 (11:37 +0200)]
block/raw-posix: Employ error parameter

Make use of the error parameter in the opening and creating functions in
block/raw-posix.c.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: move blank lines of output in case 059
Fam Zheng [Fri, 11 Oct 2013 06:59:49 +0000 (14:59 +0800)]
qemu-iotests: move blank lines of output in case 059

Move the blank line to above the test step banner, so it looks clearer
in blocks.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblkverify: Employ error parameter
Max Reitz [Thu, 10 Oct 2013 13:44:04 +0000 (15:44 +0200)]
blkverify: Employ error parameter

Make use of the error parameter in blkverify_open.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblkdebug: Employ error parameter
Max Reitz [Thu, 10 Oct 2013 13:44:03 +0000 (15:44 +0200)]
blkdebug: Employ error parameter

Make use of the error parameter in blkdebug_open.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/raw-win32: Employ error parameter
Max Reitz [Thu, 10 Oct 2013 13:44:02 +0000 (15:44 +0200)]
block/raw-win32: Employ error parameter

Make use of the error parameter in the opening and creating functions in
block/raw-win32.c.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/raw_bsd: Employ error parameter
Max Reitz [Thu, 10 Oct 2013 13:44:00 +0000 (15:44 +0200)]
block/raw_bsd: Employ error parameter

Propagate errors in raw_create rather than directly reporting and
afterwards discarding them.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Evaluate overlap check options
Max Reitz [Thu, 10 Oct 2013 09:09:28 +0000 (11:09 +0200)]
qcow2: Evaluate overlap check options

Evaluate the runtime overlap check options and set
BDRVQcowState.overlap_check appropriately.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Add more overlap check bitmask macros
Max Reitz [Thu, 10 Oct 2013 09:09:27 +0000 (11:09 +0200)]
qcow2: Add more overlap check bitmask macros

Introduces the macros QCOW2_OL_CONSTANT and QCOW2_OL_ALL in addition to
the already existing QCOW2_OL_CACHED, signifying all metadata overlap
checks that can be performed in constant time (regardless of image size
etc.) and truly all available overlap checks, respectively.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Array assigning options to OL check bits
Max Reitz [Thu, 10 Oct 2013 09:09:26 +0000 (11:09 +0200)]
qcow2: Array assigning options to OL check bits

Add an array which assigns the option string to its corresponding
overlap check bit.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Add overlap-check options
Max Reitz [Thu, 10 Oct 2013 09:09:25 +0000 (11:09 +0200)]
qcow2: Add overlap-check options

Add runtime options to tune the overlap checks to be performed before
write accesses.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Make overlap check mask variable
Max Reitz [Thu, 10 Oct 2013 09:09:24 +0000 (11:09 +0200)]
qcow2: Make overlap check mask variable

Replace the QCOW2_OL_DEFAULT macro by a variable overlap_check in
BDRVQcowState.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Use negated overflow check mask
Max Reitz [Thu, 10 Oct 2013 09:09:23 +0000 (11:09 +0200)]
qcow2: Use negated overflow check mask

In qcow2_check_metadata_overlap and qcow2_pre_write_overlap_check,
change the parameter signifying the checks to perform from its current
positive form to a negative one, i.e., it will no longer explicitly
specify every check to perform but rather a mask of checks not to
perform.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Improve driver whitelist checks
Kevin Wolf [Thu, 10 Oct 2013 09:45:55 +0000 (11:45 +0200)]
block: Improve driver whitelist checks

The main intent of this patch is to consolidate the whitelist checks to
a single point in the code instead of spreading it everywhere. This adds
a nicer error message for read-only whitelisting, too, in places where
it was still missing.

The patch also contains a bonus bug fix: By finding the format first in
bdrv_open() and then independently checking against the whitelist only
later, we avoid the case that use of a non-whitelisted format results in
probing rather than an error message. Previously, this could happen when
using the driver=... option.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
10 years agoqcow2: Use better type for numerical snapshot ID
Max Reitz [Wed, 9 Oct 2013 12:42:47 +0000 (14:42 +0200)]
qcow2: Use better type for numerical snapshot ID

When trying to find a new snapshot ID, the existing ones are converted
to integers using strtoul. This function returns an unsigned long,
therefore its result should be saved in an unsigned long as well.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Fix snapshot restoration in snapshot_create
Max Reitz [Wed, 9 Oct 2013 12:42:00 +0000 (14:42 +0200)]
qcow2: Fix snapshot restoration in snapshot_create

If the new snapshot table could not be written in qcow2_snapshot_create,
the old snapshot table has to be restored in memory and the new one
released. This should include restoration of the old snapshot count as
well, which is added by this patch.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Remove wrong metadata overlap check
Max Reitz [Wed, 9 Oct 2013 12:41:28 +0000 (14:41 +0200)]
qcow2: Remove wrong metadata overlap check

In qcow2_write_compressed, if the compression fails, a normal cluster is
written to disk. This is done through bdrv_write on the qcow2 BDS
itself (using the guest offset), thus it is wrong to do a metadata
overlap check before.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Add missing space in error message
Max Reitz [Wed, 9 Oct 2013 12:40:48 +0000 (14:40 +0200)]
qcow2: Add missing space in error message

The error message in qcow2_downgrade about an unsupported refcount
order is missing a space. This patch adds it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: qemu-iotests for vhdx, read sample dynamic image
Jeff Cody [Fri, 27 Sep 2013 12:48:15 +0000 (08:48 -0400)]
block: qemu-iotests for vhdx, read sample dynamic image

This adds the VHDX format to the qemu-iotests format, and adds
a read test.  The test reads from an existing sample image, that
was created with Hyper-V under Windwos Server 2012.

The image file is a 1GB dynamic image, with 32MB blocks.

The pattern 0xa5 exists from 0MB-33MB (past a block size boundary)

The pattern 0x96 exists from 33MB-66MB (past another block boundary,
and leaving a partial blank block)

From 66MB-1024MB, all reads should return 0.

Although 1GB dynamic image with 66MB of data, the bzip2'ed image
file size is only 874 bytes.

This also adds in the IMGFMT_GENERIC flag, so r/o images can be
tested (e.g. ./check -vhdx) without failing tests that assume
r/w support.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>