]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agovnc: recognize Hungarian doubleacutes
Michael Tokarev [Sun, 3 Feb 2013 20:36:25 +0000 (00:36 +0400)]
vnc: recognize Hungarian doubleacutes

As reported in http://bugs.debian.org/697641 , some Hungarian keys
does not work with qemu when using vnc display.

This is because while the Hungarian keymap mentions these symbols,
qemu know nothing about them.  So add them.

This patch is applicable to -stable for all previous releases.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu/9p: Don't ignore error in fid clunk
Aneesh Kumar K.V [Tue, 5 Feb 2013 05:57:46 +0000 (11:27 +0530)]
qemu/9p: Don't ignore error in fid clunk

We use the clunk request to do the actual xattr operation. So don't
ignore the error value for fid clunk.

Security model "none" don't support posix acl. Without this patch
guest won't get EOPNOTSUPP error on setxattr("system.posix_acl_access")

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu/iovec: Don't assert if sbytes is zero
Aneesh Kumar K.V [Tue, 5 Feb 2013 05:57:45 +0000 (11:27 +0530)]
qemu/iovec: Don't assert if sbytes is zero

Since these values can possibly be sent from guest (for hw/9pfs), do a sanity check
on them. A 9p write request with 0 bytes caused qemu to abort without this patch

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoe1000: fix link down handling with auto negotiation
Michael S. Tsirkin [Tue, 5 Feb 2013 19:00:21 +0000 (21:00 +0200)]
e1000: fix link down handling with auto negotiation

Fixes a couple of regression bugs introduced by
b9d03e352cb6b31a66545763f6a1e20c9abf0c2c and related to
auto-negotiation:
-   Auto-negotiation currently sets link up even if it was
    forced down from the monitor.
-   If Auto-negotiation was in progress during migration,
    link will never come up.

As a fix, don't touch NC link_down field at all,
instead add code on receive path to check
guest link status.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconfigure: Fix build with XFree
Richard Henderson [Tue, 5 Feb 2013 00:21:07 +0000 (16:21 -0800)]
configure: Fix build with XFree

The build is broken on ppc64-linux, possibly only with new binutils:

ld: hw/lm32/../milkymist-tmu2.o: undefined reference to symbol 'XFree'
ld: note: 'XFree' is defined in DSO /lib64/libX11.so.6 so try \
  adding it to the linker command line

So let's follow the linker's advice.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agobswap: Fix width of swap in leul_to_cpu
Richard Henderson [Tue, 5 Feb 2013 00:21:06 +0000 (16:21 -0800)]
bswap: Fix width of swap in leul_to_cpu

The misnamed HOST_LONG_BITS is really HOST_POINTER_BITS.  Here we're
explicitly using an unsigned long, rather than uintptr_t, so it is
more correct to select the swap size via ULONG_MAX.

Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agobios: recompile BIOS
Anthony Liguori [Wed, 6 Feb 2013 11:12:06 +0000 (05:12 -0600)]
bios: recompile BIOS

SeaBIOS is really close to spilling over to 256k.  Until we can better
handle migration across RAM block size changes, recompile SeaBIOS with
a compiler that causes the binary to still fit in 128k.

This was built with:

gcc version 4.7.2 20121109 (Red Hat 4.7.2-8) (GCC)

On 64-bit Fedora 18.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-s390x: Fix wrong comparison in interrupt handling
Stefan Weil [Sun, 3 Feb 2013 20:33:16 +0000 (21:33 +0100)]
target-s390x: Fix wrong comparison in interrupt handling

gcc with -Wextra complains about an ordered pointer comparison:

target-s390x/helper.c:660:27: warning:
 ordered comparison of pointer with integer zero [-Wextra]

Obviously the index was missing in the code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agos390x: silence warning from GCC on uninitialized values
Anthony Liguori [Mon, 4 Feb 2013 21:22:08 +0000 (15:22 -0600)]
s390x: silence warning from GCC on uninitialized values

As best I can tell, this is a false positive.

  [aliguori@ccnode4 qemu-s390]$ make
    CC    s390x-softmmu/target-s390x/helper.o
  /home/aliguori/git/qemu/target-s390x/helper.c: In function ‘do_interrupt’:
  /home/aliguori/git/qemu/target-s390x/helper.c:673:17: error: ‘addr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  /home/aliguori/git/qemu/target-s390x/helper.c:620:20: note: ‘addr’ was declared here
  /home/aliguori/git/qemu/target-s390x/helper.c:673:17: error: ‘mask’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  /home/aliguori/git/qemu/target-s390x/helper.c:620:14: note: ‘mask’ was declared here
  cc1: all warnings being treated as errors
  make[1]: *** [target-s390x/helper.o] Error 1
  make: *** [subdir-s390x-softmmu] Error 2

Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoacpi_piix4: fix segfault migrating from 1.2
Michael Roth [Mon, 4 Feb 2013 16:07:51 +0000 (10:07 -0600)]
acpi_piix4: fix segfault migrating from 1.2

b0b873a07872f7ab7f66f259c73fb9dd42aa66a9 bumped the vmstate version and
introduced an old-style load function to handle migration from prior
(<= 1.2) versions.

The load function passes the top-level PIIX4PMState pointer to
vmstate_load_state() to handle nested structs for APMState and
pci_status, which leads to corruption of the top-level PIIX4PMState,
since pointers to the nested structs are expected.

A segfault can be fairly reliably triggered by migrating from 1.2 and
issuing a reset, which will trigger a number of QOM operations which
rely on the now corrupted ObjectClass/Object members.

Fix this by passing in the expected pointers for vmstate_load_state().

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl.c: validate -numa "cpus" parameter properly
Eduardo Habkost [Mon, 4 Feb 2013 18:27:52 +0000 (16:27 -0200)]
vl.c: validate -numa "cpus" parameter properly

- Accept empty strings without aborting
- Use parse_uint*() to parse numbers
- Abort if anything except '-' or end-of-string is found after the first
  number.
- Check for endvalue < value

Also change the MAX_CPUMASK_BITS warning message from "A max of %d CPUs
are supported in a guest" to "qemu: NUMA: A max of %d VCPUs are
supported".

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl.c: Extract -numa "cpus" parsing to separate function
Eduardo Habkost [Mon, 4 Feb 2013 18:27:51 +0000 (16:27 -0200)]
vl.c: Extract -numa "cpus" parsing to separate function

This will make it easier to refactor that code later.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl.c: Use parse_uint_full() for NUMA nodeid
Eduardo Habkost [Mon, 4 Feb 2013 18:27:50 +0000 (16:27 -0200)]
vl.c: Use parse_uint_full() for NUMA nodeid

This should catch many kinds of errors that the current code wasn't
checking for:

 - Values that can't be parsed as a number
 - Negative values
 - Overflow
 - Empty string

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl.c: numa_add(): Validate nodeid before using it
Eduardo Habkost [Mon, 4 Feb 2013 18:27:49 +0000 (16:27 -0200)]
vl.c: numa_add(): Validate nodeid before using it

Without this check, QEMU will corrupt memory if a too-large nodeid is
provided in the command-line. e.g.:

  -numa node,mem=...,cpus=...,nodeid=65

This changes nodenr to unsigned long long, to avoid integer conversion
issues when converting the strtoull() result to int.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl.c: Check for NUMA node limit inside numa_add()
Eduardo Habkost [Mon, 4 Feb 2013 18:27:48 +0000 (16:27 -0200)]
vl.c: Check for NUMA node limit inside numa_add()

Instead of checking the limit before calling numa_add(), check the limit
only when we already know we're going to add a new node.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl.c: Abort on unknown -numa option type
Eduardo Habkost [Mon, 4 Feb 2013 18:27:47 +0000 (16:27 -0200)]
vl.c: Abort on unknown -numa option type

Abort in case an invalid -numa option is provided, instead of silently
ignoring it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl.c: Fix off-by-one bug when handling "-numa node" argument
Eduardo Habkost [Mon, 4 Feb 2013 18:27:46 +0000 (16:27 -0200)]
vl.c: Fix off-by-one bug when handling "-numa node" argument

The numa_add() code was unconditionally adding 1 to the get_opt_name()
return value, making it point after the end of the string if no ','
separator is present.

Example of weird behavior caused by the bug:

  $ qemu-img create -f qcow2 this-file-image-has,cpus=5,mem=1000,in-its-name.qcow2 5G
  Formatting 'this-file-image-has,cpus=5,mem=1000,in-its-name.qcow2', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536
  $ ./x86_64-softmmu/qemu-system-x86_64 -S -monitor stdio -numa node 'this-file-image-has,cpus=5,mem=1000,in-its-name.qcow2'
  QEMU 1.3.50 monitor - type 'help' for more information
  (qemu) info numa
  1 nodes
  node 0 cpus: 0
  node 0 size: 1000 MB
  (qemu)

This changes the code to nove the pointer only if ',' is found.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agocutils: unsigned int parsing functions
Eduardo Habkost [Mon, 4 Feb 2013 18:27:45 +0000 (16:27 -0200)]
cutils: unsigned int parsing functions

There are lots of duplicate parsing code using strto*() in QEMU, and
most of that code is broken in one way or another. Even the visitors
code have duplicate integer parsing code[1]. This introduces functions
to help parsing unsigned int values: parse_uint() and parse_uint_full().

Parsing functions for signed ints and floats will be submitted later.

parse_uint_full() has all the checks made by opts_type_uint64() at
opts-visitor.c:

 - Check for NULL (returns -EINVAL)
 - Check for negative numbers (returns -EINVAL)
 - Check for empty string (returns -EINVAL)
 - Check for overflow or other errno values set by strtoll() (returns
   -errno)
 - Check for end of string (reject invalid characters after number)
   (returns -EINVAL)

parse_uint() does everything above except checking for the end of the
string, so callers can continue parsing the remainder of string after
the number.

Unit tests included.

[1] string-input-visitor.c:parse_int() could use the same parsing code
    used by opts-visitor.c:opts_type_int(), instead of duplicating that
    logic.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-cris: Build fix for debug output
Andreas Färber [Sun, 27 Jan 2013 06:26:05 +0000 (07:26 +0100)]
target-cris: Build fix for debug output

Around r3361 (81fdc5f8d2d681da8d255baf0713144f8656bac9) env->debug1 used
to contain the address of an MMU fault. This is now written into
env->pregs[PR_EDA] instead.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agobitops: unify bitops_ffsl with the one in host-utils.h, call it bitops_ctzl
Paolo Bonzini [Fri, 1 Feb 2013 22:03:16 +0000 (23:03 +0100)]
bitops: unify bitops_ffsl with the one in host-utils.h, call it bitops_ctzl

We had two copies of a ffs function for longs with subtly different
semantics and, for the one in bitops.h, a confusing name: the result
was off-by-one compared to the library function ffsl.

Unify the functions into one, and solve the name problem by calling
the 0-based functions "bitops_ctzl" and "bitops_ctol" respectively.

This also fixes the build on platforms with ffsl, including Mac OS X
and Windows.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Andreas Färber <afaerber@suse.de>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoutil: Fix compilation of envlist.c for MinGW
Stefan Weil [Wed, 16 Jan 2013 18:04:27 +0000 (19:04 +0100)]
util: Fix compilation of envlist.c for MinGW

MinGW has no strtok_r, so we need a declaration in sysemu/os-win32.h.
We must also fix the include statements in util/envlist.c to include
that file.

We currently don't need an implementation of strtok_r because the
code is compiled but not linked for MinGW.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoUpdate version for 1.4.0-rc0 v1.4.0-rc0
Anthony Liguori [Fri, 1 Feb 2013 21:10:33 +0000 (15:10 -0600)]
Update version for 1.4.0-rc0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotap: unbreak -netdev tap,fd=X
Anthony Liguori [Sat, 2 Feb 2013 00:02:50 +0000 (18:02 -0600)]
tap: unbreak -netdev tap,fd=X

The multiqueue patch series broke -netdev tap,fd=X which manifests
as libvirt not being able to start a guest.  This was because it
passed NULL for the netdev name which results in an anonymous netdev
device regardless of what the user specified.

Cc: Jason Wang <jasowang@redhat.com>
Cc: Bruce Rogers <brogers@suse.com>
Reported-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqom: remove object_delete
Paolo Bonzini [Fri, 25 Jan 2013 13:12:39 +0000 (14:12 +0100)]
qom: remove object_delete

This is now unused.  Document the initial reference count of an object
and when it will be freed/finalized.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agocpu: do not use object_delete
Paolo Bonzini [Fri, 25 Jan 2013 13:12:38 +0000 (14:12 +0100)]
cpu: do not use object_delete

CPUs are never added to the composition tree, so delete is achieved
simply by removing the last references to them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: drop extra references at creation time
Paolo Bonzini [Fri, 25 Jan 2013 13:12:37 +0000 (14:12 +0100)]
qdev: drop extra references at creation time

qdev_free and qbus_free have to do unparent+unref, because nobody else
drops the initial reference (the one included by object_initialize)
before them.

For device_init_func and do_device_add, this is trivially correct,
since the DeviceState goes out of scope.

For qdev_create, qdev_try_create and qbus_init, it is a bit more tricky.
What we are doing here is just assuming that the caller knows what it's
doing, and won't call qdev_free/qbus_free while the device is still there.
This is a pretty reasonable assumption and (behind the scenes) is also
what GObject/GTK does.  GTK actually has a "floating reference" that
goes away as soon as the caller does gtk_container_add or something
like that, but in the end qbus_init and qdev_try_create are already
adding the new object to its qdev parent!  So in the end the two solutions
are the same.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: inline object_delete into qbus_free/qdev_free
Paolo Bonzini [Fri, 25 Jan 2013 13:12:36 +0000 (14:12 +0100)]
qdev: inline object_delete into qbus_free/qdev_free

We want object_delete to disappear, and we will do this one class at a
time.  Inline it for the qdev case, which we will tackle first.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: add reference for the bus while it is referred to by the DeviceState
Paolo Bonzini [Fri, 25 Jan 2013 13:12:35 +0000 (14:12 +0100)]
qdev: add reference for the bus while it is referred to by the DeviceState

Now that the unparent callbacks are complete, we can correctly account
more missing references.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: move unrealization of devices from finalize to unparent
Paolo Bonzini [Fri, 25 Jan 2013 13:12:34 +0000 (14:12 +0100)]
qdev: move unrealization of devices from finalize to unparent

Similarly, a bus holds a reference back to the device, and this will
prevent the device from going away as soon as this reference is counted
properly.  To avoid this, move the unrealization of devices to the
unparent callback.  This includes recursively unparenting all the buses
and (after the previous patch) the devices on those buses, which ensures
that the web of references completely disappears for all devices that
reside (in the qdev tree) below the one being unplugged.

After this patch, the qdev tree and the bus<->child relationship is
defined as "A is above B, iff unplugging A will automatically unplug B".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: move deletion of children from finalize to unparent
Paolo Bonzini [Fri, 25 Jan 2013 13:12:33 +0000 (14:12 +0100)]
qdev: move deletion of children from finalize to unparent

A device will never be finalized as long as it has a reference from
other devices that sit on its buses.  To ensure that the references
go away, deassociate a bus from its children in the unparent callback
for the bus.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: add reference count to a device for the BusChild
Paolo Bonzini [Fri, 25 Jan 2013 13:12:32 +0000 (14:12 +0100)]
qdev: add reference count to a device for the BusChild

Each device has a reference through the BusChild.  This reference
was not accounted for, add it now.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqom: document reference counting of link properties
Paolo Bonzini [Fri, 25 Jan 2013 13:12:31 +0000 (14:12 +0100)]
qom: document reference counting of link properties

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqom: preserve object while unparenting it
Paolo Bonzini [Fri, 25 Jan 2013 13:12:30 +0000 (14:12 +0100)]
qom: preserve object while unparenting it

Avoid that the object disappears after it's deleted from the QOM
composition tree, in case that was the only reference to it.

Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopci: use qbus_create in pci_bus_new
Paolo Bonzini [Fri, 25 Jan 2013 13:12:29 +0000 (14:12 +0100)]
pci: use qbus_create in pci_bus_new

Remove knowledge of QOM innards.  The common part of pci_bus_new and
pci_bus_new_inplace is moved to a new function pci_bus_init.

Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: change first argument of qbus_create_inplace to void *
Paolo Bonzini [Fri, 25 Jan 2013 13:12:28 +0000 (14:12 +0100)]
qdev: change first argument of qbus_create_inplace to void *

Make it clear that no BUS() macro is needed in the callers (in fact it
wouldn't work because the object has not been initialized yet with the
right class).

Suggested-by: Andreas Faerber <afaerber@suse.de>
Acked-by: Andreas F=E4rber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: remove duplication between qbus_create and qbus_create_inplace
Paolo Bonzini [Fri, 25 Jan 2013 13:12:27 +0000 (14:12 +0100)]
qdev: remove duplication between qbus_create and qbus_create_inplace

Move the common part to qbus_realize.

Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoaccel: change {xen, kvm, tcg, qtest}_allowed from int to bool
liguang [Thu, 24 Jan 2013 05:03:27 +0000 (13:03 +0800)]
accel: change {xen, kvm, tcg, qtest}_allowed from int to bool

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl: correct error message when fail to init kvm
liguang [Thu, 24 Jan 2013 05:03:26 +0000 (13:03 +0800)]
vl: correct error message when fail to init kvm

command:
qemu-system-x86_64 -hda disk.img -smp 32 --enable-kvm
error:
Number of SMP cpus requested (32) exceeds max cpus supported by KVM (16)
failed to initialize KVM: Invalid argument
No accelerator found!

well, it did find kvm, but failed to init,
so message "No accelerator found!" is confusing,
this commit remove the confusing error message.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl: skip init accelerator if it's not available
liguang [Thu, 24 Jan 2013 05:03:25 +0000 (13:03 +0800)]
vl: skip init accelerator if it's not available

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosparc: disable qtest in make check
Anthony Liguori [Tue, 29 Jan 2013 21:42:45 +0000 (15:42 -0600)]
sparc: disable qtest in make check

We've seen this repeatedly in buildbot but I can now reliably
reproduce it myself too.  With a few hundred runs of 'make check',
qemu-system-sparc will hang consuming 100% CPU.  I've attached GDB
to the hung process and unfortunately, I can't get anything useful
out of GDB (RIP is not a valid simple and there is nothing else on
the stack).

At any rate, since this only manifests in qemu-system-sparc and it
doesn't appear to be a qtest specific problem, I think we should
disable it until the problem is resolved.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Fri, 1 Feb 2013 20:40:05 +0000 (14:40 -0600)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Kevin Wolf (7) and others
# Via Stefan Hajnoczi
* stefanha/block:
  block/raw-posix: Build fix for O_ASYNC
  vmdk: Allow space in file name
  parallels: Fix bdrv_open() error handling
  dmg: Use g_free instead of free
  dmg: Fix bdrv_open() error handling
  vpc: Fix bdrv_open() error handling
  cloop: Fix bdrv_open() error handling
  bochs: Fix bdrv_open() error handling
  sheepdog: pass vdi_id to sheep daemon for sd_close()
  vmdk: Allow selecting SCSI adapter in image creation
  block: Adds mirroring tests for resized images
  block: Fix is_allocated_above with resized files
  qemu-iotests: Add regression test for b7ab0fea

11 years agoxen: fix build problem introduced from per-queue peers
Anthony Liguori [Fri, 1 Feb 2013 18:55:56 +0000 (12:55 -0600)]
xen: fix build problem introduced from per-queue peers

Reported-by Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net: compat multiqueue support
Jason Wang [Wed, 30 Jan 2013 11:12:41 +0000 (19:12 +0800)]
virtio-net: compat multiqueue support

Disable multiqueue support for pre 1.4.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net: migration support for multiqueue
Jason Wang [Wed, 30 Jan 2013 11:12:40 +0000 (19:12 +0800)]
virtio-net: migration support for multiqueue

This patch add migration support for multiqueue virtio-net. Instead of bumping
the version, we conditionally send the info of multiqueue only when the device
support more than one queue to maintain the backward compatibility.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net: multiqueue support
Jason Wang [Wed, 30 Jan 2013 11:12:39 +0000 (19:12 +0800)]
virtio-net: multiqueue support

This patch implements both userspace and vhost support for multiple queue
virtio-net (VIRTIO_NET_F_MQ). This is done by introducing an array of
VirtIONetQueue to VirtIONet.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net: separate virtqueue from VirtIONet
Jason Wang [Wed, 30 Jan 2013 11:12:38 +0000 (19:12 +0800)]
virtio-net: separate virtqueue from VirtIONet

To support multiqueue virtio-net, the first step is to separate the virtqueue
related fields from VirtIONet to a new structure VirtIONetQueue. The following
patches will add an array of VirtIONetQueue to VirtIONet based on this patch.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: add a queue_index to VirtQueue
Jason Wang [Wed, 30 Jan 2013 11:12:37 +0000 (19:12 +0800)]
virtio: add a queue_index to VirtQueue

Add a queue_index to VirtQueue and a helper to fetch it, this could be used by
multiqueue supported device.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: introduce virtio_del_queue()
Jason Wang [Wed, 30 Jan 2013 11:12:36 +0000 (19:12 +0800)]
virtio: introduce virtio_del_queue()

Some device (such as virtio-net) needs the ability to destroy or re-order the
virtqueues, this patch adds a helper to do this.

Signed-off-by: Jason Wang <jasowang>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovhost: multiqueue support
Jason Wang [Wed, 30 Jan 2013 11:12:35 +0000 (19:12 +0800)]
vhost: multiqueue support

This patch lets vhost support multiqueue. The idea is simple, just launching
multiple threads of vhost and let each of vhost thread processing a subset of
the virtqueues of the device. After this change each emulated device can have
multiple vhost threads as its backend.

To do this, a virtqueue index were introduced to record to first virtqueue that
will be handled by this vhost_net device. Based on this and nvqs, vhost could
calculate its relative index to setup vhost_net device.

Since we may have many vhost/net devices for a virtio-net device. The setting of
guest notifiers were moved out of the starting/stopping of a specific vhost
thread. The vhost_net_{start|stop}() were renamed to
vhost_net_{start|stop}_one(), and a new vhost_net_{start|stop}() were introduced
to configure the guest notifiers and start/stop all vhost/vhost_net devices.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotap: multiqueue support
Jason Wang [Wed, 30 Jan 2013 11:12:34 +0000 (19:12 +0800)]
tap: multiqueue support

Recently, linux support multiqueue tap which could let userspace call TUNSETIFF
for a signle device many times to create multiple file descriptors as
independent queues. User could also enable/disabe a specific queue through
TUNSETQUEUE.

The patch adds the generic infrastructure to create multiqueue taps. To achieve
this a new parameter "queues" were introduced to specify how many queues were
expected to be created for tap by qemu itself. Alternatively, management could
also pass multiple pre-created tap file descriptors separated with ':' through a
new parameter fds like -netdev tap,id=hn0,fds="X:Y:..:Z". Multiple vhost file
descriptors could also be passed in this way.

Each TAPState were still associated to a tap fd, which mean multiple TAPStates
were created when user needs multiqueue taps. Since each TAPState contains one
NetClientState, with the multiqueue nic support, an N peers of NetClientState
were built up.

A new parameter, mq_required were introduce in tap_open() to create multiqueue
tap fds.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotap: introduce a helper to get the name of an interface
Jason Wang [Wed, 30 Jan 2013 11:12:33 +0000 (19:12 +0800)]
tap: introduce a helper to get the name of an interface

This patch introduces a helper tap_get_ifname() to get the device name of tap
device. This is needed when ifname is unspecified in the command line and qemu
were asked to create tap device by itself. In this situation, the name were
allocated by kernel, so if multiqueue is asked, we need to fetch its name after
creating the first queue.

Only linux has this support since it's the only platform that supports
multiqueue tap.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotap: support enabling or disabling a queue
Jason Wang [Wed, 30 Jan 2013 11:12:32 +0000 (19:12 +0800)]
tap: support enabling or disabling a queue

This patch introduce a new bit - enabled in TAPState which tracks whether a
specific queue/fd is enabled. The tap/fd is enabled during initialization and
could be enabled/disabled by tap_enalbe() and tap_disable() which calls platform
specific helpers to do the real work. Polling of a tap fd can only done when
the tap was enabled.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotap: add Linux multiqueue support
Jason Wang [Wed, 30 Jan 2013 11:12:31 +0000 (19:12 +0800)]
tap: add Linux multiqueue support

This patch add basic multiqueue support for Linux. When multiqueue is needed, we
will first check whether kernel support multiqueue tap before creating more
queues. Two new functions tap_fd_enable() and tap_fd_disable() were introduced
to enable and disable a specific queue. Since the multiqueue is only supported
in Linux, return error on other platforms.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotap: factor out common tap initialization
Jason Wang [Wed, 30 Jan 2013 11:12:30 +0000 (19:12 +0800)]
tap: factor out common tap initialization

This patch factors out the common initialization of tap into a new helper
net_init_tap_one(). This will be used by multiqueue tap patches.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotap: import linux multiqueue constants
Jason Wang [Wed, 30 Jan 2013 11:12:29 +0000 (19:12 +0800)]
tap: import linux multiqueue constants

Import multiqueue constants from if_tun.h from 3.8-rc3. A new ifr flag
IFF_MULTI_QUEUE were introduced to create a multiqueue backend by calling
TUNSETIFF with the this flag and with the same interface name many times.

A new ioctl TUNSETQUEUE were introduced. When doing this ioctl with
IFF_DETACH_QUEUE, the queue were disabled in the linux kernel. When doing this
ioctl with IFF_ATTACH_QUEUE, the queue were enabled in the linux kernel.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: multiqueue support
Jason Wang [Wed, 30 Jan 2013 11:12:28 +0000 (19:12 +0800)]
net: multiqueue support

This patch adds basic multiqueue support for qemu. The idea is simple, an array
of NetClientStates were introduced in NICState, parse_netdev() were extended to
find and match all NetClientStates belongs to the backend and place their
pointers in NICConf. Then qemu_new_nic can setup a N:N mapping between NICStates
that belongs to a nic and NICStates belongs to the netdev. And a queue_index
were introduced in NetClientState to track its index. After this, each peers of
a NICState were abstracted as a queue.

After this change, all NetClientState that belongs to the same backend/nic has
the same id. When use want to change the link status, all NetClientStates that
belongs to the same backend/nic will be also changed. When user want to delete
a device or netdev, all NetClientStates that belongs to the same backend/nic
will be deleted also. Changing or deleting an specific queue is not allowed.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: introduce NetClientState destructor
Jason Wang [Wed, 30 Jan 2013 11:12:27 +0000 (19:12 +0800)]
net: introduce NetClientState destructor

To allow allocating an array of NetClientState and free it once, this patch
introduces destructor of NetClientState. Which could do type specific free,
which could be used by multiqueue to free the array once.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: introduce qemu_net_client_setup()
Jason Wang [Wed, 30 Jan 2013 11:12:26 +0000 (19:12 +0800)]
net: introduce qemu_net_client_setup()

This patch separates the setup of NetClientState from its allocation, this will
allow allocating an arrays of NetClientState and does the initialization one by
one which is what multiqueue needs.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: introduce qemu_find_net_clients_except()
Jason Wang [Wed, 30 Jan 2013 11:12:25 +0000 (19:12 +0800)]
net: introduce qemu_find_net_clients_except()

In multiqueue, all NetClientState that belongs to the same netdev or nic has the
same id. So this patches introduces an helper qemu_find_net_clients_except()
which finds all NetClientState with the same id. This will be used by multiqueue
networking.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: intorduce qemu_del_nic()
Jason Wang [Wed, 30 Jan 2013 11:12:24 +0000 (19:12 +0800)]
net: intorduce qemu_del_nic()

To support multiqueue nic, this patch separate the nic destructor from
qemu_del_net_client() to a new helper qemu_del_nic() since the mapping bettween
NiCState and NetClientState were not 1:1 in multiqueue. The following patches
would refactor this function to support multiqueue nic.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: introduce qemu_get_nic()
Jason Wang [Wed, 30 Jan 2013 11:12:23 +0000 (19:12 +0800)]
net: introduce qemu_get_nic()

To support multiqueue, this patch introduces a helper qemu_get_nic() to get
NICState from a NetClientState. The following patches would refactor this helper
to support multiqueue.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: introduce qemu_get_queue()
Jason Wang [Wed, 30 Jan 2013 11:12:22 +0000 (19:12 +0800)]
net: introduce qemu_get_queue()

To support multiqueue, the patch introduce a helper qemu_get_queue()
which is used to get the NetClientState of a device. The following patches would
refactor this helper to support multiqueue.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: tap: use abort() instead of assert(0)
Jason Wang [Wed, 30 Jan 2013 11:12:21 +0000 (19:12 +0800)]
net: tap: use abort() instead of assert(0)

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agonet: tap: using bool instead of bitfield
Jason Wang [Wed, 30 Jan 2013 11:12:20 +0000 (19:12 +0800)]
net: tap: using bool instead of bitfield

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-ppc: Fix target_ulong vs. hwaddr format mismatches
Andreas Färber [Thu, 31 Jan 2013 13:49:44 +0000 (14:49 +0100)]
target-ppc: Fix target_ulong vs. hwaddr format mismatches

Since HWADDR_PRIx is always the same now, use %016 for TARGET_PPC64 and
%08 for common code. This may slightly change the ppc64 debug output.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agolibqtest: Wait for the right child PID after killing QEMU
Eduardo Habkost [Mon, 28 Jan 2013 18:15:16 +0000 (16:15 -0200)]
libqtest: Wait for the right child PID after killing QEMU

When running "make check" with gcov enabled, we get the following
message:

   hw/tmp105.gcda:cannot open data file, assuming not executed

The problem happens because:

 * tmp105-test exits before QEMU exits, because waitpid() at
   qtest_quit() fails;
 * waitpid() fails because there's another process already
   waiting for the QEMU process;
 * The process that is already waiting for QEMU is the child created by
   qtest_init() to run system();
 * qtest_quit() is incorrectly waiting for the QEMU PID directly instead
   of the child created by qtest_init().

This fixes the problem by sending SIGTERM to QEMU, but waiting for the
child process created by qtest_init() (that exits immediately after QEMU
exits).

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoisa: QOM'ify isa_bus_from_device()
Andreas Färber [Sun, 20 Jan 2013 17:56:18 +0000 (18:56 +0100)]
isa: QOM'ify isa_bus_from_device()

DeviceState::parent_bus is document as private and should be accessed
through qdev_get_parent_bus(). Use a DEVICE() cast instead of accessing
ISADevice's qdev field directly. Use ISA_BUS() in place of DO_UPCAST().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoi2c: Drop I2C_SLAVE_FROM_QDEV() macro
Andreas Färber [Fri, 25 Jan 2013 08:12:54 +0000 (09:12 +0100)]
i2c: Drop I2C_SLAVE_FROM_QDEV() macro

It is not being used in hot paths and is obsoleted by I2C_SLAVE()
QOM cast macro. Clean it up using a scripted conversion, so that it
doesn't get used in new code.

Some of its callers were combining it with FROM_I2C_SLAVE() macro, which
is equally obsolete but needs to be replaced in a type-specific way.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Kuo-Jung Su <dantesu@faraday-tech.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconfigure: Keep -Werror enabled for Release Candidates
Andreas Färber [Sun, 27 Jan 2013 15:16:19 +0000 (16:16 +0100)]
configure: Keep -Werror enabled for Release Candidates

The automatic drop of -Werror during the RC phases has in the past led
to warnings creeping into submaintainer trees.

Last QEMU Summit it was concluded that -Werror should stay on and
enabled only as part of the release process.

To relieve our release manager, instead of always enabling -Werror or
doing some number magic, let's enable it depending on whether a .git/
directory exists in the source tree.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoRevert "e1000: no need auto-negotiation if link was down"
Michael Roth [Thu, 31 Jan 2013 23:43:51 +0000 (17:43 -0600)]
Revert "e1000: no need auto-negotiation if link was down"

This reverts commit 84dd2120247a7d25ff1bb337de21c0e76816ad2d.

I'm not sure what issue the original commit was meant to fix, or if
the logic is actually wrong, but it causes e1000 to stop working
after a guest issues a reset.

>From what I can tell a guest with an e1000 nic has no way of changing
the link status, as far as it's NetClient peer is concerned, except
in the auto-negotiation path, so with this patch in place there's no
recovery after a reset, since the link goes down and stays that way.

Revert this patch now to fix the bigger problem, and handle any
lingering issues with a follow-up.

Reproduced/tested with qemu-jeos and Ubuntu 12.10.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'quintela/migration.next' into staging
Anthony Liguori [Fri, 1 Feb 2013 15:08:14 +0000 (09:08 -0600)]
Merge remote-tracking branch 'quintela/migration.next' into staging

# By Orit Wasserman
# Via Juan Quintela
* quintela/migration.next:
  Fix error message in migrate_set_capability HMP command
  Allow XBZRLE decoding without enabling the capability
  Fix example for query-migrate-capabilities
  Add XBZRLE testing
  Move XBZRLE encoding code to a separate file to allow testing

11 years agoMerge remote-tracking branch 'agraf/s390-for-upstream' into staging
Anthony Liguori [Fri, 1 Feb 2013 15:06:23 +0000 (09:06 -0600)]
Merge remote-tracking branch 'agraf/s390-for-upstream' into staging

# By Andreas Färber
# Via Alexander Graf
* agraf/s390-for-upstream:
  target-s390x: Pass S390CPU to s390_{add, del}_running_cpu()
  target-s390x: Clean up cpu_inject_*() signatures
  target-s390x: Fix debug output
  target-s390x: Fix debug output (continued)

11 years agoMerge remote-tracking branch 'agraf/ppc-for-upstream' into staging
Anthony Liguori [Fri, 1 Feb 2013 15:02:09 +0000 (09:02 -0600)]
Merge remote-tracking branch 'agraf/ppc-for-upstream' into staging

# By Andreas Färber (2) and Alexander Graf (1)
# Via Alexander Graf
* agraf/ppc-for-upstream:
  target-ppc: Fix build for PPC_DEBUG_DISAS
  target-ppc: Fix unused variable warning for FLUSH_ALL_TLBS
  PPC: Unify dcbzl code path

11 years agoblock/raw-posix: Build fix for O_ASYNC
Andreas Färber [Thu, 31 Jan 2013 14:40:14 +0000 (15:40 +0100)]
block/raw-posix: Build fix for O_ASYNC

Commit eeb6b45d48800e96f67ef2a5c80332557fd45ddb (block: raw-posix image
file reopen) broke the build on OpenIndiana.

illumos has no O_ASYNC. Exclude it from flags to be compared
and instead assert that it is not set where defined.

Cf. e61ab1da7e98357da47c54d8f893b9bd6ff2f7f9 for qemu-ga.

Cc: qemu-stable@nongnu.org (1.3.x)
Cc: Jeff Cody <jcody@redhat.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovmdk: Allow space in file name
Philipp Hahn [Tue, 29 Jan 2013 21:50:31 +0000 (22:50 +0100)]
vmdk: Allow space in file name

The previous scanf() format string stopped parsing the file name on the
first white white space, which seems to be allowed at least by VMware
Workstation.

Change the format string to collect everything between the first and
second quote as the file name, disallowing line breaks.

Signed-off-by: Philipp Hahn <hahn@univention.de>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoparallels: Fix bdrv_open() error handling
Kevin Wolf [Fri, 25 Jan 2013 16:07:32 +0000 (17:07 +0100)]
parallels: Fix bdrv_open() error handling

Return -errno instead of -1 on errors. Hey, no memory leak to fix here
while we're touching it!

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agodmg: Use g_free instead of free
Kevin Wolf [Fri, 25 Jan 2013 16:07:31 +0000 (17:07 +0100)]
dmg: Use g_free instead of free

The buffers are allocated with g_(re)alloc, so use g_free to free them.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agodmg: Fix bdrv_open() error handling
Kevin Wolf [Fri, 25 Jan 2013 16:07:30 +0000 (17:07 +0100)]
dmg: Fix bdrv_open() error handling

Return -errno instead of -1 on errors and add error checks in some
places that didn't have one. Passing things by reference requires more
correct typing, replaced a few off_ts therefore - with a 32-bit off_t
this is even a fix for truncation bugs.

While touching the code, fix even some more memory leaks than in the
other drivers...

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovpc: Fix bdrv_open() error handling
Kevin Wolf [Fri, 25 Jan 2013 16:07:29 +0000 (17:07 +0100)]
vpc: Fix bdrv_open() error handling

Return -errno instead of -1 on errors. While touching the
code, fix a memory leak.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agocloop: Fix bdrv_open() error handling
Kevin Wolf [Fri, 25 Jan 2013 16:07:28 +0000 (17:07 +0100)]
cloop: Fix bdrv_open() error handling

Return -errno instead of -1 on errors. While touching the
code, fix a memory leak.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agobochs: Fix bdrv_open() error handling
Kevin Wolf [Fri, 25 Jan 2013 16:07:27 +0000 (17:07 +0100)]
bochs: Fix bdrv_open() error handling

Return -errno instead of -1 on errors. While touching the
code, fix a memory leak.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: pass vdi_id to sheep daemon for sd_close()
Liu Yuan [Tue, 29 Jan 2013 09:14:16 +0000 (17:14 +0800)]
sheepdog: pass vdi_id to sheep daemon for sd_close()

Sheep daemon needs vdi_id to identify which vdi is closed to release resources
such as object cache.

Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovmdk: Allow selecting SCSI adapter in image creation
Othmar Pasteka [Tue, 29 Jan 2013 23:26:52 +0000 (00:26 +0100)]
vmdk: Allow selecting SCSI adapter in image creation

Introduce a new option "adapter_type" when converting to vmdk images.
It can be one of the following: ide (default), buslogic, lsilogic
or legacyESX (according to the vmdk spec from vmware).

In case of a non-ide adapter, heads is set to 255 instead of the 16.
The latter is used for "ide".

Also see LP#545089

Signed-off-by: Othmar Pasteka <pasteka@kabsi.at>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Adds mirroring tests for resized images
Vishvananda Ishaya [Fri, 25 Jan 2013 18:57:20 +0000 (10:57 -0800)]
block: Adds mirroring tests for resized images

This test verifies two mirroring issues are fixed with resized images:

 * sync='top' creates an image that is the proper size
 * sync='full' doesn't cause an assertion failure and crash qemu
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Fix is_allocated_above with resized files
Vishvananda Ishaya [Thu, 24 Jan 2013 18:02:08 +0000 (10:02 -0800)]
block: Fix is_allocated_above with resized files

In an image chain, if the base image is smaller than the current
image, we need to make sure to use the current images count of
unallocated blocks once we get to the end of the base image. Without
this change the code will return 0 blocks when it gets to the end
of the base image and mirror_run will fail its assertion.

Signed-off-by: Vishvananda Ishaya <vishvananda@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-iotests: Add regression test for b7ab0fea
Kevin Wolf [Wed, 23 Jan 2013 15:52:49 +0000 (16:52 +0100)]
qemu-iotests: Add regression test for b7ab0fea

It turned out that the change in b7ab0fea was actually a real qcow2
corruption fix. This is a reproducer for the bug.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoFix error message in migrate_set_capability HMP command
Orit Wasserman [Thu, 31 Jan 2013 07:12:19 +0000 (09:12 +0200)]
Fix error message in migrate_set_capability HMP command

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoAllow XBZRLE decoding without enabling the capability
Orit Wasserman [Thu, 31 Jan 2013 07:12:18 +0000 (09:12 +0200)]
Allow XBZRLE decoding without enabling the capability

Before this fix we couldn't load a guest from
XBZRLE compressed file.

For example:
The user activated the XBZRLE capability
The user run migrate -d "exec:gzip -c > vm.gz"
The user won't be able to load vm.gz and get an error.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoFix example for query-migrate-capabilities
Orit Wasserman [Thu, 31 Jan 2013 07:12:17 +0000 (09:12 +0200)]
Fix example for query-migrate-capabilities

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoAdd XBZRLE testing
Orit Wasserman [Thu, 31 Jan 2013 07:12:16 +0000 (09:12 +0200)]
Add XBZRLE testing

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoMove XBZRLE encoding code to a separate file to allow testing
Orit Wasserman [Thu, 31 Jan 2013 07:12:15 +0000 (09:12 +0200)]
Move XBZRLE encoding code to a separate file to allow testing

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Fri, 1 Feb 2013 01:37:33 +0000 (19:37 -0600)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

# By Andreas Färber
# Via Andreas Färber
* afaerber/qom-cpu:
  linux-user: bsd-user: Don't reset X86CPU twice
  target-i386: Pass X86CPU to cpu_x86_set_a20()
  target-unicore32: Rename CPU subtypes
  target-openrisc: Rename CPU subtypes
  target-openrisc: TYPE_OPENRISC_CPU should be abstract
  target-m68k: Rename CPU subtypes
  target-m68k: Mark as unmigratable
  target-s390x: Mark as unmigratable
  target-sh4: Mark as unmigratable
  target-xtensa: Mark as unmigratable
  target-microblaze: Mark as unmigratable
  target-unicore32: Mark as unmigratable
  ide/mmio: QOM'ify MMIO IDE for R2D

11 years agoMerge remote-tracking branch 'afaerber-or/cocoa-for-upstream' into staging
Anthony Liguori [Fri, 1 Feb 2013 01:37:23 +0000 (19:37 -0600)]
Merge remote-tracking branch 'afaerber-or/cocoa-for-upstream' into staging

# By Henry Harrington (1) and Stefan Weil (1)
# Via Andreas Färber
* afaerber-or/cocoa-for-upstream:
  cocoa: Replace non-portable asprintf() by g_strdup_printf()
  cocoa: Fix VBE function Set Display Start

11 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Fri, 1 Feb 2013 01:35:24 +0000 (19:35 -0600)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

virtio,make,pci,e1000,vfio,piix

This includes my timestamp generation cleanup,
Amos's and my work on virtio net commands,
pci,e1000,vfio and piix fixes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Thu 31 Jan 2013 06:20:27 AM CST using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Michael S. Tsirkin (6) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  vfio-pci: Enable PCIe extended config space
  PIIX3: reset the VM when the Reset Control Register's RCPU bit gets set
  ich9: add support for pci assignment
  virtio-net: rename ctrl rx commands
  virtio-net: introduce a new macaddr control
  virtio-net: remove layout assumptions for ctrl vq
  virtio-net: revert mac on reset
  rules/mak: make clean should blow away timestamp files
  Makefile: clean timestamp generation rule
  rules.mak: cleanup config generation rules
  e1000: document ICS read behaviour

11 years agotarget-s390x: Pass S390CPU to s390_{add, del}_running_cpu()
Andreas Färber [Wed, 30 Jan 2013 12:48:25 +0000 (12:48 +0000)]
target-s390x: Pass S390CPU to s390_{add, del}_running_cpu()

This prepares for moving the halted field to CPUState.
Most call sites can already supply S390CPU, for some env becomes unused.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-s390x: Clean up cpu_inject_*() signatures
Andreas Färber [Wed, 30 Jan 2013 12:48:24 +0000 (12:48 +0000)]
target-s390x: Clean up cpu_inject_*() signatures

Despite cautioning that S390CPU is needed for upcoming CPUState
refactorings, commit 5d69c547d947798cba92d836d06f6e017ba2b19d (s390:
I/O interrupt and machine check injection.) added functions
cpu_inject_io() and cpu_inject_crw_mchk() with CPUS390XState argument,
claiming consistency with cpu_inject_ext().

This complicates making cpu_interrupt() take a CPUState even more and it
required to pass &cpu->env from some S390CPU-aware call sites already,
creating inconsistency elsewhere. Address that.

This also eliminates the need for CPUS390XState in s390_virtio_irq().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-s390x: Fix debug output
Andreas Färber [Sun, 27 Jan 2013 03:32:03 +0000 (03:32 +0000)]
target-s390x: Fix debug output

Commit 71e470886fb6092504503a5fe41092ace71c096c (target-s390x: fix
style) renamed the cpu_s390x_handle_mmu_fault() argument from _vaddr to
orig_vaddr. Update the debug output code.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-s390x: Fix debug output (continued)
Andreas Färber [Sun, 27 Jan 2013 03:32:04 +0000 (03:32 +0000)]
target-s390x: Fix debug output (continued)

Since its introduction in d5a439645a5a70fed5431318c3bce9dc2caa950f
(s390x: helper functions for system emulation) the variable name was
raddr. Fix this.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Fix build for PPC_DEBUG_DISAS
Andreas Färber [Sun, 27 Jan 2013 03:32:02 +0000 (03:32 +0000)]
target-ppc: Fix build for PPC_DEBUG_DISAS

In r5949 / 76db3ba44ee8db671f804755f13b016eefd13288 (target-ppc: memory
load/store rework) variable little_endian was replaced with ctx.le_mode.
Update the debug code.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Fix unused variable warning for FLUSH_ALL_TLBS
Andreas Färber [Sun, 27 Jan 2013 03:32:01 +0000 (03:32 +0000)]
target-ppc: Fix unused variable warning for FLUSH_ALL_TLBS

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>