]> git.proxmox.com Git - qemu.git/log
qemu.git
13 years agoMerge branch 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemu
Aurelien Jarno [Mon, 27 Dec 2010 21:59:48 +0000 (22:59 +0100)]
Merge branch 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemu

* 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemu:
  vnc/spice: add set_passwd monitor command.
  vnc: support password expire
  vnc: auth reject cleanup
  spice: add qmp 'query-spice' and hmp 'info spice' commands.
  spice: connection events.
  spice: add qxl device
  spice: add qxl vgabios binary.

13 years agox86: Filter out garbage from segment flags dump
Jan Kiszka [Mon, 27 Dec 2010 14:52:24 +0000 (15:52 +0100)]
x86: Filter out garbage from segment flags dump

Only bits 8..23 of the segment flags contain valid data, so only dump
those when printing the CPU state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoFix migrate set speed doc arg
Luiz Capitulino [Wed, 15 Dec 2010 19:56:18 +0000 (17:56 -0200)]
Fix migrate set speed doc arg

We used to ignore any fractional part in 0.13, but due to recent
changes (started with 9f9b17a4f0865286391e4d3a0a735230122a2289)
migrate_set_speed will reject the fractional part.

We don't expect existing clients to be relying on this, but we
need to update the documentation to reflect the change.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: correct cp15 c1_sys reset value for arm1136 and cortex-a9
Juha Riihimäki [Wed, 8 Dec 2010 11:15:18 +0000 (13:15 +0200)]
target-arm: correct cp15 c1_sys reset value for arm1136 and cortex-a9

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: correct cp15 c1_sys reset value for cortex-a8
Mattias Holm [Wed, 8 Dec 2010 11:15:17 +0000 (13:15 +0200)]
target-arm: correct cp15 c1_sys reset value for cortex-a8

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: fix vmsav6 access control
Juha Riihimäki [Wed, 8 Dec 2010 11:15:16 +0000 (13:15 +0200)]
target-arm: fix vmsav6 access control

Override access control checks (including execute) for mmu translation
table descriptors assigned to manager domains.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Correct result in saturating cases for VQSHL of s8/16/32
Peter Maydell [Tue, 7 Dec 2010 14:13:45 +0000 (14:13 +0000)]
target-arm: Correct result in saturating cases for VQSHL of s8/16/32

Where VQSHL of a signed 8/16/32 bit value saturated, the result
value was not being calculated correctly (it should be either
the minimum or maximum value for the size of the signed type).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: remove pointless else clause in VQSHL of u64
Juha Riihimäki [Tue, 7 Dec 2010 14:13:44 +0000 (14:13 +0000)]
target-arm: remove pointless else clause in VQSHL of u64

Remove a pointless else clause in the neon_qshl_u64 helper.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Fix VQSHL of signed 64 bit values by shift counts >= 64
Peter Maydell [Tue, 7 Dec 2010 14:13:43 +0000 (14:13 +0000)]
target-arm: Fix VQSHL of signed 64 bit values by shift counts >= 64

VQSHL of a signed 64 bit non-zero value by a shift count >= 64 should
saturate; return the correct value in this case.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Fix VQSHL of signed 64 bit values
Juha Riihimäki [Tue, 7 Dec 2010 14:13:42 +0000 (14:13 +0000)]
target-arm: Fix VQSHL of signed 64 bit values

Add a missing '-' which meant that we were misinterpreting the shift
argument for VQSHL of 64 bit signed values and treating almost every
shift value as if it were an extremely large right shift.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Fix arguments passed to VQSHL helpers
Juha Riihimäki [Tue, 7 Dec 2010 14:13:41 +0000 (14:13 +0000)]
target-arm: Fix arguments passed to VQSHL helpers

Correct the arguments passed when generating neon qshl_{u,s}64()
helpers so that we use the correct registers.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: fix bug in translation of REVSH
Aurelien Jarno [Mon, 27 Dec 2010 18:54:49 +0000 (19:54 +0100)]
target-arm: fix bug in translation of REVSH

The translation of REVSH shifted the low byte 8 steps left before performing
an 8-bit sign extend, causing this part of the expression to alwas be 0.

Reported-by: Johan Bengtsson <teofrastius@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoFix a missing trailing newline
Aurelien Jarno [Mon, 27 Dec 2010 17:29:20 +0000 (18:29 +0100)]
Fix a missing trailing newline

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-mips: fix host CPU consumption when guest is idle
Aurelien Jarno [Sat, 25 Dec 2010 21:56:32 +0000 (22:56 +0100)]
target-mips: fix host CPU consumption when guest is idle

When the CPU is in wait state, do not wake-up if an interrupt can't be
taken. This avoid host CPU running at 100% if a device (e.g. timer) has
an interrupt line left enabled.

Also factorize code to check if interrupts are enabled in
cpu_mips_hw_interrupts_pending().

Based on a patch from Edgar E. Iglesias <edgar.iglesias@gmail.com>

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agos390: compile fixes
Alexander Graf [Wed, 17 Nov 2010 12:01:04 +0000 (13:01 +0100)]
s390: compile fixes

The s390 target doesn't compile out of the box anymore. This patch fixes all
the obvious glitches that got introduced in the last few weeks.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-mips: fix translation of MT instructions
Nathan Froyd [Fri, 29 Oct 2010 14:48:46 +0000 (07:48 -0700)]
target-mips: fix translation of MT instructions

The translation of dmt/emt/dvpe/evpe was doing the moral equivalent of:

  int x;
  ... /* no initialization of x */
  x = f (x);

which confused later bits of TCG rather badly, leading to crashes.

Fix the helpers to only return results (those instructions have no
inputs), and fix the translation code accordingly.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoUse mmap() within code_gen_alloc() for OpenBSD.
Brad [Tue, 21 Dec 2010 02:25:40 +0000 (21:25 -0500)]
Use mmap() within code_gen_alloc() for OpenBSD.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd OpenBSD to ifdef list since it has CLOCK_MONOTONIC.
Brad [Tue, 21 Dec 2010 02:24:32 +0000 (21:24 -0500)]
Add OpenBSD to ifdef list since it has CLOCK_MONOTONIC.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd support for OpenBSD to QEMU's tap driver.
Brad [Tue, 21 Dec 2010 02:23:15 +0000 (21:23 -0500)]
Add support for OpenBSD to QEMU's tap driver.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg-arm: fix __clear_cache() warning
Aurelien Jarno [Tue, 21 Dec 2010 18:32:49 +0000 (19:32 +0100)]
tcg-arm: fix __clear_cache() warning

Use __builtin___clear_cache() instead of __clear_cache() to avoid having
to define the function as extern. Fix the following warning:

| In file included from qemu/cpus.c:34:
| qemu/exec-all.h: In function 'tb_set_jmp_target1':
| qemu/exec-all.h:208: error: nested extern declaration of '__clear_cache'
| make[1]: *** [cpus.o] Error 1
| make: *** [subdir-i386-softmmu] Error 2

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoqdev: sysbus_get_default must not return a NULL pointer (fix regression)
Stefan Weil [Thu, 16 Dec 2010 18:33:22 +0000 (19:33 +0100)]
qdev: sysbus_get_default must not return a NULL pointer (fix regression)

Every system should have some sort of main system bus,
so sysbus_get_default should always return a valid bus.

Without this patch, at least mipssim and malta no longer
start but raise a null pointer access exception (caused by
commit ec990eb622ad46df5ddcb1e94c418c271894d416).

Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosparc32: ledma extra registers need tracing too
Bob Breuer [Mon, 20 Dec 2010 17:55:33 +0000 (11:55 -0600)]
sparc32: ledma extra registers need tracing too

Also trace the extra registers, and update the comments with new
info from Artyom Tarasenko.

Signed-off-by: Bob Breuer <breuerr@mc.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-i386: Fix accidental use of SoftFloat uint64 type
Andreas Färber [Sun, 19 Dec 2010 16:22:41 +0000 (17:22 +0100)]
target-i386: Fix accidental use of SoftFloat uint64 type

softfloat.h's uint64 type has least-width semantics.
Use uint64_t instead since that is used in helpers.

v4:
* Summary change.

v3:
* Split off.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Huang Ying <ying.huang@intel.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agowdt_ib700: Fix accidental use of SoftFloat int64 type
Andreas Färber [Sun, 19 Dec 2010 16:22:40 +0000 (17:22 +0100)]
wdt_ib700: Fix accidental use of SoftFloat int64 type

softfloat.h's int64 type has least-width semantics.
Since we're assigning an int64_t, use plain int64_t.

v4:
* Summary change.

v3:
* Split off.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoapic: Fix accidental use of SoftFloat uint32 type
Andreas Färber [Sun, 19 Dec 2010 16:22:39 +0000 (17:22 +0100)]
apic: Fix accidental use of SoftFloat uint32 type

softfloat.h's uint32 type has least-width semantics.
Surrounding code uses uint32_t, so use uint32_t here, too.

v4:
* Summary change.

v3:
* Split off.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAvoid a warning from OpenBSD linker
Blue Swirl [Sun, 19 Dec 2010 14:05:43 +0000 (14:05 +0000)]
Avoid a warning from OpenBSD linker

Avoid the warning below by using snprintf:
../libhw64/vl.o(.text+0x78d4): In function `get_boot_devices_list':
/src/qemu/vl.c:763: warning: sprintf() is often misused, please use snprintf()

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSparc: implement monitor command 'info tlb'
Blue Swirl [Sun, 19 Dec 2010 13:42:56 +0000 (13:42 +0000)]
Sparc: implement monitor command 'info tlb'

Use existing dump_mmu() to implement monitor command 'info tlb'.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoahci: delete write-only variables (v2)
Blue Swirl [Sun, 19 Dec 2010 10:43:09 +0000 (10:43 +0000)]
ahci: delete write-only variables (v2)

Avoid these warnings with GCC 4.6.0:
/src/qemu/hw/ide/ahci.c: In function 'ahci_reset_port':
/src/qemu/hw/ide/ahci.c:810:14: error: variable 'tfd' set but not used [-Werror=unused-but-set-variable]
/src/qemu/hw/ide/ahci.c: In function 'handle_cmd':
/src/qemu/hw/ide/ahci.c:1103:19: error: variable 'pr' set but not used [-Werror=unused-but-set-variable]

In the tfd variable case, fix the logic also.

CC: Alexander Graf <agraf@suse.de>
CC: Kevin Wolf <kwolf@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agovga: Declare as little endian
Blue Swirl [Sun, 19 Dec 2010 10:04:04 +0000 (10:04 +0000)]
vga: Declare as little endian

This patch replaces explicit bswaps with endianness hints to the
mmio layer.

CC: Alexander Graf <agraf@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agowin32: Fix CRLF problem in make_device_config.sh
Stefan Weil [Sat, 18 Dec 2010 16:34:26 +0000 (17:34 +0100)]
win32: Fix CRLF problem in make_device_config.sh

QEMU source code with CRLF line endings
which is quite common on windows hosts
fails with current make_device_config.sh.

The awk script gets the name of the included
file with \r, so instead of pci.mak it will
search for pci.mak\r which of course does
not work.

Fix this by removing any \r.

v2:
    Avoid using sub() and \r with awk because they are unsupported
    on some platforms. Use tr to remove \r. This new solution
    improves portability and was suggested by Paolo Bonzini.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Acked-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agosparc32: ledma extra registers
Bob Breuer [Sat, 18 Dec 2010 17:09:04 +0000 (11:09 -0600)]
sparc32: ledma extra registers

ledma has 0x20 bytes of registers according to OBP, and at least Solaris9
reads the 5th register which is beyond what we've mapped.  So let's setup
a flag (inspired by a previous patch from Blue Swirl) to identify ledma
from espdma, and map another 16 bytes of registers which return 0.

Signed-off-by: Bob Breuer <breuerr@mc.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoFix warning on mingw32
Blue Swirl [Fri, 17 Dec 2010 21:03:00 +0000 (21:03 +0000)]
Fix warning on mingw32

Avoid this warning like other uses of setsockopt:
/src/qemu/net/socket.c: In function 'net_socket_mcast_create':
/src/qemu/net/socket.c:210: warning: passing argument 4 of 'setsockopt' from incompatible pointer type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoide: Build fix for via.c
Kevin Wolf [Fri, 17 Dec 2010 18:49:18 +0000 (19:49 +0100)]
ide: Build fix for via.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Fix build for cmd646.c
Kevin Wolf [Fri, 17 Dec 2010 18:43:41 +0000 (19:43 +0100)]
ide: Fix build for cmd646.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Andreas Färber <andreas.faerber@web.de>
13 years agodocs: Fix missing carets in QED specification
Stefan Hajnoczi [Fri, 17 Dec 2010 15:58:20 +0000 (15:58 +0000)]
docs: Fix missing carets in QED specification

For some reason the carets ('^') in the QED specification disappeared.
This patch puts them back.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoAdd proper -errno error return values to qcow2_open()
Jes Sorensen [Fri, 17 Dec 2010 15:02:40 +0000 (16:02 +0100)]
Add proper -errno error return values to qcow2_open()

In addition this adds missing braces to the function to be consistent
with the coding style.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock/qcow2.c: rename qcow_ functions to qcow2_
Jes Sorensen [Fri, 17 Dec 2010 15:02:39 +0000 (16:02 +0100)]
block/qcow2.c: rename qcow_ functions to qcow2_

It doesn't really make sense for functions in qcow2.c to be named
qcow_ so convert the names to match correctly.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqed: Consistency check support
Stefan Hajnoczi [Mon, 6 Dec 2010 16:08:03 +0000 (16:08 +0000)]
qed: Consistency check support

This patch adds support for the qemu-img check command.  It also
introduces a dirty bit in the qed header to mark modified images as
needing a check.  This bit is cleared when the image file is closed
cleanly.

If an image file is opened and it has the dirty bit set, a consistency
check will run and try to fix corrupted table offsets.  These
corruptions may occur if there is power loss while an allocating write
is performed.  Once the image is fixed it opens as normal again.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqed: Read/write support
Stefan Hajnoczi [Mon, 6 Dec 2010 16:08:02 +0000 (16:08 +0000)]
qed: Read/write support

This patch implements the read/write state machine.  Operations are
fully asynchronous and multiple operations may be active at any time.

Allocating writes lock tables to ensure metadata updates do not
interfere with each other.  If two allocating writes need to update the
same L2 table they will run sequentially.  If two allocating writes need
to update different L2 tables they will run in parallel.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqed: Table, L2 cache, and cluster functions
Stefan Hajnoczi [Mon, 6 Dec 2010 16:08:01 +0000 (16:08 +0000)]
qed: Table, L2 cache, and cluster functions

This patch adds code to look up data cluster offsets in the image via
the L1/L2 tables.  The L2 tables are writethrough cached in memory for
performance (each read/write requires a lookup so it is essential to
cache the tables).

With cluster lookup code in place it is possible to implement
bdrv_is_allocated() to query the number of contiguous
allocated/unallocated clusters.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqed: Add QEMU Enhanced Disk image format
Stefan Hajnoczi [Mon, 6 Dec 2010 16:08:00 +0000 (16:08 +0000)]
qed: Add QEMU Enhanced Disk image format

This patch introduces the qed on-disk layout and implements image
creation.  Later patches add read/write and other functionality.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agodocs: Add QED image format specification
Stefan Hajnoczi [Mon, 6 Dec 2010 16:07:59 +0000 (16:07 +0000)]
docs: Add QED image format specification

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-io: Fix typo in help texts
Kevin Wolf [Fri, 17 Dec 2010 10:55:37 +0000 (11:55 +0100)]
qemu-io: Fix typo in help texts

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoraw-posix: add discard support
Christoph Hellwig [Fri, 17 Dec 2010 10:41:15 +0000 (11:41 +0100)]
raw-posix: add discard support

Add support to discard blocks in a raw image residing on an XFS filesystem
by calling the XFS_IOC_UNRESVSP64 ioctl to punch holes.  Support for other
hole punching mechanisms can be added when they become available.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-io: Add discard command
Stefan Hajnoczi [Mon, 13 Dec 2010 09:36:26 +0000 (09:36 +0000)]
qemu-io: Add discard command

discard [-Cq] off len -- discards a number of bytes at a specified
offset

 discards a range of bytes from the given offset

 Example:
 'discard 512 1k' - discards 1 kilobyte from 512 bytes into the file

 Discards a segment of the currently open file.
 -C, -- report statistics in a machine parsable format
 -q, -- quite mode, do not show I/O statistics

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi-disk: support WRITE SAME (16) with unmap bit
Christoph Hellwig [Thu, 16 Dec 2010 18:36:43 +0000 (19:36 +0100)]
scsi-disk: support WRITE SAME (16) with unmap bit

Support discards via the WRITE SAME command with the unmap bit set, and
tell the initiator about the support for it via the block limit and the
new thin provisioning EVPD pages.  Also fix the comment which incorrectly
describedthe block limits EVPD page.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: add discard support
Christoph Hellwig [Thu, 16 Dec 2010 18:36:31 +0000 (19:36 +0100)]
block: add discard support

Add a new bdrv_discard method to free blocks in a mapping image, and a new
drive property to set the granularity for these discard.  If no discard
granularity support is set discard support is disabled.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Register vm change state handler once only
Stefan Hajnoczi [Thu, 16 Dec 2010 15:54:06 +0000 (15:54 +0000)]
ide: Register vm change state handler once only

We register the vm change state handler in a PCI BAR map() function.
This function can be called multiple times throughout the lifetime of a
PCI IDE device.  This results in duplicate vm change state handlers
being register, none of which are ever unregistered.

Instead, register the vm change state handler in the device's init
function once and for all.

piix tested, cmd646 and via not tested.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoRemove NULL checks for bdrv_new return value
Kevin Wolf [Thu, 16 Dec 2010 14:37:41 +0000 (15:37 +0100)]
Remove NULL checks for bdrv_new return value

It's an indirect call to qemu_malloc, which never returns an error.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu.img.c: Use error_report() instead of own error() implementation
Jes Sorensen [Thu, 16 Dec 2010 13:31:53 +0000 (14:31 +0100)]
qemu.img.c: Use error_report() instead of own error() implementation

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agobdrv_img_create() use proper errno return values
Jes Sorensen [Thu, 16 Dec 2010 12:52:18 +0000 (13:52 +0100)]
bdrv_img_create() use proper errno return values

Kevin suggested to have bdrv_img_create() return proper -errno values
on error.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoPrevent creating an image with the same filename as backing file
Jes Sorensen [Thu, 16 Dec 2010 12:52:17 +0000 (13:52 +0100)]
Prevent creating an image with the same filename as backing file

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoIntroduce do_snapshot_blkdev() and monitor command to handle it.
Jes Sorensen [Thu, 16 Dec 2010 12:52:16 +0000 (13:52 +0100)]
Introduce do_snapshot_blkdev() and monitor command to handle it.

The monitor command is:
snapshot_blkdev <device> [snapshot-file] [format]

Default format is qcow2. For now snapshots without a snapshot-file, eg
internal snapshots, are not supported.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img.c: Re-factor img_create()
Jes Sorensen [Thu, 16 Dec 2010 12:52:15 +0000 (13:52 +0100)]
qemu-img.c: Re-factor img_create()

This patch re-factors img_create() moving the code doing the actual
work into block.c where it can be shared with QEMU. This is needed to
be able to create images from QEMU to be used for live snapshots.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img: Call error_set_progname
Kevin Wolf [Thu, 16 Dec 2010 14:10:32 +0000 (15:10 +0100)]
qemu-img: Call error_set_progname

Call error_set_progname during the qemu-img initialization, so that error
messages printed with error_report() use the right prefix.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: honor ncq for atapi
Alexander Graf [Tue, 14 Dec 2010 15:23:38 +0000 (16:23 +0100)]
ide: honor ncq for atapi

ATAPI also can do ncq, so let's expose the capability.

This patch makes CD-ROM support work on Windows 7 for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoahci: set SATA Mode Select
Sebastian Herbszt [Tue, 14 Dec 2010 00:34:43 +0000 (01:34 +0100)]
ahci: set SATA Mode Select

Set SATA Mode Select to AHCI in the Address Map Register.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoconfig: add ahci for pci capable machines
Alexander Graf [Tue, 14 Dec 2010 00:34:42 +0000 (01:34 +0100)]
config: add ahci for pci capable machines

This patch enables AHCI for all machines supporting PCI.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoconfig: move ide core and pci to pci.mak
Alexander Graf [Tue, 14 Dec 2010 00:34:41 +0000 (01:34 +0100)]
config: move ide core and pci to pci.mak

Every device that can do PCI should also be able to do IDE. So let's move
the IDE definitions over to pci.mak.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoahci: add ahci emulation
Alexander Graf [Tue, 14 Dec 2010 00:34:40 +0000 (01:34 +0100)]
ahci: add ahci emulation

This patch adds an emulation layer for an ICH-9 AHCI controller. For now
this controller does not do IDE legacy emulation. It is a pure AHCI controller.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agopci: add ich9 pci id
Alexander Graf [Tue, 14 Dec 2010 00:34:39 +0000 (01:34 +0100)]
pci: add ich9 pci id

We need a PCI ID for our new AHCI adapter. I just picked an ICH-9
because that's the one in the Q35 chipset.

This patch adds a PCI ID define for an ICH-9 AHCI adapter.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agopci: add storage class for sata
Alexander Graf [Tue, 14 Dec 2010 00:34:38 +0000 (01:34 +0100)]
pci: add storage class for sata

This patch adds the storage sata class id.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: add ncq identify data for ahci sata drives
Roland Elek [Tue, 14 Dec 2010 00:34:37 +0000 (01:34 +0100)]
ide: add ncq identify data for ahci sata drives

I modified ide_identify() to include the zero-based queue length
value in word 75, and set bit 8 in word 76 to signal NCQ support
in the identify data for AHCI SATA drives.

Signed-off-by: Roland Elek <elek.roland@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: move transfer_start after variable modification
Alexander Graf [Tue, 14 Dec 2010 23:23:01 +0000 (00:23 +0100)]
ide: move transfer_start after variable modification

We hook into transfer_start and immediately call the end function
for ahci. This means that everything needs to be in place for the
end function when we start the transfer, so let's move the function
down to where all state is in place.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Split out BMDMA code from ATA core
Alexander Graf [Tue, 14 Dec 2010 23:23:00 +0000 (00:23 +0100)]
ide: Split out BMDMA code from ATA core

The ATA core is currently heavily intertwined with BMDMA code. Let's loosen
that a bit, so we can happily replace the DMA backend with different
implementations.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: fix whitespace gap in ide_exec_cmd
Alexander Graf [Tue, 14 Dec 2010 00:34:34 +0000 (01:34 +0100)]
ide: fix whitespace gap in ide_exec_cmd

Now that we have the function split out, we have to reindent it.
In order to increase the readability of the actual functional change,
this is split out.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: split ide command interpretation off
Alexander Graf [Tue, 14 Dec 2010 00:34:33 +0000 (01:34 +0100)]
ide: split ide command interpretation off

The ATA command interpretation code can be used for PATA and SATA
interfaces alike. So let's split it out into a separate function.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img.c: Clean up handling of image size in img_create()
Jes Sorensen [Thu, 9 Dec 2010 13:17:25 +0000 (14:17 +0100)]
qemu-img.c: Clean up handling of image size in img_create()

This cleans up the handling of image size in img_create() by parsing
the value early, and then only setting it once if a value has been
added as the last argument to the command line.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoIntroduce strtosz_suffix()
Jes Sorensen [Thu, 9 Dec 2010 13:17:24 +0000 (14:17 +0100)]
Introduce strtosz_suffix()

This introduces strtosz_suffix() which allows the caller to specify a
default suffix in case the non default of MB is wanted.

strtosz() is kept as a wrapper for strtosz_suffix() which keeps it's
current default of MB.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Fix the use of protocols in backing files
Stefan Hajnoczi [Thu, 2 Dec 2010 16:54:13 +0000 (16:54 +0000)]
block: Fix the use of protocols in backing files

Backing filenames may contain a protocol.  The code currently doesn't
consider this case and produces filenames that embed "<protocol>:".
Don't combine filenames if the backing filename contains a protocol.

Based on an earlier patch by Anthony Liguori <aliguori@us.ibm.com>.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Introduce path_has_protocol() function
Stefan Hajnoczi [Thu, 9 Dec 2010 11:53:00 +0000 (11:53 +0000)]
block: Introduce path_has_protocol() function

The bdrv_find_protocol() function returns NULL if an unknown protocol
name is given.  It returns the "file" protocol when the filename
contains no protocol at all.  This makes it difficult to distinguish
between paths which contain a protocol and those which do not.

Factor out a helper function that tests whether or not a filename has a
protocol.  The next patch makes use of this function.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblockdev: check dinfo ptr before using
Ryan Harper [Wed, 8 Dec 2010 16:05:00 +0000 (10:05 -0600)]
blockdev: check dinfo ptr before using

If a user decides to punish a guest by revoking its block device via
drive_del, and subsequently also attempts to remove the pci device
backing it, and the device is using blockdev_auto_del() then we get a
segfault when we attempt to access dinfo->auto_del.[1]

The fix is to check if drive_get_by_blockdev() actually returns a valid
dinfo pointer or not.

1. (qemu) pci_add auto storage file=images/test01.raw,if=virtio,id=block1,snapshot=on
   (qemu) drive_del block1
   (qemu) pci_del 5
   *segfault*

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoMerge remote branch 'arm/for-anthony' into staging
Anthony Liguori [Fri, 17 Dec 2010 14:25:17 +0000 (08:25 -0600)]
Merge remote branch 'arm/for-anthony' into staging

13 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 17 Dec 2010 14:23:53 +0000 (08:23 -0600)]
Merge remote branch 'kwolf/for-anthony' into staging

13 years agoMerge remote branch 'qmp/for-anthony' into staging
Anthony Liguori [Fri, 17 Dec 2010 14:23:05 +0000 (08:23 -0600)]
Merge remote branch 'qmp/for-anthony' into staging

13 years agoMerge remote branch 'jvrao/for-anthony' into staging
Anthony Liguori [Fri, 17 Dec 2010 14:22:31 +0000 (08:22 -0600)]
Merge remote branch 'jvrao/for-anthony' into staging

13 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Fri, 17 Dec 2010 14:21:29 +0000 (08:21 -0600)]
Merge remote branch 'mst/for_anthony' into staging

13 years agoqemu-img: Fail creation if backing format is invalid
Stefan Hajnoczi [Tue, 7 Dec 2010 09:35:56 +0000 (09:35 +0000)]
qemu-img: Fail creation if backing format is invalid

The qemu-img create command should check the backing format to ensure
only image files with valid backing formats are created.  By checking in
qemu-img.c we can print a useful error message.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img: Free option parameter lists in img_create()
Stefan Hajnoczi [Tue, 7 Dec 2010 09:35:55 +0000 (09:35 +0000)]
qemu-img: Free option parameter lists in img_create()

Free option parameter lists in the img_create() error return path.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-option: Fix parse_option_parameters() documentation typo
Stefan Hajnoczi [Tue, 7 Dec 2010 09:35:54 +0000 (09:35 +0000)]
qemu-option: Fix parse_option_parameters() documentation typo

Yoda said, "list is the templace is".  Fix this.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-option: Don't reinvent append_option_parameters()
Stefan Hajnoczi [Tue, 7 Dec 2010 09:35:53 +0000 (09:35 +0000)]
qemu-option: Don't reinvent append_option_parameters()

parse_option_parameters() may need to create a new option parameter list
from a template list.  Use append_option_parameters() instead of
duplicating the code.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img: Deprecate obsolete -6 and -e options
Jes Sorensen [Tue, 7 Dec 2010 16:44:34 +0000 (17:44 +0100)]
qemu-img: Deprecate obsolete -6 and -e options

If -6 or -e is specified, an error message is printed and we exit. It
does not print help() to avoid the error message getting lost in the
noise.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoceph/rbd block driver for qemu-kvm
Christian Brunner [Mon, 6 Dec 2010 19:53:01 +0000 (20:53 +0100)]
ceph/rbd block driver for qemu-kvm

RBD is an block driver for the distributed file system Ceph
(http://ceph.newdream.net/). This driver uses librados (which is part
of the Ceph server) for direct access to the Ceph object store and is
running entirely in userspace (Yehuda also wrote a driver for the
linux kernel, that can be used to access rbd volumes as a block
device).

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Christian Brunner <chb@muc.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoMake error handling more consistent in img_create() and img_resize()
Jes Sorensen [Mon, 6 Dec 2010 16:08:31 +0000 (17:08 +0100)]
Make error handling more consistent in img_create() and img_resize()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoFail if detecting an unknown option
Jes Sorensen [Mon, 6 Dec 2010 14:25:40 +0000 (15:25 +0100)]
Fail if detecting an unknown option

This patch changes qemu-img to exit if an unknown option is detected,
instead of trying to continue with a set of arguments which may be
incorrect.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoFix formatting and missing braces in qemu-img.c
Jes Sorensen [Mon, 6 Dec 2010 14:25:39 +0000 (15:25 +0100)]
Fix formatting and missing braces in qemu-img.c

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoConsolidate printing of block driver options
Jes Sorensen [Mon, 6 Dec 2010 14:25:38 +0000 (15:25 +0100)]
Consolidate printing of block driver options

This consolidates the printing of block driver options in
print_block_option_help() which is called from both img_create() and
img_convert().

This allows for the "?" detection to be done just after the parsing of
options and the filename, instead of half way down the codepath of
these functions.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoimg_convert(): Only try to free bs[] entries if bs is valid.
Jes Sorensen [Mon, 6 Dec 2010 14:25:36 +0000 (15:25 +0100)]
img_convert(): Only try to free bs[] entries if bs is valid.

This allows for jumping to 'out:' consistently for error exit.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoUse qemu_mallocz() instead of calloc() in img_convert()
Jes Sorensen [Mon, 6 Dec 2010 14:25:35 +0000 (15:25 +0100)]
Use qemu_mallocz() instead of calloc() in img_convert()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoAdd missing tracing to qemu_mallocz()
Jes Sorensen [Mon, 6 Dec 2010 14:25:34 +0000 (15:25 +0100)]
Add missing tracing to qemu_mallocz()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Make bdrv_create_file() ':' handling consistent
Stefan Hajnoczi [Tue, 30 Nov 2010 15:14:14 +0000 (15:14 +0000)]
block: Make bdrv_create_file() ':' handling consistent

Filenames may start with "<protocol>:" to explicitly use a protocol like
nbd.  Filenames with unknown protocols are rejected in most of QEMU
except for bdrv_create_file().  Even if a file with an invalid filename
can be created, QEMU cannot use it since all the other relevant
functions reject such paths.  Make bdrv_create_file() consistent.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoWatchdog: disable watchdog timer when hard-rebooting a guest.
Richard W.M. Jones [Fri, 24 Sep 2010 15:08:06 +0000 (16:08 +0100)]
Watchdog: disable watchdog timer when hard-rebooting a guest.

This commit causes the watchdog timer to be reset when a guest is
hard-rebooted.

The failure case previously was as follows:

  (a) guest boots, watchdog is enabled

  (b) guest does a reset eg:
        echo 'b' > /proc/sysrq-trigger
    (note that an ordinary /sbin/reboot wouldn't hit this case
    since as the watchdog daemon is shut down, the daemon would
    properly disable the watchdog device)

  (c) the reboot takes longer than the remaining time on the
    watchdog

  (d) the watchdog therefore fires during the reboot

  (e) probably the VM would just reboot again at this point which
    is pretty benign, but it could depend on the action that the
    user had selected for the watchdog

Now we use the qdev reset function to register a reset handler
which disables the timer.  Note the handler is called _either_
just after init _or_ when the guest reboots.

In the i6300esb case there is a small refactoring of the code so
that the device's internal state is now fully restored to defaults
on a reboot.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoPass boot device list to firmware.
Gleb Natapov [Wed, 8 Dec 2010 11:35:09 +0000 (13:35 +0200)]
Pass boot device list to firmware.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd notifier that will be called when machine is fully created.
Gleb Natapov [Wed, 8 Dec 2010 11:35:08 +0000 (13:35 +0200)]
Add notifier that will be called when machine is fully created.

Action that depends on fully initialized device model should register
with this notifier chain.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd bootindex for option roms.
Gleb Natapov [Wed, 8 Dec 2010 11:35:07 +0000 (13:35 +0200)]
Add bootindex for option roms.

Extend -option-rom command to have additional parameter ,bootindex=.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoChange fw_cfg_add_file() to get full file path as a parameter.
Gleb Natapov [Wed, 8 Dec 2010 11:35:06 +0000 (13:35 +0200)]
Change fw_cfg_add_file() to get full file path as a parameter.

Change fw_cfg_add_file() to get full file path as a parameter instead
of building one internally. Two reasons for that. First caller may need
to know how file is named. Second this moves policy of file naming out
from fw_cfg. Platform may want to use more then two levels of
directories for instance.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd bootindex parameter to net/block/fd device
Gleb Natapov [Wed, 8 Dec 2010 11:35:05 +0000 (13:35 +0200)]
Add bootindex parameter to net/block/fd device

If bootindex is specified on command line a string that describes device
in firmware readable way is added into sorted list. Later this list will
be passed into firmware to control boot order.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd get_fw_dev_path callback to scsi bus.
Gleb Natapov [Wed, 8 Dec 2010 11:35:04 +0000 (13:35 +0200)]
Add get_fw_dev_path callback to scsi bus.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd get_fw_dev_path callback for usb bus.
Gleb Natapov [Wed, 8 Dec 2010 11:35:03 +0000 (13:35 +0200)]
Add get_fw_dev_path callback for usb bus.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoRecord which USBDevice USBPort belongs too.
Gleb Natapov [Wed, 8 Dec 2010 11:35:02 +0000 (13:35 +0200)]
Record which USBDevice USBPort belongs too.

Ports on root hub will have NULL here. This is needed to reconstruct
path from device to its root hub to build device path.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>