]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agousb-tablet: Don't claim wakeup capability for USB-2 version
Hans de Goede [Tue, 2 Apr 2013 17:15:05 +0000 (19:15 +0200)]
usb-tablet: Don't claim wakeup capability for USB-2 version

Our ehci code does not implement wakeup support, so claiming support for
it with usb-tablet in USB-2 mode causes all tablet events to get lost.

http://bugzilla.redhat.com/show_bug.cgi?id=929068

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: update docs for bus name change
Gerd Hoffmann [Tue, 2 Apr 2013 10:15:24 +0000 (12:15 +0200)]
usb: update docs for bus name change

At some point the default usb bus name changed from 'usb.0' to
'usb-bus.0' (probably as part of the qom conversion).  Update
the usb documentation accordingly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-hub: report status changes only once
Gerd Hoffmann [Wed, 20 Mar 2013 11:40:11 +0000 (12:40 +0100)]
usb-hub: report status changes only once

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-hub: limit chain length
Gerd Hoffmann [Wed, 20 Mar 2013 10:40:02 +0000 (11:40 +0100)]
usb-hub: limit chain length

USB supports up to 5 hubs chained.
Catch attempts to chain more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: zap unused name field
Gerd Hoffmann [Thu, 21 Mar 2013 09:55:53 +0000 (10:55 +0100)]
xhci: zap unused name field

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: remove unimplemented printfs
Gerd Hoffmann [Wed, 20 Mar 2013 11:49:42 +0000 (12:49 +0100)]
xhci: remove unimplemented printfs

Replace them with a tracepoint, so they don't spam stderr by default.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: remove leftover debug printf
Gerd Hoffmann [Wed, 20 Mar 2013 10:42:51 +0000 (11:42 +0100)]
xhci: remove leftover debug printf

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: fix numintrs sanity checks
Gerd Hoffmann [Tue, 19 Mar 2013 08:18:20 +0000 (09:18 +0100)]
xhci: fix numintrs sanity checks

Make sure numintrs is a power of two, msi requires this.

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

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Add flow control support
Hans de Goede [Tue, 19 Mar 2013 13:54:38 +0000 (14:54 +0100)]
usb-redir: Add flow control support

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb-redir: Fix crash on migration with no client connected
Hans de Goede [Fri, 15 Mar 2013 10:52:37 +0000 (11:52 +0100)]
usb-redir: Fix crash on migration with no client connected

If no client is connected on the src side, then we won't receive a
parser during migrate, in this case usbredir_post_load() should be a nop,
rather then to try to derefefence the NULL dev->parser pointer.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Tue, 2 Apr 2013 19:07:35 +0000 (14:07 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Stefan Hajnoczi
# Via Luiz Capitulino
* luiz/queue/qmp:
  chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors
  qemu-socket: set passed fd non-blocking in socket_connect()
  net: ensure "socket" backend uses non-blocking fds
  oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()

11 years agoconfigure: remove unset variables
Paolo Bonzini [Tue, 2 Apr 2013 15:57:56 +0000 (17:57 +0200)]
configure: remove unset variables

These variables have not been set for a long time.  Do not
include them in config-host.mak.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1364918276-11866-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agochardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors
Stefan Hajnoczi [Wed, 27 Mar 2013 09:10:46 +0000 (10:10 +0100)]
chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors

When we receive a file descriptor over a UNIX domain socket the
O_NONBLOCK flag is preserved.  Clear the O_NONBLOCK flag and rely on
QEMU file descriptor users like migration, SPICE, VNC, block layer, and
others to set non-blocking only when necessary.

This change ensures we don't accidentally expose O_NONBLOCK in the QMP
API.  QMP clients should not need to get the non-blocking state
"correct".

A recent real-world example was when libvirt passed a non-blocking TCP
socket for migration where we expected a blocking socket.  The source
QEMU produced a corrupted migration stream since its code did not cope
with non-blocking sockets.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqemu-socket: set passed fd non-blocking in socket_connect()
Stefan Hajnoczi [Wed, 27 Mar 2013 09:10:45 +0000 (10:10 +0100)]
qemu-socket: set passed fd non-blocking in socket_connect()

socket_connect() sets non-blocking on TCP or UNIX domain sockets if a
callback function is passed.  Do the same for file descriptor passing,
otherwise we could unexpectedly be using a blocking file descriptor.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agonet: ensure "socket" backend uses non-blocking fds
Stefan Hajnoczi [Wed, 27 Mar 2013 09:10:44 +0000 (10:10 +0100)]
net: ensure "socket" backend uses non-blocking fds

There are several code paths in net_init_socket() depending on how the
socket is created: file descriptor passing, UDP multicast, TCP, or UDP.
Some of these support both listen and connect.

Not all code paths set the socket to non-blocking.  This patch addresses
the file descriptor passing and UDP cases which were missing
socket_set_nonblock(fd) calls.

I considered moving socket_set_nonblock(fd) to a central location but it
turns out the code paths are different enough to require non-blocking at
different places.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agooslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
Stefan Hajnoczi [Wed, 27 Mar 2013 09:10:43 +0000 (10:10 +0100)]
oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()

The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.
Rename to qemu_set_nonblock() just like qemu_set_cloexec().

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoVMXNET3: initialize rx_ridx to eliminate compile warning
Wenchao Xia [Tue, 26 Mar 2013 02:24:06 +0000 (10:24 +0800)]
VMXNET3: initialize rx_ridx to eliminate compile warning

  Gcc report "hw/vmxnet3.c:972: error: ‘rx_ridx’ may be used
uninitialized in this function", so fix it.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Message-id: 1364264646-27542-1-git-send-email-xiawenc@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: only send deleted event if device was realized
Anthony Liguori [Wed, 27 Mar 2013 16:36:14 +0000 (11:36 -0500)]
qdev: only send deleted event if device was realized

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1364402174-16580-1-git-send-email-aliguori@us.ibm.com

11 years agoQOM-ify the TPM support
Stefan Berger [Thu, 28 Mar 2013 11:26:21 +0000 (07:26 -0400)]
QOM-ify the TPM support

QOM-ified the TPM support with much code borrowed from the rng implementation.

All other TPM related code moves will be provided in a subsequent patch.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Message-id: 1364469981.24703.1.camel@d941e-10
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: rewrite io_channel_send_all and drop the '_all' suffix
Anthony Liguori [Fri, 29 Mar 2013 16:39:50 +0000 (11:39 -0500)]
qemu-char: rewrite io_channel_send_all and drop the '_all' suffix

The current code is oddly written and have equally odd semantics.
Despite the '_all' suffix, upon EAGAIN the result will be a partial
write but instead of returning the partial write, we return EAGAIN.

Change the behavior to write as much as we can until we get an EAGAIN
returning a partial write if we do.

Reported-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1364575190-731-1-git-send-email-aliguori@us.ibm.com

11 years agoui/gtk: Set QEMU window icon
Stefan Weil [Sat, 30 Mar 2013 14:21:40 +0000 (15:21 +0100)]
ui/gtk: Set QEMU window icon

The QEMU icon which is already used for SDL
is now also loaded by GTK.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1364653300-26813-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopo: add French translation
Aurelien Jarno [Mon, 1 Apr 2013 17:12:06 +0000 (19:12 +0200)]
po: add French translation

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1364836326-8707-6-git-send-email-aurelien@aurel32.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopo: update existing translation files
Aurelien Jarno [Mon, 1 Apr 2013 17:12:05 +0000 (19:12 +0200)]
po: update existing translation files

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1364836326-8707-5-git-send-email-aurelien@aurel32.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopo/Makefile: correctly pass QEMU version
Aurelien Jarno [Mon, 1 Apr 2013 17:12:04 +0000 (19:12 +0200)]
po/Makefile: correctly pass QEMU version

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1364836326-8707-4-git-send-email-aurelien@aurel32.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopo/Makefile: simplify
Aurelien Jarno [Mon, 1 Apr 2013 17:12:03 +0000 (19:12 +0200)]
po/Makefile: simplify

In the hope we get more translations, we should not have to modify
po/Makefile for each of them.

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1364836326-8707-3-git-send-email-aurelien@aurel32.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agogtk: make more messages translatable
Aurelien Jarno [Mon, 1 Apr 2013 17:12:02 +0000 (19:12 +0200)]
gtk: make more messages translatable

Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1364836326-8707-2-git-send-email-aurelien@aurel32.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoappend the terminating '\0' to bootorder string
Amos Kong [Wed, 20 Mar 2013 10:16:34 +0000 (18:16 +0800)]
append the terminating '\0' to bootorder string

Problem was introduced in commit c8a6ae8b. The last terminating
'\0' was lost, use the right length 5 ("HALT\0").

Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Message-id: 1363774594-21001-1-git-send-email-akong@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20130401.0' into staging
Anthony Liguori [Tue, 2 Apr 2013 13:12:16 +0000 (08:12 -0500)]
Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20130401.0' into staging

vfio-pci pull request 20130401

# gpg: Signature made Mon 01 Apr 2013 02:40:45 PM CDT using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

# By Alex Williamson
# Via Alex Williamson
* awilliam/tags/vfio-pci-for-qemu-20130401.0:
  vfio: cleanup includes
  vfio: Add bootindex support
  vfio-pci: Move devices to D0 on reset
  vfio-pci: Add extra debugging
  qemu vfio-pci: Graphics device quirks
  qemu vfio-pci: Add support for VGA MMIO and I/O port access
  vfio-pci: Add PCIe capability mangling based on bus type
  vfio-pci: Generalize PCI config mangling
  linux-headers: Update to v3.9-rc2

11 years agomicroblaze: Add support for the sleep insn
Edgar E. Iglesias [Thu, 28 Mar 2013 21:59:03 +0000 (22:59 +0100)]
microblaze: Add support for the sleep insn

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
11 years agovfio: cleanup includes
Alex Williamson [Mon, 1 Apr 2013 19:35:40 +0000 (13:35 -0600)]
vfio: cleanup includes

Starting to get messy, put the back in alphabetical order.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agovfio: Add bootindex support
Alex Williamson [Mon, 1 Apr 2013 19:35:24 +0000 (13:35 -0600)]
vfio: Add bootindex support

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agovfio-pci: Move devices to D0 on reset
Alex Williamson [Mon, 1 Apr 2013 19:35:08 +0000 (13:35 -0600)]
vfio-pci: Move devices to D0 on reset

Guests may leave devices in a low power state at reboot, but we expect
devices to be woken up for the next boot.  Make this happen.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agovfio-pci: Add extra debugging
Alex Williamson [Mon, 1 Apr 2013 19:34:56 +0000 (13:34 -0600)]
vfio-pci: Add extra debugging

Often when debugging it's useful to be able to disable bypass paths
so no interactions with the device are missed.  Add some extra debug
options to do this.  Also add device info on read/write BAR accesses,
which is useful when debugging more than one assigned device.  A
couple DPRINTFs also had redundant "vfio:" prefixes.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agoqemu vfio-pci: Graphics device quirks
Alex Williamson [Mon, 1 Apr 2013 19:34:40 +0000 (13:34 -0600)]
qemu vfio-pci: Graphics device quirks

Graphics cards have a number of different backdoors.  Some of these
are alternative ways to get PCI BAR addresses, some of them are
complete mirrors of PCI config space available through MMIO and
I/O port access.  These quirks cover a number of ATI Radeon and
Nvidia devices.  On the ATI/AMD side, this should enable HD5450
and HD7850 and hopefully a host of devices around those generations.
For Nvidia, my card selection is much more dated.  A 8400gs works
well with both the Window shipped driver and the Nvidia downloaded
driver.  A 7300le works as well, with the caveat that generating
the Window experience index with the Nvidia driver causes the card
to reset several times before generating a BSOD.  An NVS 290 card
seems to run well with the shipped Windows driver, but generates
a BSOD with the Nvidia driver.  All of the Nvidia devices work with
the Linux Nvidia proprietary driver and nouveau, the HD5450 works
with either radeon or fglrx, HD7850 works with vesa and fglrx (not
supported by radeon).  Extremely limited 3D testing.

Device reset is also an issue with graphics.  It's unfortunately
very common that the devices offer no means to reset the card or
doesn't seem effective.  Nvidia devices are pretty good about being
able to get the device to a working state through the VGA BIOS init,
Radeon devices less so, and often require a host reboot.  Work
remains to be done here.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agoqemu vfio-pci: Add support for VGA MMIO and I/O port access
Alex Williamson [Mon, 1 Apr 2013 19:33:44 +0000 (13:33 -0600)]
qemu vfio-pci: Add support for VGA MMIO and I/O port access

Most VGA cards need some kind of quirk to fully operate since they
hide backdoors to get to other registers outside of PCI config space
within the registers, but this provides the base infrastructure.  If
we could identity map PCI resources for assigned devices we would need
a lot fewer quirks.

To enable this, use a kernel side vfio-pci driver that incorporates
VGA support (v3.9), and use the -vga none option and add the x-vga=on
option for the vfio-pci device.  The "x-" denotes this as an
experimental feature.  You may also need to use a cached copy of the
VGA BIOS for your device, passing it to vfio-pci using the romfile=
option.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agovfio-pci: Add PCIe capability mangling based on bus type
Alex Williamson [Mon, 1 Apr 2013 17:50:04 +0000 (11:50 -0600)]
vfio-pci: Add PCIe capability mangling based on bus type

Windows seems to pay particular interest to the PCIe header type of
devices and will fail to load drivers if we attach Endpoint devices or
Legacy Endpoint devices to the Root Complex.  We can use
pci_bus_is_express and pci_bus_is_root to determine the bus type and
mangle the type appropriately:

* Legacy PCI
  * No change, capability is unmodified for compatibility.
* PCI Express
  * Integrated Root Complex Endpoint -> Endpoint
* PCI Express Root Complex
  * Endpoint -> Integrated Root Complex Endpoint
  * Legacy Endpoint -> none, capability hidden

We also take this opportunity to explicitly limit supported devices
to Endpoints, Legacy Endpoints, and Root Complex Integrated Endpoints.
We don't currently have support for other types and users often cause
themselves problems by assigning them.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agovfio-pci: Generalize PCI config mangling
Alex Williamson [Mon, 1 Apr 2013 17:50:04 +0000 (11:50 -0600)]
vfio-pci: Generalize PCI config mangling

Kernel-side vfio virtualizes all of config space, but some parts are
unique to Qemu.  For instance we may or may not expose the ROM BAR,
Qemu manages MSI/MSIX, and Qemu manages the multi-function bit so that
single function devices can appear as multi-function and vica versa.
Generalize this into a bitmap of Qemu emulated bits.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agolinux-headers: Update to v3.9-rc2
Alex Williamson [Mon, 1 Apr 2013 17:50:04 +0000 (11:50 -0600)]
linux-headers: Update to v3.9-rc2

Unedited scripts/update-linux-headers.sh run against v3.9-rc2 tag

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
11 years agotcg/mips: Implement muls2_i32
Aurelien Jarno [Sun, 24 Mar 2013 00:52:07 +0000 (01:52 +0100)]
tcg/mips: Implement muls2_i32

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.2: use clz32/ctz32 instead of reinventing the wheel
Aurelien Jarno [Tue, 26 Mar 2013 18:56:02 +0000 (19:56 +0100)]
target-i386: SSE4.2: use clz32/ctz32 instead of reinventing the wheel

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: enable SSE4.1 and SSE4.2 in TCG mode
Aurelien Jarno [Tue, 26 Mar 2013 18:56:02 +0000 (19:56 +0100)]
target-i386: enable SSE4.1 and SSE4.2 in TCG mode

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.2: fix pcmpXstrX instructions with "Masked(-)" polarity
Aurelien Jarno [Tue, 26 Mar 2013 18:56:02 +0000 (19:56 +0100)]
target-i386: SSE4.2: fix pcmpXstrX instructions with "Masked(-)" polarity

valids can equals to -1 if the reg/mem string is empty. Change the
expression to have an empty xor mask in that case.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.2: fix pcmpXstrX instructions in "Equal ordered" mode
Aurelien Jarno [Tue, 26 Mar 2013 18:56:02 +0000 (19:56 +0100)]
target-i386: SSE4.2: fix pcmpXstrX instructions in "Equal ordered" mode

The inner loop should only change the current bit of the result, instead
of the whole result.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.2: fix pcmpXstrX instructions in "Equal each" mode
Aurelien Jarno [Tue, 26 Mar 2013 18:56:01 +0000 (19:56 +0100)]
target-i386: SSE4.2: fix pcmpXstrX instructions in "Equal each" mode

pcmpXstrX instructions in "Equal each" mode force both invalid element
pair to true. It means (upper - MAX(valids, validd)) bits should be set
to 1, not (upper - MAX(valids, validd) + 1).

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.2: fix pcmpXstrX instructions in "Ranges" mode
Aurelien Jarno [Tue, 26 Mar 2013 18:56:01 +0000 (19:56 +0100)]
target-i386: SSE4.2: fix pcmpXstrX instructions in "Ranges" mode

Fix the order of the of the comparisons to match the "Intel 64 and
IA-32 Architectures Software Developer's Manual".

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.2: fix pcmpXstrm instructions
Aurelien Jarno [Tue, 26 Mar 2013 18:56:01 +0000 (19:56 +0100)]
target-i386: SSE4.2: fix pcmpXstrm instructions

pcmpXstrm instructions returns their result in the XMM0 register and
not in the first operand.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.2: fix pcmpXstri instructions
Aurelien Jarno [Tue, 26 Mar 2013 18:56:01 +0000 (19:56 +0100)]
target-i386: SSE4.2: fix pcmpXstri instructions

ffs1 returns the first bit set to one starting counting from the most
significant bit.

pcmpXstri returns the most significant bit set to one, starting counting
from the least significant bit.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.2: fix pcmpgtq instruction
Aurelien Jarno [Tue, 26 Mar 2013 18:56:01 +0000 (19:56 +0100)]
target-i386: SSE4.2: fix pcmpgtq instruction

The "Intel 64 and IA-32 Architectures Software Developer's Manual" (at
least recent versions) clearly says that the comparison is signed.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-i386: SSE4.1: fix pinsrb instruction
Aurelien Jarno [Tue, 26 Mar 2013 18:56:01 +0000 (19:56 +0100)]
target-i386: SSE4.1: fix pinsrb instruction

gen_op_mov_TN_reg() loads the value in cpu_T[0], so this temporary should
be used instead of cpu_tmp0.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 1 Apr 2013 15:36:09 +0000 (10:36 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

# By Dunrong Huang (1) and others
# Via Stefan Hajnoczi
* stefanha/trivial-patches:
  hw/tcx: Remove unused 'addr' field and the property that sets it
  hw/i386/pc: format load_linux function
  configure: show debug-info option in --help output

11 years agosysbus: Remove sysbus_add_memory and sysbus_del_memory
Peter Maydell [Fri, 15 Mar 2013 14:34:23 +0000 (14:34 +0000)]
sysbus: Remove sysbus_add_memory and sysbus_del_memory

Remove the sysbus_add_memory and sysbus_del_memory functions. These
are trivial wrappers for mapping a memory region into the system
memory space, and have no users now.  Sysbus devices should never map
their own memory regions anyway; the correct API for mapping an mmio
region is for the creator of the device to use sysbus_mmio_map.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1363358063-23973-6-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agohw/milkymist-softusb: set buffer in softusb_read_{dmem, pmem} error path
Peter Maydell [Thu, 28 Mar 2013 18:43:04 +0000 (18:43 +0000)]
hw/milkymist-softusb: set buffer in softusb_read_{dmem, pmem} error path

Make sure we set the buffer to something in the softusb_read_{dmem,pmem}
error paths, since the caller will use the buffer unconditionally.
(Newer gcc is smart enough to spot this and complain about 'may be
used uninitialized'.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1364496184-11994-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomilkymist-softusb: Don't map RAM memory regions in the device itself
Peter Maydell [Fri, 15 Mar 2013 14:34:22 +0000 (14:34 +0000)]
milkymist-softusb: Don't map RAM memory regions in the device itself

Don't map the pmem and dmem RAM memory regions in the milkymist-softusb
device itself. Instead just expose them as sysbus mmio regions which
the device creator can map appropriately. This allows us to drop the
pmem_base and dmem_base properties. Instead of going via
cpu_physical_memory_read/_write when the device wants to access the
RAMs, we just keep a host pointer to the memory and use that.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
Message-id: 1363358063-23973-5-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomilkymist-minimac2: Just expose buffers as a sysbus mmio region
Peter Maydell [Fri, 15 Mar 2013 14:34:21 +0000 (14:34 +0000)]
milkymist-minimac2: Just expose buffers as a sysbus mmio region

Just expose the register buffers memory as a standard sysbus mmio
region which the creator of the device can map, rather than
providing a qdev property which the creator has to set to the
base address and then doing the mapping in the device's own
init function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
Message-id: 1363358063-23973-4-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomusicpal: qdevify musicpal-misc
Peter Maydell [Fri, 15 Mar 2013 14:34:20 +0000 (14:34 +0000)]
musicpal: qdevify musicpal-misc

Make musicpal-misc into its own (trivial) qdev device, so we
can get rid of the abuse of sysbus_add_memory().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1363358063-23973-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosysbus: make SysBusDeviceClass::init optional
Peter Maydell [Fri, 15 Mar 2013 14:34:19 +0000 (14:34 +0000)]
sysbus: make SysBusDeviceClass::init optional

Make the SysBusDeviceClass::init optional, for devices which
genuinely don't need to do anything here. In particular, simple
devices which can do all their initialization in their
instance_init method don't need either a DeviceClass::realize
or SysBusDeviceClass::init method.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 1363358063-23973-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-moxie: set do_interrupt to a target-specific helper function
Dunrong Huang [Sun, 31 Mar 2013 01:35:53 +0000 (09:35 +0800)]
target-moxie: set do_interrupt to a target-specific helper function

The value of "do_interrupt" member of CPUClass shoule be set to a
target-specific function, or it will lead to a segfault like below:

$ moxie-softmmu/qemu-system-moxie -M moxiesim
Segmentation fault

Cc: Anthony Green <green@moxielogic.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Andreas Färber <afaerber@suse.de>
Signed-off-by: Dunrong Huang <huangdr@cloud-times.com>
Signed-of-by: Anthony Green <green@moxielogic.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agow32: Fix build with older gcc (unresolved symbol)
Stefan Weil [Fri, 29 Mar 2013 17:20:20 +0000 (18:20 +0100)]
w32: Fix build with older gcc (unresolved symbol)

The cross i586-mingw32msvc-gcc 4.4.4 from Debian Squeeze does not support
__sync_val_compare_and_swap by default.

Using -march=i686 fixes that and should also result in better code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-moxie: Fix pointer-to-integer conversion (MinGW-w64)
Stefan Weil [Sun, 24 Mar 2013 08:04:48 +0000 (09:04 +0100)]
target-moxie: Fix pointer-to-integer conversion (MinGW-w64)

The type cast must use tcg_target_long instead of long.
This makes a difference for hosts where sizeof(long) != sizeof(void *).

Cc: Anthony Green <green@moxielogic.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Green <green@moxielogic.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agopiix_pci: Fix C99 comments
David Woodhouse [Sat, 23 Feb 2013 00:40:39 +0000 (00:40 +0000)]
piix_pci: Fix C99 comments

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1361580039-4459-4-git-send-email-dwmw2@infradead.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopiix_pci: Use DEVICE() and ISA_BUS()
David Woodhouse [Sat, 23 Feb 2013 00:40:38 +0000 (00:40 +0000)]
piix_pci: Use DEVICE() and ISA_BUS()

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1361580039-4459-3-git-send-email-dwmw2@infradead.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopiix_pci: Clean up i440FX object handling
David Woodhouse [Sat, 23 Feb 2013 00:40:37 +0000 (00:40 +0000)]
piix_pci: Clean up i440FX object handling

Define and use I440FX_PCI_DEVICE() instead of using DO_UPCAST().

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1361580039-4459-2-git-send-email-dwmw2@infradead.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-bridge-helper: force usage of a very high MAC address for the bridge
Paolo Bonzini [Fri, 22 Mar 2013 16:57:48 +0000 (17:57 +0100)]
qemu-bridge-helper: force usage of a very high MAC address for the bridge

Linux uses the lowest enslaved MAC address as the MAC address of
the bridge.  Set MAC address to a high value so that it does not
affect the MAC address of the bridge.

Changing the MAC address of the bridge could cause a few seconds
of network downtime.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1363971468-21154-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon: cleanup: remove qdev field.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:15 +0000 (10:49 +0100)]
virtio-balloon: cleanup: remove qdev field.

The qdev field is no longer needed, just drop it.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-7-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon: cleanup: QOM casts.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:14 +0000 (10:49 +0100)]
virtio-balloon: cleanup: QOM casts.

As the virtio-balloon-pci is switched to the new API, we can use QOM
casts.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon: cleanup: init and exit function.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:13 +0000 (10:49 +0100)]
virtio-balloon: cleanup: init and exit function.

This remove old init and exit function as they are no longer needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon-ccw: switch to the new API.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:12 +0000 (10:49 +0100)]
virtio-balloon-ccw: switch to the new API.

Here the virtio-balloon-ccw is modified for the new API. The device
virtio-balloon-ccw extends virtio-ccw-device as before. It creates and
connects a virtio-balloon during the init. The properties are not modified.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon-pci: switch to the new API.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:11 +0000 (10:49 +0100)]
virtio-balloon-pci: switch to the new API.

Here the virtio-balloon-pci is modified for the new API. The device
virtio-balloon-pci extends virtio-pci. It creates and connects a
virtio-balloon during the init. The properties are not changed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-balloon: add the virtio-balloon device.
KONRAD Frederic [Wed, 27 Mar 2013 09:49:10 +0000 (10:49 +0100)]
virtio-balloon: add the virtio-balloon device.

Create virtio-balloon which extends virtio-device, so it can be connected on
virtio-bus.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1364377755-15508-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Thu, 28 Mar 2013 17:57:37 +0000 (12:57 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Kevin Wolf (22) and Peter Lieven (1)
# Via Stefan Hajnoczi
* stefanha/block: (23 commits)
  block: Fix direct use of protocols as driver for bdrv_open()
  qcow2: Gather clusters in a looping loop
  qcow2: Move cluster gathering to a non-looping loop
  qcow2: Allow requests with multiple l2metas
  qcow2: Use byte granularity in qcow2_alloc_cluster_offset()
  qcow2: Prepare handle_alloc/copied() for byte granularity
  qcow2: handle_copied(): Implement non-zero host_offset
  qcow2: handle_copied(): Get rid of keep_clusters parameter
  qcow2: handle_copied(): Get rid of nb_clusters parameter
  qcow2: Factor out handle_copied()
  qcow2: Clean up handle_alloc()
  qcow2: Finalise interface of handle_alloc()
  qcow2: handle_alloc(): Get rid of keep_clusters parameter
  qcow2: handle_alloc(): Get rid of nb_clusters parameter
  qcow2: Factor out handle_alloc()
  qcow2: Decouple cluster allocation from cluster reuse code
  qcow2: Change handle_dependency to byte granularity
  qcow2: Improve check for overlapping allocations
  qcow2: Handle dependencies earlier
  qcow2: Remove bogus unlock of s->lock
  ...

11 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Thu, 28 Mar 2013 17:57:32 +0000 (12:57 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

# By Lluís Vilanova (7) and others
# Via Stefan Hajnoczi
* stefanha/tracing:
  vl: add runstate_set tracepoint
  .gitignore: rename trace/generated-tracers.dtrace
  .gitignore: add trace/generated-events.[ch]
  trace: rebuild generated-events.o when configuration changes
  trace: [stderr] Port to generic event information and new control interface
  trace: [simple] Port to generic event information and new control interface
  trace: [default] Port to generic event information and new control interface
  trace: [monitor] Use new event control interface
  trace: Provide a detailed event control interface
  trace: Provide a generic tracing event descriptor
  trace: [tracetool] Explicitly identify public backends

11 years agovl: add runstate_set tracepoint
Kazuya Saito [Fri, 22 Mar 2013 08:26:59 +0000 (17:26 +0900)]
vl: add runstate_set tracepoint

This patch enables us to know RunState transition. It will be userful
for investigation when the trouble occured in special event such like
live migration, shutdown, suspend, and so on.

Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years ago.gitignore: rename trace/generated-tracers.dtrace
Stefan Hajnoczi [Fri, 8 Mar 2013 15:10:12 +0000 (16:10 +0100)]
.gitignore: rename trace/generated-tracers.dtrace

For a while the file was called trace/generated-tracers-dtrace.dtrace
but today it's called trace/generated-tracers.dtrace.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years ago.gitignore: add trace/generated-events.[ch]
Stefan Hajnoczi [Fri, 8 Mar 2013 15:10:11 +0000 (16:10 +0100)]
.gitignore: add trace/generated-events.[ch]

Don't display autogenerated files in git-status(1).

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: rebuild generated-events.o when configuration changes
Stefan Hajnoczi [Fri, 8 Mar 2013 14:52:15 +0000 (15:52 +0100)]
trace: rebuild generated-events.o when configuration changes

Make sure to rebuild generated-events.o when ./configure options change.
This prevents linker errors when a stale generated-events.o gets linked
with code compiled against fresh headers.  For example, try building
with ./configure --enable-trace-backend=stderr followed by ./configure
--enable-trace-backend=dtrace.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [stderr] Port to generic event information and new control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:48:00 +0000 (14:48 +0100)]
trace: [stderr] Port to generic event information and new control interface

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [simple] Port to generic event information and new control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:47:55 +0000 (14:47 +0100)]
trace: [simple] Port to generic event information and new control interface

The backend is forced to dump event numbers using 64 bits, as TraceEventID is
an enum.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [default] Port to generic event information and new control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:47:49 +0000 (14:47 +0100)]
trace: [default] Port to generic event information and new control interface

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [monitor] Use new event control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:47:43 +0000 (14:47 +0100)]
trace: [monitor] Use new event control interface

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: Provide a detailed event control interface
Lluís Vilanova [Tue, 5 Mar 2013 13:47:38 +0000 (14:47 +0100)]
trace: Provide a detailed event control interface

This interface decouples event obtaining from interaction.

Events can be obtained through three different methods:

* identifier
* name
* simple wildcard pattern

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: Provide a generic tracing event descriptor
Lluís Vilanova [Tue, 5 Mar 2013 13:47:32 +0000 (14:47 +0100)]
trace: Provide a generic tracing event descriptor

Uses tracetool to generate a backend-independent tracing event description
(struct TraceEvent).

The values for such structure are generated with the non-public "events"
backend ("events-c" frontend).

The generation of the defines to check if an event is statically enabled is also
moved to the "events" backend ("events-h" frontend).

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotrace: [tracetool] Explicitly identify public backends
Lluís Vilanova [Tue, 5 Mar 2013 13:47:26 +0000 (14:47 +0100)]
trace: [tracetool] Explicitly identify public backends

Public backends are those printed by "--list-backends" and thus considered valid
by the configure script.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Fix direct use of protocols as driver for bdrv_open()
Kevin Wolf [Wed, 27 Mar 2013 16:28:18 +0000 (17:28 +0100)]
block: Fix direct use of protocols as driver for bdrv_open()

bdrv_open_common() implements direct use of protocols by copying the
pre-opened BlockDriverStates to bs using bdrv_swap(). It did however
first set some fields in bs, which end up in file after the swap. When
bdrv_open() destroys file, it appears to be open, and because it isn't,
qemu could segfault while trying to close it.

Reorder the operations to return immediately in such cases so that file
is correctly detected as closed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Gather clusters in a looping loop
Kevin Wolf [Wed, 27 Mar 2013 10:43:49 +0000 (11:43 +0100)]
qcow2: Gather clusters in a looping loop

Instead of just checking once in exactly this order if there are
dependendies, non-COW clusters and new allocation, this starts looping
around these. This way we can, for example, gather non-COW clusters after
new allocations as long as the host cluster offsets stay contiguous.

Once handle_dependencies() is extended so that COW areas of in-flight
allocations can be overwritten, this allows to continue with gathering
other clusters (we wouldn't be able to do that without this change
because we would have missed a possible second dependency in one of the
next clusters).

This means that in the typical sequential write case, we can combine the
COW overwrite of one cluster with the allocation of the next cluster as
soon as something like Delayed COW gets actually implemented. It is only
by avoiding splitting requests this way that Delayed COW actually starts
improving performance noticably.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Move cluster gathering to a non-looping loop
Kevin Wolf [Tue, 26 Mar 2013 16:50:12 +0000 (17:50 +0100)]
qcow2: Move cluster gathering to a non-looping loop

This patch is mainly to separate the indentation change from the
semantic changes. All that really changes here is that everything moves
into a while loop, all 'goto done' become 'break' and at the end of the
loop a new 'break is inserted.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Allow requests with multiple l2metas
Kevin Wolf [Tue, 26 Mar 2013 16:50:11 +0000 (17:50 +0100)]
qcow2: Allow requests with multiple l2metas

Instead of expecting a single l2meta, have a list of them. This allows
to still have a single I/O request for the guest data, even though
multiple l2meta may be needed in order to describe both a COW overwrite
and a new cluster allocation (typical sequential write case).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Use byte granularity in qcow2_alloc_cluster_offset()
Kevin Wolf [Tue, 26 Mar 2013 16:50:10 +0000 (17:50 +0100)]
qcow2: Use byte granularity in qcow2_alloc_cluster_offset()

This gets rid of the nb_clusters and keep_clusters and the associated
complicated calculations. Just advance the number of bytes that have
been processed and everything is fine.

This patch advances the variables even after the last operation even
though they aren't used any more afterwards to make things look more
uniform. A later patch will turn the whole thing into a loop and then
it actually starts making sense.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Prepare handle_alloc/copied() for byte granularity
Kevin Wolf [Tue, 26 Mar 2013 16:50:09 +0000 (17:50 +0100)]
qcow2: Prepare handle_alloc/copied() for byte granularity

This makes handle_alloc() and handle_copied() return byte-granularity
host offsets instead of returning always the cluster start. This is
required so that qcow2_alloc_cluster_offset() can stop aligning
everything to cluster boundaries.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_copied(): Implement non-zero host_offset
Kevin Wolf [Tue, 26 Mar 2013 16:50:08 +0000 (17:50 +0100)]
qcow2: handle_copied(): Implement non-zero host_offset

Look only for clusters that start at a given physical offset.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_copied(): Get rid of keep_clusters parameter
Kevin Wolf [Tue, 26 Mar 2013 16:50:07 +0000 (17:50 +0100)]
qcow2: handle_copied(): Get rid of keep_clusters parameter

Now *bytes is used to return the length of the area that can be written
to without performing an allocation or COW.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_copied(): Get rid of nb_clusters parameter
Kevin Wolf [Tue, 26 Mar 2013 16:50:06 +0000 (17:50 +0100)]
qcow2: handle_copied(): Get rid of nb_clusters parameter

handle_copied() uses its bytes parameter now to determine how many
clusters it should try to find.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Factor out handle_copied()
Kevin Wolf [Tue, 26 Mar 2013 16:50:05 +0000 (17:50 +0100)]
qcow2: Factor out handle_copied()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Clean up handle_alloc()
Kevin Wolf [Tue, 26 Mar 2013 16:50:04 +0000 (17:50 +0100)]
qcow2: Clean up handle_alloc()

Things can be simplified a bit now. No semantic changes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Finalise interface of handle_alloc()
Kevin Wolf [Tue, 26 Mar 2013 16:50:03 +0000 (17:50 +0100)]
qcow2: Finalise interface of handle_alloc()

The interface works completely on a byte granularity now and duplicated
parameters are removed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_alloc(): Get rid of keep_clusters parameter
Kevin Wolf [Tue, 26 Mar 2013 16:50:02 +0000 (17:50 +0100)]
qcow2: handle_alloc(): Get rid of keep_clusters parameter

handle_alloc() is now called with the offset at which the actual new
allocation starts instead of the offset at which the whole write request
starts, part of which may already be processed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: handle_alloc(): Get rid of nb_clusters parameter
Kevin Wolf [Tue, 26 Mar 2013 16:50:01 +0000 (17:50 +0100)]
qcow2: handle_alloc(): Get rid of nb_clusters parameter

We already communicate the same information in *bytes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Factor out handle_alloc()
Kevin Wolf [Tue, 26 Mar 2013 16:50:00 +0000 (17:50 +0100)]
qcow2: Factor out handle_alloc()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Decouple cluster allocation from cluster reuse code
Kevin Wolf [Tue, 26 Mar 2013 16:49:59 +0000 (17:49 +0100)]
qcow2: Decouple cluster allocation from cluster reuse code

This moves some code that prepares the allocation of new clusters to
where the actual allocation happens. This is the minimum required to be
able to move it to a separate function in the next patch.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Change handle_dependency to byte granularity
Kevin Wolf [Tue, 26 Mar 2013 16:49:58 +0000 (17:49 +0100)]
qcow2: Change handle_dependency to byte granularity

This is a more precise description of what really constitutes a
dependency. The behaviour doesn't change at this point because the COW
area of the old request is still aligned to cluster boundaries and
therefore an overlap is detected wheneven the requests touch any part of
the same cluster.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: Improve check for overlapping allocations
Kevin Wolf [Tue, 26 Mar 2013 16:49:57 +0000 (17:49 +0100)]
qcow2: Improve check for overlapping allocations

The old code detected an overlapping allocation even when the
allocations didn't actually overlap, but were only adjacent.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>