]> Git Repo - qemu.git/log
qemu.git
12 years agoSpecification for qcow2 version 3
Kevin Wolf [Thu, 12 Apr 2012 11:20:41 +0000 (13:20 +0200)]
Specification for qcow2 version 3

This updates the qcow2 specification to cover version 3. It contains the
following changes:

- Added compatible/incompatible/auto-clear feature bits plus an optional
  feature name table to allow useful error messages even if an older
  version doesn't know some feature at all.

- Configurable refcount width. If you don't want to use internal
  snapshots, make refcounts one bit and save cache space and I/O.

- Zero cluster flags. This allows discard even with a backing file that
  doesn't contain zeros. It is also useful for copy-on-read/image
  streaming, as you'll want to keep sparseness without accessing the
  remote image for an unallocated cluster all the time.

- Fixed internal snapshot metadata to use 64 bit VM state size. You
  can't save a snapshot of a VM with >= 4 GB RAM today.

- Extended internal snapshot metadata to contain the disk size, so that
  resizing images that have snapshots can be allowed in the future.

Signed-off-by: Kevin Wolf <[email protected]>
12 years agoqcow2: Fix refcount block allocation during qcow2_alloc_cluster_at()
Kevin Wolf [Fri, 20 Apr 2012 13:50:39 +0000 (15:50 +0200)]
qcow2: Fix refcount block allocation during qcow2_alloc_cluster_at()

Refcount block allocation and refcount table growth rely on
s->free_cluster_index pointing to somewhere after the current
allocation. Change qcow2_alloc_cluster_at() to fulfill this
assumption.

Without this change it could happen that a newly allocated refcount
block and the allocated data block point to the same area in the image
file, causing data corruption in the long run.

This fixes a bug that became first visible after commit 250196f1.

Signed-off-by: Kevin Wolf <[email protected]>
12 years agoAdd .gitignore for tests/
David Gibson [Fri, 20 Apr 2012 01:40:24 +0000 (11:40 +1000)]
Add .gitignore for tests/

The new autotests in tests/ generate a number of files, both
executable and source, which are not caught by the existing .gitignore
files.  This patch adds a new .gitignore in tests/ which covers these.

[Changed 'rtc-test' to '*-test' so future tests do not need to be added
to .gitignore on a case-by-case basis.  Stefan]

Signed-off-by: David Gibson <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agoe1000: Fix spelling (segmentaion -> segmentation) in debug output
Stefan Weil [Wed, 18 Apr 2012 05:28:34 +0000 (07:28 +0200)]
e1000: Fix spelling (segmentaion -> segmentation) in debug output

This was reported by https://bugs.launchpad.net/qemu/+bug/984476.

I also changed the case for 'error'.

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agospice-qemu-char.c: Show what name is unsupported
Eduardo Elias Ferreira [Mon, 16 Apr 2012 12:51:42 +0000 (09:51 -0300)]
spice-qemu-char.c: Show what name is unsupported

Signed-off-by: Eduardo Elias Ferreira <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agopflash_cfi01: remove redundant line
Eric Bénard [Thu, 12 Apr 2012 07:51:46 +0000 (09:51 +0200)]
pflash_cfi01: remove redundant line

Signed-off-by: Eric Bénard <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agoqxl: Add missing GCC_FMT_ATTR and fix format specifier
Stefan Weil [Sun, 1 Apr 2012 20:07:30 +0000 (22:07 +0200)]
qxl: Add missing GCC_FMT_ATTR and fix format specifier

val is an uint64_t, therefore %d was not correct.

Signed-off-by: Stefan Weil <[email protected]>
Acked-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agofix block_job_set_speed name in documentation
Paolo Bonzini [Fri, 13 Apr 2012 10:03:46 +0000 (12:03 +0200)]
fix block_job_set_speed name in documentation

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agoerror.c: don't return value for void function
Amos Kong [Mon, 16 Apr 2012 07:32:49 +0000 (15:32 +0800)]
error.c: don't return value for void function

It is invalid to return a value from a function
returning void.

[C99 6.8.6.4 says "A return statement with an expression shall not
appear in a function whose return type is void" but gcc 4.6.3 with QEMU
compile flags does not complain.  It's still worth fixing this.  Stefan]

Signed-off-by: Amos Kong <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agoiotests: Resolve test failures caused by hostname
Andreas Färber [Fri, 20 Apr 2012 10:50:24 +0000 (12:50 +0200)]
iotests: Resolve test failures caused by hostname

`hostname -s` may output an errror:
hostname: Name or service not known
This causes all tests to fail for `make check-block`.

Suppress such error messages, letting the tests succeed.

Signed-off-by: Andreas Färber <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoqemu-img: let 'qemu-img convert' flush data
Liu Yuan [Fri, 20 Apr 2012 09:10:56 +0000 (17:10 +0800)]
qemu-img: let 'qemu-img convert' flush data

The 'qemu-img convert -h' advertise that the default cache mode is
'writeback', while in fact it is 'unsafe'.

This patch 1) fix the help manual and 2) let bdrv_close() call bdrv_flush()

2) is needed because some backend storage doesn't have a self-flush
mechanism(for e.g., sheepdog), so we need to call bdrv_flush() to make
sure the image is really writen to the storage instead of hanging around
writeback cache forever.

Signed-off-by: Liu Yuan <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agosparc: fix qtest
Blue Swirl [Thu, 19 Apr 2012 18:33:05 +0000 (18:33 +0000)]
sparc: fix qtest

Initialize TCG only when enabled.

Signed-off-by: Blue Swirl <[email protected]>
12 years agoqtest: add dummy functions for user emulators
Blue Swirl [Thu, 19 Apr 2012 18:52:35 +0000 (18:52 +0000)]
qtest: add dummy functions for user emulators

Allow qtest to be used also in files used for user emulators by
introducing dummy functions.

Signed-off-by: Blue Swirl <[email protected]>
12 years agoqtest: add register fuzzing to RTC test
Blue Swirl [Sun, 15 Apr 2012 07:36:49 +0000 (07:36 +0000)]
qtest: add register fuzzing to RTC test

Reviewed-by: Anthony Liguori <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agoqemu-ga: fix help output
Michael Roth [Tue, 17 Apr 2012 16:28:27 +0000 (11:28 -0500)]
qemu-ga: fix help output

Reviewed-by: Luiz Capitulino <[email protected]>
12 years agoqemu-ga: generate missing stubs for fsfreeze
Michael Roth [Sat, 14 Apr 2012 02:07:36 +0000 (21:07 -0500)]
qemu-ga: generate missing stubs for fsfreeze

When linux-specific commands (including guest-fsfreeze-*) were consolidated
under defined(__linux__), we forgot to account for the case where
defined(__linux__) && !defined(FIFREEZE). As a result stubs are no longer
being generated on linux hosts that don't have FIFREEZE support. Fix
this.

Tested-by: Andreas Färber <[email protected]>
Reviewed-by: Luiz Capitulino <[email protected]>
12 years agonbd: obey FUA on reads
Paolo Bonzini [Thu, 19 Apr 2012 09:59:11 +0000 (11:59 +0200)]
nbd: obey FUA on reads

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agonbd: do not include block_int.h
Paolo Bonzini [Mon, 12 Mar 2012 15:17:27 +0000 (16:17 +0100)]
nbd: do not include block_int.h

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoaio: simplify qemu_aio_wait
Paolo Bonzini [Thu, 12 Apr 2012 12:00:56 +0000 (14:00 +0200)]
aio: simplify qemu_aio_wait

The do...while loop can never loop, because select will just not return
0 when invoked with infinite timeout.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoaio: return "AIO in progress" state from qemu_aio_wait
Paolo Bonzini [Thu, 12 Apr 2012 12:00:55 +0000 (14:00 +0200)]
aio: return "AIO in progress" state from qemu_aio_wait

The definition of when qemu_aio_flush should loop is much simpler
than it looks.  It just has to call qemu_aio_wait until it makes
no progress and all flush callbacks return false.  qemu_aio_wait
is the logical place to tell the caller about this.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoaio: remove process_queue callback and qemu_aio_process_queue
Paolo Bonzini [Thu, 12 Apr 2012 12:00:54 +0000 (14:00 +0200)]
aio: remove process_queue callback and qemu_aio_process_queue

Both unused after the previous patch.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agonbd: do not block in nbd_wr_sync if no data at all is available
Paolo Bonzini [Mon, 5 Mar 2012 08:10:35 +0000 (09:10 +0100)]
nbd: do not block in nbd_wr_sync if no data at all is available

Right now, nbd_wr_sync will hang if no data at all is available on the
socket and the other side is not going to provide any.  Relax this by
making it loop only for writes or partial reads.  This fixes a race
where one thread is executing qemu_aio_wait() and another is executing
main_loop_wait().  Then, the select() call in main_loop_wait() can return
stale data and call the "readable" callback with no data in the socket.

Reported-by: Laurent Vivier <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
12 years agonbd: consistently return negative errno values
Paolo Bonzini [Mon, 5 Mar 2012 07:56:10 +0000 (08:56 +0100)]
nbd: consistently return negative errno values

In the next patch we need to look at the return code of nbd_wr_sync.
To avoid percolating the socket_error() ugliness all around, let's
handle errors by returning negative errno values.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agonbd: consistently check for <0 or >=0
Paolo Bonzini [Wed, 7 Mar 2012 10:05:34 +0000 (11:05 +0100)]
nbd: consistently check for <0 or >=0

This prepares for the following patch, which changes -1 return values
to negative errno.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agonbd: consistently use ssize_t
Paolo Bonzini [Wed, 7 Mar 2012 10:25:01 +0000 (11:25 +0100)]
nbd: consistently use ssize_t

GCC (pedantically, but correctly) considers that a negative ssize_t may
become positive when casted to int.  This may cause uninitialized variable
warnings when a function returns such a negative ssize_t and is inlined.
Propagate ssize_t return types to avoid this.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agonbd: avoid out of bounds access to recv_coroutine array
Paolo Bonzini [Mon, 12 Mar 2012 14:23:13 +0000 (15:23 +0100)]
nbd: avoid out of bounds access to recv_coroutine array

This can happen with a buggy or malicious server.

Reported-by: Michael Tokarev <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoposix-aio: merge posix_aio_process_queue and posix_aio_read
Paolo Bonzini [Thu, 12 Apr 2012 12:00:53 +0000 (14:00 +0200)]
posix-aio: merge posix_aio_process_queue and posix_aio_read

posix_aio_read already calls qemu_aio_process_queue, and dually
qemu_aio_process_queue is always followed by a select loop that calls
posix_aio_read.

No races are possible, so there is no need for a separate process_queue
callback.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoqemu-tool: map vm_clock to rt_clock
Paolo Bonzini [Thu, 12 Apr 2012 12:00:52 +0000 (14:00 +0200)]
qemu-tool: map vm_clock to rt_clock

QED uses vm_clock timers so that images are not touched during and after
migration.  This however does not apply to qemu-io and qemu-img.
Treat vm_clock as a synonym for rt_clock there, and enable it.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoqemu-io: use main_loop_wait
Paolo Bonzini [Thu, 12 Apr 2012 12:00:51 +0000 (14:00 +0200)]
qemu-io: use main_loop_wait

This will let timers run during aio_read and aio_write commands,
though not during synchronous commands.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoscsi: add SANITIZE command
Paolo Bonzini [Thu, 19 Apr 2012 13:43:41 +0000 (15:43 +0200)]
scsi: add SANITIZE command

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoSCSI emulation: should tell the guest that we actually support thin provisioning
Ronnie Sahlberg [Thu, 19 Apr 2012 10:41:17 +0000 (20:41 +1000)]
SCSI emulation: should tell the guest that we actually support thin provisioning

Signed-off-by: Ronnie Sahlberg <[email protected]>
[Actually, we should report it only if discard_granularity is nonzero.
 Older SBC drafts assigned 0 to thin provisioning and 1 to thick
 (resource-provisioned, they call it).  Newer drafts assign respectively
 1 and 2 - Paolo]
Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoSCSI emulation: Support unmap via WRITE_SAME_10.
Ronnie Sahlberg [Thu, 19 Apr 2012 10:41:16 +0000 (20:41 +1000)]
SCSI emulation: Support unmap via WRITE_SAME_10.

This was added in SBC r26 in place of the reserved bits that were
present up to that version.

It is the same as WRITE_SAME_16 as far as QEMU is concerned.

Signed-off-by: Ronnie Sahlberg <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: advertise DPOFUA
Paolo Bonzini [Thu, 19 Apr 2012 08:28:15 +0000 (10:28 +0200)]
scsi: advertise DPOFUA

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: small refactoring of MMC mode-sense
Paolo Bonzini [Thu, 19 Apr 2012 08:24:18 +0000 (10:24 +0200)]
scsi: small refactoring of MMC mode-sense

Make DBD a boolean value, and force device-specific parameter to zero.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: support FUA on reads
Paolo Bonzini [Thu, 19 Apr 2012 09:55:28 +0000 (11:55 +0200)]
scsi: support FUA on reads

To force unit access on reads, flush the cache *before* doing the read.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: add a started field to SCSIDiskReq
Paolo Bonzini [Thu, 19 Apr 2012 09:51:42 +0000 (11:51 +0200)]
scsi: add a started field to SCSIDiskReq

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: force unit access on VERIFY
Paolo Bonzini [Thu, 19 Apr 2012 09:46:13 +0000 (11:46 +0200)]
scsi: force unit access on VERIFY

Also DMA data from the host, to avoid that the host reports an
underrun.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoblock: allow interrupting a co_sleep_ns
Paolo Bonzini [Wed, 18 Apr 2012 13:12:01 +0000 (15:12 +0200)]
block: allow interrupting a co_sleep_ns

In the next patch we want to reenter the coroutine from
block_job_cancel_sync and cancel the timer.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoqcow2: Fix return value of alloc_refcount_block
Kevin Wolf [Wed, 18 Apr 2012 14:27:06 +0000 (16:27 +0200)]
qcow2: Fix return value of alloc_refcount_block

Someone forgot something in commit 29c1a730... Documenting the right
return value is not enough, you also need to actually return it in the
code.

This bug sometimes causes error return values even when everything has
succeeded: The new offset of the refcount block is truncated to 32 bits
and interpreted as signed. At least with small cluster sizes it's easy
to get a negative return value this way.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
12 years agoqcow2: Fix error handling in qcow2_alloc_cluster_offset
Kevin Wolf [Wed, 18 Apr 2012 14:18:14 +0000 (16:18 +0200)]
qcow2: Fix error handling in qcow2_alloc_cluster_offset

If do_alloc_cluster_offset() fails, the error handling code tried to
remove the request from the in-flight queue, to which it wasn't added
yet, resulting in a NULL pointer dereference.

m->nb_clusters really only becomes != 0 when the request is in the list.

Signed-off-by: Kevin Wolf <[email protected]>
12 years agoide: convert ide_sector_write() to asynchronous I/O
Stefan Hajnoczi [Thu, 29 Mar 2012 09:31:31 +0000 (10:31 +0100)]
ide: convert ide_sector_write() to asynchronous I/O

The IDE PIO write sector code path uses bdrv_write() and hence can make
the guest unresponsive while the I/O request is in progress.  This patch
converts ide_sector_write() to use bdrv_aio_writev() by using the
BUSY_STAT bit to tell the guest that the request is in progress.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Zhi Yong Wu <[email protected]>
Tested-by: Richard Davies <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoide: convert ide_sector_read() to asynchronous I/O
Stefan Hajnoczi [Thu, 29 Mar 2012 09:31:30 +0000 (10:31 +0100)]
ide: convert ide_sector_read() to asynchronous I/O

The IDE PIO interface currently uses bdrv_read() to perform reads
synchronously.  Synchronous I/O in the vcpu thread is bad because it
prevents the guest from executing code - it makes the guest
unresponsive.

This patch converts IDE PIO to use bdrv_aio_readv().  We simply need to
use the BUSY_STAT status so the guest knows to wait while we are busy.

The only external user of ide_sector_read() is restart behavior on I/O
errors and it is not affected by this change.  We still need to restart
I/O in the same way.

Migration is also unaffected if I understand the code correctly.  We
continue to use the same transfer function and the BUSY_STAT status
should never be migrated since we flush I/O before migrating device
state.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Zhi Yong Wu <[email protected]>
Tested-by: Richard Davies <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoqemu-io: Add command line switch for cache mode
Kevin Wolf [Wed, 18 Apr 2012 10:07:39 +0000 (12:07 +0200)]
qemu-io: Add command line switch for cache mode

To be used as in 'qemu-io -t writeback test.img'

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
12 years agoblock: Fix spelling in comment (ineffcient -> inefficient)
Stefan Weil [Tue, 17 Apr 2012 17:41:08 +0000 (19:41 +0200)]
block: Fix spelling in comment (ineffcient -> inefficient)

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoiotests: fix error in 005
Dong Xu Wang [Tue, 17 Apr 2012 08:23:44 +0000 (16:23 +0800)]
iotests: fix error in 005

According comment, we should not read again, we will write.

Signed-off-by: Dong Xu Wang <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
12 years agoblock: Drain requests in bdrv_close
Kevin Wolf [Wed, 11 Apr 2012 09:06:37 +0000 (11:06 +0200)]
block: Drain requests in bdrv_close

If an AIO request is in flight that refers to a BlockDriverState that
has been closed and possibly even freed, more or less anything could
happen. I have seen segfaults, -EBADF return values and qcow2 sometimes
actually catches the situation in bdrv_close() and abort()s.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
12 years agoqemu-iotests: Test bdrv_close while AIO is in flight
Kevin Wolf [Wed, 11 Apr 2012 08:45:51 +0000 (10:45 +0200)]
qemu-iotests: Test bdrv_close while AIO is in flight

If the BlockDriverState is closed/freed without draining the AIO
requests first, the request coroutines may work on invalid data and file
descriptors or have some dangling pointers that cause segfaults.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
12 years agoqemu-iotests: Always filter cluster_size out in _make_test_img
Kevin Wolf [Wed, 11 Apr 2012 09:21:25 +0000 (11:21 +0200)]
qemu-iotests: Always filter cluster_size out in _make_test_img

Some image formats do have a cluster size, others don't, but there are
tests that work with both sets of images and currently we get failures
because the qemu-img create output doesn't mention the cluster size for
some formats.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
12 years agoscsi: add support for FUA on writes
Paolo Bonzini [Thu, 19 Apr 2012 08:10:54 +0000 (10:10 +0200)]
scsi: add support for FUA on writes

To force unit access, add a flush operation after the actual write.
WRITE AND VERIFY commands always flush according to SBC, so do it
even though we do not perform the reread.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: move scsi_flush_complete around
Paolo Bonzini [Thu, 19 Apr 2012 08:05:04 +0000 (10:05 +0200)]
scsi: move scsi_flush_complete around

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: make code more homogeneous in AIO callback functions
Paolo Bonzini [Thu, 19 Apr 2012 12:00:24 +0000 (14:00 +0200)]
scsi: make code more homogeneous in AIO callback functions

First scsi_flush_complete, like scsi_dma_complete, is always called with
an active AIOCB.

Second, always test for "ret < 0" to check for errors.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: add missing test for cancelled request
Paolo Bonzini [Thu, 19 Apr 2012 08:09:49 +0000 (10:09 +0200)]
scsi: add missing test for cancelled request

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agovirtio-scsi: add multiqueue capability
Paolo Bonzini [Fri, 6 Apr 2012 08:39:46 +0000 (10:39 +0200)]
virtio-scsi: add multiqueue capability

Adding multiqueue is as simple as creating more than one virtqueues,
and saving the queue number for each request.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agovirtio: add virtio_queue_get_id
Paolo Bonzini [Fri, 6 Apr 2012 08:38:37 +0000 (10:38 +0200)]
virtio: add virtio_queue_get_id

Serializing virtio-scsi requests needs a simple way to get from a
VirtQueue to the number of the queue.  The virtio_queue_get_id
provides this.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agovirtio-scsi: prepare migration format for multiqueue
Paolo Bonzini [Fri, 6 Apr 2012 08:20:43 +0000 (10:20 +0200)]
virtio-scsi: prepare migration format for multiqueue

In order to restore requests correctly from a multitude of virtqueues,
we need to store the id of the request queue that each request came
from.

Do this even for single-queue, by storing a hard-coded zero, to
simplify future implementation of multiqueue.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: fix memory leak
Paolo Bonzini [Fri, 6 Apr 2012 12:12:42 +0000 (14:12 +0200)]
scsi: fix memory leak

scsibus_get_dev_path is leaking id if it is not NULL.  Fix it.

Reported-by: Laszlo Ersek <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Wed, 18 Apr 2012 15:05:58 +0000 (10:05 -0500)]
Merge remote-tracking branch 'origin/master' into staging

* origin/master:
  Allow controlling volume with PulseAudio backend
  configure: pa_simple is not needed anymore
  Do not use pa_simple PulseAudio API
  audio/spice: add support for volume control
  hw/ac97: add support for volume control
  hw/ac97: the volume mask is not only 0x1f
  hw/ac97: remove USE_MIXER code
  audio: don't apply volume effect if backend has VOICE_VOLUME_CAP
  audio: add VOICE_VOLUME ctl

12 years agotracetool: handle DTrace keywords 'in', 'next', 'self'
Stefan Hajnoczi [Mon, 16 Apr 2012 11:47:58 +0000 (12:47 +0100)]
tracetool: handle DTrace keywords 'in', 'next', 'self'

Language keywords cannot be used as argument names.  The DTrace backend
appends an underscore to the argument name in order to make the argument
name legal.

This patch adds 'in', 'next', and 'self' keywords to dtrace.py.

Also drop the unnecessary argument name lstrip() call.  The
Arguments.build() method already ensures there is no space around
argument names.  Furthermore it is misleading to do the lstrip() *after*
checking against keywords because the keyword check would not match if
spaces were in the name.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Alon Levy <[email protected]>
Reviewed-by: Lluís Vilanova <[email protected]>
12 years agotracetool: Add MAINTAINERS info
Lluís Vilanova [Tue, 3 Apr 2012 18:48:17 +0000 (20:48 +0200)]
tracetool: Add MAINTAINERS info

Update the MAINTAINERS file to reflect the new Python tracetool code.

[Commit description written by Stefan Hajnoczi]

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agotracetool: Add support for the 'dtrace' backend
Lluís Vilanova [Tue, 3 Apr 2012 18:48:12 +0000 (20:48 +0200)]
tracetool: Add support for the 'dtrace' backend

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agotracetool: Add support for the 'ust' backend
Lluís Vilanova [Tue, 3 Apr 2012 18:48:06 +0000 (20:48 +0200)]
tracetool: Add support for the 'ust' backend

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agotracetool: Add support for the 'simple' backend
Lluís Vilanova [Tue, 3 Apr 2012 18:48:01 +0000 (20:48 +0200)]
tracetool: Add support for the 'simple' backend

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agotracetool: Add support for the 'stderr' backend
Lluís Vilanova [Tue, 3 Apr 2012 18:47:55 +0000 (20:47 +0200)]
tracetool: Add support for the 'stderr' backend

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agotracetool: Add module for the 'h' format
Lluís Vilanova [Tue, 3 Apr 2012 18:47:50 +0000 (20:47 +0200)]
tracetool: Add module for the 'h' format

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agotracetool: Add module for the 'c' format
Lluís Vilanova [Tue, 3 Apr 2012 18:47:44 +0000 (20:47 +0200)]
tracetool: Add module for the 'c' format

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agotracetool: Rewrite infrastructure as python modules
Lluís Vilanova [Tue, 3 Apr 2012 18:47:39 +0000 (20:47 +0200)]
tracetool: Rewrite infrastructure as python modules

The tracetool script is written in shell and has hit several portability
problems due to shell quirks or external tools across host platforms.
Additionally the amount of string processing and lack of real data
structures makes it tough to implement code generator backends for
tracers that are more complex.

This patch replaces the shell version of tracetool with a Python
version.  The new tracetool design is:

  scripts/tracetool.py - top-level script
  scripts/tracetool/backend/ - tracer backends live here (simple, ust)
  scripts/tracetool/format/  - output formats live here (.c, .h)

There is common code for trace-events definition parsing so that
backends can focus on generating code rather than parsing input.

Support for all existing backends (nop, stderr, simple, ust,
and dtrace) is added back in follow-up patches.

[Commit description written by Stefan Hajnoczi]

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agoMerge remote-tracking branch 'spice/spice.v52' into staging
Anthony Liguori [Wed, 18 Apr 2012 12:56:18 +0000 (07:56 -0500)]
Merge remote-tracking branch 'spice/spice.v52' into staging

* spice/spice.v52:
  qxl-render: fix broken vnc+spice since commit f934493
  qxl: set default values of vram*_size_mb to -1
  trace-events: remove unused qxl_vga_ioport_while_not_in_vga_mode

12 years agoMerge remote-tracking branch 'kraxel/usb.46' into staging
Anthony Liguori [Wed, 18 Apr 2012 12:55:56 +0000 (07:55 -0500)]
Merge remote-tracking branch 'kraxel/usb.46' into staging

* kraxel/usb.46: (21 commits)
  usb-ehci: drop assert()
  usb-redir: Notify our peer when we reject a device due to a speed mismatch
  usb-ehci: Drop unused sofv value
  usb-host: rewrite usb_linux_update_endp_table
  usb: use USBDescriptor for endpoint descriptors.
  usb: use USBDescriptor for interface descriptors.
  usb: use USBDescriptor for config descriptors.
  usb: use USBDescriptor for device qualifier descriptors.
  usb: add USBDescriptor, use for device descriptors.
  usb-ehci: frindex always is a 14 bits counter
  usb-ehci: fix ehci_child_detach
  usb-hub: add tracepoints
  usb_packet_set_state: handle p->ep == NULL
  usb-host: add property to turn off pipelining
  usb-host: add usb packet to request tracepoints
  usb-host: trace canceled requests
  usb-host: trace emulated requests
  Add bootindex support to usb-host and usb-redir
  usb-uhci: queuing fix
  usb-uhci: stop queue filling when we find a in-flight td
  ...

12 years agoqxl-render: fix broken vnc+spice since commit f934493
Alon Levy [Wed, 18 Apr 2012 09:27:00 +0000 (12:27 +0300)]
qxl-render: fix broken vnc+spice since commit f934493

Notify any listeners such as vnc that the displaysurface has been
changed, otherwise they will segfault when first accessing the freed old
displaysurface data.

Signed-off-by: Alon Levy <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agoqxl: set default values of vram*_size_mb to -1
Alon Levy [Thu, 29 Mar 2012 20:24:38 +0000 (22:24 +0200)]
qxl: set default values of vram*_size_mb to -1

The addition of those values caused a regression where not specifying
any value for the vram bar size would result in a 4096 _byte_ surface
area. This is ok for the windows driver but causes the X driver to be
unusable. Also, it's a regression. This patch returns the default
behavior of having a 64 megabyte vram BAR.

Signed-off-by: Alon Levy <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agotrace-events: remove unused qxl_vga_ioport_while_not_in_vga_mode
Alon Levy [Wed, 28 Mar 2012 09:30:08 +0000 (11:30 +0200)]
trace-events: remove unused qxl_vga_ioport_while_not_in_vga_mode

The resulting stp file fails to load because of an unresolvable probe.

Signed-off-by: Alon Levy <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agoxen: add a dummy xc_hvm_inject_msi for Xen < 4.2
Stefano Stabellini [Tue, 17 Apr 2012 16:56:51 +0000 (16:56 +0000)]
xen: add a dummy xc_hvm_inject_msi for Xen < 4.2

xc_hvm_inject_msi is only available on Xen >= 4.2: add a dummy
compatibility function for Xen < 4.2.

Also enable msi support only on Xen >= 4.2.

Signed-off-by: Stefano Stabellini <[email protected]>
Acked-by: Anthony PERARD <[email protected]>
12 years agoxen,configure: detect Xen 4.2
Stefano Stabellini [Tue, 17 Apr 2012 17:04:18 +0000 (17:04 +0000)]
xen,configure: detect Xen 4.2

Xen 4.2 is the first to support xc_hvm_inject_msi: use it to determine
if we are running on it.

Signed-off-by: Stefano Stabellini <[email protected]>
Acked-by: Anthony PERARD <[email protected]>
12 years agoAllow controlling volume with PulseAudio backend
Marc-André Lureau [Tue, 17 Apr 2012 12:32:43 +0000 (14:32 +0200)]
Allow controlling volume with PulseAudio backend

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agoconfigure: pa_simple is not needed anymore
Marc-André Lureau [Tue, 17 Apr 2012 12:32:42 +0000 (14:32 +0200)]
configure: pa_simple is not needed anymore

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agoDo not use pa_simple PulseAudio API
Marc-André Lureau [Tue, 17 Apr 2012 12:32:41 +0000 (14:32 +0200)]
Do not use pa_simple PulseAudio API

Unfortunately, pa_simple is a limited API which doesn't let us
retrieve the associated pa_stream. It is needed to control the volume
of the stream.

In v4:
- add missing braces

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agoaudio/spice: add support for volume control
Marc-André Lureau [Tue, 17 Apr 2012 12:32:40 +0000 (14:32 +0200)]
audio/spice: add support for volume control

Use Spice server volume control API when available.

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agohw/ac97: add support for volume control
Marc-André Lureau [Tue, 17 Apr 2012 12:32:39 +0000 (14:32 +0200)]
hw/ac97: add support for volume control

Combine output volume with Master and PCM registers values.
Use default values in mixer_reset ().
Set volume on post-load to update backend values.

v4,v5:
- fix some code style

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agohw/ac97: the volume mask is not only 0x1f
Marc-André Lureau [Tue, 17 Apr 2012 12:32:38 +0000 (14:32 +0200)]
hw/ac97: the volume mask is not only 0x1f

It's a case by case (see Table 66. AC ?97 Baseline Audio Register Map)

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agohw/ac97: remove USE_MIXER code
Marc-André Lureau [Tue, 17 Apr 2012 12:32:37 +0000 (14:32 +0200)]
hw/ac97: remove USE_MIXER code

That code doesn't compile. The interesting bits for volume control are
going to be rewritten in the following patch.

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agoaudio: don't apply volume effect if backend has VOICE_VOLUME_CAP
Marc-André Lureau [Tue, 17 Apr 2012 12:32:36 +0000 (14:32 +0200)]
audio: don't apply volume effect if backend has VOICE_VOLUME_CAP

If the audio backend is capable of volume control, don't apply
software volume (mixeng_volume ()), but instead, rely on backend
volume control. This will allow guest to have full range volume
control.

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agoaudio: add VOICE_VOLUME ctl
Marc-André Lureau [Tue, 17 Apr 2012 12:32:35 +0000 (14:32 +0200)]
audio: add VOICE_VOLUME ctl

Add a new PCM control operation to update the stream volume on the
audio backend.  The argument given is a SWVoiceOut/SWVoiceIn.

v4:
- verified other backends didn't fail/assert on this new control
  they randomly return 0 or -1, but we ignore return value.

Signed-off-by: Marc-Andr? Lureau <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agoseabios: update to 1.7.0
Gerd Hoffmann [Tue, 17 Apr 2012 08:51:41 +0000 (10:51 +0200)]
seabios: update to 1.7.0

Update roms/seabios and pc-bios/bios.bin to the 1.7.0 release.
Most noticable new feature is virtio-scsi support.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-ehci: drop assert()
Gerd Hoffmann [Fri, 30 Mar 2012 11:20:21 +0000 (13:20 +0200)]
usb-ehci: drop assert()

Not sure what the purpose of the assert() was, in any case it is bogous.
We can arrive there if transfer descriptors passed to us from the guest
failed to pass sanity checks, i.e. it is guest-triggerable.  We deal
with that case by resetting the host controller.  Everything is ok, no
need to throw a core dump here.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-redir: Notify our peer when we reject a device due to a speed mismatch
Hans de Goede [Fri, 30 Mar 2012 07:53:54 +0000 (09:53 +0200)]
usb-redir: Notify our peer when we reject a device due to a speed mismatch

Also cleanup (reset) our device state when we reject a device due to a
speed mismatch.

Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-ehci: Drop unused sofv value
Hans de Goede [Fri, 30 Mar 2012 07:53:53 +0000 (09:53 +0200)]
usb-ehci: Drop unused sofv value

The sofv value only ever gets a value assigned and is never used (read)
anywhere, so we can just drop it.

Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-host: rewrite usb_linux_update_endp_table
Gerd Hoffmann [Thu, 29 Mar 2012 14:06:28 +0000 (16:06 +0200)]
usb-host: rewrite usb_linux_update_endp_table

This patch carries a complete rewrite of the usb descriptor parser.
Changes / improvements:

 * We are using the USBDescriptor struct instead of hard-coded offsets
   now to access descriptor data.
 * (debug) printfs are all gone, tracepoints have been added instead.
 * We don't try (and fail) to skip over unneeded descriptors.  We parse
   them all one by one.  We keep track of which configuration, interface
   and altsetting we are looking at and use this information to figure
   which desciptors are in use and which we can ignore.
 * On parse errors we clear all endpoint information, which will
   disallow any communication with the device, except control endpoint
   messages.  This makes sure we don't end up with a silly device state
   where half of the endpoints got enabled and the other half was left
   disabled.
 * Some sanity checks have been added.

The new parser is more robust and also leaves complete device
information in the trace log if you enable the ush_host_parse_*
tracepoints.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb: use USBDescriptor for endpoint descriptors.
Gerd Hoffmann [Thu, 29 Mar 2012 14:01:21 +0000 (16:01 +0200)]
usb: use USBDescriptor for endpoint descriptors.

Add endpoint descriptor substruct to USBDescriptor,
use it in the descriptor generator code.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb: use USBDescriptor for interface descriptors.
Gerd Hoffmann [Thu, 29 Mar 2012 10:30:33 +0000 (12:30 +0200)]
usb: use USBDescriptor for interface descriptors.

Add interface descriptor substruct to USBDescriptor,
use it in the descriptor generator code.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb: use USBDescriptor for config descriptors.
Gerd Hoffmann [Thu, 29 Mar 2012 10:24:08 +0000 (12:24 +0200)]
usb: use USBDescriptor for config descriptors.

Add config descriptor substruct to USBDescriptor,
use it in the descriptor generator code.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb: use USBDescriptor for device qualifier descriptors.
Gerd Hoffmann [Thu, 29 Mar 2012 10:15:01 +0000 (12:15 +0200)]
usb: use USBDescriptor for device qualifier descriptors.

Add device qualifier substruct to USBDescriptor,
use it in the descriptor generator code.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb: add USBDescriptor, use for device descriptors.
Gerd Hoffmann [Thu, 29 Mar 2012 10:04:54 +0000 (12:04 +0200)]
usb: add USBDescriptor, use for device descriptors.

This patch adds a new type for the binary representation of usb
descriptors.  It is put into use for the descriptor generator code
where the struct replaces the hard-coded offsets.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-ehci: frindex always is a 14 bits counter
Hans de Goede [Wed, 28 Mar 2012 18:47:51 +0000 (20:47 +0200)]
usb-ehci: frindex always is a 14 bits counter

frindex always is a 14 bits counter, and not a 13 bits one as we were
emulating. There are some subtle hints to this in the spec, first of all
"Table 2-12. FRINDEX - Frame Index Register" says:
"Bit 13:0 Frame Index. The value in this register increments at the end of
each time frame (e.g. micro-frame). Bits [N:3] are used for the Frame List
current index. This means that each location of the frame list is accessed
8 times (frames or micro-frames) before moving to the next index. The
following illustrates values of N based on the value of the Frame List
Size field in the USBCMD register.

USBCMD[Frame List Size] Number Elements  N
00b 1024 12
01b  512 11
10b  256 10
11b     Reserved"

Notice how the text talks about "Bits [N:3]" are used ..., it does
NOT say that when N == 12 (our case) the counter will wrap from 8191 to 0,
or in otherwords that it is a 13 bits counter (bits 0 - 12).

The other hint is in "Table 2-10. USBSTS USB Status Register Bit Definitions":

"Bit 3 Frame List Rollover - R/WC. The Host Controller sets this bit to a one
when the Frame List Index (see Section 2.3.4) rolls over from its maximum value
to zero. The exact value at which the rollover occurs depends on the frame
list size. For example, if the frame list size (as programmed in the Frame
List Size field of the USBCMD register) is 1024, the Frame Index Register
rolls over every time FRINDEX[13] toggles. Similarly, if the size is 512,
the Host Controller sets this bit to a one every time FRINDEX[12] toggles."

Notice how this text talks about setting bit 3 when bit 13 of frindex toggles
(when there are 1024 entries, so our case), so this indicates that frindex
has a bit 13 making it a 14 bit counter.

Besides these clear hints the real proof is in the pudding. Before this
patch I could not stream data from a USB2 webcam under Windows XP, after
this cam using a USB2 webcam under Windows XP works fine, and no regressions
with other operating systems were seen.

Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-ehci: fix ehci_child_detach
Gerd Hoffmann [Fri, 23 Mar 2012 14:43:45 +0000 (15:43 +0100)]
usb-ehci: fix ehci_child_detach

Looks like a cut+paste bug from ehci_detach.  When the device itself is
detached from a ehci port (ehci_detach op) we have to clear the
device pointer for the companion port too.  When a device gets removed
from a downstream port of a usb hub (ehci_child_detach op) the ehci port
where the usb hub is plugged in is not affected.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-hub: add tracepoints
Gerd Hoffmann [Fri, 23 Mar 2012 14:42:58 +0000 (15:42 +0100)]
usb-hub: add tracepoints

Add tracepoints to the usb hub emulation.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb_packet_set_state: handle p->ep == NULL
Gerd Hoffmann [Fri, 23 Mar 2012 12:34:50 +0000 (13:34 +0100)]
usb_packet_set_state: handle p->ep == NULL

usb_packet_set_state can be called with p->ep = NULL.  The tracepoint
there tries to log endpoint information, which leads to a segfault.
This patch makes usb_packet_set_state handle the NULL pointer properly.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-host: add property to turn off pipelining
Gerd Hoffmann [Thu, 22 Mar 2012 14:28:45 +0000 (15:28 +0100)]
usb-host: add property to turn off pipelining

Add a property to usb-host to disable the bulk endpoint pipelining.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-host: add usb packet to request tracepoints
Gerd Hoffmann [Fri, 23 Mar 2012 11:35:55 +0000 (12:35 +0100)]
usb-host: add usb packet to request tracepoints

Add pointer to USBPacket to all tracepoints tracking requests to make it
easier to identify them when multiple requests are in flight.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-host: trace canceled requests
Gerd Hoffmann [Fri, 23 Mar 2012 11:26:59 +0000 (12:26 +0100)]
usb-host: trace canceled requests

Add tracepoints to track canceled requests.

Signed-off-by: Gerd Hoffmann <[email protected]>
12 years agousb-host: trace emulated requests
Gerd Hoffmann [Thu, 22 Mar 2012 14:10:55 +0000 (15:10 +0100)]
usb-host: trace emulated requests

Add tracepoint to track completion of emulated control requests.

Signed-off-by: Gerd Hoffmann <[email protected]>
This page took 0.096184 seconds and 4 git commands to generate.