]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
10 years agoUpdate VERSION for 1.6.2 release stable-1.6 v1.6.2
Michael Roth [Tue, 10 Dec 2013 00:19:25 +0000 (18:19 -0600)] 
Update VERSION for 1.6.2 release

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoscsi_target_send_command(): amend stable-1.6 port of the CVE-2013-4344 fix
Laszlo Ersek [Sat, 2 Nov 2013 19:14:21 +0000 (20:14 +0100)] 
scsi_target_send_command(): amend stable-1.6 port of the CVE-2013-4344 fix

The originally suggested fix for CVE-2013-4344 introduced a regression in
scsi_target_send_command() / REQUEST_SENSE; the third argument passed to
scsi_device_get_sense() -- for the "len" parameter -- ignored the
possibility of the guest SCSI driver requesting truncated (or shorter than
full) sense data.

This could result in (r->len > req->cmd.xfer) on return, which is not
valid SCSI.

The problem was addressed in the second round, and the commit on the
master branch (84642435) is correct. However the stable-1.6 branch (the
v1.6.1 release) has the original, regressive fix (commit fdcbe7d5); let's
update it.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu-ga: execute fsfreeze-freeze in reverse order of mounts
Tomoki Sekiyama [Tue, 1 Oct 2013 21:09:53 +0000 (17:09 -0400)] 
qemu-ga: execute fsfreeze-freeze in reverse order of mounts

Currently, fsfreeze-freeze may cause deadlock if a guest has loopback mounts
of image files in its disk; e.g.:

    # mount | grep ^/
    /dev/vda1 / type ext4 (rw,noatime,seclabel,data=ordered)
    /tmp/disk.img on /mnt type ext4 (rw,relatime,seclabel)

To avoid the deadlock, this freezes filesystems in reverse order of mounts.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
*fix up commit msg
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit e5d9adbdab972a2172815c1174aed3fabcc448f1)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-mips: fix 64-bit FPU config for user-mode emulation
Petar Jovanovic [Fri, 29 Nov 2013 16:27:42 +0000 (17:27 +0100)] 
target-mips: fix 64-bit FPU config for user-mode emulation

FR bit should be initialized to 1 for MIPS64, under condition that this
bit is writable and that CPU has an FPU unit. It should be initialized to
zero for MIPS32.
This fixes different MIPS32 issues with FPU instructions whose behaviour
defaulted to 64-bit FPU mode.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 4d66261f71f2efa31e1052e4041c5ee505572fe5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoseccomp: add kill() to the syscall whitelist
Paul Moore [Thu, 21 Nov 2013 15:40:15 +0000 (10:40 -0500)] 
seccomp: add kill() to the syscall whitelist

The kill() syscall is triggered with the following command:

 # qemu -sandbox on -monitor stdio \
        -device intel-hda -device hda-duplex -vnc :0

The resulting syslog/audit message:

 # ausearch -m SECCOMP
 ----
 time->Wed Nov 20 09:52:08 2013
 type=SECCOMP msg=audit(1384912328.482:6656): auid=0 uid=0 gid=0 ses=854
  subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12087
  comm="qemu-kvm" sig=31 syscall=62 compat=0 ip=0x7f7a1d2abc67 code=0x0
 # scmp_sys_resolver 62
 kill

Reported-by: CongLi <coli@redhat.com>
Tested-by: CongLi <coli@redhat.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Acked-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
(cherry picked from commit e9eecb5bf82a71564bf018fcbbfc6cda19cab6c2)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovmdk: Fix creating big description file
Fam Zheng [Tue, 3 Dec 2013 02:41:05 +0000 (10:41 +0800)] 
vmdk: Fix creating big description file

The buffer for description file was 4096 which only covers a few
hundred of extents. This changes the buffer to dynamic allocated with
g_strdup_printf in order to support bigger cases.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit af057fe74092df2e7a576448ddbdc0daac1370bf)

Conflicts:

block/vmdk.c
tests/qemu-iotests/059
tests/qemu-iotests/059.out

*removed dependencies on 4823970b and 4f6fd349

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqcow2: Zero-initialise first cluster for new images
Kevin Wolf [Wed, 4 Dec 2013 10:06:36 +0000 (11:06 +0100)] 
qcow2: Zero-initialise first cluster for new images

Strictly speaking, this is only required for has_zero_init() == false,
but it's easy enough to just do a cluster-aligned write that is padded
with zeros after the header.

This fixes that after 'qemu-img create' header extensions are attempted
to be parsed that are really just random leftover data.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit f8413b3c23b08a547ce18609acc6fae5fd04ed5c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovfio-pci: Release all MSI-X vectors when disabled
Alex Williamson [Fri, 6 Dec 2013 18:16:40 +0000 (11:16 -0700)] 
vfio-pci: Release all MSI-X vectors when disabled

We were relying on msix_unset_vector_notifiers() to release all the
vectors when we disable MSI-X, but this only happens when MSI-X is
still enabled on the device.  Perform further cleanup by releasing
any remaining vectors listed as in-use after this call.  This caused
a leak of IRQ routes on hotplug depending on how the guest OS prepared
the device for removal.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-stable@nongnu.org
(cherry picked from commit 3e40ba0faf0822fa78336fe6cd9d677ea9b14f1b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agorng-egd: offset the point when repeatedly read from the buffer
Amos Kong [Thu, 21 Nov 2013 08:42:51 +0000 (16:42 +0800)] 
rng-egd: offset the point when repeatedly read from the buffer

The buffer content might be read out more than once, currently
we just repeatedly read the first data block, buffer offset is
missing.

Cc: qemu-stable@nongnu.org
Signed-off-by: Amos Kong <akong@redhat.com>
Message-id: 1385023371-8198-3-git-send-email-akong@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
(cherry picked from commit 1eb1bd9eafa890f1f4d16ef5cb8b9239a86874d9)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopci: unregister vmstate_pcibus on unplug
Bandan Das [Wed, 6 Nov 2013 22:52:17 +0000 (17:52 -0500)] 
pci: unregister vmstate_pcibus on unplug

PCIBus registers a vmstate during init. Unregister it upon
removal/unplug.

Signed-off-by: Bandan Das <bsd@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 5c397242d5d53c1adecce31817bb439383cf8228)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqdev-monitor: Unref device when device_add fails
Stefan Hajnoczi [Tue, 10 Sep 2013 16:21:08 +0000 (18:21 +0200)] 
qdev-monitor: Unref device when device_add fails

qdev_device_add() leaks the created device upon failure.  I suspect this
problem crept in because qdev_free() unparents the device but does not
drop a reference - confusing name.

Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit ee6abeb6ec08473713848ce9028110f1684853b7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqdev-monitor: Fix crash when device_add is called with abstract driver
Igor Mammedov [Tue, 17 Sep 2013 13:32:32 +0000 (15:32 +0200)] 
qdev-monitor: Fix crash when device_add is called with abstract driver

User is able to crash running QEMU when following monitor
command is called:

 device_add intel-hda-generic

Crash is caused by assertion in object_initialize_with_type()
when type is abstract.

Checking if type is abstract before instance is created in
qdev_device_add() allows to prevent crash on incorrect user input.

Cc: qemu-stable@nongnu.org
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 2fa4e56d88aa0039062bbc7f9a88e9f90c77ed94)

Conflicts:

qdev-monitor.c

*updated to reflect different 1.6 variable names

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqom: Fix memory leak in object_property_set_link()
Vlad Yasevich [Fri, 15 Nov 2013 17:09:47 +0000 (12:09 -0500)] 
qom: Fix memory leak in object_property_set_link()

Save the result of the call to object_get_canonical_path()
so we can free it.

Cc: qemu-stable@nongnu.org
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 2d3aa28cc2cf382aa04cd577e0be542175eea9bd)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio-net: fix the memory leak in rxfilter_notify()
Amos Kong [Mon, 18 Nov 2013 15:32:17 +0000 (23:32 +0800)] 
virtio-net: fix the memory leak in rxfilter_notify()

object_get_canonical_path() returns a gchar*, it should be freed by the
caller.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Vlad Yasevich <vyasevic@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 96e35046e4a97df5b4e1e24e217eb1e1701c7c71)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovfio-pci: Fix multifunction=on
Alex Williamson [Tue, 12 Nov 2013 18:53:24 +0000 (11:53 -0700)] 
vfio-pci: Fix multifunction=on

When an assigned device is initialized it copies the device config
space into the emulated config space.  Unfortunately multifunction is
setup prior to the device initfn and gets clobbered.  We need to
restore it just like pci-assign does.

Cc: qemu-stable@nongnu.org
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 8d07d6c46597a885eb38d99cc6fff399ce69cd21)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqcow2: fix possible corruption when reading multiple clusters
Peter Lieven [Tue, 12 Nov 2013 12:48:07 +0000 (13:48 +0100)] 
qcow2: fix possible corruption when reading multiple clusters

if multiple sectors spanning multiple clusters are read the
function count_contiguous_clusters should ensure that the
cluster type should not change between the clusters.

Especially the for-loop should break when we have one
or more normal clusters followed by a compressed cluster.

Unfortunately the wrong macro was used in the mask to
compare the flags.

This was discovered while debugging a data corruption
issue when converting a compressed qcow2 image to raw.
qemu-img reads 2MB chunks which span multiple clusters.

CC: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 78a52ad5acca7053b774fcc80290e7b7e224c80a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqcow2: count_contiguous_clusters and compression
Max Reitz [Fri, 27 Sep 2013 10:14:15 +0000 (12:14 +0200)] 
qcow2: count_contiguous_clusters and compression

The function is not intended to be used on compressed clusters and will
not work correctly, if used anyway, since L2E_OFFSET_MASK is not the
right mask for determining the offset of compressed clusters. Therefore,
assert that the first cluster is not compressed and always include the
compression flag in the mask of significant flags, i.e., stop the search
as soon as a compressed cluster occurs.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 15684a474286cc2c6106c756ddd095a21d058970)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoFix pc migration from qemu <= 1.5
Cole Robinson [Tue, 5 Nov 2013 23:46:27 +0000 (18:46 -0500)] 
Fix pc migration from qemu <= 1.5

The following commit introduced a migration incompatibility:

commit 568f0690fd9aa4d39d84b04c1a5dbb53a915c3fe
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Thu Jun 6 18:48:49 2013 +1000

    pci: Replace pci_find_domain() with more general pci_root_bus_path()

The issue is that i440fx savevm idstr went from 0000:00:00.0/I440FX to
0000:00.0/I440FX. Unfortunately we are stuck with the breakage for
1.6 machine types.

Add a compat property to maintain the busted idstr for the 1.6 machine
types, but revert to the old style format for 1.7+, and <= 1.5.

Tested with migration from qemu 1.5, qemu 1.6, and qemu.git.

Cc: qemu-stable@nongnu.org
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 04c7d8b8dea724f1007f0f6e76047ff03b4cb24f)

Conflicts:

include/hw/i386/pc.h

*removed 1.6 compat properties
*enabled short_root_bus by default to enable for 1.6 (no 1.6 compat
 fields to do so in 1.6.x)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoexec: fix breakpoint_invalidate when pc may not be translated
Max Filippov [Fri, 27 Sep 2013 18:29:17 +0000 (22:29 +0400)] 
exec: fix breakpoint_invalidate when pc may not be translated

This fixes qemu abort with the following message:

    include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.

which happens due to attempt to invalidate breakpoint by virtual address
for which get_phys_page_debug couldn't find mapping.

For more details see
http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04582.html

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit e8262a1b5b7cfbcbc80c46e4ce6ff7c517b7b2f6)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio-net: only delete bh that existed
Jason Wang [Wed, 6 Nov 2013 08:58:08 +0000 (16:58 +0800)] 
virtio-net: only delete bh that existed

We delete without check whether it existed during exit. This will lead NULL
pointer deference since it was created conditionally depends on guest driver
status and features. So add a check of existence before trying to delete it.

Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1383728288-28469-1-git-send-email-jasowang@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
(cherry picked from commit fe2dafa02de4f80ab36f6e0f4ddfcd6418c03c49)

Conflicts:

hw/net/virtio-net.c

*modified to reflect timer function names for 1.6

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agolinux-user: Fix stat64 syscall for SPARC64
Stefan Weil [Wed, 30 Oct 2013 21:52:24 +0000 (22:52 +0100)] 
linux-user: Fix stat64 syscall for SPARC64

Some targets use a stat64 structure for the stat64 syscall while others
use a stat structure. SPARC64 used the wrong kind.

Instead of extending the conditional compilation in syscall.c, now a
macro TARGET_HAS_STRUCT_STAT64 is defined whenever a target has a
target_stat64.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Erik de Castro Lopo <erikd@mega-nerd.com>
(cherry picked from commit 20d155bc902f41c5b354937e730ad85b43614ae9)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoconfigure: Explicitly set ARFLAGS so we can build with GNU Make 4.0
Peter Maydell [Mon, 21 Oct 2013 20:03:06 +0000 (21:03 +0100)] 
configure: Explicitly set ARFLAGS so we can build with GNU Make 4.0

Our rules.mak adds '-rR' to MAKEFLAGS to indicate that we will be
explicitly specifying everything and not relying on any default
variables or rules. However we were accidentally relying on the
default ARFLAGS ("rv"). This went unnoticed because of a bug in
GNU Make 3.82 and earlier which meant that adding -rR to MAKEFLAGS
only affected submakes, not the currently running instance.
Explicitly set ARFLAGS in config-host.mak, in the same way we
handle CFLAGS and LDFLAGS; this will allow us to work with
Make 4.0.

Thanks to Paul Smith for analyzing this bug for us.

Cc: qemu-stable@nongnu.org
Reported-by: Ken Moffat <zarniwhoop@ntlworld.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 45d285abd7028ac72418c1a22f9298bb898fbfb8)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotests: fix memleak in error path test for input visitor
Wenchao Xia [Tue, 5 Nov 2013 18:35:51 +0000 (02:35 +0800)] 
tests: fix memleak in error path test for input visitor

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1383676551-18806-3-git-send-email-xiawenc@linux.vnet.ibm.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
(cherry picked from commit 8aa15b6e527f234e491a6d354bed4d10da3a01a7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqapi: fix memleak by adding implict struct functions in dealloc visitor
Wenchao Xia [Tue, 5 Nov 2013 18:35:50 +0000 (02:35 +0800)] 
qapi: fix memleak by adding implict struct functions in dealloc visitor

Otherwise member "base" is leaked in a qapi_free_STRUCTURE() call.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1383676551-18806-2-git-send-email-xiawenc@linux.vnet.ibm.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
(cherry picked from commit 3dce9cad5a6c0b0dbe0830973b270c9466c8ab4b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoconfigure: detect endian via compile test
Mike Frysinger [Mon, 1 Jul 2013 03:30:18 +0000 (23:30 -0400)] 
configure: detect endian via compile test

This avoids needing to execute a program and keeping an (incomplete)
list when cross-compiling.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: James Hogan <james.hogan@imgtec.com> [mips]
Message-id: 1372649418-4987-1-git-send-email-vapier@gentoo.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
(cherry picked from commit 61cc919f73ea7ca134c0ac41b748981ad63a253b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoAdjust qapi-visit for python-2.4.3
Richard Henderson [Thu, 31 Oct 2013 20:26:01 +0000 (13:26 -0700)] 
Adjust qapi-visit for python-2.4.3

We say we support python 2.4, but python 2.4.3 does not
support the "expr if test else expr" syntax used here.

This allows QEMU to compile on RHEL 5.3, the last release for ia64.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit 7b75d9d61bf9b7b43f6df2fb2fbfc38c4eb9d2e9)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.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>
(cherry picked from commit a66670c79c5c7d530d818430ffcdaa25cbf2c2ab)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agomonitor: eliminate monitor_event_state_lock
Paolo Bonzini [Wed, 16 Oct 2013 17:17:08 +0000 (19:17 +0200)] 
monitor: eliminate monitor_event_state_lock

This lock does not protect anything that the BQL does not already
protect.  Furthermore, with -nodefaults and no monitor, the mutex
is not initialized but monitor_protocol_event_queue is called
anyway, which causes a crash under mingw (and only works by luck.
under Linux or other POSIX OSes).

Reported-by: Orx Goshen <orx.goshen@intel.com>
Cc: Daniel Berrange <berrange@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit c20b7fa4b2fedd979bcb0cc974bb5d08a10e3448)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoaudio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* second
Hans de Goede [Wed, 9 Oct 2013 19:33:44 +0000 (21:33 +0200)] 
audio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* second

Now that we no longer have MIN_REARM_TIMER_NS a bug in the audio subsys has
clearly shown it self by trying to make a timer fire every nano second.

Note we have a similar problem in 1.6, 1.5 and older but there
MIN_REARM_TIMER_NS limits the wakeups caused by audio being active to
4000 times / second. This still causes a host cpu load of 50 % for simply
playing audio, where as with this patch git master is at 13%, so we should
backport this to 1.5 and 1.6 too.

Note this will not apply to 1.5 and 1.6 as is.

Cc: qemu-stable@nongnu.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit b4350deed67b95651896ddb60cf9f765093a4848)

Conflicts:

audio/audio.c

*fixed to reflect 1.6 timer function/clock names

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.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>
(cherry picked from commit 899f1ae219d5eaa96a53c996026cb0178d62a86d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoxen_disk: mark ioreq as mapped before unmapping in error case
Matthew Daley [Thu, 10 Oct 2013 14:10:48 +0000 (14:10 +0000)] 
xen_disk: mark ioreq as mapped before unmapping in error case

Commit 4472beae modified the semantics of ioreq_{un,}map so that they are
idempotent if called when they're not needed (ie., twice in a row). However,
it neglected to handle the case where batch mapping is not being used (the
default), and one of the grants fails to map. In this case, ioreq_unmap will
be called to unwind and unmap any mappings already performed, but ioreq_unmap
simply returns due to the aforementioned change (the ioreq has not already
been marked as mapped).

The frontend user can therefore force xen_disk to leak grant mappings, a
per-domain limited resource.

Fix by marking the ioreq as mapped before calling ioreq_unmap in this
situation.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
(cherry picked from commit a76f48e53382e6f039db6278443e3ce437653302)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu-char: Fix potential out of bounds access to local arrays
Stefan Weil [Mon, 30 Sep 2013 21:04:49 +0000 (23:04 +0200)] 
qemu-char: Fix potential out of bounds access to local arrays

Latest gcc-4.8 supports a new option -fsanitize=address which activates
an AddressSanitizer. This AddressSanitizer stops the QEMU system emulation
very early because two character arrays of size 8 are potentially written
with 9 bytes.

Commit 6ea314d91439741e95772dfbab98b4135e04bebb added the code.

There is no obvious reason why width or height could need 8 characters,
so reduce it to 7 characters which together with the terminating '\0'
fit into the arrays.

Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Alex Bennée <alex@bennee.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 49aa4058ac6dd0081aaa45776f07c98df397ca5e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agomisc: Use new rotate functions
Stefan Weil [Thu, 12 Sep 2013 19:13:13 +0000 (21:13 +0200)] 
misc: Use new rotate functions

Signed-off-by: Stefan Weil <sw@weilnetz.de>
(cherry picked from commit 3df2b8fde949be86d8a78923c992fdd698d4ea4c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agobitops: Add rotate functions (rol8, ror8, ...)
Stefan Weil [Thu, 12 Sep 2013 19:13:12 +0000 (21:13 +0200)] 
bitops: Add rotate functions (rol8, ror8, ...)

These functions were copies from include/linux/bitopts.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
(cherry picked from commit 6aa25b4a7bb10c48c3054f268d5be98e42ea42c0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotci: Add implementation of rotl_i64, rotr_i64
Stefan Weil [Thu, 12 Sep 2013 19:13:11 +0000 (21:13 +0200)] 
tci: Add implementation of rotl_i64, rotr_i64

It is used by qemu-ppc64 when running Debian's busybox-static.

Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
(cherry picked from commit d285bf784b6234e994ce73c05c82c9fb6429df00)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotests: Update .gitignore for test-int128 and test-bitops
Markus Armbruster [Tue, 24 Sep 2013 07:43:40 +0000 (09:43 +0200)] 
tests: Update .gitignore for test-int128 and test-bitops

Forgotten in commit 6046c62 and 3464700.

Cc: qemu-stable@nongnu.org
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 9dbb52e862458935c250bac9e71d5a87da4e33e9)

Conflicts:

tests/.gitignore

*removed post-1.6 additions from diff

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotests: Fix schema parser test for in-tree build
Markus Armbruster [Tue, 24 Sep 2013 07:43:39 +0000 (09:43 +0200)] 
tests: Fix schema parser test for in-tree build

Commit 4f193e3 added the test, but screwed up in-tree builds
(SRCDIR=.): the tests's output overwrites the expected output, and is
thus compared to itself.

Cc: qemu-stable@nongnu.org
Reported-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit d8039e58b1ecfdc9af171502c83e3949f6dafb95)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agochar: remove watch callback on chardev detach from frontend
Amit Shah [Wed, 28 Aug 2013 09:54:05 +0000 (15:24 +0530)] 
char: remove watch callback on chardev detach from frontend

If a frontend device releases the chardev (via unplug), the chr handlers
are set to NULL via qdev's exit callbacks invoking
qemu_chr_add_handlers().  If the chardev had a pending operation, a
callback will be invoked, which will try to access data in the
just-released frontend, causing a segfault.

Ensure the callbacks are disabled when frontends release chardevs.

This was seen when a virtio-serial port was unplugged when heavy
guest->host IO was in progress (causing a callback to be registered).
In the window in which the throttling was active, unplugging ports
caused a qemu segfault.

https://bugzilla.redhat.com/show_bug.cgi?id=985205

CC: <qemu-stable@nongnu.org>
Reported-by: Sibiao Luo <sluo@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
(cherry picked from commit 386a5a1e0057e220f79c48fe3689e3dfb17f1b09)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agochar: use common function to disable callbacks on chardev close
Amit Shah [Wed, 28 Aug 2013 09:53:37 +0000 (15:23 +0530)] 
char: use common function to disable callbacks on chardev close

This deduplicates code used a lot of times.

CC: <qemu-stable@nongnu.org>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
(cherry picked from commit 26da70c72524eb22c946ab19ec98a217b8252f7e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agochar: move backends' io watch tag to CharDriverState
Amit Shah [Wed, 28 Aug 2013 09:48:29 +0000 (15:18 +0530)] 
char: move backends' io watch tag to CharDriverState

All the backends implement an io watcher tag for callbacks.  Move it to
CharDriverState from each backend's struct to make accessing the tag from
backend-neutral functions easier.

This will be used later to cancel a callback on chardev detach from a
frontend.

CC: <qemu-stable@nongnu.org>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
(cherry picked from commit 7ba9addc165b37b764baa08c02518b15b2361707)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoUpdate VERSION for 1.6.1 release v1.6.1
Michael Roth [Fri, 4 Oct 2013 15:21:43 +0000 (10:21 -0500)] 
Update VERSION for 1.6.1 release

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoscsi: Allocate SCSITargetReq r->buf dynamically
Asias He [Fri, 13 Sep 2013 06:56:55 +0000 (14:56 +0800)] 
scsi: Allocate SCSITargetReq r->buf dynamically

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1007330
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6282465

This is the backport of the following commit. The patch is not
sent public since it is a embargoed bug.

   r->buf is hardcoded to 2056 which is (256 + 1) * 8, allowing 256 luns at
   most. If more than 256 luns are specified by user, we have buffer
   overflow in scsi_target_emulate_report_luns.

   To fix, we allocate the buffer dynamically.

Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
*s/&r->buf/r->buf/ due to type change

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu: Add qemu xen logic for Xen HVM S3 resume
Liu, Jinsong [Wed, 25 Sep 2013 16:40:23 +0000 (16:40 +0000)] 
qemu: Add qemu xen logic for Xen HVM S3 resume

This patch is qemu patch 2 to fix Xen HVM S3 bug, adding qemu
xen logic. When qemu wakeup, qemu xen logic is notified and
hypercall to xen hypervisor to unpause domain.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
(cherry picked from commit 11addd0ab9371af2b6ec028c7fe4e4c4992252fc)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu: Adjust qemu wakeup
Liu, Jinsong [Wed, 25 Sep 2013 16:38:29 +0000 (16:38 +0000)] 
qemu: Adjust qemu wakeup

Currently Xen hvm s3 has a bug coming from the difference between
qemu-traditioanl and qemu-xen. For qemu-traditional, the way to
resume from hvm s3 is via 'xl trigger' command. However, for
qemu-xen, the way to resume from hvm s3 inherited from standard
qemu, i.e. via QMP, and it doesn't work under Xen.

The root cause is, for qemu-xen, 'xl trigger' command didn't reset
devices, while QMP didn't unpause hvm domain though they did qemu
system reset.

We have two qemu patches and one xl patch to fix Xen hvm s3 bug.
This patch is the qemu patch 1. It adjusts qemu wakeup so that
Xen s3 resume logic (which will be implemented at qemu patch 2)
will be notified after qemu system reset.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
(cherry picked from commit 4bc78a877252d772b983810a7d2c0be00e9be70e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agocoroutine: add ./configure --disable-coroutine-pool
Stefan Hajnoczi [Wed, 11 Sep 2013 14:42:35 +0000 (16:42 +0200)] 
coroutine: add ./configure --disable-coroutine-pool

The 'gthread' coroutine backend was written before the freelist (aka
pool) existed in qemu-coroutine.c.

This means that every thread is expected to exit when its coroutine
terminates.  It is not possible to reuse threads from a pool.

This patch automatically disables the pool when 'gthread' is used.  This
allows the 'gthread' backend to work again (for example,
tests/test-coroutine completes successfully instead of hanging).

I considered implementing thread reuse but I don't want quirks like CPU
affinity differences due to coroutine threads being recycled.  The
'gthread' backend is a reference backend and it's therefore okay to skip
the pool optimization.

Note this patch also makes it easy to toggle the pool for benchmarking
purposes:

  ./configure --with-coroutine-backend=ucontext \
              --disable-coroutine-pool

Reported-by: Gabriel Kerneis <gabriel@kerneis.info>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Gabriel Kerneis <gabriel@kerneis.info>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 70c60c089fdc6bf8a79324e492c13e8c08d55942)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopiix4: disable io on reset
Michael S. Tsirkin [Wed, 11 Sep 2013 10:33:31 +0000 (13:33 +0300)] 
piix4: disable io on reset

io base register at 0x40 is cleared on reset,
but io is not disabled until some other event
happens to call pm_io_space_update.

Invoke pm_io_space_update directly to make this
consistent.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit c046e8c4a26c902ca1b4f5bdf668a2da6bc75f54)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovmdk: fix cluster size check for flat extents
Fam Zheng [Mon, 23 Sep 2013 09:18:29 +0000 (17:18 +0800)] 
vmdk: fix cluster size check for flat extents

We use the extent size as cluster size for flat extents (where no L1/L2
table is allocated so it's safe) reuse sector calculating code with
sparse extents.

Don't pass in the cluster size for adding flat extent, just set it to
sectors later, then the cluster size checking will not fail.

The cluster_sectors is changed to int64_t to allow big flat extent.

Without this, flat extent opening is broken:

    # qemu-img create -f vmdk -o subformat=monolithicFlat /tmp/a.vmdk 100G
    Formatting '/tmp/a.vmdk', fmt=vmdk size=107374182400 compat6=off subformat='monolithicFlat' zeroed_grain=off
    # qemu-img info /tmp/a.vmdk
    image: /tmp/a.vmdk
    file format: raw
    virtual size: 0 (0 bytes)
    disk size: 4.0K

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 301c7d38a0c359b91526391d13617386f3d9bb29)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agorbd: avoid qemu_rbd_snap_list() memory leaks
Stefan Hajnoczi [Wed, 25 Sep 2013 14:00:48 +0000 (16:00 +0200)] 
rbd: avoid qemu_rbd_snap_list() memory leaks

When there are no snapshots qemu_rbd_snap_list() returns 0 and the
snapshot table pointer is NULL.  Don't forget to free the snaps buffer
we allocated for librbd rbd_snap_list().

When the function succeeds don't forget to free the snaps buffer after
calling rbd_snap_list_end().

Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 9e6337d0818650362149b734d53edf9489f3acaa)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotap: Use numbered tap/tun devices on all *BSD OS's
Brad Smith [Sun, 4 Aug 2013 02:20:41 +0000 (22:20 -0400)] 
tap: Use numbered tap/tun devices on all *BSD OS's

The following patch simplifies the *BSD tap/tun code and makes use of numbered
tap/tun interfaces on all *BSD OS's. NetBSD has a patch in their pkgsrc tree
to make use of this feature and DragonFly also supports this as well.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit aa4f082f7526d39dac8e2ca64d192d858014ee10)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoiov: avoid "orig_len may be used unitialized" warning
Michael Tokarev [Sat, 14 Sep 2013 09:11:36 +0000 (13:11 +0400)] 
iov: avoid "orig_len may be used unitialized" warning

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 2be178a475289286db80de5ddd7830e67e112bdd)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoxhci: emulate intr endpoint intervals correctly
Gerd Hoffmann [Wed, 28 Aug 2013 09:38:44 +0000 (11:38 +0200)] 
xhci: emulate intr endpoint intervals correctly

Respect the interval for interrupt endpoints, so we don't finish
transfers as fast as possible but at the rate configured by the guest.

Fixes guest deadlocks triggered by interrupt storms.

Cc:
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 4d7a81c06f5f17e019a2d3a18300500bd64f6f40)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio-blk: do not relay a previous driver's WCE configuration to the current
Paolo Bonzini [Fri, 20 Sep 2013 15:31:55 +0000 (17:31 +0200)] 
virtio-blk: do not relay a previous driver's WCE configuration to the current

The following sequence happens:
- the SeaBIOS virtio-blk driver does not support the WCE feature, which
causes QEMU to disable writeback caching

- the Linux virtio-blk driver resets the device, finds WCE is available
but writeback caching is disabled; tells block layer to not send cache
flush commands

- the Linux virtio-blk driver sets the DRIVER_OK bit, which causes
writeback caching to be re-enabled, but the Linux virtio-blk driver does
not know of this side effect and cache flushes remain disabled

The bug is at the third step.  If the guest does know about CONFIG_WCE,
QEMU should ignore the WCE feature's state.  The guest will control the
cache mode solely using configuration space.  This change makes Linux
do flushes correctly, but Linux will keep SeaBIOS's writethrough mode.

Hence, whenever the guest is reset, the cache mode of the disk should
be reset to whatever was specified in the "-drive" option.  With this
change, the Linux virtio-blk driver finds that writeback caching is
enabled, and tells the block layer to send cache flush commands
appropriately.

Reported-by: Rusty Russell <rusty@au1.ibm.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit ef5bc96268ceec64769617dc53b0ac3a20ff351c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoblockdev: do not default cache.no-flush to true
Paolo Bonzini [Thu, 19 Sep 2013 16:48:53 +0000 (18:48 +0200)] 
blockdev: do not default cache.no-flush to true

That's why all my VMs were so fast lately. :)

This changed in 1.6.0 by mistake in patch 29c4e2b (blockdev: Split up
'cache' option, 2013-07-18).

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 1df6fa4bc6754a170cf511a78e2e6fef84eb5228)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotci: Fix qemu-alpha on 32 bit hosts (wrong assertions)
Stefan Weil [Thu, 12 Sep 2013 18:17:50 +0000 (20:17 +0200)] 
tci: Fix qemu-alpha on 32 bit hosts (wrong assertions)

Debian busybox-static for alpha has a load address of 0x0000000120000000
which is mapped to 0x0000000020000000 for 32 bit hosts.

qemu-alpha uses the TCG opcodes qemu_ld32, qemu_ld64, qemu_st32 and
qemu_st64 which all raise the assertion (taddr == host_addr).

Remove all assertions of this type because they are either wrong or
unnecessary (when sizeof(tcg_target_ulong) >= sizeof(target_ulong)).

Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 07ac4dc5db22a31e47b149abdbc5ea99013cf4de)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agokvmvapic: Clear also physical ROM address when entering INACTIVE state
Jan Kiszka [Tue, 3 Sep 2013 16:08:52 +0000 (18:08 +0200)] 
kvmvapic: Clear also physical ROM address when entering INACTIVE state

To avoid misinterpreting INACTIVE after migration as old qemu-kvm's
STANDBY, also clear rom_state_paddr when going back to this state.

CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 4357930b8a7d2fcff2d8121ec518117428a781e7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agokvmvapic: Enter inactive state on hardware reset
Jan Kiszka [Tue, 3 Sep 2013 16:08:51 +0000 (18:08 +0200)] 
kvmvapic: Enter inactive state on hardware reset

ROM layout may change after reset of devices are hotplugged, so we have
to pick up the physical address again when the ROM is initialized. This
is best achieved by resetting the state to INACTIVE.

CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit c056bc3f3464cfae1c94b7dd633d3ec13b13b655)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agokvmvapic: Catch invalid ROM size
Jan Kiszka [Tue, 3 Sep 2013 16:08:50 +0000 (18:08 +0200)] 
kvmvapic: Catch invalid ROM size

If not caught early, a zero-length ROM will cause a NULL-pointer access
later on in patch_hypercalls when allocating a zero-length ROM copy and
trying to read from it.

CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 18e5eec4db96a00907eb588a2b803401637c7f67)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agochardev: fix pty_chr_timer
Gerd Hoffmann [Thu, 22 Aug 2013 09:43:58 +0000 (11:43 +0200)] 
chardev: fix pty_chr_timer

pty_chr_timer first calls pty_chr_update_read_handler(), then clears
timer_tag (because it is a one-shot timer).   This is the wrong order
though.  pty_chr_update_read_handler might re-arm time timer, and the
new timer_tag gets overwitten in that case.

This leads to crashes when unplugging a pty chardev:  pty_chr_close
thinks no timer is running -> timer isn't canceled -> pty_chr_timer gets
called with stale CharDevState -> BOOM.

This patch fixes the ordering.
Kill the pointless goto while being at it.

https://bugzilla.redhat.com/show_bug.cgi?id=994414

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit b0d768c35e08d2057b63e8e77e7a513c447199fa)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopcnet-pci: mark I/O and MMIO as LITTLE_ENDIAN
Aurelien Jarno [Wed, 28 Aug 2013 12:17:39 +0000 (14:17 +0200)] 
pcnet-pci: mark I/O and MMIO as LITTLE_ENDIAN

Now that the memory subsystem is propagating the endianness correctly,
the pcnet-pci device should have its I/O ports and MMIO memory marked
as LITTLE_ENDIAN, as PCI devices are little endian.

This makes the pcnet-pci NIC to work again on big endian MIPS Malta
(default NIC).

Cc: qemu-stable@nongnu.org
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit a26405b350c0d31d5ef53f3b459aeb6eaaf50db0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqapi-types.py: Fix enum struct sizes on i686
Cole Robinson [Sat, 31 Aug 2013 22:36:17 +0000 (18:36 -0400)] 
qapi-types.py: Fix enum struct sizes on i686

Unlike other list types, enum wasn't adding any padding, which caused
a mismatch between the generated struct size and GenericList struct
size. More details in a678e26cbe89f7a27cbce794c2c2784571ee9d21

This crashed qemu if calling qmp query-tpm-types for example, which
upsets libvirt capabilities probing. Reproducer on i686:

(sleep 5; printf '{"execute":"qmp_capabilities"}\n{"execute":"query-tpm-types"}\n') | ./i386-softmmu/qemu-system-i386 -S -nodefaults -nographic -M none -qmp stdio

https://bugs.launchpad.net/qemu/+bug/1219207

Cc: qemu-stable@nongnu.org
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit 02dc4bf5684d3fb46786fab2ecff98214b1df9fe)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopc_q35: Initialize Xen.
Anthony PERARD [Mon, 9 Sep 2013 16:15:53 +0000 (16:15 +0000)] 
pc_q35: Initialize Xen.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 254c12825f93f405658ca3366cd34f8a8ad23511)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopc: Initializing ram_memory under Xen.
Anthony PERARD [Mon, 9 Sep 2013 16:15:52 +0000 (16:15 +0000)] 
pc: Initializing ram_memory under Xen.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
CC: qemu-stable@nongnu.org
(cherry picked from commit 04d7bad8a4fb23e6d9af9d06ce3ddc28a251d94d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqxl: fix local renderer
Gerd Hoffmann [Thu, 5 Sep 2013 19:57:19 +0000 (21:57 +0200)] 
qxl: fix local renderer

The local spice renderer assumes the primary surface is located at the
start of the "ram" bar.  This used to be a requirement in qxl hardware
revision 1.  In revision 2+ this is relaxed.  Nevertheless guest drivers
continued to use the traditional location, for historical and backward
compatibility reasons.  The qxl kms driver doesn't though as it depends
on qxl revision 4+ anyway.

Result is that local rendering is hosed for recent linux guests, you'll
get pixel garbage with non-spice ui (gtk, sdl, vnc) and when doing
screendumps.  Fix that by doing a proper mapping of the guest-specified
memory location.

https://bugzilla.redhat.com/show_bug.cgi?id=948717

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit c58c7b959b93b864a27fd6b3646ee1465ab8832b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoehci: save device pointer in EHCIState
Gerd Hoffmann [Mon, 9 Sep 2013 08:18:17 +0000 (10:18 +0200)] 
ehci: save device pointer in EHCIState

We'll need a pointer to the actual pci/sysbus device,
stick a pointer to it into the EHCIState struct.

https://bugzilla.redhat.com/show_bug.cgi?id=1005495

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit adbecc89731cf3e0ae656d50ea9fa58c589c4bdc)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agone2000: mark I/O as LITTLE_ENDIAN
Aurelien Jarno [Mon, 2 Sep 2013 11:10:34 +0000 (13:10 +0200)] 
ne2000: mark I/O as LITTLE_ENDIAN

Now that the memory subsystem is propagating the endianness correctly,
the ne2000 device should have its I/O ports marked as LITTLE_ENDIAN, as
PCI devices are little endian.

This makes the ne2000 NIC to work again on PowerPC.

Cc: qemu-stable@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 45d883dcf208160e2db308d1b368beb74f37dc7e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoexec: check offset_within_address_space for register subpage
Hu Tao [Thu, 29 Aug 2013 10:21:16 +0000 (18:21 +0800)] 
exec: check offset_within_address_space for register subpage

If offset_within_address_space falls in a page, then we register a
subpage. So check offset_within_address_space rather than
offset_within_region.

Cc: qemu-stable@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 88266249701032211c1d7449460d063fbc01bf12)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoRevert "memory: Return -1 again on reads from unsigned regions"
Jan Kiszka [Mon, 2 Sep 2013 16:43:31 +0000 (18:43 +0200)] 
Revert "memory: Return -1 again on reads from unsigned regions"

This reverts commit 9b8c69243585a32d14b9bb9fcd52c37b0b5a1b71.

The commit was wrong: We only return -1 on invalid accesses, not on
valid but unbacked ones. This broke various corner cases.

Cc: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 68a7439a150d6b4da99082ab454b9328b151bc25)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agomemory: Provide separate handling of unassigned io ports accesses
Jan Kiszka [Mon, 2 Sep 2013 16:43:30 +0000 (18:43 +0200)] 
memory: Provide separate handling of unassigned io ports accesses

Accesses to unassigned io ports shall return -1 on read and be ignored
on write. Ensure these properties via dedicated ops, decoupling us from
the memory core's handling of unassigned accesses.

Cc: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 3bb28b7208b349e7a1b326e3c6ef9efac1d462bf)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agow32: Fix access to host devices (regression)
Stefan Weil [Sun, 1 Sep 2013 20:59:25 +0000 (22:59 +0200)] 
w32: Fix access to host devices (regression)

QEMU failed to open host devices like \\.\PhysicalDrive0 (first hard disk)
since some time (commit 8a79380b8ef1b02d2abd705dd026a18863b09020?).

Those devices use hdev_open which did not use the latest API for options.
This resulted in a fatal runtime error:

  Block protocol 'host_device' doesn't support the option 'filename'

Duplicate code from raw_open to fix this.

Cc: qemu-stable@nongnu.org
Reported-by: David Brenner <david.brenner3@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 68dc036488dfea170627a55e6ee3dfd7f2c2063e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agousb: parallelize usb3 streams
Gerd Hoffmann [Tue, 27 Aug 2013 13:25:24 +0000 (15:25 +0200)] 
usb: parallelize usb3 streams

usb3 bulk endpoints with streams are implicitly pipelined now,
so the requests will actually be processed in parallel.  Also
allow them to complete out-of-order.

Fixes stalls in the uas driver.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit c96c41ed0d38d68a6c8b6f84751afebafeae31be)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoxhci: reset port when disabling slot
Gerd Hoffmann [Wed, 28 Aug 2013 09:47:09 +0000 (11:47 +0200)] 
xhci: reset port when disabling slot

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 5c67dd7b4884979a2613a4702ac1ab68b0e6a16e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoexec: always use MADV_DONTFORK
Andrea Arcangeli [Thu, 25 Jul 2013 10:11:15 +0000 (12:11 +0200)] 
exec: always use MADV_DONTFORK

MADV_DONTFORK prevents fork to fail with -ENOMEM if the default
overcommit heuristics decides there's too much anonymous virtual
memory allocated. If the KVM secondary MMU is synchronized with MMU
notifiers or not, doesn't make a difference in that regard.

Secondly it's always more efficient to avoid copying the guest
physical address space in the fork child (so we avoid to mark all the
guest memory readonly in the parent and so we skip the establishment
and teardown of lots of pagetables in the child).

In the common case we can ignore the error if MADV_DONTFORK is not
available. Leave a second invocation that errors out in the KVM path
if MMU notifiers are missing and KVM is enabled, to abort in such
case.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
(cherry picked from commit 3e469dbfe413c25d48321c3a19ddfae0727dc6e5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio_pci: fix level interrupts with irqfd
Michael S. Tsirkin [Sun, 1 Sep 2013 08:03:45 +0000 (11:03 +0300)] 
virtio_pci: fix level interrupts with irqfd

commit 62c96360ae7f2c7a8b029277fbb7cb082fdef7fd
    virtio-pci: fix level interrupts
only helps systems without irqfd: on systems with irqfd support we
passed in flag requesting irqfd even when msix is disabled.

As a result, for level interrupts we didn't install an fd handler so
unmasking an fd had no effect.

Fix this up.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 23fe2b3f9e7df8da53ac1bc32c6875254911d7f4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoexec: fix writing to MMIO area with non-power-of-two length
Paolo Bonzini [Mon, 29 Jul 2013 12:27:39 +0000 (14:27 +0200)] 
exec: fix writing to MMIO area with non-power-of-two length

The problem is introduced by commit 2332616 (exec: Support 64-bit
operations in address_space_rw, 2013-07-08).  Before that commit,
memory_access_size would only return 1/2/4.

Since alignment is already handled above, reduce l to the largest
power of two that is smaller than l.

Cc: qemu-stable@nongnu.org
Reported-by: Oleksii Shevchuk <alxchk@gmail.com>
Tested-by: Oleksii Shevchuk <alxchk@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 098178f2749a63fbbb1a626dcc7d939d5cb2bde7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoadlib: sort offsets in portio registration
Hervé Poussineau [Wed, 14 Aug 2013 09:49:04 +0000 (11:49 +0200)] 
adlib: sort offsets in portio registration

This fixes the following assert when -device adlib is used:
ioport.c:240: portio_list_add: Assertion `pio->offset >= off_last' failed.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 2b21fb57af305f17841d79e7e2e02ad1aec3f5ca)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-i386: fix disassembly with PAE=1, PG=0
Paolo Bonzini [Fri, 30 Aug 2013 09:58:45 +0000 (11:58 +0200)] 
target-i386: fix disassembly with PAE=1, PG=0

CR4.PAE=1 will not enable paging if CR0.PG=0, but the "if" chain
in x86_cpu_get_phys_page_debug says otherwise.  Check CR0.PG
before everything else.

Fixes "-d in_asm" for a code section at the beginning of OVMF.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
(cherry picked from commit f2f8560c7a5303065a2a3207ec475dfb3a622a0e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoblock: expect errors from bdrv_co_is_allocated
Paolo Bonzini [Wed, 4 Sep 2013 17:00:25 +0000 (19:00 +0200)] 
block: expect errors from bdrv_co_is_allocated

Some bdrv_is_allocated callers do not expect errors, but the fallback
in qcow2.c might make other callers trip on assertion failures or
infinite loops.

Fix the callers to always look for errors.

Cc: qemu-stable@nongnu.org
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit d663640c04f2aab810915c556390211d75457704)

Conflicts:

block/cow.c

*modified to avoid dependency on upstream's e641c1e8

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoRevert "usb-hub: report status changes only once"
Gerd Hoffmann [Tue, 27 Aug 2013 15:00:04 +0000 (17:00 +0200)] 
Revert "usb-hub: report status changes only once"

This reverts commit a309ee6e0a256f690760abfba44fceaa52a7c2f3.

This isn't in line with the usb specification and adds regressions,
win7 fails to drive the usb hub for example.

Was added because it "solved" the issue of hubs interacting badly
with the xhci host controller.  Now with the root cause being fixed
in xhci (commit <FIXME>) we can revert this one.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit bdebd6ee81f4d849aa8541c289203e3992450db0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoxhci: fix endpoint interval calculation
Gerd Hoffmann [Wed, 28 Aug 2013 09:39:02 +0000 (11:39 +0200)] 
xhci: fix endpoint interval calculation

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ca7162782a293f525633e5816470498dd86a51cf)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor...
yinyin [Thu, 22 Aug 2013 06:47:16 +0000 (14:47 +0800)] 
virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table

virtqueue_get_avail_bytes: when found a indirect desc, we need loop over it.
           /* loop over the indirect descriptor table */
           indirect = 1;
           max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
           num_bufs = i = 0;
           desc_pa = vring_desc_addr(desc_pa, i);
But, It init i to 0, then use i to update desc_pa. so we will always get:
desc_pa = vring_desc_addr(desc_pa, 0);
the last two line should swap.

Cc: qemu-stable@nongnu.org
Signed-off-by: Yin Yin <yin.yin@cs2c.com.cn>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1ae2757c6c4525c9b42f408c86818f843bad7418)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopseries: Fix stalls on hypervisor virtual console
Anton Blanchard [Tue, 13 Aug 2013 04:10:04 +0000 (14:10 +1000)] 
pseries: Fix stalls on hypervisor virtual console

A number of users are reporting stalls when using the pseries
hypervisor virtual console.

A simple test case is to paste 15 or 17 characters at a time
into the console. Pasting 15 characters at a time works fine
but pasting 17 characters hangs for a random amount of time.
Other activity (network, qemu monitor etc) unblocks it.

If qemu-char tries to send more than 16 characters at once,
vty_can_receive returns false. At this point we have to
wait for the guest to consume that output. Everything is good
so far.

The problem occurs when the the guest does consume the output.
We need to signal back to the qemu-char layer that we are
ready for more input. Without this we block until something
else kicks us (eg network activity).

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit 7770b6f78a2d655e03852a5de238f5926c92be6a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopc: fix regression for 64 bit PCI memory
Michael S. Tsirkin [Tue, 27 Aug 2013 05:37:26 +0000 (08:37 +0300)] 
pc: fix regression for 64 bit PCI memory

commit 398489018183d613306ab022653552247d93919f
    pc: limit 64 bit hole to 2G by default
introduced a way for management to control
the window allocated to the 64 bit PCI hole.

This is useful, but existing management tools do not know how to set
this property.  As a result, e.g. specifying a large ivshmem device with
size > 4G is broken by default.  For example this configuration no
longer works:

-device ivshmem,size=4294967296,chardev=cfoo
-chardev socket,path=/tmp/sock,id=cfoo,server,nowait

Fix this by detecting that hole size was not specified
and defaulting to the backwards-compatible value of 1 << 62.

Cc: qemu-stable@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1466cef32dd5e7ef3c6477e96d85d92302ad02e3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoscsi: Fix scsi_bus_legacy_add_drive() scsi-generic with serial
Markus Armbruster [Fri, 23 Aug 2013 16:01:58 +0000 (18:01 +0200)] 
scsi: Fix scsi_bus_legacy_add_drive() scsi-generic with serial

scsi_bus_legacy_add_drive() creates either a scsi-disk or a
scsi-generic device.  It sets property "serial" to argument serial
unless null.  Crashes with scsi-generic, because it doesn't have such
the property.

Only usb_msd_initfn_storage() passes non-null serial.  Reproducer:

    $ qemu-system-x86_64 -nodefaults -display none -S -usb \
    -drive if=none,file=/dev/sg1,id=usb-drv0 \
    -device usb-storage,id=usb-msd0,drive=usb-drv0,serial=123
    qemu-system-x86_64: -device usb-storage,id=usb-msd0,drive=usb-drv0,serial=123: Property '.serial' not found
    Aborted (core dumped)

Fix by handling exactly like "removable": set the property only when
it exists.

Cc: qemu-stable@nongnu.org
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit c24e7517ee4a98e90eee5f0f07708a1fa12326b3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agousb/dev-hid: Modified usb-tablet category from Misc to Input
Marcel Apfelbaum [Thu, 22 Aug 2013 17:11:36 +0000 (20:11 +0300)] 
usb/dev-hid: Modified usb-tablet category from Misc to Input

usb-tablet device was wrongly assigned to Misc category

Reported-by: Markus Armbruster <armbru@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 31efd2e883018b4c079ad082105bc161fbb3fef8)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoscripts/qapi.py: Avoid syntax not supported by Python 2.4
Peter Maydell [Tue, 20 Aug 2013 14:50:15 +0000 (15:50 +0100)] 
scripts/qapi.py: Avoid syntax not supported by Python 2.4

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

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit 21e0043bada1a24ae2ba6cd0051e104c0cbf9634)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agordma: silly ipv6 bugfix
Michael R. Hines [Mon, 19 Aug 2013 02:27:08 +0000 (22:27 -0400)] 
rdma: silly ipv6 bugfix

My bad - but it's very important for us to warn the user that
IPv6 is broken on RoCE in linux right now, until linux releases
a fixed version.

Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit c89aa2f1851b08c3efa8a1070c0a6b9a36e1227f)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-ppc: fix bit extraction for FPBF and FPL
Aurelien Jarno [Thu, 15 Aug 2013 11:32:38 +0000 (13:32 +0200)] 
target-ppc: fix bit extraction for FPBF and FPL

Bit extraction for the FP BF and L field of the MTFSFI and MTFSF
instructions is wrong and doesn't match the reference manual (which
explain the bit number in big endian format). It has been broken in
commit 7d08d85645def18eac2a9d672c1868a35e0bcf79.

This patch fixes this, which in turn fixes the problem reported by
Khem Raj about the floor() function of libm.

Reported-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
CC: qemu-stable@nongnu.org (1.6)
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit 779f659021d1754117bce1aab9370dc22f37ae07)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agogdbstub: Fix gdb_register_coprocessor() register counting
Andreas Färber [Mon, 12 Aug 2013 16:09:47 +0000 (18:09 +0200)] 
gdbstub: Fix gdb_register_coprocessor() register counting

Commit a0e372f0c49ac01faeaeb73a6e8f50e8ac615f34 reorganized the register
counting for GDB. While it seems correct not to let the total number of
registers skyrocket in an SMP scenario through a static variable, the
distinction between total register count and 'g' packet register count
(last_reg vs. num_g_regs) got lost among the way.

Fix this by introducing CPUState::gdb_num_g_regs and using that in
gdb_handle_packet().

Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org (stable-1.6)
Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tested-by: Max Filippov <jcmvbkbc@gmail.com>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 35143f0164e6933a85c7c2b8a89a040d881a9151)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoblock: ensure bdrv_drain_all() works during bdrv_delete()
Stefan Hajnoczi [Thu, 27 Jun 2013 13:32:26 +0000 (15:32 +0200)] 
block: ensure bdrv_drain_all() works during bdrv_delete()

In bdrv_delete() make sure to call bdrv_make_anon() *after* bdrv_close()
so that the device is still seen by bdrv_drain_all() when iterating
bdrv_states.

Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit e1b5c52e04d04bb93546c6e37e8884889d047cb1)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoUpdate version for 1.6.0 v1.6.0
Anthony Liguori [Thu, 15 Aug 2013 15:40:51 +0000 (10:40 -0500)] 
Update version for 1.6.0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agomips_malta: do not raise exceptions when accessing invalid memory
Aurelien Jarno [Mon, 12 Aug 2013 19:34:53 +0000 (21:34 +0200)] 
mips_malta: do not raise exceptions when accessing invalid memory

Since commit c658b94f6e8c206c59d02aa6fbac285b86b53d2c, MIPS raises
exceptions when accessing invalid memory. This is not the correct
behaviour for MIPS Malta Core LV, as the GT-64120A system controller
just ignore undecoded access. This feature is used by the Linux kernel
to probe for some devices.

Emulate the correct behaviour in QEMU by adding an empty slot covering
the entire memory space decoded by the GT-64120A.

Tested-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agoblock: Dont ignore previously set bdrv_flags
M. Mohan Kumar [Wed, 14 Aug 2013 12:26:41 +0000 (17:56 +0530)] 
block: Dont ignore previously set bdrv_flags

bdrv_flags is set by bdrv_parse_discard_flags(), but later it is reset
to zero.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Message-id: 1376483201-13466-1-git-send-email-mohan@in.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoqemu-char: fix infinite recursion connecting to monitor pty
James Hogan [Thu, 8 Aug 2013 11:09:38 +0000 (12:09 +0100)] 
qemu-char: fix infinite recursion connecting to monitor pty

Since commit bd5c51e (qemu-char: don't issue CHR_EVENT_OPEN in a BH), an
infinite recursion occurs when putting the monitor on a pty (-monitor
pty) and connecting a terminal to the slave port.

This is because of the qemu_chr_be_event(s, CHR_EVENT_OPENED) added to
qemu_chr_be_generic_open(). This event is captured by monitor_event()
which prints a welcome message to the character device. The flush of
that welcome message retriggers another open event in pty_chr_state()
because it checks s->connected, but only sets it to 1 after calling
qemu_chr_be_generic_open().

I've fixed this by setting s->connected = 1 before the call to
qemu_chr_be_generic_open() instead of after, so that the recursive
pty_chr_state() doesn't call it again.

An example snippet of repeating backtrace:
 ...
 #107486 0x007aec58 in monitor_flush (mon=0xf418b0) at qemu/monitor.c:288
 #107487 0x007aee7c in monitor_puts (mon=0xf418b0, str=0x1176d07 "") at qemu/monitor.c:322
 #107488 0x007aef20 in monitor_vprintf (mon=0xf418b0, fmt=0x8d4820 "QEMU %s monitor - type 'help' for more information\n",
     ap=0x7f432be0) at qemu/monitor.c:339
 #107489 0x007aefac in monitor_printf (mon=0xf418b0, fmt=0x8d4820 "QEMU %s monitor - type 'help' for more information\n")
     at qemu/monitor.c:347
 #107490 0x007ba4bc in monitor_event (opaque=0xf418b0, event=2) at qemu/monitor.c:4699
 #107491 0x00684c28 in qemu_chr_be_event (s=0xf37788, event=2) at qemu/qemu-char.c:108
 #107492 0x00684c70 in qemu_chr_be_generic_open (s=0xf37788) at qemu/qemu-char.c:113
 #107493 0x006880a4 in pty_chr_state (chr=0xf37788, connected=1) at qemu/qemu-char.c:1145
 #107494 0x00687fa4 in pty_chr_update_read_handler (chr=0xf37788) at qemu/qemu-char.c:1121
 #107495 0x00687c9c in pty_chr_write (chr=0xf37788, buf=0x70b3c008 <Address 0x70b3c008 out of bounds>, len=538720)
     at qemu/qemu-char.c:1063
 #107496 0x00684cc4 in qemu_chr_fe_write (s=0xf37788, buf=0x70b3c008 <Address 0x70b3c008 out of bounds>, len=538720)
     at qemu/qemu-char.c:118
 ...

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: 1375960178-10882-1-git-send-email-james.hogan@imgtec.com
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agopvpanic: fix bad merge
Anthony Liguori [Tue, 13 Aug 2013 14:02:52 +0000 (09:02 -0500)] 
pvpanic: fix bad merge

Context matching caused the 'has_pvpanic = true' to be applied to
the 1.6 machine type instead of the 1.5 machine type.

Reported-by: Markus Armbruster <armbru@redhat.com>
Reported-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoUpdate version for 1.6.0-rc3 v1.6.0-rc3
Anthony Liguori [Mon, 12 Aug 2013 20:03:36 +0000 (15:03 -0500)] 
Update version for 1.6.0-rc3

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
Anthony Liguori [Mon, 12 Aug 2013 20:03:20 +0000 (15:03 -0500)] 
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging

QOM CPUState refactorings

* Fix X86CPU Westmere CPUID for pc-*-1.4 and older

* afaerber/tags/qom-cpu-for-anthony:
  pc: Remove PCLMULQDQ from Westmere on pc-*-1.4 and older

Conflicts:
hw/i386/pc_piix.c
hw/i386/pc_q35.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agopc: drop external DSDT loading
Anthony Liguori [Mon, 12 Aug 2013 14:01:44 +0000 (09:01 -0500)] 
pc: drop external DSDT loading

This breaks migration and is unneeded with modern SeaBIOS.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1376316104-11269-1-git-send-email-aliguori@us.ibm.com

10 years agohw/misc: make pvpanic known to user
Marcel Apfelbaum [Sun, 11 Aug 2013 15:10:43 +0000 (18:10 +0300)] 
hw/misc: make pvpanic known to user

This patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.html

The pvpanic device may be enabled now with "-device pvpanic"
from command line.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Message-id: 1376233843-19410-3-git-send-email-marcel.a@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agohw/misc: don't create pvpanic device by default
Marcel Apfelbaum [Sun, 11 Aug 2013 15:10:42 +0000 (18:10 +0300)] 
hw/misc: don't create pvpanic device by default

This patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00124.html

No need to hard-code pvpanic as part of the machine.
It can be added with "-device pvpanic" from command line (The next patch).
Anyway, for backport compatibility it is still part of 1.5
machine.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Message-id: 1376233843-19410-2-git-send-email-marcel.a@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agopc: Remove PCLMULQDQ from Westmere on pc-*-1.4 and older
Eduardo Habkost [Fri, 9 Aug 2013 14:11:36 +0000 (11:11 -0300)] 
pc: Remove PCLMULQDQ from Westmere on pc-*-1.4 and older

Commit 41cb383f42d0cb51d8e3e25e3ecebc954dd4196f made a guest-visible
change by adding the PCLMULQDQ bit to Westmere without adding
compatibility code to keep the ABI for older machine-types.
Fix it by adding the missing compat code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>