sdk/emulator/qemu.git
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>
10 years agoqemu-img: Improve error messages
Fam Zheng [Tue, 22 Apr 2014 05:36:11 +0000 (13:36 +0800)]
qemu-img: Improve error messages

Previously, when there is a user error in argv parsing, qemu-img prints
help text and exits.

Add an error_exit function to print a helpful error message and a hint
to run 'qemu-img --help' for more information.

As a bonus, "qemu-img <cmd> --help" now has a more reasonable exit code
0.

In the future the help text should be split by sub command, and only
print the information for the specified command.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agousb: add CompatibleID support to msos
Gerd Hoffmann [Tue, 18 Mar 2014 10:01:50 +0000 (11:01 +0100)]
usb: add CompatibleID support to msos

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoqemu-iotests: Check common namespace for id and node-name
Kevin Wolf [Thu, 17 Apr 2014 11:40:30 +0000 (13:40 +0200)]
qemu-iotests: Check common namespace for id and node-name

A name that is taken by an ID can't be taken by a node-name at the same
time. Check that conflicts are correctly detected.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
10 years agoblock: Catch duplicate IDs in bdrv_new()
Kevin Wolf [Thu, 17 Apr 2014 11:27:05 +0000 (13:27 +0200)]
block: Catch duplicate IDs in bdrv_new()

Since commit f298d071, block devices added with blockdev-add don't have
a QemuOpts around in dinfo->opts. Consequently, we can't rely any more
on QemuOpts catching duplicate IDs for block devices.

This patch adds a new check for duplicate IDs to bdrv_new(), and moves
the existing check that the ID isn't already taken for a node-name there
as well.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoqemu-img: Avoid duplicate block device IDs
Kevin Wolf [Thu, 17 Apr 2014 14:57:13 +0000 (16:57 +0200)]
qemu-img: Avoid duplicate block device IDs

qemu-img used to use "image" as ID for all block devices. This means
that e.g. img_convert() ended up with potentially multiple source images
and one target image, all with the same ID. The next patch will catch
this and fail to open the block device.

This patch makes sure that qemu-img uses meaningful unique IDs for the
block devices it uses.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Add errp to bdrv_new()
Kevin Wolf [Thu, 17 Apr 2014 11:16:01 +0000 (13:16 +0200)]
block: Add errp to bdrv_new()

This patch adds an errp parameter to bdrv_new() and updates all its
callers. The next patches will make use of this in order to check for
duplicate IDs. Most of the callers know that their ID is fine, so they
can simply assert that there is no error.

Behaviour doesn't change with this patch yet as bdrv_new() doesn't
actually assign errors to errp.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoconvert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create()
Aakriti Gupta [Sat, 15 Mar 2014 09:35:23 +0000 (15:05 +0530)]
convert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create()

This patch converts fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create()
(error_setg() is part of error reporting API in include/qapi/error.h)

Signed-off-by: Aakriti Gupta <aakritty@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Remove -errno return value from bdrv_assign_node_name
Kevin Wolf [Fri, 24 Jan 2014 13:11:52 +0000 (14:11 +0100)]
block: Remove -errno return value from bdrv_assign_node_name

It takes an errp argument. That's enough for error handling.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Replaced old error handling with error reporting API.
Maria Kustova [Tue, 18 Mar 2014 05:59:18 +0000 (09:59 +0400)]
curl: Replaced old error handling with error reporting API.

Signed-off-by: Maria Kustova <maria.k@catit.be>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Handle error of bdrv_getlength in bdrv_create_dirty_bitmap
Fam Zheng [Wed, 16 Apr 2014 01:34:30 +0000 (09:34 +0800)]
block: Handle error of bdrv_getlength in bdrv_create_dirty_bitmap

bdrv_getlength could fail, check the return value before using it.
Return NULL and set errno if it fails. Callers are updated to handle
the error case.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovmdk: Fix %d and %lld to PRI* in format strings
Fam Zheng [Thu, 17 Apr 2014 03:34:37 +0000 (11:34 +0800)]
vmdk: Fix %d and %lld to PRI* in format strings

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Check bdrv_getlength() return value in bdrv_make_zero()
Kevin Wolf [Mon, 14 Apr 2014 15:03:34 +0000 (17:03 +0200)]
block: Check bdrv_getlength() return value in bdrv_make_zero()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Catch integer overflow in bdrv_rw_co()
Kevin Wolf [Mon, 14 Apr 2014 13:39:36 +0000 (15:39 +0200)]
block: Catch integer overflow in bdrv_rw_co()

Insanely large requests could cause an integer overflow in
bdrv_rw_co() while converting sectors to bytes. This patch catches the
problem and returns an error (if we hadn't overflown the integer here,
bdrv_check_byte_request() would have rejected the request, so we're not
breaking anything that was supposed to work before).

We actually do have a test case that triggers behaviour where we
accidentally let such a request pass, so that it would return success,
but read 0 bytes instead of the requested 4 GB. It fails now like it
should.

If the vdi block driver wants to be able to deal with huge images, it
can't read the whole block bitmap at once into memory like it does
today, but needs to use a metadata cache like qcow2 does.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Limit size to INT_MAX in bdrv_check_byte_request()
Kevin Wolf [Mon, 14 Apr 2014 12:48:16 +0000 (14:48 +0200)]
block: Limit size to INT_MAX in bdrv_check_byte_request()

Commit 8f4754ed intended to protect against integer overflow bugs in
block drivers by making sure that a single request that is passed to
drivers is no longer than INT_MAX bytes.

However, meanwhile there are some callers that don't use that code path
any more but call bdrv_check_byte_request() directy, so let's add a
check there as well.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Fix nb_sectors check in bdrv_check_byte_request()
Kevin Wolf [Mon, 14 Apr 2014 12:47:14 +0000 (14:47 +0200)]
block: Fix nb_sectors check in bdrv_check_byte_request()

nb_sectors is signed, check for negative values.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agotcg: Use HOST_WORDS_BIGENDIAN
Richard Henderson [Mon, 31 Mar 2014 21:09:13 +0000 (14:09 -0700)]
tcg: Use HOST_WORDS_BIGENDIAN

Instead of rolling a local TCG_TARGET_WORDS_BIGENDIAN.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Fix fallback from muls2_i64 to mulu2_i64
Richard Henderson [Wed, 26 Mar 2014 18:09:44 +0000 (11:09 -0700)]
tcg: Fix fallback from muls2_i64 to mulu2_i64

Brown Bag sez, don't put the fallback code into the wrong function.
Also, check for muluh_i64 and use tcg_gen_mulu2_i64 instead of raw ops.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Use tcg_gen_mulu2_i32 in tcg_gen_muls2_i32
Richard Henderson [Wed, 26 Mar 2014 18:01:30 +0000 (11:01 -0700)]
tcg: Use tcg_gen_mulu2_i32 in tcg_gen_muls2_i32

Rather than hard-coding use of mulu2_i32, allow muluh_i32.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Relax requirement for mulu2_i32 on 32-bit hosts
Richard Henderson [Wed, 26 Mar 2014 17:59:14 +0000 (10:59 -0700)]
tcg: Relax requirement for mulu2_i32 on 32-bit hosts

Instead require either mulu2_i32 or muluh_i32.  The code in tcg-op.h
already supports looking for both.  Previous incomplete conversion?

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-s390: Remove W constraint
Richard Henderson [Mon, 31 Mar 2014 06:25:26 +0000 (02:25 -0400)]
tcg-s390: Remove W constraint

Now redundant with the type parameter to tcg_target_const_match.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-sparc: Use the type parameter to tcg_target_const_match
Richard Henderson [Mon, 31 Mar 2014 05:27:35 +0000 (22:27 -0700)]
tcg-sparc: Use the type parameter to tcg_target_const_match

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Use the type parameter to tcg_target_const_match
Richard Henderson [Mon, 31 Mar 2014 05:07:27 +0000 (22:07 -0700)]
tcg-ppc64: Use the type parameter to tcg_target_const_match

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-aarch64: Remove w constraint
Richard Henderson [Mon, 31 Mar 2014 04:26:34 +0000 (21:26 -0700)]
tcg-aarch64: Remove w constraint

Now redundant with the type parameter to tcg_target_const_match.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Add TCGType parameter to tcg_target_const_match
Richard Henderson [Mon, 31 Mar 2014 04:22:11 +0000 (21:22 -0700)]
tcg: Add TCGType parameter to tcg_target_const_match

Most 64-bit targets need to be able to ignore the high bits
of a TCG_TYPE_I32 value.

Suggested-by: Stuart Brady <sdb@zubnet.me.uk>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Fix out of range shift in deposit optimizations
Richard Henderson [Tue, 18 Mar 2014 21:23:52 +0000 (14:23 -0700)]
tcg: Fix out of range shift in deposit optimizations

By inspection, for a deposit(x, y, 0, 64), we'd have a shift of (1<<64)
and everything else falls apart.  But we can reuse the existing deposit
logic to get this right.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotci: Mask shift counts to avoid undefined behavior
Richard Henderson [Tue, 18 Mar 2014 15:44:05 +0000 (08:44 -0700)]
tci: Mask shift counts to avoid undefined behavior

TCG now requires unspecified behavior rather than a potential crash,
bring the C shift within the letter of the law.

Signed-off-by: Richard Henderson <rth@twiddle.net>