sdk/emulator/qemu.git
11 years agoMerge remote-tracking branch 'rth/tcg-pull' into staging
Anthony Liguori [Fri, 11 Oct 2013 16:36:52 +0000 (09:36 -0700)]
Merge remote-tracking branch 'rth/tcg-pull' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/tcg-pull:
  exec: Add both big- and little-endian memory helpers
  tcg: Add qemu_ld_st_i32/64
  tcg: Add TCGMemOp
  configure: Remove CONFIG_QEMU_LDST_OPTIMIZATION
  tcg: Add tcg-be-ldst.h
  tcg: Add tcg-be-null.h
  exec: Delete is_tcg_gen_code and GETRA_EXT
  tcg-aarch64: Update to helper_ret_*_mmu routines
  tcg: Merge tcg_register_helper into tcg_context_init
  tcg: Add tcg-runtime.c helpers to all_helpers
  tcg: Put target helper data into an array.
  tcg: Remove stray semi-colons from target-*/helper.h
  tcg: Move helper registration into tcg_context_init
  target-m68k: Rename helpers.h to helper.h
  tcg: Use a GHashTable for tcg_find_helper
  tcg: Delete tcg_helper_get_name declaration
  tcg-hppa: Remove tcg backend

Message-id: 1381440525-6666-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoqdev-monitor: Group "device_add help" and "info qdm" by category
Markus Armbruster [Thu, 10 Oct 2013 13:00:21 +0000 (15:00 +0200)]
qdev-monitor: Group "device_add help" and "info qdm" by category

Output is a long, unsorted list.  Not very helpful.  Print one list
per device category instead, with a header line identifying the
category, plus a list of uncategorized devices.  Print each list in
case-insenitive alphabetical order.

Devices with multiple categories are listed multiple times.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Message-id: 1381410021-1538-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoMostly revert "qemu-help: Sort devices by logical functionality"
Markus Armbruster [Thu, 10 Oct 2013 13:00:20 +0000 (15:00 +0200)]
Mostly revert "qemu-help: Sort devices by logical functionality"

This reverts most of commit 3d1237fb2ab4edb926c717767bb5e31d6053a7c5.

The commit claims to sort the output of "-device help" "by
functionality rather than alphabetical".  Issues:

* The output was unsorted before, not alphabetically sorted.
  Misleading, but harmless enough.

* The commit doesn't just sort the output of "-device help" as it
  claims, it adds categories to each line of "-device help", and it
  prints devices once per category.  In particular, devices without a
  category aren't shown anymore.  Maybe such devices should not exist,
  but they do.  Regression.

* Categories are also added to the output of "info qdm".  Silent
  change, not nice.  Output remains unsorted, unlike "-device help".

I'm going to reimplement the feature we actually want, without the
warts.  Reverting the flawed commit first should make it easier to
review.  However, I can't revert it completely, since DeviceClass
member categories has been put to use.  So leave that part in.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Message-id: 1381410021-1538-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoUse qemu-project.org domain name
Stefan Hajnoczi [Fri, 11 Oct 2013 12:52:38 +0000 (14:52 +0200)]
Use qemu-project.org domain name

qemu.org is held by a third-party and no core community contributor has
access to the DNS configuration.  This leaves the website exposed to
outages due to DNS issues or IP address changes.  For example, if the
web server IP address needs to change we cannot guarantee qemu.org will
point to it!

The newer qemu-project.org domain name is owned by Anthony Liguori
<anthony@codemonkey.ws>.  You can confirm this by querying the whois
information.  Also note that the #qemu IRC channel topic already
references qemu-project.org.

Short of having a dedicated legal entity to hold the domain name on
behalf of the community, qemu-project.org seems like the safest bet.

Let's replace references to qemu.org with qemu-project.org.

Note that git-submodule(1) does not detect URL changes.  The following
commands clear out and re-initialize all submodules to ensure you are
using the latest URLs:

  $ git submodule deinit . # you'll be warned if you have local changes
  $ rm -rf .git/modules    # also clear cached .git/ directories
  $ git submodule update --init

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1381495958-8306-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 11 Oct 2013 16:29:58 +0000 (09:29 -0700)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Max Reitz (30) and others
# Via Kevin Wolf
* kwolf/for-anthony: (61 commits)
  qemu-iotests: Add test for inactive L2 overlap
  qemu-io: Let "open" pass options to block driver
  vmdk: Fix vmdk_parse_extents
  blockdev: blockdev_init() error conversion
  blockdev: Don't disable COR automatically with blockdev-add
  blockdev: Remove 'media' parameter from blockdev_init()
  qemu-iotests: Check autodel behaviour for device_del
  blockdev: Remove IF_* check for read-only blockdev_init
  blockdev: Move virtio-blk device creation to drive_init
  blockdev: Move bus/unit/index processing to drive_init
  blockdev: Move parsing of 'boot' option to drive_init
  blockdev: Moving parsing of geometry options to drive_init
  blockdev: Move parsing of 'if' option to drive_init
  blockdev: Move parsing of 'media' option to drive_init
  blockdev: Pass QDict to blockdev_init()
  blockdev: Separate ID generation from DriveInfo creation
  blockdev: 'blockdev-add' QMP command
  blockdev: Introduce DriveInfo.enable_auto_del
  qapi-types/visit.py: Inheritance for structs
  qapi-types/visit.py: Pass whole expr dict for structs
  ...

Message-id: 1381503951-27985-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoqemu-iotests: Add test for inactive L2 overlap
Max Reitz [Fri, 11 Oct 2013 12:02:11 +0000 (14:02 +0200)]
qemu-iotests: Add test for inactive L2 overlap

Extend 060 by a test which creates a corrupted image with an active L2
entry pointing to an inactive L2 table and writes to the corresponding
guest offset.

Also, use overlap-check=all for all tests in 060.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-io: Let "open" pass options to block driver
Max Reitz [Fri, 11 Oct 2013 12:02:10 +0000 (14:02 +0200)]
qemu-io: Let "open" pass options to block driver

Add an option to the open command to specify runtime options for the
block driver used.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agovmdk: Fix vmdk_parse_extents
Fam Zheng [Fri, 11 Oct 2013 11:48:29 +0000 (19:48 +0800)]
vmdk: Fix vmdk_parse_extents

An extra 'p++' after while loop when *p == '\n' will move p to unknown
data position, risking parsing junk data or memory access violation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblockdev: blockdev_init() error conversion
Kevin Wolf [Fri, 20 Sep 2013 09:33:11 +0000 (11:33 +0200)]
blockdev: blockdev_init() error conversion

This gives us meaningful error messages for the blockdev-add QMP
command.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Don't disable COR automatically with blockdev-add
Kevin Wolf [Thu, 19 Sep 2013 13:12:18 +0000 (15:12 +0200)]
blockdev: Don't disable COR automatically with blockdev-add

If a read-only device is configured with copy-on-read=on, the old code
only prints a warning and automatically disables copy on read. Make it
a real error for blockdev-add.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Remove 'media' parameter from blockdev_init()
Kevin Wolf [Thu, 19 Sep 2013 12:24:10 +0000 (14:24 +0200)]
blockdev: Remove 'media' parameter from blockdev_init()

The remaining users shouldn't be there with blockdev-add and are easy to
move to drive_init().

Bonus bug fix: As a side effect, CD-ROM drives can now use block drivers
on the read-only whitelist without explicitly specifying read-only=on,
even if a format is explicitly specified.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoqemu-iotests: Check autodel behaviour for device_del
Kevin Wolf [Wed, 18 Sep 2013 14:47:41 +0000 (16:47 +0200)]
qemu-iotests: Check autodel behaviour for device_del

Block devices creates with -drive and drive_add should automatically
disappear if the guest device is unplugged. blockdev-add ones shouldn't.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Remove IF_* check for read-only blockdev_init
Kevin Wolf [Fri, 13 Sep 2013 13:51:47 +0000 (15:51 +0200)]
blockdev: Remove IF_* check for read-only blockdev_init

IF_NONE allows read-only, which makes forbidding it in this place
for other types pretty much pointless.

Instead, make sure that all devices for which the check would have
errored out check in their init function that they don't get a read-only
BlockDriverState. This catches even cases where IF_NONE and -device is
used.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Move virtio-blk device creation to drive_init
Kevin Wolf [Fri, 13 Sep 2013 12:09:17 +0000 (14:09 +0200)]
blockdev: Move virtio-blk device creation to drive_init

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Move bus/unit/index processing to drive_init
Kevin Wolf [Tue, 10 Sep 2013 13:48:13 +0000 (15:48 +0200)]
blockdev: Move bus/unit/index processing to drive_init

This requires moving the automatic ID generation at the same time, so
let's do that as well.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Move parsing of 'boot' option to drive_init
Kevin Wolf [Mon, 9 Sep 2013 15:01:03 +0000 (17:01 +0200)]
blockdev: Move parsing of 'boot' option to drive_init

It's already ignored and only prints a deprecation message. No use in
making it available in new interfaces.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Moving parsing of geometry options to drive_init
Kevin Wolf [Mon, 9 Sep 2013 14:49:49 +0000 (16:49 +0200)]
blockdev: Moving parsing of geometry options to drive_init

This moves all of the geometry options (cyls/heads/secs/trans) to
drive_init so that they can only be accessed using legacy functions, but
never with anything blockdev-add related.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Move parsing of 'if' option to drive_init
Kevin Wolf [Wed, 28 Aug 2013 15:24:51 +0000 (17:24 +0200)]
blockdev: Move parsing of 'if' option to drive_init

It's always IF_NONE for blockdev-add.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Move parsing of 'media' option to drive_init
Kevin Wolf [Wed, 28 Aug 2013 15:00:13 +0000 (17:00 +0200)]
blockdev: Move parsing of 'media' option to drive_init

This moves as much as possible of the processing of the 'media' option
to drive_init so that it can only be accessed using legacy functions,
but never with anything blockdev-add related.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Pass QDict to blockdev_init()
Kevin Wolf [Tue, 10 Sep 2013 10:01:20 +0000 (12:01 +0200)]
blockdev: Pass QDict to blockdev_init()

Working on a QDict instead of a QemuOpts that accepts anything is more
in line with bdrv_open(). A QDict is what qmp_blockdev_add() already has
anyway, so this saves additional conversions. And last, but not least,
it allows later patches to easily extract legacy options into a
separate, typed QemuOpts for drive_init() (the untyped QemuOpts that
drive_init already has doesn't allow access to numbers, only strings,
and is therefore useless without conversion).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: Separate ID generation from DriveInfo creation
Kevin Wolf [Thu, 11 Jul 2013 10:52:34 +0000 (12:52 +0200)]
blockdev: Separate ID generation from DriveInfo creation

blockdev-add shouldn't automatically generate IDs, but will keep most of
the DriveInfo creation code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblockdev: 'blockdev-add' QMP command
Kevin Wolf [Mon, 23 Sep 2013 13:26:03 +0000 (15:26 +0200)]
blockdev: 'blockdev-add' QMP command

For examples see the changes to qmp-commands.hx.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblockdev: Introduce DriveInfo.enable_auto_del
Kevin Wolf [Wed, 18 Sep 2013 13:14:47 +0000 (15:14 +0200)]
blockdev: Introduce DriveInfo.enable_auto_del

BlockDriverStates shouldn't be affected by an unplugged guest device,
except if created with the legacy -drive command line option or the
drive_add HMP command.

Make the automatic deletion as well as cancelling of jobs conditional on
an enable_auto_del boolean that is only set in drive_init().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
11 years agoqapi-types/visit.py: Inheritance for structs
Kevin Wolf [Thu, 19 Sep 2013 09:56:36 +0000 (11:56 +0200)]
qapi-types/visit.py: Inheritance for structs

This introduces a new 'base' key for struct definitions that refers to
another struct type. On the JSON level, the fields of the base type are
included directly into the same namespace as the fields of the defined
type, like with unions. On the C level, a pointer to a struct of the
base type is included.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoqapi-types/visit.py: Pass whole expr dict for structs
Kevin Wolf [Wed, 18 Sep 2013 15:22:02 +0000 (17:22 +0200)]
qapi-types/visit.py: Pass whole expr dict for structs

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agovmdk: refuse enabling zeroed grain with flat images
Fam Zheng [Fri, 11 Oct 2013 07:43:23 +0000 (15:43 +0800)]
vmdk: refuse enabling zeroed grain with flat images

This is a header flag and we needs sparse for the header.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agovmdk: convert error code to use errp
Fam Zheng [Fri, 11 Oct 2013 07:43:22 +0000 (15:43 +0800)]
vmdk: convert error code to use errp

Convert "fprintf(stderr,..." and standardize error messages:

Remove a few local_error's and use errp.

Remove "VMDK:" or "Vmdk:" prefixes in error message and fix to upper
case.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agobuild: add command check-clean
Wenchao Xia [Thu, 26 Sep 2013 00:42:56 +0000 (08:42 +0800)]
build: add command check-clean

This command will package the clean operations in tests. Now root Makefile
simply calls the command and do not care the details of it any more. Original
the built binaries for test will not be removed, now they will be deleted
in clean operation.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agotests: build the helper program by default
Wenchao Xia [Thu, 26 Sep 2013 00:42:55 +0000 (08:42 +0800)]
tests: build the helper program by default

Usually we may configure and make, then goto ./tests/qemu-iotest,
check. In this case an error will happen since helper program
was not built. This patch simply build it by default. A better way
may be introducing Makefile in ./tests/qemu-iotest, but it is more
complicate to handle out of tree case, and a bit overkill
for a single file now, we can do that when more files come.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock/raw-posix: Employ error parameter
Max Reitz [Fri, 11 Oct 2013 09:37:01 +0000 (11:37 +0200)]
block/raw-posix: Employ error parameter

Make use of the error parameter in the opening and creating functions in
block/raw-posix.c.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: move blank lines of output in case 059
Fam Zheng [Fri, 11 Oct 2013 06:59:49 +0000 (14:59 +0800)]
qemu-iotests: move blank lines of output in case 059

Move the blank line to above the test step banner, so it looks clearer
in blocks.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkverify: Employ error parameter
Max Reitz [Thu, 10 Oct 2013 13:44:04 +0000 (15:44 +0200)]
blkverify: Employ error parameter

Make use of the error parameter in blkverify_open.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: Employ error parameter
Max Reitz [Thu, 10 Oct 2013 13:44:03 +0000 (15:44 +0200)]
blkdebug: Employ error parameter

Make use of the error parameter in blkdebug_open.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock/raw-win32: Employ error parameter
Max Reitz [Thu, 10 Oct 2013 13:44:02 +0000 (15:44 +0200)]
block/raw-win32: Employ error parameter

Make use of the error parameter in the opening and creating functions in
block/raw-win32.c.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock/raw_bsd: Employ error parameter
Max Reitz [Thu, 10 Oct 2013 13:44:00 +0000 (15:44 +0200)]
block/raw_bsd: Employ error parameter

Propagate errors in raw_create rather than directly reporting and
afterwards discarding them.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Evaluate overlap check options
Max Reitz [Thu, 10 Oct 2013 09:09:28 +0000 (11:09 +0200)]
qcow2: Evaluate overlap check options

Evaluate the runtime overlap check options and set
BDRVQcowState.overlap_check appropriately.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Add more overlap check bitmask macros
Max Reitz [Thu, 10 Oct 2013 09:09:27 +0000 (11:09 +0200)]
qcow2: Add more overlap check bitmask macros

Introduces the macros QCOW2_OL_CONSTANT and QCOW2_OL_ALL in addition to
the already existing QCOW2_OL_CACHED, signifying all metadata overlap
checks that can be performed in constant time (regardless of image size
etc.) and truly all available overlap checks, respectively.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Array assigning options to OL check bits
Max Reitz [Thu, 10 Oct 2013 09:09:26 +0000 (11:09 +0200)]
qcow2: Array assigning options to OL check bits

Add an array which assigns the option string to its corresponding
overlap check bit.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Add overlap-check options
Max Reitz [Thu, 10 Oct 2013 09:09:25 +0000 (11:09 +0200)]
qcow2: Add overlap-check options

Add runtime options to tune the overlap checks to be performed before
write accesses.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Make overlap check mask variable
Max Reitz [Thu, 10 Oct 2013 09:09:24 +0000 (11:09 +0200)]
qcow2: Make overlap check mask variable

Replace the QCOW2_OL_DEFAULT macro by a variable overlap_check in
BDRVQcowState.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Use negated overflow check mask
Max Reitz [Thu, 10 Oct 2013 09:09:23 +0000 (11:09 +0200)]
qcow2: Use negated overflow check mask

In qcow2_check_metadata_overlap and qcow2_pre_write_overlap_check,
change the parameter signifying the checks to perform from its current
positive form to a negative one, i.e., it will no longer explicitly
specify every check to perform but rather a mask of checks not to
perform.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: Improve driver whitelist checks
Kevin Wolf [Thu, 10 Oct 2013 09:45:55 +0000 (11:45 +0200)]
block: Improve driver whitelist checks

The main intent of this patch is to consolidate the whitelist checks to
a single point in the code instead of spreading it everywhere. This adds
a nicer error message for read-only whitelisting, too, in places where
it was still missing.

The patch also contains a bonus bug fix: By finding the format first in
bdrv_open() and then independently checking against the whitelist only
later, we avoid the case that use of a non-whitelisted format results in
probing rather than an error message. Previously, this could happen when
using the driver=... option.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
11 years agoqcow2: Use better type for numerical snapshot ID
Max Reitz [Wed, 9 Oct 2013 12:42:47 +0000 (14:42 +0200)]
qcow2: Use better type for numerical snapshot ID

When trying to find a new snapshot ID, the existing ones are converted
to integers using strtoul. This function returns an unsigned long,
therefore its result should be saved in an unsigned long as well.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Fix snapshot restoration in snapshot_create
Max Reitz [Wed, 9 Oct 2013 12:42:00 +0000 (14:42 +0200)]
qcow2: Fix snapshot restoration in snapshot_create

If the new snapshot table could not be written in qcow2_snapshot_create,
the old snapshot table has to be restored in memory and the new one
released. This should include restoration of the old snapshot count as
well, which is added by this patch.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Remove wrong metadata overlap check
Max Reitz [Wed, 9 Oct 2013 12:41:28 +0000 (14:41 +0200)]
qcow2: Remove wrong metadata overlap check

In qcow2_write_compressed, if the compression fails, a normal cluster is
written to disk. This is done through bdrv_write on the qcow2 BDS
itself (using the guest offset), thus it is wrong to do a metadata
overlap check before.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Add missing space in error message
Max Reitz [Wed, 9 Oct 2013 12:40:48 +0000 (14:40 +0200)]
qcow2: Add missing space in error message

The error message in qcow2_downgrade about an unsupported refcount
order is missing a space. This patch adds it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: qemu-iotests for vhdx, read sample dynamic image
Jeff Cody [Fri, 27 Sep 2013 12:48:15 +0000 (08:48 -0400)]
block: qemu-iotests for vhdx, read sample dynamic image

This adds the VHDX format to the qemu-iotests format, and adds
a read test.  The test reads from an existing sample image, that
was created with Hyper-V under Windwos Server 2012.

The image file is a 1GB dynamic image, with 32MB blocks.

The pattern 0xa5 exists from 0MB-33MB (past a block size boundary)

The pattern 0x96 exists from 33MB-66MB (past another block boundary,
and leaving a partial blank block)

From 66MB-1024MB, all reads should return 0.

Although 1GB dynamic image with 66MB of data, the bzip2'ed image
file size is only 874 bytes.

This also adds in the IMGFMT_GENERIC flag, so r/o images can be
tested (e.g. ./check -vhdx) without failing tests that assume
r/w support.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoahci: set ahci mode on reset
Michael S. Tsirkin [Sat, 28 Sep 2013 21:09:35 +0000 (00:09 +0300)]
ahci: set ahci mode on reset

ATM we set AHCI mode on 1st GHC write.
Spec says we should set it on reset.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Discard preallocated zero clusters
Max Reitz [Wed, 9 Oct 2013 10:07:33 +0000 (12:07 +0200)]
qemu-iotests: Discard preallocated zero clusters

Add a new test case for discarding preallocated zero clusters; doing
this should not result in any leaks.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: Add BlockDriver.bdrv_check_ext_snapshot.
Benoît Canet [Wed, 2 Oct 2013 12:33:48 +0000 (14:33 +0200)]
block: Add BlockDriver.bdrv_check_ext_snapshot.

This field is used by blkverify to disable external snapshots creation.
It will also be used by block filters like quorum to disable external
snapshot creation.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock/get_block_status: avoid redundant callouts on raw devices
Peter Lieven [Tue, 8 Oct 2013 12:43:14 +0000 (14:43 +0200)]
block/get_block_status: avoid redundant callouts on raw devices

if a raw device like an iscsi target or host device is used
the current implementation makes a second call out to get
the block status of bs->file.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Assert against snapshot name/ID overflow
Max Reitz [Wed, 9 Oct 2013 08:51:06 +0000 (10:51 +0200)]
qcow2: Assert against snapshot name/ID overflow

qcow2_write_snapshots relies on the length of every snapshot ID and name
fitting into an unsigned 16 bit integer. This is currently ensured by
QEMU through generally only allowing 128 byte IDs and 256 byte names.
However, if this should change in the future, the length written to the
image file should not be silently truncated (though the name itself
would be written completely).

Since this is currently not an issue but might require attention due to
internal QEMU changes in the future, an assert ensuring sanity is enough
for now.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Free allocated snapshot table on error
Max Reitz [Wed, 9 Oct 2013 08:51:05 +0000 (10:51 +0200)]
qcow2: Free allocated snapshot table on error

If an error occurs during qcow2_write_snapshots, the newly allocated
snapshot table clusters are leaked and should thus be freed.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Always use error path on writing snapshots
Max Reitz [Wed, 9 Oct 2013 08:51:04 +0000 (10:51 +0200)]
qcow2: Always use error path on writing snapshots

qcow2_write_snapshots does contain a fail label and there is no reason
not to use it on some errors; therefore, we should always jump there on
error.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Free preallocated zero clusters
Max Reitz [Wed, 9 Oct 2013 08:44:28 +0000 (10:44 +0200)]
qcow2: Free preallocated zero clusters

In qcow2_free_any_clusters, preallocated zero clusters should be freed
just as normal clusters are.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Use pread for inactive L1 in overlap check
Max Reitz [Wed, 9 Oct 2013 08:42:56 +0000 (10:42 +0200)]
qcow2: Use pread for inactive L1 in overlap check

Currently, qcow2_check_metadata_overlap uses bdrv_read to read inactive
L1 tables from disk. The number of sectors to read is calculated through
a truncating integer division, therefore, if the L1 table size is not a
multiple of the sector size, the final entries will not be read and
their entries in memory remain undefined (from the g_malloc).
Using bdrv_pread fixes this.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Alignment of snapshot table entries
Max Reitz [Wed, 9 Oct 2013 08:34:10 +0000 (10:34 +0200)]
qcow2: Alignment of snapshot table entries

The qcow2 specification does not explicitly state so far that every
snapshot table entry is aligned to 8 bytes. QEMU, in contrast, does this
alignment, thus it should be properly documented (which this patch
does).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Additional info from qemu-img info
Max Reitz [Wed, 9 Oct 2013 08:46:20 +0000 (10:46 +0200)]
qemu-iotests: Additional info from qemu-img info

Add a test for the additional information now provided by qemu-img info
when used on qcow2 images. It also tests the qemu QMP output from the
query-block command when running qemu with different runtime options
than specified in the image (ImageInfoSpecific should always refer to
the image).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Discard specific info in _img_info
Max Reitz [Wed, 9 Oct 2013 08:46:19 +0000 (10:46 +0200)]
qemu-iotests: Discard specific info in _img_info

In _img_info, filter out additional information specific to the image
format provided by qemu-img info, since tests designed for multiple
image formats would produce different outputs for every image format
otherwise.

In a human-readable dump, that new information will always be last for
each "image information block" (multiple blocks are emitted when
inspecting the backing file chain). Every block is separated by an empty
line. Therefore, in this case, everything starting with the line "Format
specific information:" up to that empty line (or EOF, if it is the last
block) has to be stripped.

The JSON dump will always emit pretty JSON data. Therefore, the opening
and closing braces of every object will be on lines which are indented
by exactly the same amount, and all lines in between will have more
indentation. Thus, in this case, everything starting with a line
matching the regular expression /^ *"format-specific": {/ until /^ *},?/
has to be stripped, where the number of spaces at the beginning of the
respective lines is equal.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Add support for ImageInfoSpecific
Max Reitz [Wed, 9 Oct 2013 08:46:18 +0000 (10:46 +0200)]
qcow2: Add support for ImageInfoSpecific

Add a new ImageInfoSpecificQCow2 type as a subtype of ImageInfoSpecific.
This contains the compatibility level as a string and an optional
lazy_refcounts boolean (optional means mandatory for compat >= 1.1 and
not available for compat == 0.10).

Also, add qcow2_get_specific_info, which returns this information.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock/qapi: Human-readable ImageInfoSpecific dump
Max Reitz [Wed, 9 Oct 2013 08:46:17 +0000 (10:46 +0200)]
block/qapi: Human-readable ImageInfoSpecific dump

Add a function for generically dumping the ImageInfoSpecific information
in a human-readable format to block/qapi.c.

Use this function in bdrv_image_info_dump and qemu-io-cmds.c:info_f to
allow qemu-img info resp. qemu-io -c info to print that format specific
information.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: Add bdrv_get_specific_info
Max Reitz [Wed, 9 Oct 2013 08:46:16 +0000 (10:46 +0200)]
block: Add bdrv_get_specific_info

Add a function for retrieving an ImageInfoSpecific object from a block
driver.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqapi: Add ImageInfoSpecific type
Max Reitz [Wed, 9 Oct 2013 08:46:15 +0000 (10:46 +0200)]
qapi: Add ImageInfoSpecific type

Add a new type ImageInfoSpecific as a union for image format specific
information in ImageInfo.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqapi: make use of new BlockJobType
Fam Zheng [Tue, 8 Oct 2013 09:29:40 +0000 (17:29 +0800)]
qapi: make use of new BlockJobType

Switch the string to enum type BlockJobType in BlockJobDriver.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqapi: Introduce enum BlockJobType
Fam Zheng [Tue, 8 Oct 2013 09:29:39 +0000 (17:29 +0800)]
qapi: Introduce enum BlockJobType

This will replace the open coded block job type string for mirror,
commit and backup.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblockjob: rename BlockJobType to BlockJobDriver
Fam Zheng [Tue, 8 Oct 2013 09:29:38 +0000 (17:29 +0800)]
blockjob: rename BlockJobType to BlockJobDriver

We will use BlockJobType as the enum type name of block jobs in QAPI,
rename current BlockJobType to BlockJobDriver, which will eventually
become a set of operations, similar to block drivers.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoexec: Add both big- and little-endian memory helpers
Richard Henderson [Wed, 4 Sep 2013 18:45:20 +0000 (11:45 -0700)]
exec: Add both big- and little-endian memory helpers

Step three in the transition: helpers not tied to the target
"default" endianness.  To be used when the guest uses a memory
operation with non-default endianness.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Add qemu_ld_st_i32/64
Richard Henderson [Wed, 4 Sep 2013 15:11:05 +0000 (08:11 -0700)]
tcg: Add qemu_ld_st_i32/64

Step two in the transition, adding the new ldst opcodes.  Keep the old
opcodes around until all backends support the new opcodes.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoMerge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
Anthony Liguori [Thu, 10 Oct 2013 20:16:25 +0000 (13:16 -0700)]
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging

QOM CPUState refactorings / X86CPU

* Fix for X86CPU model field of qemu32/qemu64 CPU models
* Bug fix for longjmp on FreeBSD
* Removal of unused function
* Confinement of clone syscall infrastructure to linux-user

# gpg: Signature made Wed 09 Oct 2013 03:40:51 AM PDT using RSA key ID 3E7E013F
# gpg: Can't check signature: public key not found

# By Andreas Färber (2) and others
# Via Andreas Färber
* afaerber/tags/qom-cpu-for-anthony:
  cpu: Drop cpu_model_str from CPU_COMMON
  cpu: Move cpu_copy() into linux-user
  cputlb: Remove dead function tlb_update_dirty()
  cpu-exec: Also reload CPUClass *cc after longjmp return in cpu_exec()
  target-i386: Set model=6 on qemu64 & qemu32 CPU models

11 years agoMerge remote-tracking branch 'amit/char-remove-watch-on-unplug' into staging
Anthony Liguori [Thu, 10 Oct 2013 20:16:02 +0000 (13:16 -0700)]
Merge remote-tracking branch 'amit/char-remove-watch-on-unplug' into staging

# By Amit Shah
# Via Amit Shah
* amit/char-remove-watch-on-unplug:
  char: remove watch callback on chardev detach from frontend
  char: use common function to disable callbacks on chardev close
  char: move backends' io watch tag to CharDriverState

Message-id: 20131004154802.GA25646@grmbl.mre
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoMerge remote-tracking branch 'otubo/seccomp' into staging
Anthony Liguori [Thu, 10 Oct 2013 20:15:46 +0000 (13:15 -0700)]
Merge remote-tracking branch 'otubo/seccomp' into staging

# By Eduardo Otubo
# Via Eduardo Otubo
* otubo/seccomp:
  seccomp: fine tuning whitelist by adding times()

Message-id: 1380047458-21673-1-git-send-email-otubo@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoMerge remote-tracking branch 'mcayland/qemu-openbios' into staging
Anthony Liguori [Thu, 10 Oct 2013 20:00:03 +0000 (13:00 -0700)]
Merge remote-tracking branch 'mcayland/qemu-openbios' into staging

* mcayland/qemu-openbios:
  Update OpenBIOS images

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agotcg: Add TCGMemOp
Richard Henderson [Tue, 3 Sep 2013 20:52:19 +0000 (13:52 -0700)]
tcg: Add TCGMemOp

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoconfigure: Remove CONFIG_QEMU_LDST_OPTIMIZATION
Richard Henderson [Thu, 3 Oct 2013 19:58:00 +0000 (14:58 -0500)]
configure: Remove CONFIG_QEMU_LDST_OPTIMIZATION

No longer used.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Add tcg-be-ldst.h
Richard Henderson [Thu, 3 Oct 2013 19:51:24 +0000 (14:51 -0500)]
tcg: Add tcg-be-ldst.h

Move TCGLabelQemuLdst and related stuff out of tcg.h.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Add tcg-be-null.h
Richard Henderson [Thu, 3 Oct 2013 19:04:46 +0000 (14:04 -0500)]
tcg: Add tcg-be-null.h

This is a no-op backend data implementation, for those targets that
are not currently using the load/store optimization path.

This is prepatory to always requiring these functions in all backends.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoexec: Delete is_tcg_gen_code and GETRA_EXT
Richard Henderson [Tue, 3 Sep 2013 21:24:58 +0000 (14:24 -0700)]
exec: Delete is_tcg_gen_code and GETRA_EXT

All implementations now boil down to GETRA.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-aarch64: Update to helper_ret_*_mmu routines
Richard Henderson [Tue, 1 Oct 2013 20:47:38 +0000 (13:47 -0700)]
tcg-aarch64: Update to helper_ret_*_mmu routines

A minimal update to use the new helpers with the return address argument.

Tested-by: Claudio Fontana <claudio.fontana@linaro.org>
Reviewed-by: Claudio Fontana <claudio.fontana@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Merge tcg_register_helper into tcg_context_init
Richard Henderson [Sat, 14 Sep 2013 23:44:31 +0000 (16:44 -0700)]
tcg: Merge tcg_register_helper into tcg_context_init

Eliminates the repeated checks for having created
the s->helpers hash table.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Add tcg-runtime.c helpers to all_helpers
Richard Henderson [Sat, 14 Sep 2013 23:06:50 +0000 (16:06 -0700)]
tcg: Add tcg-runtime.c helpers to all_helpers

For the few targets that actually use these, we'd not report
them symbolicly in the tcg opcode logs.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Put target helper data into an array.
Richard Henderson [Sat, 14 Sep 2013 22:57:22 +0000 (15:57 -0700)]
tcg: Put target helper data into an array.

One call inside of a loop to tcg_register_helper instead of hundreds
of sequential calls.

Presumably more icache and branch prediction friendly; resulting binary
size mostly unchanged on x86_64, as we're trading 32-bit rip-relative
references in .text for full 64-bit pointers in .rodata.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Remove stray semi-colons from target-*/helper.h
Richard Henderson [Sat, 14 Sep 2013 22:38:30 +0000 (15:38 -0700)]
tcg: Remove stray semi-colons from target-*/helper.h

During GEN_HELPER=1, these are actually stray top-level semi-colons
which are technically invalid ISO C, but GCC accepts as an extension.
If we added enough __extension__ markers that we could dare use
-Wpedantic, we'd see

  warning: ISO C does not allow extra ‘;’ outside of a function

This will become a hard error in the next patch, wherein those ; will
appear in the middle of a data structure.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Move helper registration into tcg_context_init
Richard Henderson [Sat, 14 Sep 2013 22:09:39 +0000 (15:09 -0700)]
tcg: Move helper registration into tcg_context_init

No longer needs to be done on a per-target basis.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotarget-m68k: Rename helpers.h to helper.h
Richard Henderson [Sat, 14 Sep 2013 21:41:34 +0000 (14:41 -0700)]
target-m68k: Rename helpers.h to helper.h

This brings the m68k target in line with all other targets.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Use a GHashTable for tcg_find_helper
Richard Henderson [Sat, 14 Sep 2013 21:37:06 +0000 (14:37 -0700)]
tcg: Use a GHashTable for tcg_find_helper

Slightly changes the interface, in that we now return name
instead of a TCGHelperInfo structure, which goes away.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Delete tcg_helper_get_name declaration
Richard Henderson [Sat, 14 Sep 2013 21:29:35 +0000 (14:29 -0700)]
tcg: Delete tcg_helper_get_name declaration

The function was deleted in 4dc81f2822187f4503d4bdb76785cafa5b28db0b.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-hppa: Remove tcg backend
Richard Henderson [Wed, 25 Sep 2013 19:11:31 +0000 (12:11 -0700)]
tcg-hppa: Remove tcg backend

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoMerge remote-tracking branch 'sstabellini/xen-2013-10-10' into staging
Anthony Liguori [Thu, 10 Oct 2013 17:03:38 +0000 (10:03 -0700)]
Merge remote-tracking branch 'sstabellini/xen-2013-10-10' into staging

# By Matthew Daley (1) and Roger Pau Monné (1)
# Via Stefano Stabellini
* sstabellini/xen-2013-10-10:
  qemu/xen: make use of xenstore relative paths
  xen_disk: mark ioreq as mapped before unmapping in error case

11 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Thu, 10 Oct 2013 17:03:00 +0000 (10:03 -0700)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

# By Asias He (1) and Peter Lieven (1)
# Via Paolo Bonzini
* bonzini/scsi-next:
  scsi: Allocate SCSITargetReq r->buf dynamically [CVE-2013-4344]
  block/iscsi: reenable iscsi_co_get_block_status

Message-id: 1381332391-8781-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoUpdate email address
Anthony Liguori [Thu, 10 Oct 2013 16:56:25 +0000 (09:56 -0700)]
Update email address

Amazon is now funding my work as QEMU maintainer so update addresses
accordingly.

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
11 years agoqemu/xen: make use of xenstore relative paths
Roger Pau Monné [Thu, 10 Oct 2013 14:25:52 +0000 (14:25 +0000)]
qemu/xen: make use of xenstore relative paths

Qemu has several hardcoded xenstore paths that are only valid on Dom0.
Attempts to launch a Qemu instance (to act as a userspace backend for
PV disks) will fail because Qemu is not able to access those paths
when running on a domain different than Dom0.

Instead make the xenstore paths relative to the domain where Qemu is
actually running.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Cc: xen-devel@lists.xenproject.org
Cc: Anthony PERARD <anthony.perard@citrix.com>
11 years agoxen_disk: mark ioreq as mapped before unmapping in error case
Matthew Daley [Thu, 10 Oct 2013 14:10:48 +0000 (14:10 +0000)]
xen_disk: mark ioreq as mapped before unmapping in error case

Commit 4472beae modified the semantics of ioreq_{un,}map so that they are
idempotent if called when they're not needed (ie., twice in a row). However,
it neglected to handle the case where batch mapping is not being used (the
default), and one of the grants fails to map. In this case, ioreq_unmap will
be called to unwind and unmap any mappings already performed, but ioreq_unmap
simply returns due to the aforementioned change (the ioreq has not already
been marked as mapped).

The frontend user can therefore force xen_disk to leak grant mappings, a
per-domain limited resource.

Fix by marking the ioreq as mapped before calling ioreq_unmap in this
situation.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
11 years agoscsi: Allocate SCSITargetReq r->buf dynamically [CVE-2013-4344]
Asias He [Wed, 9 Oct 2013 07:41:03 +0000 (15:41 +0800)]
scsi: Allocate SCSITargetReq r->buf dynamically [CVE-2013-4344]

r->buf is hardcoded to 2056 which is (256 + 1) * 8, allowing 256 luns at
most. If more than 256 luns are specified by user, we have buffer
overflow in scsi_target_emulate_report_luns.

To fix, we allocate the buffer dynamically.

Signed-off-by: Asias He <asias@redhat.com>
Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Wed, 9 Oct 2013 14:54:42 +0000 (07:54 -0700)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Max Reitz (5) and others
# Via Stefan Hajnoczi
* stefanha/block:
  block: use correct filename
  qemu-iotests: Correct 026 output
  qcow2: Free allocated L2 cluster on error
  qcow2: Switch L1 table in a single sequence
  block: vhdx - add migration blocker
  block: use correct filename for error report
  qcow2: CHECK_OFLAG_COPIED is obsolete
  qcow2: Correct endianness in overlap check

Message-id: 1381145289-6591-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Wed, 9 Oct 2013 14:54:20 +0000 (07:54 -0700)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Stefan Weil (5) and others
# Via Michael Tokarev
* mjt/trivial-patches:
  migration: Fix compiler warning ('caps' may be used uninitialized)
  util/path: Fix type which is longer than 8 bit for MinGW
  hw/9pfs: Fix errno value for xattr functions
  vl: Clean up unnecessary boot_order complications
  qemu-char: Fix potential out of bounds access to local arrays
  pci-ohci: Add missing 'break' in ohci_service_td
  sh4: Fix serial line access for Linux kernels later than 3.2
  hw/alpha: Fix compiler warning (integer constant is too large)
  target-i386: Fix compiler warning (integer constant is too large)
  block: Remove unused assignment (fixes warning from clang)
  exec: cleanup DEBUG_SUBPAGE
  tests: Fix schema parser test for in-tree build
  tests: Update .gitignore for test-int128 and test-bitops
  .gitignore: ignore tests/qemu-iotests/socket_scm_helper

Message-id: 1381051979-25742-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoMerge remote-tracking branch 'rth/tcg-arm-pull' into staging
Anthony Liguori [Wed, 9 Oct 2013 14:52:57 +0000 (07:52 -0700)]
Merge remote-tracking branch 'rth/tcg-arm-pull' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/tcg-arm-pull:
  tcg-arm: Move the tlb addend load earlier
  tcg-arm: Remove restriction on qemu_ld output register
  tcg-arm: Return register containing tlb addend
  tcg-arm: Move load of tlb addend into tcg_out_tlb_read
  tcg-arm: Use QEMU_BUILD_BUG_ON to verify constraints on tlb
  tcg-arm: Use strd for tcg_out_arg_reg64
  tcg-arm: Rearrange slow-path qemu_ld/st
  tcg-arm: Use ldrd/strd for appropriate qemu_ld/st64

Message-id: 1380663109-14434-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoMerge remote-tracking branch 'sweil/mingw' into staging
Anthony Liguori [Wed, 9 Oct 2013 14:52:21 +0000 (07:52 -0700)]
Merge remote-tracking branch 'sweil/mingw' into staging

# By Sebastian Ottlik
# Via Stefan Weil
* sweil/mingw:
  util: call socket_set_fast_reuse instead of setting SO_REUSEADDR
  slirp: call socket_set_fast_reuse instead of setting SO_REUSEADDR
  net: call socket_set_fast_reuse instead of setting SO_REUSEADDR
  gdbstub: call socket_set_fast_reuse instead of setting SO_REUSEADDR
  util: add socket_set_fast_reuse function which will replace setting SO_REUSEADDR

Message-id: 1380735690-24009-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoMerge remote-tracking branch 'kraxel/chardev.8' into staging
Anthony Liguori [Wed, 9 Oct 2013 14:52:11 +0000 (07:52 -0700)]
Merge remote-tracking branch 'kraxel/chardev.8' into staging

# By Gerd Hoffmann
# Via Gerd Hoffmann
* kraxel/chardev.8:
  chardev: handle qmp_chardev_add(KIND_MUX) failure

Message-id: 1380708925-6721-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoMerge remote-tracking branch 'sweil/tci' into staging
Anthony Liguori [Wed, 9 Oct 2013 14:50:37 +0000 (07:50 -0700)]
Merge remote-tracking branch 'sweil/tci' into staging

# By Stefan Weil
# Via Stefan Weil
* sweil/tci:
  misc: Use new rotate functions
  bitops: Add rotate functions (rol8, ror8, ...)
  tci: Add implementation of rotl_i64, rotr_i64

Message-id: 1380137693-3729-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoblock/iscsi: reenable iscsi_co_get_block_status
Peter Lieven [Wed, 2 Oct 2013 11:52:08 +0000 (13:52 +0200)]
block/iscsi: reenable iscsi_co_get_block_status

Commit f35c934a accidently disabled iscsi_co_get_block_status for all
libiscsi versions. Its not possible to check for enumeration constants
in the C preprocessor. This patch changes the check to the preprocessor
constant LIBISCSI_FEATURE_IOVECTOR which was introduced shortly after
get_lba_status support was added to libiscsi.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>