sdk/emulator/qemu.git
9 years agoqemu-iotests: Add test case for mirror with unmap
Fam Zheng [Mon, 8 Jun 2015 05:56:13 +0000 (13:56 +0800)]
qemu-iotests: Add test case for mirror with unmap

This checks that the discard on mirror source that effectively zeroes
data is also reflected by the data of target.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqemu-iotests: Make block job methods common
Fam Zheng [Mon, 8 Jun 2015 05:56:12 +0000 (13:56 +0800)]
qemu-iotests: Make block job methods common

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock: Remove bdrv_reset_dirty
Fam Zheng [Mon, 8 Jun 2015 05:56:11 +0000 (13:56 +0800)]
block: Remove bdrv_reset_dirty

Using this function would always be wrong because a dirty bitmap must
have a specific owner that consumes the dirty bits and calls
bdrv_reset_dirty_bitmap().

Remove the unused function to avoid future misuse.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock: Fix dirty bitmap in bdrv_co_discard
Fam Zheng [Mon, 8 Jun 2015 05:56:10 +0000 (13:56 +0800)]
block: Fix dirty bitmap in bdrv_co_discard

Unsetting dirty globally with discard is not very correct. The discard may zero
out sectors (depending on can_write_zeroes_with_unmap), we should replicate
this change to destination side to make sure that the guest sees the same data.

Calling bdrv_reset_dirty also troubles mirror job because the hbitmap iterator
doesn't expect unsetting of bits after current position.

So let's do it the opposite way which fixes both problems: set the dirty bits
if we are to discard it.

Reported-by: wangxiaolong@ucloud.cn
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agomirror: Do zero write on target if sectors not allocated
Fam Zheng [Mon, 8 Jun 2015 05:56:09 +0000 (13:56 +0800)]
mirror: Do zero write on target if sectors not allocated

If guest discards a source cluster, mirroring with bdrv_aio_readv is overkill.
Some protocols do zero upon discard, where it's best to use
bdrv_aio_write_zeroes, otherwise, bdrv_aio_discard will be enough.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqmp: Add optional bool "unmap" to drive-mirror
Fam Zheng [Mon, 8 Jun 2015 05:56:08 +0000 (13:56 +0800)]
qmp: Add optional bool "unmap" to drive-mirror

If specified as "true", it allows discarding on target sectors where source is
not allocated.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock: Add bdrv_get_block_status_above
Fam Zheng [Mon, 8 Jun 2015 05:56:07 +0000 (13:56 +0800)]
block: Add bdrv_get_block_status_above

Like bdrv_is_allocated_above, this function follows the backing chain until seeing
BDRV_BLOCK_ALLOCATED.  Base is not included.

Reimplement bdrv_is_allocated on top.

[Initialized bdrv_co_get_block_status_above() ret to 0 to silence
mingw64 compiler warning about the unitialized variable.  assert(bs !=
base) prevents that case but I suppose the program could be compiled
with -DNDEBUG.
--Stefan]

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agotimer: Use a single definition of NSEC_PER_SEC for the whole codebase
Alberto Garcia [Fri, 12 Jun 2015 13:01:30 +0000 (16:01 +0300)]
timer: Use a single definition of NSEC_PER_SEC for the whole codebase

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: c6e55468856ba0b8f95913c4da111cc0ef266541.1434113783.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agotimer: Move NANOSECONDS_PER_SECONDS to timer.h
Alberto Garcia [Fri, 12 Jun 2015 13:01:29 +0000 (16:01 +0300)]
timer: Move NANOSECONDS_PER_SECONDS to timer.h

We want to be able to reuse this define by making it common to
multiple QEMU modules.

This also makes it an integer since there's no need for it to be a
float.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 6375912849da2ab561046dd013684535ccecca44.1434113783.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblockdev: no need to drain+flush in hmp_drive_del
Paolo Bonzini [Thu, 28 May 2015 14:17:09 +0000 (16:17 +0200)]
blockdev: no need to drain+flush in hmp_drive_del

bdrv_close already does that, and in fact hmp_drive_del would need
another drain after the flush (which bdrv_close does).  So remove
the duplication.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1432822629-25401-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqapi: Rename 'dirty-bitmap' mode to 'incremental'
John Snow [Fri, 5 Jun 2015 00:20:34 +0000 (20:20 -0400)]
qapi: Rename 'dirty-bitmap' mode to 'incremental'

If we wish to make differential backups a feature that's easy to access,
it might be pertinent to rename the "dirty-bitmap" mode to "incremental"
to make it clear what /type/ of backup the dirty-bitmap is helping us
perform.

This is an API breaking change, but 2.4 has not yet gone live,
so we have this flexibility.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1433463642-21840-2-git-send-email-jsnow@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqcow2: Handle EAGAIN returned from update_refcount
Jindřich Makovička [Wed, 24 Jun 2015 05:05:25 +0000 (07:05 +0200)]
qcow2: Handle EAGAIN returned from update_refcount

Fixes a crash during image compression

Signed-off-by: Jindřich Makovička <makovick@gmail.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblock/iscsi: add support for request timeouts
Peter Lieven [Tue, 16 Jun 2015 11:45:07 +0000 (13:45 +0200)]
block/iscsi: add support for request timeouts

libiscsi starting with 1.15 will properly support timeout of iscsi
commands. The default will remain no timeout, but this can
be changed via cmdline parameters, e.g.:

qemu -iscsi timeout=30 -drive file=iscsi://...

If a timeout occurs a reconnect is scheduled and the timed out command
will be requeued for processing after a successful reconnect.

The required API call iscsi_set_timeout is present since libiscsi
1.10 which was released in October 2013. However, due to some bugs
in the libiscsi code the use is not recommended before version 1.15.

Please note that this patch bumps the libiscsi requirement to 1.10
to have all function and macros defined. The patch fixes also a
off-by-one error in the NOP timeout calculation which was fixed
while touching these code parts.

Signed-off-by: Peter Lieven <pl@kamp.de>
Message-id: 1434455107-19328-1-git-send-email-pl@kamp.de
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/vivier/tags/pull-m68k-20150629' into staging
Peter Maydell [Mon, 29 Jun 2015 16:03:20 +0000 (17:03 +0100)]
Merge remote-tracking branch 'remotes/vivier/tags/pull-m68k-20150629' into staging

Trivial m68k cleanup

# gpg: Signature made Mon Jun 29 16:38:40 2015 BST using DSA key ID ABF36C53
# gpg: Good signature from "Laurent Vivier <laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier <Laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier <Laurent@lvivier.info>"
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# gpg:                 aka "[jpeg image of size 3881]"
# 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: 9EC7 B78A C0AC E697 5E4B  BDE3 34A4 F6C9 ABF3 6C53

* remotes/vivier/tags/pull-m68k-20150629:
  m68k: remove useless parameter op_size from gen_lea_indexed()
  m68k: remove useless file m68k-qreg.h
  m68k: is_mem is useless

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agom68k: remove useless parameter op_size from gen_lea_indexed()
Laurent Vivier [Wed, 24 Jun 2015 00:51:49 +0000 (02:51 +0200)]
m68k: remove useless parameter op_size from gen_lea_indexed()

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
9 years agom68k: remove useless file m68k-qreg.h
Laurent Vivier [Wed, 24 Jun 2015 00:07:24 +0000 (02:07 +0200)]
m68k: remove useless file m68k-qreg.h

Unused since:

    commit e1f3808e03f73e7a7fa966afbed2455dd052202e
    Author: pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
    Date:   Sat May 24 22:29:16 2008 +0000

        Convert m68k target to TCG.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
9 years agom68k: is_mem is useless
Laurent Vivier [Tue, 23 Jun 2015 23:00:22 +0000 (01:00 +0200)]
m68k: is_mem is useless

Remove is_mem as it is never tested anymore since:

    commit bfa50bc2638d877cf2900712b7503be22e8811cb
    Author: aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
    Date:   Tue Nov 18 20:26:41 2008 +0000

        Remove premature memop TB terminations (Jan Kiszka)

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
9 years agoMerge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150629' into...
Peter Maydell [Mon, 29 Jun 2015 12:26:43 +0000 (13:26 +0100)]
Merge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150629' into staging

TriCore bugfixes

# gpg: Signature made Mon Jun 29 13:08:17 2015 BST using RSA key ID 6B69CA14
# gpg: Good signature from "Bastian Koppelmann <kbastian@mail.uni-paderborn.de>"

* remotes/bkoppelmann/tags/pull-tricore-20150629:
  target-tricore: fix depositing bits from PCXI into ICR

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-tricore: fix depositing bits from PCXI into ICR
Paolo Bonzini [Wed, 24 Jun 2015 12:01:10 +0000 (14:01 +0200)]
target-tricore: fix depositing bits from PCXI into ICR

Spotted by Coverity, because (env->PCXI & MASK_PCXI_PCPN) >> 24
is always zero.  The immediately preceding assignment is also
wrong though.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <1435147270-1040-1-git-send-email-pbonzini@redhat.com>

9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Fri, 26 Jun 2015 14:57:43 +0000 (15:57 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

virtio, pci fixes, enhancements

Almost exclusively bugfixes, though in this case,
we are adding functionality to the pxb in order
to make OVMF work on it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Fri Jun 26 14:43:27 2015 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream:
  Fix glib_subprocess test
  hw/pci-bridge: format special OFW unit address for PXB host
  hw/core: explicit OFW unit address callback for SysBusDeviceClass
  hw/pci-bridge: disable SHPC in PXB
  hw/pci-bridge: introduce "shpc" property
  hw/pci: introduce shpc_present() helper function
  hw/pci-bridge: add macro for "msi" property
  hw/pci-bridge: add macro for "chassis_nr" property
  hw/pci-bridge: expose _test parameter in SHPC_VMSTATE()
  migration: introduce VMSTATE_BUFFER_UNSAFE_INFO_TEST()
  add pci-bridge-seat
  pc: cleanup and convert TMP ACPI device description to AML API
  MAINTAINERS: add ACPI entry
  vhost: correctly pass error to caller in vhost_dev_enable_notifiers()
  balloon: add a feature bit to let Guest OS deflate balloon on oom
  qdev: fix OVERFLOW_BEFORE_WIDEN
  virito-pci: fix OVERRUN problem

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150626' into...
Peter Maydell [Fri, 26 Jun 2015 13:40:47 +0000 (14:40 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150626' into staging

target-arm queue:
 * Change the virt board's default interface type for block devices to virtio
 * Improve some error messages that will now be triggered by some incorrect
   but previously worked-by-accident command lines
 * Print ELR if we're doing debug logging of AArch64 exception entry
 * Handle the "completely empty semihosting commandline" correctly for
   softmmu (we already did for linux-user)
 * Add GICv2m description to ACPI tables for virt board
 * Fix some incorrect table revision entries in virt board ACPI tables

# gpg: Signature made Fri Jun 26 14:29:39 2015 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20150626:
  hw/arm/virt: Make block devices default to virtio
  qdev-properties-system: Improve error message for drive assignment conflict
  qdev-properties-system: Change set_pointer's parse callback to use Error
  target-arm: A64: Print ELR when taking exceptions
  target-arm: default empty semihosting cmdline
  hw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table
  hw/arm/virt-acpi-build: Fix table revision and some comments

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt: Make block devices default to virtio
Peter Maydell [Fri, 26 Jun 2015 13:22:37 +0000 (14:22 +0100)]
hw/arm/virt: Make block devices default to virtio

Now we have virtio-pci, we can make the virt board's default block
device type be IF_VIRTIO. This allows users to use simplified
command lines that don't have to explicitly create virtio-pci-blk
devices; the -hda &c very short options now also work.

This means we also need to set no_cdrom to avoid getting a
default cdrom device -- this is needed because the virtio-blk
device will fail if it is connected to a block backend with
no media, which is what the default cdrom device typically is.
Providing a cdrom with media via -cdrom will succeed, but silently
create a device with non-removable medium. this is probably
not really what the user wants, but is the best we can do now.

Note that this change means that some command lines which used
to work (by accident) will stop working. Where a drive was connected
manually to a device but without 'if=none' being specified, we
used to treat this as an IDE drive, which we would then not autoplug
because the board doesn't support IDE. Now we will treat it as a
virtio disk and autoplug it, which means the attempt to use the
drive manually will fail:
  qemu-system-arm: -drive file=img.qcow2,id=foo: Drive 'foo' is already
  in use because it has been automatically connected to another device
  (did you need 'if=none' in the drive options?)
The command line will have to be changed to include 'if=none', as the
error message suggests.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435068107-12594-4-git-send-email-peter.maydell@linaro.org

9 years agoqdev-properties-system: Improve error message for drive assignment conflict
Peter Maydell [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
qdev-properties-system: Improve error message for drive assignment conflict

If the user forgot if=none on their drive specification they're likely
to get an error message because the drive is assigned once automatically
by QEMU and once by the manual id=/drive= user command line specification.
Improve the error message produced in this case to explicitly guide the
user towards if=none.

We rephrase the "drive conflict but not for an if=something" error as
well to keep the wording in line.

The two cases that change are:

(1) Drive specified as to be auto-connected and also manually connected
(and the board does handle this if= type):

  qemu-system-x86_64 -nodefaults -display none \
     -drive if=scsi,file=tmp.qcow2,id=foo -device ide-hd,drive=foo

Previously:
  qemu-system-x86_64: -device ide-hd,drive=foo: Property 'ide-hd.drive'
  can't take value 'foo', it's in use

Now:
  qemu-system-x86_64: -device ide-hd,drive=foo: Drive 'foo' is already in
  use because it has been automatically connected to another device (did
  you need 'if=none' in the drive options?)

(2) Drive specified to be manually connected in two different ways:

  qemu-system-x86_64 -nodefaults -display none \
   -drive if=none,file=tmp.qcow2,id=foo -device ide-hd,drive=foo \
   -device ide-hd,drive=foo

Previously:
  qemu-system-x86_64: -device ide-hd,drive=foo: Property 'ide-hd.drive'
  can't take value 'foo', it's in use

Now:
  qemu-system-x86_64: -device ide-hd,drive=foo: Drive 'foo' is already in
  use by another device

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435068107-12594-3-git-send-email-peter.maydell@linaro.org

9 years agoqdev-properties-system: Change set_pointer's parse callback to use Error
Peter Maydell [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
qdev-properties-system: Change set_pointer's parse callback to use Error

Instead of having set_pointer() call a parse callback which returns
an error number that we then convert to an Error string with
error_set_from_qdev_prop_error(), make the parse callback take an
Error** and set the error itself. This will allow parse routines
to provide more helpful error messages than the generic ones.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435068107-12594-2-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: A64: Print ELR when taking exceptions
Soren Brinkmann [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
target-arm: A64: Print ELR when taking exceptions

When taking an exception print the content of the exception link
register. This is useful especially for synchronous exceptions because
in that case this registers holds the address of the instruction that
generated the exception.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Message-id: 1435036655-16132-1-git-send-email-soren.brinkmann@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: default empty semihosting cmdline
Liviu Ionescu [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
target-arm: default empty semihosting cmdline

If neither explicit semihosting args nor -kernel are used,
make SYS_GET_CMDLINE return an empty string.

Signed-off-by: Liviu Ionescu <ilg@livius.net>
Message-id: AC7B5AFC-06AE-4FAD-9852-B65708E80E09@livius.net
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table
Shannon Zhao [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
hw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table

Add GICv2m description in ACPI MADT table, so guest can use MSI when
booting with ACPI.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Tested-by: Andrew Jones <drjones@redhat.com>
Message-id: 1434676210-2276-1-git-send-email-shannon.zhao@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt-acpi-build: Fix table revision and some comments
Shannon Zhao [Fri, 26 Jun 2015 13:22:36 +0000 (14:22 +0100)]
hw/arm/virt-acpi-build: Fix table revision and some comments

The table revision is not the ACPI spec version. Fix the wrong revision
and also some comments.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1433820378-8336-1-git-send-email-zhaoshenglong@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/lalrae/tags/mips-20150626' into staging
Peter Maydell [Fri, 26 Jun 2015 10:32:58 +0000 (11:32 +0100)]
Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150626' into staging

MIPS patches 2015-06-26

Changes:
* MIPS UHI semihosting support
* microMIPS32 R6 support

# gpg: Signature made Fri Jun 26 10:42:33 2015 BST using RSA key ID 0B29DA6B
# gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>"
# 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: 8DD3 2F98 5495 9D66 35D4  4FC0 5211 8E3C 0B29 DA6B

* remotes/lalrae/tags/mips-20150626:
  target-mips: add mips32r6-generic CPU definition
  target-mips: microMIPS32 R6 POOL16{A, C} instructions
  target-mips: microMIPS32 R6 Major instructions
  target-mips: microMIPS32 R6 POOL32{I, C} instructions
  target-mips: microMIPS32 R6 POOL32F instructions
  target-mips: microMIPS32 R6 POOL32A{XF} instructions
  target-mips: microMIPS32 R6 branches and jumps
  target-mips: add microMIPS32 R6 opcode enum
  target-mips: signal RI for removed instructions in microMIPS R6
  target-mips: raise RI exceptions when FIR.PS = 0
  target-mips: rearrange gen_compute_compact_branch
  target-mips: refactor {D}LSA, {D}ALIGN, {D}BITSWAP
  target-mips: remove an unused argument
  target-mips: add microMIPS TLBINV, TLBINVF
  target-mips: fix {RD, WR}PGPR in microMIPS
  target-mips: convert host to MIPS errno values when required
  target-mips: add Unified Hosting Interface (UHI) support
  target-mips: remove identical code in different branch
  hw/mips: Do not clear BEV for MIPS malta kernel load
  include/softmmu-semi.h: Make semihosting support 64-bit clean

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-mips: add mips32r6-generic CPU definition
Yongbok Kim [Wed, 24 Jun 2015 23:24:27 +0000 (00:24 +0100)]
target-mips: add mips32r6-generic CPU definition

Define a new CPU definition supporting MIPS32 Release 6 ISA and
microMIPS32 Release 6 ISA.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 POOL16{A, C} instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:26 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 POOL16{A, C} instructions

microMIPS32 Release 6 POOL16A/ POOL16C instructions

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 Major instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:25 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 Major instructions

Add new microMIPS32 Release 6 Major opcode instructions

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 POOL32{I, C} instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:24 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 POOL32{I, C} instructions

Add new microMIPS32 Release 6 POOL32I/POOL32C type instructions

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 POOL32F instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:23 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 POOL32F instructions

Add new microMIPS32 Release 6 POOL32F instructions

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 POOL32A{XF} instructions
Yongbok Kim [Wed, 24 Jun 2015 23:24:22 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 POOL32A{XF} instructions

Add new microMIPS32 Release 6 pool32a/pool32axf instructions.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: microMIPS32 R6 branches and jumps
Yongbok Kim [Wed, 24 Jun 2015 23:24:21 +0000 (00:24 +0100)]
target-mips: microMIPS32 R6 branches and jumps

Add new microMIPS32 Release 6 branch and jump instructions.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: add microMIPS32 R6 opcode enum
Yongbok Kim [Wed, 24 Jun 2015 23:24:20 +0000 (00:24 +0100)]
target-mips: add microMIPS32 R6 opcode enum

Add microMIPS32 Release 6 opcode enum.
Remove RI checking for pre-R6 reserved opcode.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: signal RI for removed instructions in microMIPS R6
Yongbok Kim [Wed, 24 Jun 2015 23:24:19 +0000 (00:24 +0100)]
target-mips: signal RI for removed instructions in microMIPS R6

Signal a Reserved Instruction exception for removed instruction encoding
in microMIPS Release 6.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: raise RI exceptions when FIR.PS = 0
Yongbok Kim [Wed, 24 Jun 2015 23:24:18 +0000 (00:24 +0100)]
target-mips: raise RI exceptions when FIR.PS = 0

64-bit paired-single (PS) floating point data type is optional in the
pre-Release 6.
It has to raise RI exception when PS type is not implemented. (FIR.PS = 0)
(The PS data type is removed in the Release 6.)
Loongson-2E and Loongson-2F don't have any implementation field in
FCSR0(FIR) but do support PS data format, therefore for these cores RI will
not be signalled regardless of PS bit.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: rearrange gen_compute_compact_branch
Yongbok Kim [Wed, 24 Jun 2015 23:24:17 +0000 (00:24 +0100)]
target-mips: rearrange gen_compute_compact_branch

The function will be also used for microMIPS Release 6.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: refactor {D}LSA, {D}ALIGN, {D}BITSWAP
Yongbok Kim [Wed, 24 Jun 2015 23:24:16 +0000 (00:24 +0100)]
target-mips: refactor {D}LSA, {D}ALIGN, {D}BITSWAP

Refactor those instructions in order to reuse them for microMIPS32
Release 6.
Rearrange gen_move_low32().

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: remove an unused argument
Yongbok Kim [Wed, 24 Jun 2015 23:24:15 +0000 (00:24 +0100)]
target-mips: remove an unused argument

Remove an unused argument from decode_micromips32_opc()

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: add microMIPS TLBINV, TLBINVF
Yongbok Kim [Wed, 24 Jun 2015 23:24:14 +0000 (00:24 +0100)]
target-mips: add microMIPS TLBINV, TLBINVF

Add microMIPS TLBINV, TLBINVF

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: fix {RD, WR}PGPR in microMIPS
Yongbok Kim [Wed, 24 Jun 2015 23:24:13 +0000 (00:24 +0100)]
target-mips: fix {RD, WR}PGPR in microMIPS

rt, rs were swapped

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: convert host to MIPS errno values when required
Leon Alrae [Fri, 19 Jun 2015 10:08:44 +0000 (11:08 +0100)]
target-mips: convert host to MIPS errno values when required

Convert only errno values which can be returned by system calls in
mips-semi.c and are not generic to all archs.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: add Unified Hosting Interface (UHI) support
Leon Alrae [Fri, 19 Jun 2015 10:08:43 +0000 (11:08 +0100)]
target-mips: add Unified Hosting Interface (UHI) support

Add UHI semihosting support for MIPS. QEMU run with "-semihosting" option
will alter the behaviour of SDBBP 1 instruction -- UHI operation will be
called instead of generating a debug exception.

Also tweak Malta's pseudo-bootloader. On CPU reset the $4 register is set
to -1 if semihosting arguments are passed to indicate that the UHI
operations should be used to obtain input arguments.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: remove identical code in different branch
Leon Alrae [Fri, 19 Jun 2015 10:08:42 +0000 (11:08 +0100)]
target-mips: remove identical code in different branch

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agohw/mips: Do not clear BEV for MIPS malta kernel load
Matthew Fortune [Fri, 19 Jun 2015 10:08:41 +0000 (11:08 +0100)]
hw/mips: Do not clear BEV for MIPS malta kernel load

The BEV flag controls whether the boot exception vector is still
in place when starting a kernel.  When cleared the exception vector
at EBASE (or hard coded address of 0x80000000) is used instead.

The early stages of the linux kernel would benefit from BEV still
being set to ensure any faults get handled by the boot rom exception
handlers.  This is a moot point for system qemu as there aren't really
any BEV handlers, but there are other good reasons to change this...

The UHI (semi-hosting interface) defines special behaviours depending
on whether an application starts in an environment with BEV set or
cleared. When BEV is set then UHI assumes that a bootloader is
relatively dumb and has no advanced exception handling logic.
However, when BEV is cleared then UHI assumes that the bootloader
has the ability to handle UHI exceptions with its exception handlers
and will unwind and forward UHI SYSCALL exceptions to the exception
vector that was installed prior to running the application.

Signed-off-by: Matthew Fortune <matthew.fortune@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agoinclude/softmmu-semi.h: Make semihosting support 64-bit clean
Maciej W. Rozycki [Fri, 19 Jun 2015 10:08:40 +0000 (11:08 +0100)]
include/softmmu-semi.h: Make semihosting support 64-bit clean

Correct addresses passed around in semihosting to use a data type suitable
for both 32-bit and 64-bit targets.

Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Thu, 25 Jun 2015 13:03:55 +0000 (14:03 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

# gpg: Signature made Wed Jun 24 16:37:23 2015 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: simplify net_client_init1()
  net: drop if expression that is always true
  net: raise an error if -net type is invalid
  net: replace net_client_init1() netdev whitelist with blacklist
  net: add missing "netmap" to host_net_devices[]

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Thu, 25 Jun 2015 10:19:46 +0000 (11:19 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Wed Jun 24 16:27:53 2015 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:
  virito-blk: drop duplicate check
  qemu-iotests: fix 051.out after qdev error message change
  iov: don't touch iov in iov_send_recv()
  raw-posix: Introduce hdev_is_sg()
  raw-posix: Use DPRINTF for DEBUG_FLOPPY
  raw-posix: DPRINTF instead of DEBUG_BLOCK_PRINT
  Fix migration in case of scsi-generic
  block: Use bdrv_is_sg() everywhere
  nvme: Fix memleak in nvme_dma_read_prp
  vvfat: add a label option
  util/hbitmap: Add an API to reset all set bits in hbitmap
  virtio-blk: Use blk_drain() to drain IO requests
  block-backend: Introduce blk_drain()
  throttle: Check current timers before updating any_timer_armed[]
  block: Let bdrv_drain_all() to call aio_poll() for each AioContext

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agonet: simplify net_client_init1()
Stefan Hajnoczi [Wed, 27 May 2015 16:16:52 +0000 (17:16 +0100)]
net: simplify net_client_init1()

Drop the union and move the hubport creation into the !is_netdev case.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 1432743412-15943-6-git-send-email-stefanha@redhat.com

9 years agonet: drop if expression that is always true
Stefan Hajnoczi [Wed, 27 May 2015 16:16:51 +0000 (17:16 +0100)]
net: drop if expression that is always true

Both is_netdev and !is_netdev paths already check that
net_client_init_func[opts->kind] is non-NULL so there is no need for the
if statement.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 1432743412-15943-5-git-send-email-stefanha@redhat.com

9 years agonet: raise an error if -net type is invalid
Stefan Hajnoczi [Wed, 27 May 2015 16:16:50 +0000 (17:16 +0100)]
net: raise an error if -net type is invalid

When a -net type is used that was not compiled into the binary there
should be an error message.

Note the special case for -net none, which is a no-op.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 1432743412-15943-4-git-send-email-stefanha@redhat.com

9 years agonet: replace net_client_init1() netdev whitelist with blacklist
Stefan Hajnoczi [Wed, 27 May 2015 16:16:49 +0000 (17:16 +0100)]
net: replace net_client_init1() netdev whitelist with blacklist

It's cumbersome to keep the whitelist up-to-date.  New netdev backends
should most likely be allowed so a blacklist makes more sense than a
whitelist.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 1432743412-15943-3-git-send-email-stefanha@redhat.com

9 years agonet: add missing "netmap" to host_net_devices[]
Stefan Hajnoczi [Wed, 27 May 2015 16:16:48 +0000 (17:16 +0100)]
net: add missing "netmap" to host_net_devices[]

Although hmp-commands.hx lists "netmap" as a valid host_net_add type,
the command rejects it because it's missing from the list.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1432743412-15943-2-git-send-email-stefanha@redhat.com

9 years agovirito-blk: drop duplicate check
Gonglei [Wed, 24 Jun 2015 09:29:24 +0000 (17:29 +0800)]
virito-blk: drop duplicate check

in_num = req->elem.in_num, and req->elem.in_num is
checked in line 489, so the check about in_num variable
is superflous, let's drop it.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1435138164-11728-1-git-send-email-arei.gonglei@huawei.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqemu-iotests: fix 051.out after qdev error message change
Stefan Hajnoczi [Tue, 23 Jun 2015 14:56:09 +0000 (15:56 +0100)]
qemu-iotests: fix 051.out after qdev error message change

Commit f006cf7fa9a63ba8e4ccf57d46231ce594301727 ("qdev-monitor:
Propagate errors through qdev_device_add()") dropped a meaningless error
message.  This change in output caused qemu-iotests 051 to fail:

   QEMU_PROG: -device ide-drive,drive=disk: Device initialization failed.
  -QEMU_PROG: -device ide-drive,drive=disk: Device 'ide-drive' could not be initialized

Update 051.out so the test passes again.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1435071369-30936-1-git-send-email-stefanha@redhat.com

9 years agoFix glib_subprocess test
Dr. David Alan Gilbert [Wed, 24 Jun 2015 09:45:42 +0000 (10:45 +0100)]
Fix glib_subprocess test

A typo means that the tests dependent on glib with subprocess
support are never run.

Fixes: 9d41401b90fa10b335d2e739149d36437cfbf622

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/pci-bridge: format special OFW unit address for PXB host
Laszlo Ersek [Fri, 19 Jun 2015 02:40:17 +0000 (04:40 +0200)]
hw/pci-bridge: format special OFW unit address for PXB host

We have agreed that OpenFirmware device paths in the "bootorder" fw_cfg
file should follow the pattern

  /pci@i0cf8,%x/...

for devices that live behind an extra root bus. The extra root bus in
question is the %x'th among the extra root buses. (In other words, %x
gives the position of the affected extra root bus relative to the other
extra root buses, in bus_nr order.) %x starts at 1, and is formatted in
hex.

The portion of the unit address that comes before the comma is dynamically
taken from the main host bridge, similarly to sysbus_get_fw_dev_path().

Cc: Kevin O'Connor <kevin@koconnor.net>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/core: explicit OFW unit address callback for SysBusDeviceClass
Laszlo Ersek [Fri, 19 Jun 2015 02:40:16 +0000 (04:40 +0200)]
hw/core: explicit OFW unit address callback for SysBusDeviceClass

The sysbus_get_fw_dev_path() function formats OpenFirmware device path
nodes ("driver-name@unit-address") for sysbus devices. The first choice
for "unit-address" is the base address of the device's first MMIO region.
The second choice is its first IO port.

However, if two sysbus devices with the same "driver-name" lack both MMIO
and PIO resources, then there is no good way to distinguish them based on
their OFW nodes, because in this case unit-address is omitted completely
for both devices. An example is TYPE_PXB_HOST ("pxb-host").

For the sake of such devices, introduce the explicit_ofw_unit_address()
"virtual member function". With this function, each sysbus device in the
same SysBusDeviceClass can state its own address.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Tested-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/pci-bridge: disable SHPC in PXB
Laszlo Ersek [Fri, 19 Jun 2015 02:40:14 +0000 (04:40 +0200)]
hw/pci-bridge: disable SHPC in PXB

OVMF downloads the ACPI linker/loader script from QEMU when the edk2 PCI
Bus driver globally signals the firmware that PCI enumeration and resource
allocation have completed. At this point QEMU regenerates the ACPI payload
in an fw_cfg read callback, and this is when the PXB's _CRS gets
populated.

Unfortunately, when this happens, the PCI_COMMAND_MEMORY bit is clear in
the root bus's command register, *unlike* under SeaBIOS. The consequences
unfold as follows:

- When build_crs() fetches dev->io_regions[i].addr, it is all-bits-one,
  because pci_update_mappings() --> pci_bar_address() calculated it as
  PCI_BAR_UNMAPPED, due to the PCI_COMMAND_MEMORY bit being clear.

- Consequently, the SHPC MMIO BAR (bar 0) of the bridge is not added to
  the _CRS, *despite* having been programmed in PCI config space.

- Similarly, the SHPC MMIO BAR of the PXB is not removed from the main
  root bus's DWordMemory descriptor.

- Guest OSes (Linux and Windows alike) notice the pre-programmed SHPC BAR
  within the PXB's config space, and notice that it conflicts with the
  main root bus's memory resource descriptors. Linux reports

  pci 0000:04:00.0: BAR 0: can't assign mem (size 0x100)
  pci 0000:04:00.0: BAR 0: trying firmware assignment [mem
                           0x88200000-0x882000ff 64bit]
  pci 0000:04:00.0: BAR 0: [mem 0x88200000-0x882000ff 64bit] conflicts
                           with PCI Bus 0000:00 [mem
                           0x88200000-0xfebfffff]

  While Windows Server 2012 R2 reports

    https://technet.microsoft.com/en-us/library/cc732199%28v=ws.10%29.aspx

    This device cannot find enough free resources that it can use. If you
    want to use this device, you will need to disable one of the other
    devices on this system. (Code 12)

This issue was apparently encountered earlier, see the "hack" in:

  https://lists.nongnu.org/archive/html/qemu-devel/2015-01/msg02983.html

and the current hole-punching logic in build_crs() and build_ssdt() is
probably supposed to remedy exactly that problem -- however, for OVMF they
don't work, because at the end of the PCI enumeration and resource
allocation, which cues the ACPI linker/loader client, the command register
is clear.

The "shpc" property of "pci-bridge", introduced in the previous patches,
allows us to disable the standard hotplug controller cleanly, eliminating
the SHPC bar and the conflict.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/pci-bridge: introduce "shpc" property
Laszlo Ersek [Fri, 19 Jun 2015 02:40:13 +0000 (04:40 +0200)]
hw/pci-bridge: introduce "shpc" property

In the PCI expander bridge, we will want to disable those features of
pci-bridge that relate to SHPC (standard hotplug controller):

- SHPC bar and underlying MemoryRegion
- interrupt (INTx or MSI)
- effective hotplug callbacks
- other SHPC hooks (initialization, cleanup, migration etc)

Introduce a new feature request bit in the PCIBridgeDev.flags field, and
turn off the above if the bit is explicitly cleared.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/pci: introduce shpc_present() helper function
Laszlo Ersek [Fri, 19 Jun 2015 02:40:12 +0000 (04:40 +0200)]
hw/pci: introduce shpc_present() helper function

It follows msi_present() in "include/hw/pci/msi.h".

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/pci-bridge: add macro for "msi" property
Laszlo Ersek [Fri, 19 Jun 2015 02:40:11 +0000 (04:40 +0200)]
hw/pci-bridge: add macro for "msi" property

This should help catch property name typos at compile time.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/pci-bridge: add macro for "chassis_nr" property
Laszlo Ersek [Fri, 19 Jun 2015 02:40:10 +0000 (04:40 +0200)]
hw/pci-bridge: add macro for "chassis_nr" property

This should help catch property name typos at compile time.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/pci-bridge: expose _test parameter in SHPC_VMSTATE()
Laszlo Ersek [Fri, 19 Jun 2015 02:40:09 +0000 (04:40 +0200)]
hw/pci-bridge: expose _test parameter in SHPC_VMSTATE()

Change the signature of the function-like macro SHPC_VMSTATE(), so that we
can produce and expect this field conditionally in the migration stream,
starting with an upcoming patch.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agomigration: introduce VMSTATE_BUFFER_UNSAFE_INFO_TEST()
Laszlo Ersek [Fri, 19 Jun 2015 02:40:08 +0000 (04:40 +0200)]
migration: introduce VMSTATE_BUFFER_UNSAFE_INFO_TEST()

There is no _TEST() variant of VMSTATE_BUFFER_UNSAFE_INFO() yet, but we'll
soon need it. Introduce it and rebase the original
VMSTATE_BUFFER_UNSAFE_INFO() on top.

The parameter order of the new function-like macro follows that of
VMSTATE_SINGLE_TEST(): "_test" is introduced between "_state" and
"_version".

Cc: Juan Quintela <quintela@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-06-23' into...
Peter Maydell [Tue, 23 Jun 2015 17:25:55 +0000 (18:25 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-06-23' into staging

trivial patches for 2015-06-23

# gpg: Signature made Tue Jun 23 18:23:45 2015 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>"

* remotes/mjt/tags/pull-trivial-patches-2015-06-23: (21 commits)
  util/qemu-sockets: improve ai_flag hints for ipv6 hosts
  hw/display/tcx.c: Fix memory leak
  hw/display/cg3.c: Fix memory leak
  Makefile: Add "make ctags"
  Makefile: Fix "make cscope TAGS"
  qemu-options: Use @itemx where appropriate
  qemu-options: Improve -global documentation
  throttle: Fix typo in the documentation of block_set_io_throttle
  hw/display/qxl-logger.c: Constify some variable
  configure: rearrange --help and consolidate enable/disable together
  libcacard: pkgconfig: tidy dependent libs
  vt82c686: QOMify
  xen_pt: QOMify
  wdt_i6300esb: QOMify
  piix4: QOMify
  piix: piix3 QOMify
  pci-assign: QOMify
  Print error when failing to load PCI config data
  Grammar: 'as to'->'as for'
  remove libdecnumber/dpd/decimal128Local.h
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoutil/qemu-sockets: improve ai_flag hints for ipv6 hosts
Wolfgang Bumiller [Thu, 21 May 2015 12:33:29 +0000 (14:33 +0200)]
util/qemu-sockets: improve ai_flag hints for ipv6 hosts

*) Do not use AI_ADDRCONFIG on listening sockets, because this flag
makes it impossible to explicitly listen on '127.0.0.1' if no global
ipv4 address is configured additionally, making this a very
uncomfortable option.
*) Add AI_V4MAPPED hint for connecting sockets.

If your system is globally only connected via ipv6 you often still want
to be able to use '127.0.0.1' and 'localhost' (even if localhost doesn't
also have an ipv6 entry).
For example, PVE - unless explicitly asking for insecure mode - uses
ipv4 loopback addresses with QEMU for live migrations tunneled over SSH.
These fail to start because AI_ADDRCONFIG makes getaddrinfo refuse to
work with '127.0.0.1'.

As for the AI_V4MAPPED flag: glibc uses it by default, and providing
non-0 flags removes it. I think it makes sense to use it.

I also want to point out that glibc explicitly sidesteps POSIX standards
when passing 0 as hints by then assuming both AI_V4MAPPED and
AI_ADDRCONFIG (the latter being a rather weird choice IMO), while
according to POSIX.1-2001 it should be assumed 0. (glibc considers its
choice an improvement.)
Since either AI_CANONNAME or AI_PASSIVE are passed in our cases, glibc's
default flags in turn are disabled again unless explicitly added, which
I do with this patch.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agohw/display/tcx.c: Fix memory leak
Shannon Zhao [Thu, 28 May 2015 11:13:45 +0000 (19:13 +0800)]
hw/display/tcx.c: Fix memory leak

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agohw/display/cg3.c: Fix memory leak
Shannon Zhao [Thu, 28 May 2015 11:13:42 +0000 (19:13 +0800)]
hw/display/cg3.c: Fix memory leak

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoMakefile: Add "make ctags"
Fam Zheng [Fri, 22 May 2015 05:35:08 +0000 (13:35 +0800)]
Makefile: Add "make ctags"

This generates ctags file

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoMakefile: Fix "make cscope TAGS"
Fam Zheng [Fri, 22 May 2015 05:35:07 +0000 (13:35 +0800)]
Makefile: Fix "make cscope TAGS"

Cscope and TAGS files work in source directory rather than the build
directory, also, don't ask users to run configure first, because they
may have an out of tree build.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoqemu-options: Use @itemx where appropriate
Markus Armbruster [Mon, 15 Jun 2015 12:35:59 +0000 (14:35 +0200)]
qemu-options: Use @itemx where appropriate

Doesn't appear to make a difference, but let's use it consistently.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoqemu-options: Improve -global documentation
Markus Armbruster [Mon, 15 Jun 2015 12:35:58 +0000 (14:35 +0200)]
qemu-options: Improve -global documentation

Recent commit 3751d7c "vl: allow full-blown QemuOpts syntax for
-global" overloaded its existing argument syntax DRIVER.PROP=VALUE
with QemuOpts syntax.  Unambigious as long as no DRIVER contains '='.

Its documentation claims that "the two syntaxes are equivalent."
Improve it to spell out how exactly the old syntax gets desugared into
the new one.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agothrottle: Fix typo in the documentation of block_set_io_throttle
Alberto Garcia [Mon, 15 Jun 2015 13:12:52 +0000 (16:12 +0300)]
throttle: Fix typo in the documentation of block_set_io_throttle

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agohw/display/qxl-logger.c: Constify some variable
Frediano Ziglio [Thu, 11 Jun 2015 13:17:56 +0000 (14:17 +0100)]
hw/display/qxl-logger.c: Constify some variable

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoconfigure: rearrange --help and consolidate enable/disable together
Michael Tokarev [Wed, 17 Jun 2015 19:19:26 +0000 (22:19 +0300)]
configure: rearrange --help and consolidate enable/disable together

This is an attempt to rearrange configure --help output a bit
and consolidate pairs of --enable/disable into its own section.

After this, help text is easier to sort, manage and read.
More descriptive text can be added as well, since we now have
more space.

While at it, mention en/dis-able-vte.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agolibcacard: pkgconfig: tidy dependent libs
Michael Tokarev [Wed, 17 Jun 2015 18:02:03 +0000 (21:02 +0300)]
libcacard: pkgconfig: tidy dependent libs

libcacard.pc file lists only one package in Requires
field, which is nss, while glib-2.0 is also a requiriment.
Furthermore, for libraries used internally by the library
(this is the way nss and glib are used by libcacard),
Requires.private shold be used instead of Requires.

Fix both issues.

This does not affect linking of qemu because it links
with objects from libcacard directly.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agovt82c686: QOMify
Gonglei [Wed, 13 May 2015 00:43:27 +0000 (08:43 +0800)]
vt82c686: QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoxen_pt: QOMify
Gonglei [Wed, 13 May 2015 00:43:26 +0000 (08:43 +0800)]
xen_pt: QOMify

Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Tested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agowdt_i6300esb: QOMify
Gonglei [Wed, 13 May 2015 00:43:25 +0000 (08:43 +0800)]
wdt_i6300esb: QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agopiix4: QOMify
Gonglei [Wed, 13 May 2015 00:43:24 +0000 (08:43 +0800)]
piix4: QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agopiix: piix3 QOMify
Gonglei [Wed, 13 May 2015 00:43:23 +0000 (08:43 +0800)]
piix: piix3 QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agopci-assign: QOMify
Gonglei [Wed, 13 May 2015 00:43:22 +0000 (08:43 +0800)]
pci-assign: QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoPrint error when failing to load PCI config data
Dr. David Alan Gilbert [Wed, 3 Jun 2015 16:58:01 +0000 (17:58 +0100)]
Print error when failing to load PCI config data

When loading migration fails due to a disagreement about
PCI config data we don't currently get any errors explaining
that was the cause of the problem or which byte in the config
data was at fault.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoGrammar: 'as to'->'as for'
Dr. David Alan Gilbert [Wed, 3 Jun 2015 18:43:56 +0000 (19:43 +0100)]
Grammar: 'as to'->'as for'

Fixup migrate-incoming text as requested by Eric in:

 http://lists.nongnu.org/archive/html/qemu-devel/2015-03/msg03362.html

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoremove libdecnumber/dpd/decimal128Local.h
Michael Tokarev [Wed, 3 Jun 2015 14:37:27 +0000 (17:37 +0300)]
remove libdecnumber/dpd/decimal128Local.h

Commit 72ac97cdfc added two equivalent versions of decimal128Local.h,
one in libdecnumber/dpd/ and another in include/libdecnumber/dpd/.
Being identical by the code, the two files however differs in the
licensing terms.  The one in libdecnumber/dpd/ (which is being
removed by this patch) is licensed as GPL3.1 (plus gcc runtime
exception), which, as far as I know, is not compatible with GPL-2.
This file is not used (it is included from
include/libdecnumber/dpd/decimal128.h, so version in include/ is
used).

More, the version in include/ can also be removed, since none
of the 3 defines from that file are actually used by the code.
Even more, one of the defines from there, decimal128SetSign,
is redefined (to equivalent value) in libdecnumber/dpd/decimal128.c,
but again, never used.

What a mess...

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoconfigure: append --extra-ldflags to LDFLAGS
Alex Bennée [Wed, 3 Jun 2015 13:22:41 +0000 (14:22 +0100)]
configure: append --extra-ldflags to LDFLAGS

The help text says --extra-ldflags is appended to LDFLAGS so make it so.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/xen-220615-3' into staging
Peter Maydell [Tue, 23 Jun 2015 16:46:20 +0000 (17:46 +0100)]
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-220615-3' into staging

xen-220615, more SOB lines

# gpg: Signature made Tue Jun 23 17:19:08 2015 BST using RSA key ID 70E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"

* remotes/sstabellini/tags/xen-220615-3:
  Revert "xen-hvm: increase maxmem before calling xc_domain_populate_physmap"
  xen/pass-through: constify some static data
  xen/pass-through: log errno values rather than function return ones
  xen/pass-through: ROM BAR handling adjustments
  xen/pass-through: fold host PCI command register writes

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoRevert "xen-hvm: increase maxmem before calling xc_domain_populate_physmap"
Stefano Stabellini [Mon, 22 Jun 2015 13:00:42 +0000 (13:00 +0000)]
Revert "xen-hvm: increase maxmem before calling xc_domain_populate_physmap"

This reverts commit c1d322e6048796296555dd36fdd102d7fa2f50bf.

The original commit fixes a bug when assigning a large number of
devices which require option roms to a guest.  (One known
configuration that needs extra memory is having more than 4 emulated
NICs assigned.  Three or fewer NICs seems to work without this
functionality.)

However, by unilaterally increasing maxmem, it introduces two
problems.

First, now libxl's calculation of the required maxmem during migration
is broken -- any guest which exercised this functionality will fail on
migration.  (Guests which have the default number of devices are not
affected.)

Secondly, it makes it impossible for a higher-level toolstack or
administer to predict how much memory a VM will actually use, making
it much more difficult to effectively use all of the memory on a
machine.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/pass-through: constify some static data
Jan Beulich [Fri, 5 Jun 2015 12:04:55 +0000 (13:04 +0100)]
xen/pass-through: constify some static data

This is done indirectly by adjusting two typedefs and helps emphasizing
that the respective tables aren't supposed to be modified at runtime
(as they may be shared between devices).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/pass-through: log errno values rather than function return ones
Jan Beulich [Fri, 5 Jun 2015 12:04:18 +0000 (13:04 +0100)]
xen/pass-through: log errno values rather than function return ones

Functions setting errno commonly return just -1, which is of no
particular use in the log file.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/pass-through: ROM BAR handling adjustments
Jan Beulich [Mon, 8 Jun 2015 13:11:51 +0000 (14:11 +0100)]
xen/pass-through: ROM BAR handling adjustments

Expecting the ROM BAR to be written with an all ones value when sizing
the region is wrong - the low bit has another meaning (enable/disable)
and bits 1..10 are reserved. The PCI spec also mandates writing all
ones to just the address portion of the register.

Use suitable constants also for initializing the ROM BAR register field
description.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
9 years agoxen/pass-through: fold host PCI command register writes
Jan Beulich [Fri, 15 May 2015 12:46:11 +0000 (13:46 +0100)]
xen/pass-through: fold host PCI command register writes

The code introduced to address XSA-126 allows simplification of other
code in xen_pt_initfn(): All we need to do is update "cmd" suitably,
as it'll be written back to the host register near the end of the
function anyway.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
9 years agoadd pci-bridge-seat
Gerd Hoffmann [Thu, 18 Jun 2015 10:17:29 +0000 (12:17 +0200)]
add pci-bridge-seat

Simplifies multiseat configuration, see
docs/multiseat.txt update for details.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: cleanup and convert TMP ACPI device description to AML API
Igor Mammedov [Tue, 9 Jun 2015 03:31:53 +0000 (05:31 +0200)]
pc: cleanup and convert TMP ACPI device description to AML API

remove some code duplication in acpi-build.c and drop 5
ASL and binary blobs files with TPM ACPI device description,
replacing them with 1 small hunk written in AML API.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoMAINTAINERS: add ACPI entry
Michael S. Tsirkin [Tue, 23 Jun 2015 06:09:34 +0000 (08:09 +0200)]
MAINTAINERS: add ACPI entry

Igor agreed to help review ACPI patches, add an entry to MAINTAINERS
with all ACPI stuff I could think of.
Note: I listed ARM ACPI files here just to make sure we are Cc'd, no
plan to maintain ACPI for ARM through my tree :)

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost: correctly pass error to caller in vhost_dev_enable_notifiers()
Jason Wang [Fri, 29 May 2015 06:13:14 +0000 (14:13 +0800)]
vhost: correctly pass error to caller in vhost_dev_enable_notifiers()

We override the error value r in fail_vq, this will cause the caller
can't detect the failure which may cause the caller may disable the
notifiers twice if vhost is failed to start. Fix this by using another
variable to keep track the return value of set_host_notifier().

Fixes b0b3db79559e57db340b292621c397e7a6cdbdc5 ("vhost-net: cleanup
host notifiers at last step")

Cc: qemu-stable@nongnu.org
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>