]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agoUpdate VERSION for 1.5.3 release origin/stable-1.5 v1.5.3
Michael Roth [Thu, 22 Aug 2013 16:21:34 +0000 (11:21 -0500)]
Update VERSION for 1.5.3 release

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu-char: Fix ringbuf option size
Markus Armbruster [Thu, 27 Jun 2013 14:22:07 +0000 (16:22 +0200)]
qemu-char: Fix ringbuf option size

Any attempt to use it trips an "opt->desc->type == QEMU_OPT_NUMBER"
assertion.  Broken in commit 1da48c65.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit 0f953051178f2e3df36efa5158a71f33d35fa812)

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoMerge tag 'qom-cpu-for-1.5' into stable-1.5-staging
Michael Roth [Tue, 13 Aug 2013 18:09:23 +0000 (13:09 -0500)]
Merge tag 'qom-cpu-for-1.5' into stable-1.5-staging

QOM CPUState and X86CPU for stable-1.5

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

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

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agovhost: clear signalled_used_valid on vhost stop
Michael S. Tsirkin [Mon, 12 Aug 2013 09:21:36 +0000 (12:21 +0300)]
vhost: clear signalled_used_valid on vhost stop

When vhost device stops, its implementation synchronizes kernel state
back to virtio.c so we can continue emulating the device
in userspace.

This patch ensures that virtio.c's signalled_used_valid flag is reset so
that userspace does not suppress guest notifications due to stale
signalled_used values.

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio: clear signalled_used_valid when switching from dataplane
Stefan Hajnoczi [Mon, 12 Aug 2013 09:08:09 +0000 (11:08 +0200)]
virtio: clear signalled_used_valid when switching from dataplane

When the dataplane thread stops, its vring.c implementation synchronizes
vring state back to virtio.c so we can continue emulating the virtio
device.

This patch ensures that virtio.c's signalled_used_valid flag is reset so
that we do not suppress guest notifications due to stale signalled_used
values.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 6793dfd1b6a99a79b9f2e3c4d6625ccd6513f240)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agodataplane: sync virtio.c and vring.c virtqueue state
Stefan Hajnoczi [Mon, 1 Jul 2013 11:29:17 +0000 (13:29 +0200)]
dataplane: sync virtio.c and vring.c virtqueue state

Load the virtio.c state into vring.c when we start dataplane mode and
vice versa when stopping dataplane mode.  This patch makes it possible
to start and stop dataplane any time while the guest is running.

This will eventually allow us to go back to QEMU main loop for
bdrv_drain_all() and live migration.  In the meantime, this patch makes
the dataplane lifecycle more robust but should make no visible
difference.  It may be useful in the virtio-net dataplane effort.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 9154b02c53bb6685797c973fcdbec51c4714777d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoi82801b11: Fix i82801b11 PCI host bridge config space
Gerd Hoffmann [Mon, 5 Aug 2013 14:36:40 +0000 (16:36 +0200)]
i82801b11: Fix i82801b11 PCI host bridge config space

pci_bridge_write_config() was not being used.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 4965b7f056177ddfb816319e9ff5e766898d0bc5)

Conflicts:

hw/pci-bridge/i82801b11.c

* modified to avoid dependency on 125ee0ed

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoBugfix for loading multiboot kernels
Martijn van den Broek [Tue, 6 Aug 2013 18:45:39 +0000 (20:45 +0200)]
Bugfix for loading multiboot kernels

This patch fixes a bug in rom_copy introduced by
commit d60fa42e8bae39440f997ebfe8fe328269a57d16.

rom_copy failed to load roms with a "datasize" of 0.
As a result, multiboot kernels were not loaded correctly
when they contain a segment with a "file size" of 0.

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

Signed-off-by: Martijn van den Broek <martijn.vdbrk@gmail.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: CAG1x_oET1u3TMPu3r_zzd3ZXsTWQLiaM0zAc+RkHFCwvJjGOvg@mail.gmail.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 0dd5ce38fbeb2fb97b01cc8c1c97292211e48ee6)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agosemaphore: fix a hangup problem under load on NetBSD hosts.
Izumi Tsutsui [Wed, 3 Jul 2013 08:58:14 +0000 (17:58 +0900)]
semaphore: fix a hangup problem under load on NetBSD hosts.

Fix following bugs in "fallback implementation of counting semaphores
with mutex+condvar" added in c166cb72f1676855816340666c3b618beef4b976:
 - waiting threads are not restarted properly if more than one threads
   are waiting unblock signals in qemu_sem_timedwait()
 - possible missing pthread_cond_signal(3) calls when waiting threads
   are returned by ETIMEDOUT
 - fix an uninitialized variable
The problem is analyzed by and fix is provided by Noriyuki Soda.

Also put additional cleanup suggested by Laszlo Ersek:
 - make QemuSemaphore.count unsigned (it won't be negative)
 - check a return value of in pthread_cond_wait() in qemu_sem_wait()

Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1372841894-10634-1-git-send-email-tsutsui@ceres.dti.ne.jp
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 79761c6681f0d1cc1c027116fcb4382d41ed3ece)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoignore SIGPIPE in qemu-img and qemu-io
MORITA Kazutaka [Tue, 23 Jul 2013 08:30:11 +0000 (17:30 +0900)]
ignore SIGPIPE in qemu-img and qemu-io

This prevents the tools from being stopped when they write data to a
closed connection in the other side.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 526eda14a68d5b3596be715505289b541288ef2a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-i386: Fix X86CPU error handling
Andreas Färber [Fri, 2 Aug 2013 16:56:05 +0000 (18:56 +0200)]
target-i386: Fix X86CPU error handling

Error **errp argument is not for emitting warnings, it means an error
has occurred and the caller should not make any assumptions about the
state of other return values (unless otherwise documented).

Therefore cpu_x86_create() must unref the new X86CPU itself, and
pc_new_cpu() must check for an Error rather than NULL return value.

While at it, clean up a superfluous NULL check.

Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-stable@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit cd7b87ffe9b6b7b0089ec8c71555f3b942bc6daf)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoiov: handle EOF in iov_send_recv
MORITA Kazutaka [Tue, 23 Jul 2013 08:30:12 +0000 (17:30 +0900)]
iov: handle EOF in iov_send_recv

Without this patch, iov_send_recv() never returns when do_send_recv()
returns zero.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 840042901710c2dc1a3ac3e5af9bed449c339701)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoseccomp: add additional asynchronous I/O syscalls
Paul Moore [Mon, 15 Jul 2013 19:32:01 +0000 (15:32 -0400)]
seccomp: add additional asynchronous I/O syscalls

A previous commit, "seccomp: add the asynchronous I/O syscalls to the
whitelist", added several asynchronous I/O syscalls but left out the
io_submit() and io_cancel() syscalls.  This patch corrects this by
adding the two missing asynchronous I/O syscalls.

Signed-off-by: Paul Moore <pmoore@redhat.com>
Reviewed-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
Message-id: 20130715193201.943.4913.stgit@localhost
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 94113bd8a1d9acd05a879bc309cc659ace09e287)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoseccomp: add arch_prctl() to the syscall whitelist
Paul Moore [Thu, 18 Jul 2013 13:57:03 +0000 (09:57 -0400)]
seccomp: add arch_prctl() to the syscall whitelist

It appears that even a very simple /etc/qemu-ifup configuration can
require the arch_prctl() syscall, see the example below:

#!/bin/sh
/sbin/ifconfig $1 0.0.0.0 up
/usr/sbin/brctl addif <switch> $1

Signed-off-by: Paul Moore <pmoore@redhat.com>
Reviewed-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
Message-id: 20130718135703.8247.19213.stgit@localhost
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit d2509b667caf482b6f827ff2645cbeb9b39ce29e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agochardev: fix CHR_EVENT_OPENED events for mux chardevs
Michael Roth [Tue, 30 Jul 2013 18:04:22 +0000 (13:04 -0500)]
chardev: fix CHR_EVENT_OPENED events for mux chardevs

As of bd5c51ee6c4f1c79cae5ad2516d711a27b4ea8ec, chardevs no longer use
bottom-halves to issue CHR_EVENT_OPENED events. To maintain past
semantics, we instead defer the CHR_EVENT_OPENED events toward the end
of chardev initialization.

For muxes, this isn't good enough, since a range of FEs must be able
to attach to the mux prior to any CHR_EVENT_OPENED being issued, else
each FE will immediately print it's initial output (prompts, banners,
etc.) just prior to us switching to the next FE as part of
initialization.

The is new and confusing behavior for users, as they'll see output for
things like the HMP monitor, even though their the current mux focus
may be a guest serial port with potentially no output.

We fix this by further deferring CHR_EVENT_OPENED events for FEs
associated with muxes until after machine init by flagging mux chardevs
with 'explicit_be_open', which suppresses emission of CHR_EVENT_OPENED
events until we explicitly set the mux as opened later.

Currently, we must defer till after machine init since we potentially
associate FEs with muxes as part of realize (for instance,
serial_isa_realizefn).

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: 1375207462-8141-1-git-send-email-mdroth@linux.vnet.ibm.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 7b7ab18d0b9769b5f39e663fa55caed461b1202e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoxhci: fix segfault
Gerd Hoffmann [Wed, 31 Jul 2013 08:54:11 +0000 (10:54 +0200)]
xhci: fix segfault

Guest trying to reset a endpoint of a disconnected device resulted in
xhci trying to dereference uport while being NULL, thereby crashing
qemu.  Fix that by adding a check.  Drop unused dev variable while
touching that code bit.

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopci-bridge: update mappings for migration/restore
Don Koch [Tue, 9 Jul 2013 15:40:02 +0000 (11:40 -0400)]
pci-bridge: update mappings for migration/restore

Fix for LP#1187529: Devices on PCI bridge stop working when
live-migrated. Update bridge mappings for all PCI bridge
devices in get_pci_config_device().

Signed-off-by: Don Koch <dkoch@verizon.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit e78e9ae4a933504d383703870d491615b0261801)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio-console: Use exitfn for virtserialport, too
Andreas Färber [Wed, 31 Jul 2013 23:28:46 +0000 (01:28 +0200)]
virtio-console: Use exitfn for virtserialport, too

virtconsole and virtserialport are identical in every other aspect
except for the distinguishing VirtIOSerialPortClass::is_console field.

Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id: 1375313326-14966-1-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 203439ce0a832e36b276f10892846bd91ee836eb)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqapi: Rename ChardevBackend member "memory" to "ringbuf"
Markus Armbruster [Fri, 26 Jul 2013 14:44:34 +0000 (16:44 +0200)]
qapi: Rename ChardevBackend member "memory" to "ringbuf"

Commit 1da48c6 called the new member "memory" after commit 3949e59
standardized "ringbuf".  Rename for consistency.

However, member name "memory" is visible in QMP since 1.5.  It's
undocumented just like the driver name.  Keep it working anyway.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1374849874-25531-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 3a1da42eb35a67d0dbc899dd571ea386fa11c4dd)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu-char: Register ring buffer driver with correct name "ringbuf"
Markus Armbruster [Fri, 26 Jul 2013 14:44:33 +0000 (16:44 +0200)]
qemu-char: Register ring buffer driver with correct name "ringbuf"

The driver is new in 1.4, with the documented name "ringbuf".
However, it's actual name is the completely undocumented "memory".
Screwed up in commit 3949e59.  Fix code to match documentation.

Keep the undocumented name working as an alias for compatibility.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1374849874-25531-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit c11ed9666d69abaf217c8800f299c519b487b7d3)

Conflicts:

qemu-char.c

* removed dependency on command-line specifiable mux (bb6fb7c0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoxhci: handle USB_RET_IOERROR
Gerd Hoffmann [Thu, 25 Jul 2013 11:12:35 +0000 (13:12 +0200)]
xhci: handle USB_RET_IOERROR

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

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agodataplane: refuse to start if device is already in use
Stefan Hajnoczi [Mon, 29 Jul 2013 13:02:00 +0000 (15:02 +0200)]
dataplane: refuse to start if device is already in use

Dataplane must check whether a block device is in use before launching
the dataplane thread.  This is necessary since the thread does not
synchronize with the main loop and I/O requests could cause corruption.

One example is when a drive is added and a block job is started before
hotplugging the virtio-blk-pci adapter.  In this case we must not use
dataplane mode.

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agogtk: Fix compiler warning (GTK 3 deprecated function)
Stefan Weil [Sun, 16 Jun 2013 14:13:07 +0000 (16:13 +0200)]
gtk: Fix compiler warning (GTK 3 deprecated function)

With GTK 3, the function gdk_cursor_unref is deprecated:

qemu/ui/gtk.c: In function ‘gd_cursor_define’:
qemu/ui/gtk.c:380:5: error:
 ‘gdk_cursor_unref’ is deprecated (declared at /usr/include/gtk-3.0/gdk/gdkcursor.h:233): Use 'g_object_unref' instead [-Werror=deprecated-declarations]

Fix the gcc compiler warning by using conditional compilation.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1371391987-10795-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 030b4b7debf659dcd6fc66826564285fdce5057d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agogtk: don't use g_object_unref on GdkCursor
Anthony Liguori [Mon, 3 Jun 2013 20:37:23 +0000 (15:37 -0500)]
gtk: don't use g_object_unref on GdkCursor

It's not a GObject.

Cc: Gerd Hoffman <kraxel@redhat.com>
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - Fix summary to agree with code (Peter)
(cherry picked from commit 171392406d8e230d62e5ebf4805f71460854b8ec)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agomegasas: Legacy command line handling fix
Andreas Färber [Sun, 21 Jul 2013 10:20:15 +0000 (12:20 +0200)]
megasas: Legacy command line handling fix

Only apply legacy command line handling when the device has not been
hot-plugged. Propagate failure of legacy command line handling.

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

Conflicts:

hw/scsi/megasas.c

* modified to avoid dependency on fancy new upcast macros

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agocpus: Let vm_stop[_force_state]() always flush block devices
Kevin Wolf [Thu, 18 Jul 2013 12:52:19 +0000 (14:52 +0200)]
cpus: Let vm_stop[_force_state]() always flush block devices

Even if the VM is already stopped, we cannot assume that all data has
already been successfully flushed to disk. The flush during the previous
vm_stop() could have failed.

Run bdrv_flush_all() unconditionally so that we get an error each time
if the block device isn't really flushed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 594a45ce64dbef1829996403506a1154eb2fd1cc)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agocpus: Add return value for vm_stop()
Kevin Wolf [Fri, 5 Jul 2013 11:49:54 +0000 (13:49 +0200)]
cpus: Add return value for vm_stop()

If flushing the block devices fails, return an error. The VM is stopped
anyway.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 5698346391b306c2c84358c68ee897c095d714cc)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoblock: Add return value for bdrv_flush_all()
Kevin Wolf [Fri, 5 Jul 2013 11:48:01 +0000 (13:48 +0200)]
block: Add return value for bdrv_flush_all()

bdrv_flush() can fail, and bdrv_flush_all() should return an error as
well if this happens for a block device. It returns the first error
return now, but still at least tries to flush the remaining devices even
in error cases.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit f0f0fdfeec6c67ad374114ecc4b3e3ccde5e94d2)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoiscsi: assert that sectors are aligned to LUN blocksize
Peter Lieven [Thu, 11 Jul 2013 12:16:27 +0000 (14:16 +0200)]
iscsi: assert that sectors are aligned to LUN blocksize

if the blocksize of an iSCSI LUN is bigger than the BDRV_SECTOR_SIZE
it is possible that sector_num or nb_sectors are not correctly
aligned.

to avoid corruption we fail requests which are misaligned.

Signed-off-by: Peter Lieven <pl@kamp.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 91bea4e2bb1a5f7954a3b3a4f2e28e96bd25c458)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoiscsi: remove support for misaligned nb_sectors in aio_readv
Peter Lieven [Thu, 11 Jul 2013 12:16:26 +0000 (14:16 +0200)]
iscsi: remove support for misaligned nb_sectors in aio_readv

this hask is not working (anymore). support for misaligned offsets should
be handled at the block layer.

Signed-off-by: Peter Lieven <pl@kamp.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 7e4d5a9f94a0d8485bf63e1f8256e0a0014495ab)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoiscsi: fix -ENOSPC in iscsi_create()
Peter Lieven [Thu, 11 Jul 2013 12:16:24 +0000 (14:16 +0200)]
iscsi: fix -ENOSPC in iscsi_create()

the -ENOPSC case did not work due to the missing goto.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit d3bda7bc166f40326ba646ee145630bb1b59da96)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoahci: Fix FLUSH command
Kevin Wolf [Mon, 15 Jul 2013 09:25:55 +0000 (11:25 +0200)]
ahci: Fix FLUSH command

AHCI couldn't cope with asynchronous commands that aren't doing DMA, it
simply wouldn't complete them. Due to the bug fixed in commit f68ec837,
FLUSH commands would seem to have completed immediately even if they
were still running on the host. After the commit, they would simply hang
and never unset the BSY bit, rendering AHCI unusable on any OS sending
flushes.

This patch adds another callback for the completion of asynchronous
commands. This is what AHCI really wants to use for its command
completion logic rather than an DMA completion callback.

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqapi: qapi-commands: fix possible leaks on visitor dealloc
Luiz Capitulino [Thu, 11 Jul 2013 18:26:56 +0000 (14:26 -0400)]
qapi: qapi-commands: fix possible leaks on visitor dealloc

In qmp-marshal.c the dealloc visitor calls use the same errp
pointer of the input visitor calls. This means that if any of
the input visitor calls fails, then the dealloc visitor will
return early, before freeing the object's memory.

Here's an example, consider this code:

int qmp_marshal_input_block_passwd(Monitor *mon, const QDict *qdict, QObject **ret)
{
[...]

    char * device = NULL;
    char * password = NULL;

    mi = qmp_input_visitor_new_strict(QOBJECT(args));
    v = qmp_input_get_visitor(mi);
    visit_type_str(v, &device, "device", errp);
    visit_type_str(v, &password, "password", errp);
    qmp_input_visitor_cleanup(mi);

    if (error_is_set(errp)) {
        goto out;
    }
    qmp_block_passwd(device, password, errp);

out:
    md = qapi_dealloc_visitor_new();
    v = qapi_dealloc_get_visitor(md);
    visit_type_str(v, &device, "device", errp);
    visit_type_str(v, &password, "password", errp);
    qapi_dealloc_visitor_cleanup(md);

[...]

    return 0;
}

Consider errp != NULL when the out label is reached, we're going
to leak device and password.

This patch fixes this by always passing errp=NULL for dealloc
visitors, meaning that we always try to free them regardless of
any previous failure. The above example would then be:

out:
    md = qapi_dealloc_visitor_new();
    v = qapi_dealloc_get_visitor(md);
    visit_type_str(v, &device, "device", NULL);
    visit_type_str(v, &password, "password", NULL);
    qapi_dealloc_visitor_cleanup(md);

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit 8f91ad8a1b4702966d91ea58cd90bbde1faea1b3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoseccomp: add the asynchronous I/O syscalls to the whitelist
Paul Moore [Wed, 29 May 2013 20:30:01 +0000 (16:30 -0400)]
seccomp: add the asynchronous I/O syscalls to the whitelist

In order to enable the asynchronous I/O functionality when using the
seccomp sandbox we need to add the associated syscalls to the
whitelist.

Signed-off-by: Paul Moore <pmoore@redhat.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Message-id: 20130529203001.20939.83322.stgit@localhost
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit fd21faadb12669e24eaf0a277de61c24fcde4cac)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqom: Fix class cast of NULL classes
Peter Crosthwaite [Tue, 18 Jun 2013 09:18:59 +0000 (19:18 +1000)]
qom: Fix class cast of NULL classes

Its clear from the implementation that class casting is supposed to work
with a NULL class argument. Guard all dereferences of the class argument
against NULL accordingly.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 94cd5ba46b74eea289a7e582635820c1c54e66fa.1371546907.git.peter.crosthwaite@xilinx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 9d6a3d58e4d1431ab3809ff621cfd1f9ec75eef5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-openrisc: Fix typename in openrisc_cpu_class_by_name()
Dongxue Zhang [Tue, 2 Jul 2013 09:11:55 +0000 (17:11 +0800)]
target-openrisc: Fix typename in openrisc_cpu_class_by_name()

Commit 478032a93d908e59085c1ac56f10979942e7dc4f (target-openrisc:
Rename CPU subtypes) suffixed CPU sub-types with "-or32-cpu" but forgot
to update openrisc_cpu_class_by_name(), so that it was still looking for
the types without suffix.

Make target-openrisc running OK by adding the suffix to the model name.

This means it is no longer possible to use -cpu or1200-or32-cpu or
-cpu any-or32-cpu though.

Cc: qemu-stable@nongnu.org
Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
Tested-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 071b3364e7995036816aa4ebf80ecfa04b1a31de)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoblock: fix bdrv_flush() ordering in bdrv_close()
Stefan Hajnoczi [Tue, 2 Jul 2013 13:36:25 +0000 (15:36 +0200)]
block: fix bdrv_flush() ordering in bdrv_close()

Since 80ccf93b we flush the block device during close.  The
bdrv_drain_all() call should come before bdrv_flush() to ensure guest
write requests have completed.  Otherwise we may miss pending writes
when flushing.

Call bdrv_drain_all() again for safety as the final step after
bdrv_flush().  This should not be necessary but we can be paranoid here
in case bdrv_flush() left I/O pending.

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-xtensa: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 18:05:21 +0000 (20:05 +0200)]
target-xtensa: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit ae06d4988d6799f0bd16f27c2bcf80fa1cd2cfd7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-moxie: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 18:04:28 +0000 (20:04 +0200)]
target-moxie: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 13cccc692818a570d1fb1326c84d3edae68987aa)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-microblaze: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 18:03:00 +0000 (20:03 +0200)]
target-microblaze: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit fd327f48f7e5892318b6dca2c9c6030618f65728)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-lm32: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 17:35:02 +0000 (19:35 +0200)]
target-lm32: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 28014bcab244e968cb03f20384943494bd069ee0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-cris: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 17:30:14 +0000 (19:30 +0200)]
target-cris: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 6f47ec50db92b4bc77de06661a9e7a3eb538b660)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu-char: Fix ID reuse after chardev-remove for qapi-based init
Markus Armbruster [Thu, 27 Jun 2013 13:25:12 +0000 (15:25 +0200)]
qemu-char: Fix ID reuse after chardev-remove for qapi-based init

Commit 2c5f488 introduced qapi-based character device initialization
as a new code path in qemu_chr_new_from_opts().  Unfortunately, it
failed to store parameter opts in the new chardev.  Therefore,
qemu_chr_delete() doesn't delete it.  Even though the device is gone,
its options linger, and any attempt to create another one with the
same ID fails.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1372339512-28149-1-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2ea3e2c1e85097c45a882dbc1fbba4a7fdb3ff1c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agokvmclock: clock should count only if vm is running
Marcelo Tosatti [Tue, 18 Jun 2013 23:38:25 +0000 (20:38 -0300)]
kvmclock: clock should count only if vm is running

kvmclock should not count while vm is paused, because:

1) if the vm is paused for long periods, timekeeping
math can overflow while converting the (large) clocksource
delta to nanoseconds.

2) Users rely on CLOCK_MONOTONIC to count run time, that is,
time which OS has been in a runnable state (see CLOCK_BOOTTIME).

Change kvmclock driver so as to save clock value when vm transitions
from runnable to stopped state, and to restore clock value from stopped
to runnable transition.

Cc: qemu-stable@nongnu.org
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 00f4d64ee76e873be881a82d893a591487aa7950)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoraw-posix: Fix /dev/cdrom magic on OS X
Kevin Wolf [Tue, 11 Jun 2013 08:44:58 +0000 (10:44 +0200)]
raw-posix: Fix /dev/cdrom magic on OS X

The raw-posix driver has code to provide a /dev/cdrom on OS X even
though it doesn't really exist. However, since commit c66a6157 the real
filename is dismissed after finding it, so opening /dev/cdrom fails.
Put the filename back into the options QDict to make this work again.

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agomigration: do not overwrite zero pages
Peter Lieven [Mon, 10 Jun 2013 10:14:20 +0000 (12:14 +0200)]
migration: do not overwrite zero pages

on incoming migration do not memset pages to zero if they already read as zero.
this will allocate a new zero page and consume memory unnecessarily. even
if we madvise a MADV_DONTNEED later this will only deallocate the memory
asynchronously.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 211ea74022f51164a7729030b28eec90b6c99a08)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoRevert "migration: do not sent zero pages in bulk stage"
Peter Lieven [Mon, 10 Jun 2013 10:14:19 +0000 (12:14 +0200)]
Revert "migration: do not sent zero pages in bulk stage"

Not sending zero pages breaks migration if a page is zero
at the source but not at the destination. This can e.g. happen
if different BIOS versions are used at source and destination.
It has also been reported that migration on pseries is completely
broken with this patch.

This effectively reverts commit f1c72795af573b24a7da5eb52375c9aba8a37972.

Conflicts:

arch_init.c

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 9ef051e5536b6368a1076046ec6c4ec4ac12b5c6)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovmdk: remove wrong calculation of relative path
Fam Zheng [Wed, 26 Jun 2013 09:24:32 +0000 (17:24 +0800)]
vmdk: remove wrong calculation of relative path

When creating image with backing file, the driver tries to calculate the
relative path from created image file to backing file, but the path
computation is incorrect. e.g.:

    $ qemu-img create -f vmdk -b vmdk-data-disk.vmdk vmdk-data-snapshot1
    Formatting 'vmdk-data-snapshot1', fmt=vmdk size=10737418240
    backing_file='vmdk-data-disk.vmdk' compat6=off zeroed_grain=off

    $ qemu-img info vmdk-data-snapshot1
    image: vmdk-data-snapshot1
    file format: vmdk
    virtual size: 10G (10737418240 bytes)
    disk size: 12K
->  backing file: disk.vmdk

The common part in file names, "vmdk-data-", is incorrectly forgotten by
relative_path(). As the VMDK specification has no restriction on
parentNameHint to be relative path, we simply remove this by using the
backing_file option.

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 8ed610a1c983dd2ed1eed8841036af55751d115f)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agogluster: Return bdrv_has_zero_init = 0
Kevin Wolf [Wed, 26 Jun 2013 07:41:57 +0000 (09:41 +0200)]
gluster: Return bdrv_has_zero_init = 0

GlusterFS volumes can be backed by block devices, in which case
bdrv_create() doesn't make sure that the image is zeroed out. It is
currently not possibly to detect whether a given image is backed by a
file or a block device, and incorrectly assuming that it is zeroed
corrupts images during qemu-img convert, so let's err on the side of
caution and always return 0.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 8ab6feec2c7500faafd9a4571fb40d03dd360a64)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoblock/ssh: Set bdrv_has_zero_init according to the file type.
Richard W.M. Jones [Tue, 25 Jun 2013 17:15:18 +0000 (18:15 +0100)]
block/ssh: Set bdrv_has_zero_init according to the file type.

If the remote is a regular file, set it to true (ie. reads of
uninitialized areas in a newly created file will return zeroes).
If we can't prove that, return false (a safe default).

Tested by adding a debugging print statement [not part of this commit]
and creating a remote file and a remote block device:

  $ ./qemu-img create ssh://localhost/tmp/new 100M
  Formatting 'ssh://localhost/tmp/new', fmt=raw size=104857600
  filename ssh://localhost/tmp/new: has_zero_init = 1
  $ sudo lvcreate -L 1G -n tmp /dev/fedora
    Logical volume "tmp" created
  $ ./qemu-img create ssh://localhost/dev/fedora/tmp 1G
  Formatting 'ssh://localhost/dev/fedora/tmp', fmt=raw size=1073741824
  filename ssh://localhost/dev/fedora/tmp: has_zero_init = 0

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 0b3f21e6a99c025c829d342ee417f317fe2e03b2)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoFix iSCSI crash on SG_IO with an iovector
Ronnie Sahlberg [Sun, 23 Jun 2013 15:07:08 +0000 (08:07 -0700)]
Fix iSCSI crash on SG_IO with an iovector

Don't assume that SG_IO is always invoked with a simple buffer,
check the iovec_count and if it is >= 1 then we need to pass an array
of iovectors to libiscsi instead of just a plain buffer.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 0a53f010745635c39a83756a948df60a84e88fe5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agos390/ipl: Fix boot order
Christian Borntraeger [Tue, 18 Jun 2013 12:31:52 +0000 (14:31 +0200)]
s390/ipl: Fix boot order

The latest ipl code adaptions collided with some of the virtio
refactoring rework. This resulted in always booting the first
disk. Let's fix booting from a given ID.
The new code also checks for command lines without bootindex to
avoid random behaviour when accessing dev_st (==0).

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit 5c8ded6ef55761e80353f42d8e59c6e233a2f51a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agousb-host-libusb: set USB_DEV_FLAG_IS_HOST
Gerd Hoffmann [Wed, 12 Jun 2013 11:17:02 +0000 (13:17 +0200)]
usb-host-libusb: set USB_DEV_FLAG_IS_HOST

... like host-{linux,bsd}.c do.

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoacl: acl_add can't insert before last list element, fix
Markus Armbruster [Tue, 18 Jun 2013 08:05:23 +0000 (10:05 +0200)]
acl: acl_add can't insert before last list element, fix

Watch this:

    $ upstream-qemu -nodefaults -S -vnc :0,acl,sasl -monitor stdio
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) acl_add vnc.username drei allow
    acl: added rule at position 1
    (qemu) acl_show vnc.username
    policy: deny
    1: allow drei
    (qemu) acl_add vnc.username zwei allow 1
    acl: added rule at position 2
    (qemu) acl_show vnc.username
    policy: deny
    1: allow drei
    2: allow zwei
    (qemu) acl_add vnc.username eins allow 1
    acl: added rule at position 1
    (qemu) acl_show vnc.username
    policy: deny
    1: allow eins
    2: allow drei
    3: allow zwei

The second acl_add inserts at position 2 instead of 1.

Root cause is an off-by-one in qemu_acl_insert(): when index ==
acl->nentries, it appends instead of inserting before the last list
element.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 4999f3a8a6009de05ba82e58e723277917f16254)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio-scsi: forward scsibus for virtio-scsi-pci.
KONRAD Frederic [Wed, 12 Jun 2013 06:15:17 +0000 (08:15 +0200)]
virtio-scsi: forward scsibus for virtio-scsi-pci.

This fix a bug with scsi hotplug on virtio-scsi-pci:

As virtio-scsi-pci doesn't have any scsi bus, we need to forward scsi-hot-add
to the virtio-scsi-device plugged on the virtio-bus.

Cc: qemu-stable@nongnu.org
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqxl: Fix QXLRam initialisation.
Anthony PERARD [Mon, 17 Jun 2013 16:38:26 +0000 (17:38 +0100)]
qxl: Fix QXLRam initialisation.

The qxl driver expect NULL for QXLRam.memory_configs, but this is never
initialized.

If memory is set to 0xc2c2.., it leads to a spice-critical error when
trying to start qxl.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 329f97fc4ff4b533fcd2d8f4eab6c9c2568aed27)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoppc: do not register IABR SPR twice for 603e
Hervé Poussineau [Sat, 11 May 2013 19:03:50 +0000 (21:03 +0200)]
ppc: do not register IABR SPR twice for 603e

IABR SPR is already registered in gen_spr_603(), called from init_proc_603E().

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit 9fea2ae25080ad790d7d904d01a1300a45a634eb)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoarm/boot: Free dtb blob memory after use
Peter Maydell [Tue, 25 Jun 2013 17:34:13 +0000 (18:34 +0100)]
arm/boot: Free dtb blob memory after use

The dtb blob returned by load_device_tree() is in memory allocated
with g_malloc(). Free it accordingly once we have copied its
contents into the guest memory. To make this easy, we need also to
clean up the error handling in load_dtb() so that we consistently
handle errors in the same way (by printing a message and then
returning -1, rather than either plowing on or exiting immediately).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1371209256-11408-1-git-send-email-peter.maydell@linaro.org
(cherry picked from commit c23045ded7571f0eaad95920ab00b6bc9c3a91e6)

Conflicts:

hw/arm/boot.c

* updated to include #ifdef for CONFIG_FDT

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agos390/virtio-ccw: Fix virtio reset
Christian Borntraeger [Fri, 7 Jun 2013 10:18:46 +0000 (12:18 +0200)]
s390/virtio-ccw: Fix virtio reset

On virtio reset we must reset the indicator to avoid stale interrupts,
e.g. after a reset.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
(cherry picked from commit 6504a93011138458a2e4f67b513c5a77bdb3cae1)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoUpdate VERSION for 1.5.2 release v1.5.2
Michael Roth [Thu, 25 Jul 2013 19:52:08 +0000 (14:52 -0500)]
Update VERSION for 1.5.2 release

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqga: escape cmdline args when registering win32 service (CVE-2013-2231)
Laszlo Ersek [Wed, 3 Jul 2013 13:14:10 +0000 (15:14 +0200)]
qga: escape cmdline args when registering win32 service (CVE-2013-2231)

Reported-by: Lev Veyde <lveyde@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoga_install_service(): nest error paths more idiomatically
Laszlo Ersek [Wed, 3 Jul 2013 13:14:09 +0000 (15:14 +0200)]
ga_install_service(): nest error paths more idiomatically

Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqga/service-win32.c: diagnostic output should go to stderr
Laszlo Ersek [Wed, 3 Jul 2013 13:14:08 +0000 (15:14 +0200)]
qga/service-win32.c: diagnostic output should go to stderr

Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqga: save state directory in ga_install_service()
Laszlo Ersek [Sat, 18 May 2013 04:31:53 +0000 (06:31 +0200)]
qga: save state directory in ga_install_service()

If the user selects a non-default state directory at service installation
time, we should remember it in the registered service.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit a839ee77c786a8200c76ca92f697eebf6bcc9aa3)

* modified to save state_dir unconditionally an avoid reliance on
  uncommitted CSIDL_COMMON_APPDATA dependencies

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqga: remove undefined behavior in ga_install_service()
Laszlo Ersek [Sat, 18 May 2013 04:31:52 +0000 (06:31 +0200)]
qga: remove undefined behavior in ga_install_service()

We shouldn't snprintf() from a buffer to the same buffer.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit a880845f3d92e508e43fcc38f0631b91c203e5d5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoUpdate VERSION for 1.5.1 release v1.5.1
Anthony Liguori [Wed, 26 Jun 2013 21:46:50 +0000 (16:46 -0500)]
Update VERSION for 1.5.1 release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agowdt_i6300esb: fix vmstate versioning
Michael Roth [Wed, 22 May 2013 16:32:51 +0000 (11:32 -0500)]
wdt_i6300esb: fix vmstate versioning

When this VMSD was introduced it's version fields were set to
sizeof(I6300State), making them essentially random from build to build,
version to version.

To fix this, we lock in a high version id and low minimum version id to
support old->new migration from all prior versions of this device's
state. This should work since the device state has not changed since
its introduction.

The potentially breaks migration from 1.5+ to 1.5, but since the
versioning was essentially random prior to this patch, new->old
migration was not consistently functional to begin with.

Reported-by: Nicholas Thomas <nick@bytemark.co.uk>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit c1990468d5a13c8f1d9111fcca0a78a6adad062b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovirtio-rng: Fix crash with non-default backend
Cole Robinson [Fri, 31 May 2013 18:12:48 +0000 (14:12 -0400)]
virtio-rng: Fix crash with non-default backend

'default_backend' isn't always set, but 'rng' is, so use that.

$ ./x86_64-softmmu/qemu-system-x86_64 -object rng-random,id=rng0,filename=/dev/random -device virtio-rng-pci,rng=rng0
Segmentation fault (core dumped)

Regressed with virtio refactoring in 59ccd20a9ac719cff82180429458728f03ec612f

CC: qemu-stable@nongnu.org
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: bf4505014a0a941dbd3c62068f3cf2c496b69e6a.1370023944.git.crobinso@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 5b456438f5bb395ed6b1eec95e18ce7a7a884a0a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoiscsi: reorganize iscsi_readcapacity_sync
Paolo Bonzini [Fri, 31 May 2013 11:56:24 +0000 (13:56 +0200)]
iscsi: reorganize iscsi_readcapacity_sync

Avoid the goto, and use the same retry logic for the 10- and 16-
byte versions.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 1288844e7c4ede59509bf697a4cca0f2215a1ce3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoiscsi: simplify freeing of tasks
Paolo Bonzini [Fri, 31 May 2013 11:47:08 +0000 (13:47 +0200)]
iscsi: simplify freeing of tasks

Always free them in the iscsi_aio_*_acb functions and remove the
checks in their callers.  Remove ifs when the task struct was
previously dereferenced (spotted by Coverity).

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

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovhost-scsi: fix k->set_guest_notifiers() NULL dereference
Stefan Hajnoczi [Thu, 30 May 2013 14:14:44 +0000 (16:14 +0200)]
vhost-scsi: fix k->set_guest_notifiers() NULL dereference

Coverity picked up a copy-paste bug.  In vhost_scsi_start() we check for
!k->set_guest_notifiers and error out.  The check probably got copied
but instead of erroring we actually use the function pointer!

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Asias He <asias@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 0e22a2d18998fd183c8181663981eb681ca977e9)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoscsi-disk: scsi-block device for scsi pass-through should not be removable
Pavel Hrdina [Wed, 29 May 2013 13:47:23 +0000 (15:47 +0200)]
scsi-disk: scsi-block device for scsi pass-through should not be removable

This patch adds a new SCSI_DISK_F_NO_REMOVABLE_DEVOPS feature. By this
feature we can set that the scsi-block (scsi pass-through) device will still
be removable from the guest side, but from monitor it cannot be removed.

Cc: qemu-stable@nongnu.org
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 18e673b8f350e1d789b8a50d209eb4a4252ebbda)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoscsi-generic: check the return value of bdrv_aio_ioctl in execute_command
Pavel Hrdina [Wed, 29 May 2013 12:12:10 +0000 (14:12 +0200)]
scsi-generic: check the return value of bdrv_aio_ioctl in execute_command

This fixes the bug introduced by this commit ad54ae80c73f.
The bdrv_aio_ioctl() still could return null and we should return an error
in that case.

Cc: qemu-stable@nongnu.org
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit d836f8d35dc418e24c3b11e2ea67d361b867b650)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoscsi-generic: fix sign extension of READ CAPACITY(10) data
Paolo Bonzini [Tue, 21 May 2013 12:08:53 +0000 (14:08 +0200)]
scsi-generic: fix sign extension of READ CAPACITY(10) data

Issuing the READ CAPACITY(10) command in the guest will cause QEMU
to update its knowledge of the maximum accessible LBA in the disk.
The recorded maximum LBA will be wrong if the disk is bigger than
1TB, because ldl_be_p returns a signed int.

When this is fixed, a latent bug will be unmasked.  If the READ
CAPACITY(10) command reported an overflow (0xFFFFFFFF), we must
not overwrite the previously-known maximum accessible LBA, or the guest
will fail to access the disk above the first 2TB.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 53254e569f8e07501f3e0098bd57d2b780e52faa)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoscsi: reset cdrom tray statuses on scsi_disk_reset
Pavel Hrdina [Mon, 20 May 2013 11:06:47 +0000 (13:06 +0200)]
scsi: reset cdrom tray statuses on scsi_disk_reset

Tray statuses should be also reset. Some guests may lock the tray and
right after resetting the guest it should be unlocked and closed. This
is done on power-on, reset and resume from suspend/hibernate on bare-metal.

This fix is already committed for IDE CD.
Check the commit a7f3d65b65b8c86a5ff0c0abcfefb45e2ec6fe4c.

Test results on bare-metal:
  - on reset/power-on the CD-ROM tray is closed even before the monitor
    is turned on
  - on resume from suspend/hibernate the tray is also closed before
    the monitor is turned on

From test results it seems that this behavior is OS and probably BIOS
independent.

Cc: qemu-stable@nongnu.org
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 7721c7f7c272fd2ed9d58500b7e99c33ab8a1af1)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agonbd: strip braces from literal IPv6 address in URI
Ján Tomko [Mon, 3 Jun 2013 15:54:56 +0000 (17:54 +0200)]
nbd: strip braces from literal IPv6 address in URI

Otherwise they would get passed to getaddrinfo and fail with:
address resolution failed for [::1]:1234: Name or service not known

(Broken by commit v1.4.0-736-gf17c90b)

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 23307908790cd8fad91220863d7712c571ddc977)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu-socket: allow hostnames starting with a digit
Ján Tomko [Mon, 3 Jun 2013 15:54:55 +0000 (17:54 +0200)]
qemu-socket: allow hostnames starting with a digit

According to RFC 1123 [1], hostnames can start with a digit too.

[1] http://tools.ietf.org/html/rfc1123#page-13

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Cc: qemu-stable@nongnu.org
[Use strspn, not strcspn. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 391b7b9701ba3318e890ec0cba97a3c654bfa667)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovmdk: byteswap VMDK4Header.desc_offset field
Stefan Hajnoczi [Mon, 10 Jun 2013 09:07:33 +0000 (11:07 +0200)]
vmdk: byteswap VMDK4Header.desc_offset field

Remember to byteswap VMDK4Header.desc_offset on big-endian machines.

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 5a394b9e96eb3c39676353bdf8a230180ae8d6f4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-i386: cpu: Fix potential buffer overrun in get_register_name_32()
Igor Mammedov [Mon, 3 Jun 2013 16:23:27 +0000 (18:23 +0200)]
target-i386: cpu: Fix potential buffer overrun in get_register_name_32()

Spotted by Coverity,
x86_reg_info_32[] is CPU_NB_REGS32 elements long, so accessing
x86_reg_info_32[CPU_NB_REGS32] will be one element off array.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 31ccdde298d98b08526dc23059071c9086dec6c2)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agopc: Fix crash when attempting to hotplug CPU with negative ID
Igor Mammedov [Thu, 30 May 2013 15:09:34 +0000 (17:09 +0200)]
pc: Fix crash when attempting to hotplug CPU with negative ID

QMP command "{ 'execute': 'cpu-add', 'arguments': { 'id': -1 }}" may cause
QEMU SIGSEGV at:
 piix4_cpu_hotplug_req ()
    ...
    g->sts[cpu_id / 8] |= (1 << (cpu_id % 8));
    ...

Since for PC in current implementation id should be in range [0...maxcpus)
and maxcpus is already checked, add check for lower bound and error out
on incorrect value.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 8de433cb0820dc1f387a2d580d255744aacd60cc)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agosmbios: Check R in -smbios type=0, release=R parses okay
Markus Armbruster [Fri, 7 Jun 2013 13:00:36 +0000 (15:00 +0200)]
smbios: Check R in -smbios type=0, release=R parses okay

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-7-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 6e5c4540d18d1e9a5253104df161a7e0d408ca95)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agosmbios: Fix -smbios type=0, release=... for big endian hosts
Markus Armbruster [Fri, 7 Jun 2013 13:00:35 +0000 (15:00 +0200)]
smbios: Fix -smbios type=0, release=... for big endian hosts

Classic endianness bug due to careless dirty coding: assuming reading
a byte from an int variable gets the least significant byte.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-6-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 527cd96f15348f4454d5bb71f69aaeb95461c90e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agosmbios: Clean up smbios_add_field() parameters
Markus Armbruster [Fri, 7 Jun 2013 13:00:34 +0000 (15:00 +0200)]
smbios: Clean up smbios_add_field() parameters

Having size precede the associated pointer is odd.  Swap them, and fix
up the types.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-5-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit ebc85e3f724d17530e74df665d1a30fb9b0041b5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agosmbios: Convert to error_report()
Markus Armbruster [Fri, 7 Jun 2013 13:00:33 +0000 (15:00 +0200)]
smbios: Convert to error_report()

Improves diagnistics from ad hoc messages like

    Invalid SMBIOS UUID string

to

    qemu-system-x86_64: -smbios type=1,uuid=gaga: Invalid UUID

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 5bb95e41868b461f37159efb48908828ebd7ab36)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agolog.h: Supply missing includes
Markus Armbruster [Fri, 7 Jun 2013 13:00:32 +0000 (15:00 +0200)]
log.h: Supply missing includes

<stdio.h> has always been missing.  Rest missed in commit eeacee4.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit f3eededb2fbc73c73daf08f791f0407b8541f4f4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoerror-report.h: Supply missing include
Markus Armbruster [Fri, 7 Jun 2013 13:00:31 +0000 (15:00 +0200)]
error-report.h: Supply missing include

Missed in commit e5924d8.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit b293796fd71009ecffe4343713a4e4e568c33fb0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotcg-ppc64: rotr_i32 rotates wrong amount
Anton Blanchard [Sun, 2 Jun 2013 12:30:18 +0000 (22:30 +1000)]
tcg-ppc64: rotr_i32 rotates wrong amount

rotr_i32 calculates the amount to left shift and puts it into a
temporary, but then doesn't use it when doing the shift.

Cc: qemu-stable@nongnu.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
(cherry picked from commit d1bdd3af49f227dd4a4b03b90cb020c55cbed440)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotcg-ppc64: Fix add2_i64
Anton Blanchard [Sun, 2 Jun 2013 12:29:39 +0000 (22:29 +1000)]
tcg-ppc64: Fix add2_i64

add2_i64 was adding the lower double word to the upper double word
of each input. Fix this so we add the lower double words, then the
upper double words with carry propagation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
(cherry picked from commit 84247357104044b8c4ec4a634e84769f432cbe52)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotcg-ppc64: bswap64 rotates output 32 bits
Anton Blanchard [Sun, 2 Jun 2013 12:28:27 +0000 (22:28 +1000)]
tcg-ppc64: bswap64 rotates output 32 bits

If our input and output is in the same register, bswap64 tries to
undo a rotate of the input. This just ends up rotating the output.

Cc: qemu-stable@nongnu.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
(cherry picked from commit 82e0f9170ac9307de4fc15bfb4d12d5534550322)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotcg-ppc64: Fix RLDCL opcode
Anton Blanchard [Tue, 11 Jun 2013 11:19:35 +0000 (21:19 +1000)]
tcg-ppc64: Fix RLDCL opcode

The rldcl instruction doesn't have an sh field, so the minor opcode
is shifted 1 bit. We were using the XO30 macro which shifted the
minor opcode 2 bits.

Remove XO30 and add MD30 and MDS30 macros which match the
Power ISA categories.

Cc: qemu-stable@nongnu.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
(cherry picked from commit 8a94cfb05ea9a8991c832236b4174d354025a7b7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoivshmem: add missing error exit(2)
Stefan Hajnoczi [Mon, 3 Jun 2013 08:58:31 +0000 (10:58 +0200)]
ivshmem: add missing error exit(2)

If the user fails to specify 'chardev' or 'shm' then we cannot continue.
Exit right away so that we don't invoke shm_open(3) with a NULL pointer.

It would be nice to replace exit(1) with error returns in the PCI device
.init() function, but leave that for another patch since exit(1) is
currently used elsewhere.

Spotted by Coverity.

Cc: Cam Macdonell <cam@cs.ualberta.ca>
Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit baefb8bf8e4a708c601bbab898a6039cd9cd12e3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoMakefile: Install qemu-img and qemu-nbd man pages only if built
Andreas Färber [Tue, 11 Jun 2013 11:13:58 +0000 (13:13 +0200)]
Makefile: Install qemu-img and qemu-nbd man pages only if built

When splitting openSUSE's qemu and qemu-linux-user packages we noticed
that for linux-user-only builds unrelated man pages got installed.
It's surely possible to delete them before packaging, but not installing
them in the first place seems more logical.

Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 8a3e8f7fd8144343f6c83e810b988c1e8a99d50a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotap: fix NULL dereference when passing invalid parameters to tap
Jason Wang [Tue, 4 Jun 2013 05:18:17 +0000 (13:18 +0800)]
tap: fix NULL dereference when passing invalid parameters to tap

This patch forbid the following invalid parameters to tap:

1) fd and vhostfds were specified but vhostfd were not specified
2) vhostfds were specified but fds were not specified
3) fds and vhostfd were specified

For 1 and 2, net_init_tap_one() will still pass NULL as vhostfdname to
monitor_handle_fd_param(), which may crash the qemu.

Also remove the unnecessary has_fd check.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <shajnocz@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit c87826a878be05208c3906eb9d5e1f37cff5e98e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agocreate qemu_openpty_raw() helper function and move it to a separate file
Michael Tokarev [Wed, 5 Jun 2013 14:44:54 +0000 (18:44 +0400)]
create qemu_openpty_raw() helper function and move it to a separate file

In two places qemu uses openpty() which is very system-dependent,
and in both places the pty is switched to raw mode as well.
Make a wrapper function which does both steps, and move all the
system-dependent complexity into a separate file, together
with static/local implementations of openpty() and cfmakeraw()
from qemu-char.c.

It is in a separate file, not part of oslib-posix.c, because
openpty() often resides in -lutil which is not linked to
every program qemu builds.

This change removes #including of <pty.h>, <termios.h>
and other rather specific system headers out of qemu-common.h,
which isn't a place for such specific headers really.

This version has been verified to build correctly on Linux,
OpenBSD, FreeBSD and OpenIndiana.  On the latter it lets qemu
to be built with gtk gui which were not possible there due to
missing openpty() and cfmakeraw().

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Andreas Färber <andreas.faerber@web.de>
(cherry picked from commit 4efeabbbe8441cc327052304976c7b9b86309d72)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoblockdev: reset werror/rerror on drive_del
Stefan Hajnoczi [Wed, 5 Jun 2013 08:33:14 +0000 (10:33 +0200)]
blockdev: reset werror/rerror on drive_del

Paolo Bonzini <pbonzini@redhat.com> suggested the following test case:

1. Launch a guest and wait at the GRUB boot menu:

  qemu-system-x86_64 -enable-kvm -m 1024 \
   -drive if=none,cache=none,file=test.img,id=foo,werror=stop,rerror=stop
   -device virtio-blk-pci,drive=foo,id=virtio0,addr=4

2. Hot unplug the device:

  (qemu) drive_del foo

3. Select the first boot menu entry

Without this patch the guest pauses due to ENOMEDIUM.  The guest is
stuck in a continuous pause loop since the I/O request is retried and
fails immediately again when the guest is resumed.

With this patch the error is reported to the guest.

Note that this scenario actually happens sometimes during libvirt disk
hot unplug, where device_del is followed by drive_del.  I/O may still be
submitted to the drive after drive_del if the guest does not process the
PCI hot unplug notification.

Reported-by: Dafna Ron <dron@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 293c51a6ee369228633a8428ab689f14c045ff98)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoq35: set fw_name
Michael S. Tsirkin [Thu, 30 May 2013 08:35:23 +0000 (11:35 +0300)]
q35: set fw_name

PCI host bridges need to set fw_name to be discoverable
by bios for boot device selection.

In particular, seabios expects root device to be called
"/pci/@i0cf8", so let's set it up like that for Q35.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Amos Kong <akong@redhat.com>
(cherry picked from commit 68c0e134a090666246b467deaf9046e573b089f2)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agotarget-i386: Fix aflag logic for CODE64 and the 0x67 prefix
Richard Henderson [Wed, 29 May 2013 19:30:51 +0000 (12:30 -0700)]
target-i386: Fix aflag logic for CODE64 and the 0x67 prefix

The code reorganization in commit 4a6fd938 broke handling of PREFIX_ADR.
While fixing this, tidy and comment the code so that it's more obvious
what's going on in setting both aflag and dflag.

The TARGET_X86_64 ifdef can be eliminated because CODE64 expands to the
constant zero when TARGET_X86_64 is undefined.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1369855851-21400-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit dec3fc9657e0682637de4d5a29d947284d01985c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqemu-char: don't issue CHR_EVENT_OPEN in a BH
Michael Roth [Fri, 7 Jun 2013 20:19:53 +0000 (15:19 -0500)]
qemu-char: don't issue CHR_EVENT_OPEN in a BH

When CHR_EVENT_OPENED was initially added, it was CHR_EVENT_RESET,
and it was issued as a bottom-half:

86e94dea5b740dad65446c857f6959eae43e0ba6

Which we basically used to print out a greeting/prompt for the
monitor.

AFAICT the only reason this was ever done in a BH was because in
some cases we'd modify the chr_write handler for a new chardev
backend *after* the site where we issued the reset (see:
86e94d:qemu_chr_open_stdio())

At some point this event was renamed to CHR_EVENT_OPENED, and we've
maintained the use of this BH ever since.

However, due to 9f939df955a4152aad69a19a77e0898631bb2c18, we schedule
the BH via g_idle_add(), which is causing events to sometimes be
delivered after we've already begun processing data from backends,
leading to:

 known bugs:

  QMP:
    session negotation resets with OPENED event, in some cases this
    is causing new sessions to get sporadically reset

 potential bugs:

  hw/usb/redirect.c:
    can_read handler checks for dev->parser != NULL, which may be
    true if CLOSED BH has not been executed yet. In the past, OPENED
    quiesced outstanding CLOSED events prior to us reading client
    data. If it's delayed, our check may allow reads to occur even
    though we haven't processed the OPENED event yet, and when we
    do finally get the OPENED event, our state may get reset.

  qtest.c:
    can begin session before OPENED event is processed, leading to
    a spurious reset of the system and irq_levels

  gdbstub.c:
    may start a gdb session prior to the machine being paused

To fix these, let's just drop the BH.

Since the initial reasoning for using it still applies to an extent,
work around that by deferring the delivery of CHR_EVENT_OPENED until
after the chardevs have been fully initialized, toward the end of
qmp_chardev_add() (or some cases, qemu_chr_new_from_opts()). This
defers delivery long enough that we can be assured a CharDriverState
is fully initialized before CHR_EVENT_OPENED is sent.

Also, rather than requiring each chardev to do an explicit open, do it
automatically, and allow the small few who don't desire such behavior to
suppress the OPENED-on-init behavior by setting a 'explicit_be_open'
flag.

We additionally add missing OPENED events for stdio backends on w32,
which were previously not being issued, causing us to not recieve the
banner and initial prompts for qmp/hmp.

Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: 1370636393-21044-1-git-send-email-mdroth@linux.vnet.ibm.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit bd5c51ee6c4f1c79cae5ad2516d711a27b4ea8ec)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>