sdk/emulator/qemu.git
10 years agocurl: Eliminate unnecessary use of curl_multi_socket_all
Matthew Booth [Tue, 29 Apr 2014 15:03:30 +0000 (16:03 +0100)]
curl: Eliminate unnecessary use of curl_multi_socket_all

curl_multi_socket_all is a deprecated catch-all which checks for
activities on all open curl sockets. We have enough information from
the event loop to check only the sockets with activity. This change
removes use of curl_multi_socket_all in favour of
curl_multi_socket_action called with the relevant handle.

At the same time, it also ensures that the driver only checks for
completion of read operations after reading from a socket, rather than
both reading and writing.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Remove unnecessary explicit calls to internal event handler
Matthew Booth [Tue, 29 Apr 2014 15:03:29 +0000 (16:03 +0100)]
curl: Remove unnecessary explicit calls to internal event handler

Remove calls to curl_multi_do where the relevant handles are already
registered to the event loop.

Ensure that we kick off socket handling with CURL_SOCKET_TIMEOUT after
adding a new handle.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Remove erroneous sleep waiting for curl completion
Matthew Booth [Tue, 29 Apr 2014 15:03:28 +0000 (16:03 +0100)]
curl: Remove erroneous sleep waiting for curl completion

The driver will not start more than a fixed number of curl sessions.
If it needs more, it must wait for the completion of an existing one.
The driver was sleeping, which will prevent the main loop from
running, and therefore the event it's waiting on. It was also directly
calling its internal handler rather than waiting on existing
registered handlers to be called from the main loop.

This change causes it simply to wait for a period of time whilst
allowing the main loop to execute.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Fix return from curl_read_cb with invalid state
Matthew Booth [Tue, 29 Apr 2014 15:03:27 +0000 (16:03 +0100)]
curl: Fix return from curl_read_cb with invalid state

A curl write callback is supposed to return the number of bytes it
handled.  curl_read_cb would have erroneously reported it had handled
all bytes in the event that the internal curl state was invalid.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Remove unnecessary use of goto
Matthew Booth [Tue, 29 Apr 2014 15:03:26 +0000 (16:03 +0100)]
curl: Remove unnecessary use of goto

This isn't any of the usually acceptable uses of goto.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Fix long line
Matthew Booth [Tue, 29 Apr 2014 15:03:25 +0000 (16:03 +0100)]
curl: Fix long line

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/vdi: Error out immediately in vdi_create()
Max Reitz [Tue, 29 Apr 2014 17:03:16 +0000 (19:03 +0200)]
block/vdi: Error out immediately in vdi_create()

Currently, if an error occurs during the part of vdi_create() which
actually writes the image, the function stores -errno, but continues
anyway.

Instead of trying to write data which (if it can be written at all) does
not make any sense without the operations before succeeding (e.g.,
writing the image header), just error out immediately.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/bochs: Fix error handling for seek_to_sector()
Max Reitz [Tue, 29 Apr 2014 17:03:15 +0000 (19:03 +0200)]
block/bochs: Fix error handling for seek_to_sector()

Currently, seek_to_sector() returns -1 both for errors and unallocated
sectors, resulting in silent errors. As 0 is an invalid offset of data
clusters (bitmap_offset is greater than 0 because s->data_offset is
greater than 0), just return 0 for unallocated sectors and -errno in
case of error. This should then be propagated by bochs_read(), the sole
user of seek_to_sector().

That function also has a case of "return -1 in case of error", which is
fixed by this patch as well.

bochs_read() is called by bochs_co_read() which passes the return value
through, therefore it is indeed correct for bochs_read() to return
-errno.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Check min_size in qcow2_grow_l1_table()
Max Reitz [Tue, 29 Apr 2014 17:03:14 +0000 (19:03 +0200)]
qcow2: Check min_size in qcow2_grow_l1_table()

First, new_l1_size is an int64_t, whereas min_size is a uint64_t.
Therefore, during the loop which adjusts new_l1_size until it equals or
exceeds min_size, new_l1_size might overflow and become negative. The
comparison in the loop condition however will take it as an unsigned
value (because min_size is unsigned) and therefore recognize it as
exceeding min_size. Therefore, the loop is left with a negative
new_l1_size, which is not correct. This could be fixed by making
new_l1_size uint64_t.

On the other hand, however, by doing this, the while loop may take
forever. If min_size is e.g. UINT64_MAX, it will take new_l1_size
probably multiple overflows to reach the exact same value (if it reaches
it at all). Then, right after the loop, new_l1_size will be recognized
as being too big anyway.

Both problems require a ridiculously high min_size value, which is very
unlikely to occur; but both problems are also simply avoided by checking
whether min_size is sane before calculating new_l1_size (which should
still be checked separately, though).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Catch bdrv_getlength() error
Max Reitz [Tue, 29 Apr 2014 17:03:13 +0000 (19:03 +0200)]
qcow2: Catch bdrv_getlength() error

The call to bdrv_getlength() from qcow2_check_refcounts() may result in
an error. Check this and abort if necessary.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Use correct width in format strings
Max Reitz [Tue, 29 Apr 2014 17:03:12 +0000 (19:03 +0200)]
block: Use correct width in format strings

Instead of blindly relying on a normal integer having a width of 32 bits
(which is a pretty good assumption, but we should not rely on it if
there is no need), use the correct format string macros.

This does not touch DEBUG output.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Avoid overflow in alloc_clusters_noref()
Max Reitz [Tue, 29 Apr 2014 17:03:11 +0000 (19:03 +0200)]
qcow2: Avoid overflow in alloc_clusters_noref()

alloc_clusters_noref() stores the cluster index in a uint64_t. However,
offsets are often represented as int64_t (as for example the return
value of alloc_clusters_noref() itself demonstrates). Therefore, we
should make sure all offsets in the allocated range of clusters are
representable using int64_t without overflows.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Use error_abort in bdrv_image_info_specific_dump()
Max Reitz [Tue, 29 Apr 2014 16:32:25 +0000 (18:32 +0200)]
block: Use error_abort in bdrv_image_info_specific_dump()

Currently, bdrv_image_info_specific_dump() uses an error variable for
visit_type_ImageInfoSpecific, but ignores the result. As this function
is used here with an output visitor to transform the ImageInfoSpecific
object to a generic QDict, an error should actually be impossible. It is
however better to assert that this is indeed the case. This is done by
this patch using error_abort instead of an unused local Error variable.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Fix open_flags in bdrv_reopen()
Kevin Wolf [Fri, 25 Apr 2014 17:04:55 +0000 (19:04 +0200)]
block: Fix open_flags in bdrv_reopen()

Use the same function as bdrv_open() for determining what the right
flags for bs->file are. Without doing this, a reopen means that
bs->file loses BDRV_O_CACHE_WB or BDRV_O_UNMAP if bs doesn't have it as
well.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoRevert "block: another bdrv_append fix"
Kevin Wolf [Fri, 25 Apr 2014 10:36:07 +0000 (12:36 +0200)]
Revert "block: another bdrv_append fix"

This reverts commit 3a389e7926750cba5c83f662b1941888b2bebc04. The commit
was wrong and what it tried to fix just works today without any change.

What the commit tried to fix:

    When creating live snapshots, the new image file is opened with
    BDRV_O_NO_BACKING because the whole backing chain is already opened.
    It is then appended to the chain using bdrv_append(). The result of
    this was that the image had a backing file, but BDRV_O_NO_BACKING
    was still set. This is obviously inconsistent.

    There used to be some places in qemu that closed and image and then
    opened it again, with its old flags (a bdrv_open()/close() sequence
    involves reopening the whole backing file chain, too). In this case
    the BDRV_O_NO_BACKING flag meant that the backing chain wasn't
    reopened and only the top layer was left.

    (Most, but not all of these places are replaced by bdrv_reopen()
    today, which doesn't touch the backing files at all.)

    Other places that looked at bs->open_flags weren't interested in
    BDRV_O_NO_BACKING, so no breakage there.

What it actually did:

    The commit moved the BDRV_O_NO_BACKING away to the backing file.
    Because the bdrv_open()/close() sequences only looked at the flags
    of the top level BlockDriverState and used it for the whole chain,
    the flag didn't hurt there any more. Obviously, it is still
    inconsistent because the backing file may have another backing file,
    but without practical impact.

    At the same time, it swapped all other flags. This is practically
    irrelevant as long as live snapshots only allow opening the new
    layer with the same flags as the old top layer. It still doesn't
    make any sense, and it is a time bomb that explodes as soon as the
    flags can differ.

    bdrv_append_temp_snapshot() is such a case: It adds the new flag
    BDRV_O_TEMPORARY for the temporary snapshot. The swapping of commit
    3a389e79 results in the following nonsensical configuration:

    bs->open_flags:                     BDRV_O_TEMPORARY cleared
    bs->file->open_flags:               BDRV_O_TEMPORARY set
    bs->backing_hd->open_flags:         BDRV_O_TEMPORARY set
    bs->backing_hd->file->open_flags:   BDRV_O_TEMPORARY cleared

    We're still lucky because the format layer ignores the flag and the
    protocol layer happens to get the right value, but sooner or later
    this is bound to go wrong...

What the right fix would have been:

    Simply clear the BDRV_O_NO_BACKING flag when the BlockDriverState is
    appended to an existing backing file chain, because now it does have
    a backing file.

    Commit 4ddc07ca already implemented this silently in bdrv_append(),
    so we don't have to come up with a new fix.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Unlink temporary files in raw-posix/win32
Kevin Wolf [Fri, 11 Apr 2014 17:16:36 +0000 (19:16 +0200)]
block: Unlink temporary files in raw-posix/win32

Instead of having unlink() calls in the generic block layer, where we
aren't even guarateed to have a file name, move them to those block
drivers that are actually used and that always have a filename. Gets us
rid of some #ifdefs as well.

The patch also converts bs->is_temporary to a new BDRV_O_TEMPORARY open
flag so that it is inherited in the protocol layer and the raw-posix and
raw-win32 drivers can unlink the file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Remove BDRV_O_COPY_ON_READ for bs->file
Kevin Wolf [Fri, 11 Apr 2014 19:36:45 +0000 (21:36 +0200)]
block: Remove BDRV_O_COPY_ON_READ for bs->file

Copy on Read makes sense on the format level where backing files are
implemented, but it's not required on the protocol level. While it
shouldn't actively break anything to have COR enabled on both layers,
needless serialisation and allocation checks may impact performance.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Create bdrv_backing_flags()
Kevin Wolf [Fri, 25 Apr 2014 11:27:34 +0000 (13:27 +0200)]
block: Create bdrv_backing_flags()

Instead of manipulation flags inline, move the derivation of the flags
of a backing file into a new function next to the existing functions
that derive flags for bs->file and for the block driver open function.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Create bdrv_inherited_flags()
Kevin Wolf [Fri, 11 Apr 2014 19:29:52 +0000 (21:29 +0200)]
block: Create bdrv_inherited_flags()

Instead of having bdrv_open_flags() as a function that creates flags for
several unrelated places and then adding open-coded flags on top, create
a new function that derives the flags for bs->file from the flags for bs.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoiotests: Discarding compressed clusters on qcow2
Max Reitz [Tue, 29 Apr 2014 14:12:31 +0000 (16:12 +0200)]
iotests: Discarding compressed clusters on qcow2

Add a test which discards a compressed cluster on qcow2. This should
work without any problems.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Fix discard
Max Reitz [Tue, 29 Apr 2014 14:12:30 +0000 (16:12 +0200)]
qcow2: Fix discard

discard_single_l2() should not implement its own version of
qcow2_get_cluster_type(), but rather rely on this already existing
function. By doing so, it will work for compressed clusters as well
(which it did not so far).

Also, rename "old_offset" to "old_l2_entry", as both are quite different
(and the value is indeed of the latter kind).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: qemu-iotests: make test 019 and 086 work with spaced pathnames
Jeff Cody [Thu, 10 Apr 2014 20:47:40 +0000 (16:47 -0400)]
block: qemu-iotests: make test 019 and 086 work with spaced pathnames

Both tests 019 and 086 need proper quotations to work with pathnames
that contain spaces.

Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: qemu-iotests - fix image cleanup when using spaced pathnames
Jeff Cody [Thu, 10 Apr 2014 20:47:39 +0000 (16:47 -0400)]
block: qemu-iotests - fix image cleanup when using spaced pathnames

The _rm_test_img() function in common.rc did not quote the image
file, which left droppings in the scratch directory (and performed
a potentially unsafe rm -f).

This adds the necessary quotes.

Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agomirror: Check for bdrv_get_info result
Fam Zheng [Tue, 29 Apr 2014 10:14:17 +0000 (18:14 +0800)]
mirror: Check for bdrv_get_info result

bdrv_get_info could fail. Add check before using the returned value.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agomirror: Fix resource leak when bdrv_getlength fails
Fam Zheng [Tue, 29 Apr 2014 10:09:09 +0000 (18:09 +0800)]
mirror: Fix resource leak when bdrv_getlength fails

The direct return will skip releasing of all the resouces at
immediate_exit, don't miss that.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Ignore duplicate or NULL format_name in bdrv_iterate_format
Jeff Cody [Mon, 28 Apr 2014 22:29:54 +0000 (18:29 -0400)]
block: Ignore duplicate or NULL format_name in bdrv_iterate_format

Some block drivers have multiple BlockDriver instances with identical
format_name fields (e.g. gluster, nbd).

Both qemu-img and qemu will use bdrv_iterate_format() to list the
supported formats when a help option is invoked.  As protocols and
formats may register multiple drivers, redundant listings of formats
occur (e.g., "Supported formats: ... gluster gluster gluster gluster ...
").

Since the list of driver formats will be small, this performs a simple
linear search on format_name, and ignores any duplicates.

The end result change is that the iterator will no longer receive
duplicate string names, nor will it receive NULL pointers.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Add '--version' option to qemu-img
Jeff Cody [Mon, 28 Apr 2014 18:37:18 +0000 (14:37 -0400)]
block: Add '--version' option to qemu-img

This allows qemu-img to print out version information, without
needing to print the long help wall of text.

While there, perform some minor whitespace cleanup, and remove the
unused option_index variable in the call to getopt_long().

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agomirror: Use DIV_ROUND_UP
Fam Zheng [Mon, 28 Apr 2014 02:59:28 +0000 (10:59 +0800)]
mirror: Use DIV_ROUND_UP

Although bdrv_getlength() was just called above this, and checked for
error, it is better to just use the value we already get, and use
DIV_ROUND_UP.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: fix qemu-img --help invocation
Jeff Cody [Fri, 25 Apr 2014 21:02:32 +0000 (17:02 -0400)]
block: fix qemu-img --help invocation

This fixes a bug introduced in commit ac1307ab, that caused the
'--help' option to not be recognized as a valid command, and not
print any help.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/otubo/seccomp' into staging
Peter Maydell [Mon, 28 Apr 2014 13:14:35 +0000 (14:14 +0100)]
Merge remote-tracking branch 'remotes/otubo/seccomp' into staging

* remotes/otubo/seccomp:
  seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist
  seccomp: add timerfd_create and timerfd_settime to the whitelist

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-04-28' into staging
Peter Maydell [Mon, 28 Apr 2014 12:43:16 +0000 (13:43 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-04-28' into staging

trivial patches for 2014-04-28

# gpg: Signature made Mon 28 Apr 2014 05:56:01 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514  66A7 BEE5 9D74 A4C3 D7DB

* remotes/mjt/tags/trivial-patches-2014-04-28:
  slirp/smb: Move ncalrpc directory to tmp
  po: add proper Language: tags to .po files
  po/Makefile: fix $SRC_PATH reference
  init_paths: fix minor memory leak
  virtfs-proxy-helper: fix call to accept
  net/net.c: remove unnecessary semicolon
  Add QEMU logo (SVG file)
  vl: avoid closing stdout with 'writeconfig'
  xilinx: Fix typo in comment (Marvel -> Marvell)
  vl: Eliminate a superfluous local variable
  vl: Remove useless 'continue'
  gitignore: cleanups #2
  tests/.gitignore: Ignore test-rfifolock
  move test-* from .gitignore to tests/.gitignore
  configure: Improve help behavior
  vl: convert -m to QemuOpts
  qemu-option: introduce qemu_find_opts_singleton
  misc: Use cpu_physical_memory_read and cpu_physical_memory_write

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Mon, 28 Apr 2014 11:56:33 +0000 (12:56 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  monitor: fix qmp_getfd() fd leak in error case
  HMP: support specifying dump format for dump-guest-memory
  HMP: fix doc of dump-guest-memory
  qmp: object-add: Validate class before creating object
  monitor: Add device_add and device_del completion.
  monitor: Add command_completion callback to mon_cmd_t.
  monitor: Fix drive_del id argument type completion.
  error: Remove some unused headers
  qerror.h: Replace QERR_NOT_SUPPORTED with QERR_UNSUPPORTED
  qerror.h: Remove QERR defines that are only used once
  qerror.h: Remove unused error classes
  error: Print error_report() to stderr if using qmp
  monitor: Remove unused monitor_print_filename
  error: Privatize error_print_loc
  vnc: Remove default_mon usage
  slirp: Remove default_mon usage

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Mon, 28 Apr 2014 10:50:30 +0000 (11:50 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Block pull request

# gpg: Signature made Fri 25 Apr 2014 17:05:13 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  iscsi: Don't use error_is_set() to suppress additional errors
  blockdev: Clean up fragile use of error_is_set()
  nbd: Use return values instead of error_is_set(errp)
  qemu-img: Consistently name Error * objects err, and not errp
  Use error_is_set() only when necessary (again)
  block: Expose host_* drivers in blockdev-add
  MAINTAINERS: Add qemu-img/io to block subsystem
  qemu-iotests: Improve and make use of QMPTestCase.wait_until_completed()
  doc: add -drive rerror=,werror= to qemu --help output
  block: Prevent coroutine stack overflow when recursing in bdrv_open_backing_file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Mon, 28 Apr 2014 10:29:02 +0000 (11:29 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

Net patches

# gpg: Signature made Fri 25 Apr 2014 15:07:31 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/net-pull-request:
  net: Don't use error_is_set() to suppress additional errors
  net: Make qmp_query_rx_filter() with name argument more obvious
  net: xilinx_axienet.c: Add phy soft reset bit clearing
  net/net.c: Remove unnecessary semicolon
  pcnet: remove duplicate assignment
  tap: Avoid extra iterations while closing file fd

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20140425' into staging
Peter Maydell [Mon, 28 Apr 2014 09:51:32 +0000 (10:51 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140425' into staging

Some s390x patches:

- gdb stubs to make it compile if gdb support is pulled in
- linux-headers update for new oneregs
- two onereg enhancements

# gpg: Signature made Fri 25 Apr 2014 12:42:46 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20140425:
  s390x/kvm: sync gbea and pp register
  s390x/kvm: rework KVM synchronize to tracing for some ONEREGS
  linux-headers update
  s390x: empty function stubs in preparation for __KVM_HAVE_GUEST_DEBUG

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoslirp/smb: Move ncalrpc directory to tmp
Michael Buesch [Sun, 27 Apr 2014 10:54:12 +0000 (14:54 +0400)]
slirp/smb: Move ncalrpc directory to tmp

The smbd forked by qemu still uses the default ncalrpc directory
in /var/run/samba. This may lead to problems, if /var/run/samba
does not exist (for example if /var/run is a tmpfs and the host
smbd was not started).

This leads to the following error message from samba
and an unworkable smbd:
Failed to create pipe directory /var/run/samba/ncalrpc - No such file or directory

Fix this by pointing smbd to /tmp/qemu-smb.%d.%d/ncalrpc as ncalrpc directory.
Smbd will create the actual ncalrpc subdirectory on its own.

Signed-off-by: Michael Buesch <m@bues.ch>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Applying this to -trivial because it _is_ rather trivial
 and because Jan does not reply for months)

10 years agopo: add proper Language: tags to .po files
Michael Tokarev [Sun, 27 Apr 2014 10:49:14 +0000 (14:49 +0400)]
po: add proper Language: tags to .po files

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agopo/Makefile: fix $SRC_PATH reference
Michael Tokarev [Sun, 27 Apr 2014 09:32:07 +0000 (13:32 +0400)]
po/Makefile: fix $SRC_PATH reference

The rule for messages.po appears to be slightly wrong.
Move the `cd' command within parens.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Stefan Weil <sw@weilnetz.de>
10 years agoinit_paths: fix minor memory leak
Kirill Batuzov [Thu, 10 Apr 2014 14:07:57 +0000 (18:07 +0400)]
init_paths: fix minor memory leak

Fields "name" (created with strdup in new_entry) and "pathname"
(created with g_strdup_printf in new_entry) of pathelem struct should
be freed before the whole struct is.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovirtfs-proxy-helper: fix call to accept
Tim Comer [Sat, 19 Apr 2014 17:39:57 +0000 (13:39 -0400)]
virtfs-proxy-helper: fix call to accept

The current code calls accept() without initializing the size parameter
which means the accept call might write too much to the stack.

URL: https://bugs.gentoo.org/486714
Signed-off-by: Tim Comer <comer0@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agonet/net.c: remove unnecessary semicolon
Igor Ryzhov [Wed, 16 Apr 2014 13:43:07 +0000 (17:43 +0400)]
net/net.c: remove unnecessary semicolon

Signed-off-by: Igor Ryzhov <iryzhov@arccn.ru>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoAdd QEMU logo (SVG file)
Stefan Weil [Thu, 17 Apr 2014 20:31:13 +0000 (22:31 +0200)]
Add QEMU logo (SVG file)

The "Q" of the logo is already included in pc-bios/qemu_logo_no_text.svg.

This file now adds the complete logo as it was designed by Benoît Canet.
Benoît licensed it under CC-BY 3.0, see
http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg02865.html.

Unneeded borders from Benoît's original logo were removed,
and metadata (license, author, date) was added in this version.

Cc: Benoît Canet <benoit@irqsave.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: avoid closing stdout with 'writeconfig'
Chen Gang [Tue, 22 Apr 2014 01:12:34 +0000 (09:12 +0800)]
vl: avoid closing stdout with 'writeconfig'

'writeconfig' supports output to stdout (with '-'); when that happens,
we must not close stdout, or further command line options that also use
stdout will be impacted. (Although 'writeconfig' was copied from
'readconfig', the latter does not have the problem because it does not
support reading from '-')

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoxilinx: Fix typo in comment (Marvel -> Marvell)
Stefan Weil [Thu, 17 Apr 2014 17:32:42 +0000 (19:32 +0200)]
xilinx: Fix typo in comment (Marvel -> Marvell)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: Eliminate a superfluous local variable
Chen Gang [Tue, 15 Apr 2014 23:57:41 +0000 (07:57 +0800)]
vl: Eliminate a superfluous local variable

CODING_STYLE frowns upon mixing declarations and statements.  main()
has such a declaration.  Clean up by eliminating the variable.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: Remove useless 'continue'
Chen Gang [Tue, 15 Apr 2014 23:56:20 +0000 (07:56 +0800)]
vl: Remove useless 'continue'

"This if else has no code between it and the end of the enclosing
while loop. This makes this continue redundant."

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agogitignore: cleanups #2
Michael Tokarev [Sun, 27 Apr 2014 11:02:26 +0000 (15:02 +0400)]
gitignore: cleanups #2

A few more cleanups for .gitignore file.
The final goal is to have only files in there which
are generated during build.  Things like .orig or
.gdbinit are definitely not generated during build.
Also, anchor a few more build-time directories.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotests/.gitignore: Ignore test-rfifolock
Cole Robinson [Fri, 11 Apr 2014 22:23:02 +0000 (18:23 -0400)]
tests/.gitignore: Ignore test-rfifolock

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomove test-* from .gitignore to tests/.gitignore
Laszlo Ersek [Fri, 11 Apr 2014 22:23:01 +0000 (18:23 -0400)]
move test-* from .gitignore to tests/.gitignore

Also sort the test-* entries in the latter.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: Improve help behavior
Fam Zheng [Fri, 18 Apr 2014 06:55:36 +0000 (14:55 +0800)]
configure: Improve help behavior

Old:
There are two paths to show help and exit 1, one is with "-h" or
"--help", one is with invalid options.

New:
Show help and exit 0 for --help.
On invalid option, don't show the long help and bury the early "ERROR:"
line, just give a message pointing to --help.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: convert -m to QemuOpts
Igor Mammedov [Wed, 27 Nov 2013 00:27:35 +0000 (01:27 +0100)]
vl: convert -m to QemuOpts

Adds option to -m
 "size" - startup memory amount

For compatibility with legacy CLI if suffix-less number is passed,
it assumes amount in Mb.

Otherwise user is free to use suffixed number using suffixes b,k/K,M,G

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqemu-option: introduce qemu_find_opts_singleton
Paolo Bonzini [Thu, 6 Mar 2014 09:39:24 +0000 (10:39 +0100)]
qemu-option: introduce qemu_find_opts_singleton

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomisc: Use cpu_physical_memory_read and cpu_physical_memory_write
Stefan Weil [Mon, 7 Apr 2014 18:28:23 +0000 (20:28 +0200)]
misc: Use cpu_physical_memory_read and cpu_physical_memory_write

These functions don't need type casts (as does cpu_physical_memory_rw)
and also make the code better readable.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoseccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist
Paul Moore [Wed, 26 Feb 2014 15:25:01 +0000 (10:25 -0500)]
seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist

Additional testing reveals that PulseAudio requires shmctl() and the
mlock()/munlock() syscalls on some systems/configurations.  As before,
on systems that do require these syscalls, the problem can be seen with
the following command line:

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

Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
10 years agoseccomp: add timerfd_create and timerfd_settime to the whitelist
Felix Geyer [Thu, 30 Jan 2014 20:28:17 +0000 (21:28 +0100)]
seccomp: add timerfd_create and timerfd_settime to the whitelist

libusb calls timerfd_create() and timerfd_settime() when it's built with
timerfd support.

Command to reproduce:

       -device usb-host,hostbus=1,hostaddr=3,id=hostdev0

Log messages:

audit(1390730418.924:135): auid=4294967295 uid=121 gid=103 ses=4294967295
                           pid=5232 comm="qemu-system-x86" sig=31 syscall=283
                           compat=0 ip=0x7f2b0f4e96a7 code=0x0
audit(1390733100.580:142): auid=4294967295 uid=121 gid=103 ses=4294967295
                           pid=16909 comm="qemu-system-x86" sig=31 syscall=286
                           compat=0 ip=0x7f03513a06da code=0x0

Reading a few hundred MB from a USB drive on x86_64 shows this syscall distribution.
Therefore the timerfd_settime priority is set to 242.

    calls  syscall
 --------- ----------------
   5303600 write
   2240554 read
   2167030 ppoll
   2134828 ioctl
    704023 timerfd_settime
    689105 poll
     83122 futex
       803 writev
       476 rt_sigprocmask
       287 recvmsg
       178 brk

Signed-off-by: Felix Geyer <debfx@fobos.de>
Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
10 years agoiscsi: Don't use error_is_set() to suppress additional errors
Markus Armbruster [Fri, 25 Apr 2014 14:50:35 +0000 (16:50 +0200)]
iscsi: Don't use error_is_set() to suppress additional errors

Using error_is_set(errp) that way can sweep programming errors under
the carpet when we get called incorrectly with an error set.

Commit 24d3bd6 added a broken error path to iscsi_do_inquiry(): it
first calls error_setg(), then jumps to the preexisting error label,
where error_setg() gets called again, triggering an assertion failure.

Commit cbee81f fixed this by guarding the second error_setg() with an
error_is_set().

Replace this fix by a simpler and safer one: jump right behind the
second error_setg().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblockdev: Clean up fragile use of error_is_set()
Markus Armbruster [Fri, 25 Apr 2014 14:50:34 +0000 (16:50 +0200)]
blockdev: Clean up fragile use of error_is_set()

Using error_is_set(ERRP) to find out whether a function failed is
either wrong, fragile, or unnecessarily opaque.  It's wrong when ERRP
may be null, because errors go undetected when it is.  It's fragile
when proving ERRP non-null involves a non-local argument.  Else, it's
unnecessarily opaque (see commit 84d18f0).

The error_is_set(errp) in internal_snapshot_prepare() is merely
fragile, because the caller never passes a null errp argument.

Make the code more robust and more obviously correct: receive the
error in a local variable, then propagate it through the parameter.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agonbd: Use return values instead of error_is_set(errp)
Markus Armbruster [Fri, 25 Apr 2014 14:50:33 +0000 (16:50 +0200)]
nbd: Use return values instead of error_is_set(errp)

Using error_is_set(errp) to check whether a function call failed is
fragile: it breaks when errp is null.  Check perfectly suitable return
values instead when possible.  errp can't be null there now, but this
is more robust and more obviously correct

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-img: Consistently name Error * objects err, and not errp
Markus Armbruster [Fri, 25 Apr 2014 14:50:32 +0000 (16:50 +0200)]
qemu-img: Consistently name Error * objects err, and not errp

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoUse error_is_set() only when necessary (again)
Markus Armbruster [Fri, 25 Apr 2014 14:50:31 +0000 (16:50 +0200)]
Use error_is_set() only when necessary (again)

error_is_set(&var) is the same as var != NULL, but it takes
whole-program analysis to figure that out.  Unnecessarily hard for
optimizers, static checkers, and human readers.  Commit 84d18f0 dumbed
it down to obvious, but a few more have crept in since, and
documentation was overlooked.  Dumb these down, too.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Expose host_* drivers in blockdev-add
Kevin Wolf [Thu, 24 Apr 2014 13:02:39 +0000 (15:02 +0200)]
block: Expose host_* drivers in blockdev-add

All the functionality to use the host_device, host_cdrom and host_floppy
drivers is already there, they just need to be added to the schema.

The block driver names containing underscores are preexisting and cannot
be changed without breaking command line compatibility.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMAINTAINERS: Add qemu-img/io to block subsystem
Kevin Wolf [Thu, 24 Apr 2014 09:53:39 +0000 (11:53 +0200)]
MAINTAINERS: Add qemu-img/io to block subsystem

qemu-img and qemu-io were not covered by any MAINTAINERS entry so far.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Improve and make use of QMPTestCase.wait_until_completed()
Fam Zheng [Wed, 2 Apr 2014 05:54:07 +0000 (13:54 +0800)]
qemu-iotests: Improve and make use of QMPTestCase.wait_until_completed()

This eliminates code duplication.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agodoc: add -drive rerror=,werror= to qemu --help output
Stefan Hajnoczi [Wed, 23 Apr 2014 11:55:37 +0000 (13:55 +0200)]
doc: add -drive rerror=,werror= to qemu --help output

These options are already documented on the man page but missing from
qemu --help.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Prevent coroutine stack overflow when recursing in bdrv_open_backing_file.
Benoît Canet [Tue, 22 Apr 2014 15:05:27 +0000 (17:05 +0200)]
block: Prevent coroutine stack overflow when recursing in bdrv_open_backing_file.

In 1.7.1 qcow2_create2 reopen the file for flushing without the BDRV_O_NO_BACKING
flags.

As a consequence the code would recursively open the whole backing chain.

These three stack arrays would pile up through the recursion and lead to a coroutine
stack overflow.

Convert these array to malloced buffers in order to streamline the coroutine
footprint.

Symptoms where freezes or segfaults on production machines while taking QMP externals
snapshots. The overflow disturbed coroutine switching.

[Resolved conflicts on qemu.git/master since the patch was against v1.7.1
--Stefan]

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agomonitor: fix qmp_getfd() fd leak in error case
Stefan Hajnoczi [Thu, 24 Apr 2014 11:58:18 +0000 (13:58 +0200)]
monitor: fix qmp_getfd() fd leak in error case

qemu_chr_fe_get_msgfd() transfers ownership of the file descriptor to
the caller.  Therefore all code paths in qmp_getfd() should either
register the file descriptor somewhere or close it.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoHMP: support specifying dump format for dump-guest-memory
Qiao Nuohan [Thu, 17 Apr 2014 08:15:07 +0000 (16:15 +0800)]
HMP: support specifying dump format for dump-guest-memory

Dumping guest memory is available to specify the dump format now. This patch
adds options '-z|-l|-s' to HMP command dump-guest-memory to specify dumping in
kdump-compression format, with zlib/lzo/snappy compression. And without these
options ELF format will be used.

The discussion about this feature is here:

http://lists.nongnu.org/archive/html/qemu-devel/2014-03/msg04235.html

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Suggested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> (on s390x/kvm)
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoHMP: fix doc of dump-guest-memory
Qiao Nuohan [Thu, 17 Apr 2014 08:15:06 +0000 (16:15 +0800)]
HMP: fix doc of dump-guest-memory

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp: object-add: Validate class before creating object
Eduardo Habkost [Wed, 16 Apr 2014 17:39:38 +0000 (14:39 -0300)]
qmp: object-add: Validate class before creating object

Currently it is very easy to crash QEMU by issuing an object-add command
using an abstract class or a class that doesn't support
TYPE_USER_CREATABLE as parameter.

Example: with the following QMP command:

    (QEMU) object-add qom-type=cpu id=foo

QEMU aborts at:

    ERROR:qom/object.c:335:object_initialize_with_type: assertion failed: (type->abstract == false)

This patch moves the check for TYPE_USER_CREATABLE before object_new(),
and adds a check to prevent the code from trying to instantiate abstract
classes.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Tested-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agonet: Don't use error_is_set() to suppress additional errors
Markus Armbruster [Thu, 24 Apr 2014 13:44:18 +0000 (15:44 +0200)]
net: Don't use error_is_set() to suppress additional errors

Using error_is_set(errp) that way can sweep programming errors under
the carpet when we get called incorrectly with an error set.

qmp_query_rx_filter() breaks its loop when it detects an error.  It
needs to set another error when the loop completes normally.

Return right away instead of merely breaking the loop.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agonet: Make qmp_query_rx_filter() with name argument more obvious
Markus Armbruster [Thu, 24 Apr 2014 13:44:17 +0000 (15:44 +0200)]
net: Make qmp_query_rx_filter() with name argument more obvious

With a client name, the QMP command is specified to return a list of
one element.  This isn't locally obvious in the code.  Make it so.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agomonitor: Add device_add and device_del completion.
Hani Benhabiles [Sun, 13 Apr 2014 15:25:07 +0000 (16:25 +0100)]
monitor: Add device_add and device_del completion.

Also fix device_add completion including non-hotpluggable devices.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: Add command_completion callback to mon_cmd_t.
Hani Benhabiles [Sun, 13 Apr 2014 15:25:06 +0000 (16:25 +0100)]
monitor: Add command_completion callback to mon_cmd_t.

Convert object_add and object_del commands to use the new callback.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: Fix drive_del id argument type completion.
Hani Benhabiles [Sun, 13 Apr 2014 15:25:05 +0000 (16:25 +0100)]
monitor: Fix drive_del id argument type completion.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoerror: Remove some unused headers
Cole Robinson [Fri, 21 Mar 2014 23:42:28 +0000 (19:42 -0400)]
error: Remove some unused headers

Makes it a bit clear how the interdependencies work.

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqerror.h: Replace QERR_NOT_SUPPORTED with QERR_UNSUPPORTED
Cole Robinson [Fri, 21 Mar 2014 23:42:27 +0000 (19:42 -0400)]
qerror.h: Replace QERR_NOT_SUPPORTED with QERR_UNSUPPORTED

The former is only used twice, the latter is used over 30 times, and
has a nicer error message.

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqerror.h: Remove QERR defines that are only used once
Cole Robinson [Fri, 21 Mar 2014 23:42:26 +0000 (19:42 -0400)]
qerror.h: Remove QERR defines that are only used once

Just hardcode them in the callers

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqerror.h: Remove unused error classes
Cole Robinson [Fri, 21 Mar 2014 23:42:25 +0000 (19:42 -0400)]
qerror.h: Remove unused error classes

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoerror: Print error_report() to stderr if using qmp
Cole Robinson [Fri, 21 Mar 2014 23:42:24 +0000 (19:42 -0400)]
error: Print error_report() to stderr if using qmp

monitor_printf will drop the requested output if cur_mon is qmp (for
good reason). However these messages are often helpful for debugging
issues with via libvirt.

If we know the message won't hit the monitor, send it to stderr.

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: Remove unused monitor_print_filename
Cole Robinson [Fri, 21 Mar 2014 23:42:23 +0000 (19:42 -0400)]
monitor: Remove unused monitor_print_filename

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoerror: Privatize error_print_loc
Cole Robinson [Fri, 21 Mar 2014 23:42:22 +0000 (19:42 -0400)]
error: Privatize error_print_loc

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agovnc: Remove default_mon usage
Cole Robinson [Fri, 21 Mar 2014 23:42:21 +0000 (19:42 -0400)]
vnc: Remove default_mon usage

These errors don't seem user initiated, so forcibly printing to the
monitor doesn't seem right. Just use error_report.

Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoslirp: Remove default_mon usage
Cole Robinson [Fri, 21 Mar 2014 23:42:20 +0000 (19:42 -0400)]
slirp: Remove default_mon usage

These errors don't seem user initiated, so forcibly printing to the
monitor doesn't seem right. Just use error_report.

Drop lprint since it's now unused.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/rth/tags/tgt-axp-pull-20140424' into staging
Peter Maydell [Fri, 25 Apr 2014 12:25:22 +0000 (13:25 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/tgt-axp-pull-20140424' into staging

target-alpha queue pull for 20140424

# gpg: Signature made Thu 24 Apr 2014 20:44:23 BST using RSA key ID 4DD0279B
# gpg: Can't check signature: public key not found

* remotes/rth/tags/tgt-axp-pull-20140424: (40 commits)
  target-alpha: Remove cpu_unique, cpu_sysval, cpu_usp
  target-alpha: Tidy alpha_translate_init
  target-alpha: Don't issue goto_tb under singlestep
  target-alpha: Use non-local temps for zero/sink
  target-alpha: Use extract to get insn fields
  target-alpha: Convert mfpr/mtpr to source/sink
  target-alpha: Convert gen_cpys et al to source/sink
  target-alpha: Convert gen_fcvtlq/ql to source/sink
  target-alpha: Convert gen_fcmov to source/sink
  target-alpha: Convert gen_bcond to source/sink
  target-alpha: Convert most ieee insns to source/sink
  target-alpha: Convert gen_ieee_input to source/sink
  target-alpha: Convert MVIOP2 to source/sink
  target-alpha: Convert ARITH3 to source/sink
  target-alpha: Convert FARITH3 to source/sink
  target-alpha: Convert FARITH2 to source/sink
  target-alpha: Convert gen_zap/not to source/sink
  target-alpha: Convert gen_ins_h/l to source/sink
  target-alpha: Convert gen_ext_h/l to source/sink
  target-alpha: Convert gen_msk_h/l to source/sink
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agonet: xilinx_axienet.c: Add phy soft reset bit clearing
Nathan Rossi [Wed, 9 Apr 2014 01:52:39 +0000 (18:52 -0700)]
net: xilinx_axienet.c: Add phy soft reset bit clearing

Clear the BMCR Reset when writing to registers.

Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
[ PC:
 * Trivial style fixes to commit message
]
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agonet/net.c: Remove unnecessary semicolon
Igor Ryzhov [Wed, 16 Apr 2014 13:43:07 +0000 (17:43 +0400)]
net/net.c: Remove unnecessary semicolon

Signed-off-by: Igor Ryzhov <iryzhov@arccn.ru>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agopcnet: remove duplicate assignment
Prasad Joshi [Sun, 23 Mar 2014 09:28:40 +0000 (14:58 +0530)]
pcnet: remove duplicate assignment

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotap: Avoid extra iterations while closing file fd
Pankaj Gupta [Wed, 12 Mar 2014 16:54:27 +0000 (22:24 +0530)]
tap: Avoid extra iterations while closing file fd

Avoid iterations for fd 0, 1 & 2 when we are closing file fds in child process.

Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Fri, 25 Apr 2014 11:22:37 +0000 (12:22 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches

# gpg: Signature made Wed 23 Apr 2014 11:02:29 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  block/cloop: use PRIu32 format specifier for uint32_t
  vmdk: Fix "%x" to PRIx32 in format strings for cid
  qemu-img: Improve error messages
  qemu-iotests: Check common namespace for id and node-name
  block: Catch duplicate IDs in bdrv_new()
  qemu-img: Avoid duplicate block device IDs
  block: Add errp to bdrv_new()
  convert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create()
  block: Remove -errno return value from bdrv_assign_node_name
  curl: Replaced old error handling with error reporting API.
  block: Handle error of bdrv_getlength in bdrv_create_dirty_bitmap
  vmdk: Fix %d and %lld to PRI* in format strings
  block: Check bdrv_getlength() return value in bdrv_make_zero()
  block: Catch integer overflow in bdrv_rw_co()
  block: Limit size to INT_MAX in bdrv_check_byte_request()
  block: Fix nb_sectors check in bdrv_check_byte_request()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agos390x/kvm: sync gbea and pp register
Christian Borntraeger [Thu, 3 Apr 2014 09:01:13 +0000 (11:01 +0200)]
s390x/kvm: sync gbea and pp register

We also need to sync guest breaking event address and program parameter
register for migration support.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x/kvm: rework KVM synchronize to tracing for some ONEREGS
Christian Borntraeger [Thu, 3 Apr 2014 13:54:58 +0000 (15:54 +0200)]
s390x/kvm: rework KVM synchronize to tracing for some ONEREGS

Some ONE_REGS on s390 are not protected by a capability. Older kernels
might not provide those and return an error. Fortunately these registers
are only critical for the migration path. There is no need to error out
on reset and normal runtime. Furthermore, these kernels don't provide
a proper dirty bitmap anyway, so let's use tracing for those errors.

Also provide generic one reg helper to simplify the code.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agolinux-headers update
Cornelia Huck [Fri, 25 Apr 2014 10:57:56 +0000 (12:57 +0200)]
linux-headers update

linux-headers update against v3.15-rc2 (a798c10f)

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x: empty function stubs in preparation for __KVM_HAVE_GUEST_DEBUG
David Hildenbrand [Mon, 3 Sep 2012 10:45:13 +0000 (12:45 +0200)]
s390x: empty function stubs in preparation for __KVM_HAVE_GUEST_DEBUG

This patch creates empty function stubs (used by the gdbserver) in preparation
for the hw debugging support by kvm on s390, which will enable the
__KVM_HAVE_GUEST_DEBUG define in the linux headers and require these methods on
the qemu side.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-usb-5' into staging
Peter Maydell [Thu, 24 Apr 2014 15:16:57 +0000 (16:16 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-5' into staging

usb: mtp filesharing

# gpg: Signature made Wed 23 Apr 2014 09:28:37 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-usb-5:
  usb: mtp filesharing
  usb: add CompatibleID support to msos

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/tags/tcg-next-20140422' into staging
Peter Maydell [Thu, 24 Apr 2014 14:24:51 +0000 (15:24 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/tcg-next-20140422' into staging

Pull tcg 2014-04-22

# gpg: Signature made Tue 22 Apr 2014 22:00:04 BST using RSA key ID 4DD0279B
# gpg: Can't check signature: public key not found

* remotes/rth/tags/tcg-next-20140422:
  tcg: Use HOST_WORDS_BIGENDIAN
  tcg: Fix fallback from muls2_i64 to mulu2_i64
  tcg: Use tcg_gen_mulu2_i32 in tcg_gen_muls2_i32
  tcg: Relax requirement for mulu2_i32 on 32-bit hosts
  tcg-s390: Remove W constraint
  tcg-sparc: Use the type parameter to tcg_target_const_match
  tcg-ppc64: Use the type parameter to tcg_target_const_match
  tcg-aarch64: Remove w constraint
  tcg: Add TCGType parameter to tcg_target_const_match
  tcg: Fix out of range shift in deposit optimizations
  tci: Mask shift counts to avoid undefined behavior
  tcg: Mask shift quantities while folding
  tcg: Use "unspecified behavior" for shifts
  tcg: Fix warning (1 bit signed bitfield entry) and replace int by bool

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/tags/tcg-ia64-pull-20140421' into staging
Peter Maydell [Thu, 24 Apr 2014 13:14:51 +0000 (14:14 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/tcg-ia64-pull-20140421' into staging

Pull for 20140421

# gpg: Signature made Mon 21 Apr 2014 17:57:24 BST using RSA key ID 4DD0279B
# gpg: Can't check signature: public key not found

* remotes/rth/tags/tcg-ia64-pull-20140421:
  tcg-ia64: Convert to new ldst opcodes
  tcg-ia64: Move part of softmmu slow path out of line
  tcg-ia64: Convert to new ldst helpers
  tcg-ia64: Reduce code duplication in tcg_out_qemu_ld
  tcg-ia64: Move tlb addend load into tlb read
  tcg-ia64: Move bswap for store into tlb load
  tcg-ia64: Re-bundle the tlb load
  tcg-ia64: Optimize small arguments to exit_tb

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-04-18' into staging
Peter Maydell [Thu, 24 Apr 2014 12:22:16 +0000 (13:22 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-04-18' into staging

trivial patches for 2014-04-18

# gpg: Signature made Fri 18 Apr 2014 07:36:15 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514  66A7 BEE5 9D74 A4C3 D7DB

* remotes/mjt/tags/trivial-patches-2014-04-18:
  Fix grammar in comment
  doc: grammify "allows to"
  configure: Remove redundant message for -Werror
  scripts: add sample model file for Coverity Scan
  xbzrle.c: Avoid undefined behaviour with signed arithmetic
  int128.h: Avoid undefined behaviours involving signed arithmetic
  hw/ide/ahci.c: Avoid shift left into sign bit
  net: Report error when device / hub combo is not found.
  configure: Fix indentation of help for --enable/disable-debug-info
  qga: trivial fix for unclear documentation of guest-set-time
  vl: Report accelerator not supported for target more nicely

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoblock/cloop: use PRIu32 format specifier for uint32_t
Stefan Hajnoczi [Wed, 23 Apr 2014 08:05:20 +0000 (10:05 +0200)]
block/cloop: use PRIu32 format specifier for uint32_t

PRIu32 is the format string specifier for uint32_t, let's use it.
Variables ->block_size, ->n_blocks, and i are all uint32_t.

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agousb: mtp filesharing
Gerd Hoffmann [Thu, 18 Oct 2012 08:26:09 +0000 (10:26 +0200)]
usb: mtp filesharing

Implementation of a USB Media Transfer Device device for easy
filesharing.  Read-only.  No access control inside qemu, it will
happily export any file it is able to open to the guest, i.e.
standard unix access rights for the qemu process apply.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agovmdk: Fix "%x" to PRIx32 in format strings for cid
Fam Zheng [Thu, 17 Apr 2014 10:43:53 +0000 (18:43 +0800)]
vmdk: Fix "%x" to PRIx32 in format strings for cid

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>