Commit graph

41805 commits

Author SHA1 Message Date
Paolo Bonzini 20cbe7a279 qemu-char: convert pipe backend to data-driven creation
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-10-19 10:05:49 +02:00
Paolo Bonzini 38bfb1a63d qemu-char: convert parallel backend to data-driven creation
Conversion to Error * brings better error messages; before:

    qemu-system-x86_64: -chardev id=serial,backend=parallel,path=vl.c: Failed to create chardev

After:

    qemu-system-x86_64: -chardev id=serial,backend=parallel,path=vl.c: not a parallel port: Inappropriate ioctl for device

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-10-19 10:05:35 +02:00
Nutan Shinde 8307c294a3 Remove macros IO_READ_PROTO and IO_WRITE_PROTO
Signed-off-by: Nutan Shinde <nutanshinde1992@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-10-19 09:03:53 +02:00
Peter Maydell 40fe17bea4 hw/ide/ahci.c: Fix shift left into sign bit
Avoid undefined behaviour from shifting left into the sign bit:

hw/ide/ahci.c:551:36: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

(Unfortunately C's promotion rules mean that in the expression
"some_uint8_t_variable << 24" the LHS gets promoted to signed
int before shifting.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
2015-10-18 11:00:40 +01:00
Knut Omang 7df953bd45 intel_iommu: Add support for translation for devices behind bridges
- Use a hash table indexed on bus pointers to store information about buses
  instead of using the bus numbers.
  Bus pointers are stored in a new VTDBus struct together with the vector
  of device address space pointers indexed by devfn.
- The bus number is still used for lookup for selective SID based invalidate,
  in which case the bus number is lazily resolved from the bus hash table and
  cached in a separate index.

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-18 10:05:43 +03:00
Peter Maydell c737c7a608 Block layer patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJWIP1yAAoJEH8JsnLIjy/WvQwQAJ9L9GaOochbHZ9Y2VjsRO07
 oqpd997p42GMGkcpTaEn1iyKgH4M+HN7iMu5FvISW/6HPVCgfRhLsrkOoBVTOhSv
 dM6PFFOxqI6fp/HsHbV1yt3M6hy01WP+kNuRmqPyjV3veEKtHgm7QzFqgA6LTXhT
 z6dLpl5qKxMd5gHzpJm91hql4I9nwVBDT4LKQpA3j0yO9WrZ6uGTHubFJ514raWC
 Kp1xxkuhIbyNdOs3lb7UAbAjCDX9am9+jorT7J1M1e97yZiYtuSbcElVnZDHI8hq
 0e8t/oQ3WdLP35Tg6n6XG37fhb6pMsC03wxWqXygoQbovLFTOHmPW0dSQhlhRcBm
 RZfJ77//QIVtKhrIPRzQMAy+AJUjBvQhcNDMOs1wfKsqEHgAHlFupwRxUK5DMOd7
 GYWnx3gYBGqdof1GXIzGhc024dsOmwlgluSQK4/Q7LGkF3DCeW960yItht41Lee0
 vDWAyLaa+SDujsTNye5LFbYEfScIOZR0bUzyfOHBdSsMiHgPElUV2f+XubAVGynC
 SCe4fQMciohpFPqVnkj8wBHl/AwPKR44sOqqQOEIXZ9pCI5qqebyuP1y/4druRLW
 UdzZ1rpJTExNATNJO8AEjXw1vKAhKZTh0UlQXIhtnYFB7vMMXEeVo1dxBrKffiSV
 m8Mb2lRdEhxApsoUPUxm
 =/ct2
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Fri 16 Oct 2015 14:36:50 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (29 commits)
  blkdebug: Don't confuse image as backing file
  qcow2: Remove forward declaration of QCowAIOCB
  qemu-nbd: always compile in --aio=MODE option
  blockdev: always compile in -drive aio= parsing
  raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
  block: auto-generated node-names
  util - add automated ID generation utility
  blkverify: Fix BDS leak in .bdrv_open error path
  block: Allow bdrv_unref_child(bs, NULL)
  block: Remove bdrv_swap()
  block: Add and use bdrv_replace_in_backing_chain()
  blockjob: Store device name at job creation
  block: Implement bdrv_append() without bdrv_swap()
  block: Introduce parents list
  block-backend: Add blk_set_bs()
  block/io: Make bdrv_requests_pending() public
  block: Split bdrv_move_feature_fields()
  block: Manage backing file references in bdrv_set_backing_hd()
  block: Convert bs->backing_hd to BdrvChild
  block: Remove bdrv_open_image()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-17 22:14:52 +01:00
Peter Maydell 6d57410a79 target-arm queue:
* break TBs after ISB instructions
  * more support code for future implementation of EL2 and 64-bit EL3
  * tell guest if KVM is enabled in SMBIOS version string
  * implement OSLAR/OSLSR system registers
  * provide better help text for Sharp PDA machine names
  * rename imx25_pdk to imx25-pdk (since it has never been released
    with the underscore-version name)
  * fix MMIO writes in zynq_slcr
  * implement MDCR_EL2
  * virt: allow the guest to configure PCI BARs with zero PCI addresses
  * fix breakpoint handling code
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWIQH/AAoJEDwlJe0UNgze6AkQAJ1Q1eCG7ryy5UnQ/xBItfBz
 StUgoWto+clOOaq5ljHJg8CLfNL9NN7eDsTCGDtBiMa0GTW8pjb8cF6EF2fUWz1m
 VuKtx6mmF7+tHf/sBfJovbSYQ3H9e74QioAgIp+XZsjgRNOhQ03HOTWfz1X40rVq
 GNLBEC4XgyKhZvR1YS+AMOJi+uGOwbG9/snhf5N1qKzo+pX+X/qsyeAxUPTjbR1x
 B7obH92zgdpuC8xGM6LdDPrlE85mVslGivsTTPeh9cw771IJZb6b4n5AXMGDZNsD
 pGUMSAqk6Zg8FoEiJIAPpvfhuN7VQ5PRmO4CYJB5ToIZpe0jAIZTBVuUjPbAXd6W
 rXnjuu88GbuiAWv/IeGS9r+R3yoLNH4VFbjeFfe7nKra4EuZ1xE7bsT5hJd/Pt/c
 53dODlnAZ4wVxTLvfOXaOzCfKH5cEn7mAJiLgGPGbhwNdVbUIFthrPLnCOOa0Tpx
 kSTvE1qQ1FsIjEuppyJd9lTdvbo04xrleX3Zfqi124AlH+bRG3dC50jr1F/WG232
 mj2gz/KIaVJJbs56+6YYaX9dyc5+CYzpKjiTobH4pcdB4+1FBb+3Dem7p29Nuagr
 0jnM1LsmFw2GxA3VCGvUOUSQsRaDHErrkRW1cqgGvZTDEg39iuk4ngyKo6lHHAB1
 esl9EkhWsJ7XxHr7JYAW
 =nXtn
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20151016' into staging

target-arm queue:
 * break TBs after ISB instructions
 * more support code for future implementation of EL2 and 64-bit EL3
 * tell guest if KVM is enabled in SMBIOS version string
 * implement OSLAR/OSLSR system registers
 * provide better help text for Sharp PDA machine names
 * rename imx25_pdk to imx25-pdk (since it has never been released
   with the underscore-version name)
 * fix MMIO writes in zynq_slcr
 * implement MDCR_EL2
 * virt: allow the guest to configure PCI BARs with zero PCI addresses
 * fix breakpoint handling code

# gpg: Signature made Fri 16 Oct 2015 14:56:15 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"

* remotes/pmaydell/tags/pull-target-arm-20151016:
  target-arm: Fix CPU breakpoint handling
  target-arm: Fix GDB breakpoint handling
  target-arm: implement arm_debug_target_el()
  hw/arm/virt: Allow zero address for PCI IO space
  target-arm: Add MDCR_EL2
  misc: zynq_slcr: Fix MMIO writes
  arm: imx25-pdk: Fix machine name
  target-arm: Provide model numbers for Sharp PDAs
  target-arm: Implement AArch64 OSLAR/OSLSR_EL1 sysregs
  hw/arm/virt: smbios: inform guest of kvm
  target-arm: Avoid calling arm_el_is_aa64() function for unimplemented EL
  target-arm: Break the TB after ISB to execute self-modified code correctly
  target-arm: Add missing 'static' attribute

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-17 12:31:33 +01:00
Peter Maydell 9c1f5bbc73 cocoa queue:
* fixes for compiler warnings
  * fix mouse cursor flickering
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWIMzqAAoJEDwlJe0UNgzeTM8P/2XTU4q0s2ICXRwvhe+tCd30
 Wq9F02WDyG/SztjIzBTPd+FWw015D30kjs/Eco1fR/fbsV6eSPdflBqcy4FvMuWD
 FlnHA0ZR31O41pj8NQySYrcUc5Q++tCNShBZ8M+lttI1wpSD3RkLcdq5cG3Kmi7/
 QJ/GintsfWc8dEHkLmjdzj4Mrk7Vp+L6+gdftTl40SkQjR8/y8pVwg64GG25UsaA
 E7QekzoIk0g8DDnrX8SLGJ5gc6wCVjkCQocsE93/LNftwrXToTxEJV72Lo8mFKXm
 rz+NJenuQ21+zHILggENnR1LBv/71KvovCAi+FNa7qbKq9nR0O+ESkbgckxa2MaA
 X6yuZ8nQEI3MP6hb/0cpuQ1pXD96BGU46SKzvPtoqHD+QbxLjThchpHuGw6esU+q
 y5AtKKHNcmjcJb2oQlIUsRMRr9couV+ccl5aiZyne7NjLRal5QTSmjVv64C0ehqk
 VFYfa+I0a5cFbVtG7F8tGjqVKDcbVdem+hVNH7jhI46dso0Szrk5RQjoI+G0WTag
 IyvC/oDHZBbSfweJnSWQ55Qn4YYMyxXCkMX0NFdCse+BUMwUjAJ4ULp5DCLBS9MT
 fbx+sFoQ/2WP0fEh7XYw6Ku3yWA1fB+R9NqoPtxn+cdMLx9DB16QJzSPjlfNS/pq
 wOZ42bpTzFwUA/04xRx8
 =mkIq
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-cocoa-20151016' into staging

cocoa queue:
 * fixes for compiler warnings
 * fix mouse cursor flickering

# gpg: Signature made Fri 16 Oct 2015 11:09:46 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"

* remotes/pmaydell/tags/pull-cocoa-20151016:
  ui/cocoa.m: blinky mouse cursor fix
  ui/cocoa.m: addRemovableDevicesMenuItems() warning fix
  ui/cocoa.m: eliminate normalWindow warning

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 19:11:59 +01:00
Peter Maydell 61f7901bb8 QAPI patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWH0puAAoJEDhwtADrkYZT6/cP/3EfS/0TVI6tiU1pz/qm6SMy
 yFYeYw1WIHw9/x7esRMGZ977QfmuL1YhZ0sD4lmpIMcXwuzTd0/tuO0AydH7ffZj
 daL/rKSiQjdPCbebHol6rAFWHOxRBqz1g2jDgIM9FB4dEjqzbUydV7/9Mmo5b44v
 Hss0/neKn6zVHognv4aB/FMmjjsbzqgvHcour7T+rVIF9qial/hA2I6ioM2kCnt4
 jbkLUYYhb/rPNTlxjvT4vNsDfTiHScTeow6gRzd5LL5f1K7nTmRzqalsyZpRgpl+
 mDIrbPExN4O6gDZkKDk3pmwAI+vPTVNP868tSjqNJmUeCdUmT9EQ8LagZCbt0b/e
 aViwkRmuDv+FNPfkmgmhXY0RTaX9QDT3vwWSjOzLGvrFj66UfbepXfBWlOZnl7DQ
 KJU33CnEjkbu/viiCat4HjCGt1kF11s+YPlYWGXgyo1QkF54o8OmKGTjZOaEze+R
 gvIdtbBKYSwnyMbPo26OrwvTDBYfZ+F5j2MCpuDEgwE0CtKbtAOCc87PMRtunDoh
 xloQ3F6fuItC9dPUGDcDxvN9RG3uPNcOUU4aoS0/y7CHlHqlxOJz6AIlm57vO67B
 T/PAd1uW6T/yFJWCub0iAHCkvmui639eIz2VyPfuJJb2YAiWivULsLplOzS1cYE4
 N7J7BPGEATvaCCmmRPjd
 =CoJX
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-10-15' into staging

QAPI patches

# gpg: Signature made Thu 15 Oct 2015 07:40:46 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-qapi-2015-10-15:
  qapi: Track location that created an implicit type
  qapi: Create simple union type member earlier
  qapi: Lazy creation of array types
  qapi: Don't use info as witness of implicit object type
  qapi: Drop redundant args-member-array test
  qapi: Drop redundant flat-union-reverse-define test
  qapi: Drop redundant returns-int test
  qapi: Move empty-enum to compile-time test
  qapi: Drop redundant alternate-good test
  qapi: Prepare for errors during check()
  qapi: Use predicate callback to determine visit filtering
  qapi: Fix regression with '-netdev help'

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 17:13:05 +01:00
Peter Maydell e95bdb4341 migration/next for 20151015
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWH0bXAAoJEPSH7xhYctcjCSYP/jxMPlLpmTWCAJra++buJ77d
 qgU/MWSIf3/9AGYrbz8Y5KUGlfMeB7ZYDICnFH9vF69fnHHwV9kgMqIS8yC8coih
 JeKT4pWQzhleIz5lFmHr7Krt5i5U0Q+SJ0aWQv489UkKEXlIDz2YM23yvaIQjMP4
 Ue6FkiHqoENsUznhnxsCjPMkR3a0zuVRqEseIUD+1lCjnLzgrYQks/lwXNtlX8HF
 7HbQl4MAKi3vRSxy0Tx1cyCOoJ8zdmIhwwlBL3dS8TYDODXFWYuJDWNqvNjoQiit
 lQ2M9TgsvPxjwaoujnP8/dUCcvnVNaDnAPwTxs/FjUCSQ1i4gzBOg3KNExs5Rhn4
 SHWMjgffDMWoHXLSQScz+qpVIPBgK4ETJk4TG0vgi7ZA0/XAE45R8fbMf66vpmhT
 F2s00UwCvZ14E614sdnCrhYPafb2f+HMRrpM6Rr5Yt1Q6EP30ZK1RKE6+SvGN6KJ
 kQFzNvXJn9F7ClXzuVmtBKRw3hgEJWv1wPqf+RXpotTc9IDxCFIk1YwD4FofgkdT
 A8sYcw1S3W0bcYHB/l85AW+1L+Mkwl3qtaOh3Y7orF/NwQfSfVTXxTMCrOqAXhBA
 zg9WsLJlTjVVdGUnEiqPFuDu/LaVUTd8A+qiNsqyiImw/WJnf8qFrmpDafbMq1YH
 zQichbdN7s7GVswYL6qC
 =IZs3
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20151015' into staging

migration/next for 20151015

# gpg: Signature made Thu 15 Oct 2015 07:25:27 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20151015:
  migration: fix deadlock
  migration: announce VM's new home just before VM is runnable
  Migration: Generate the completed event only when we complete

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 15:47:59 +01:00
Sergey Fedorov 5d98bf8f38 target-arm: Fix CPU breakpoint handling
A QEMU breakpoint match is not definitely an architectural breakpoint
match. If an exception is generated unconditionally during translation,
it is hardly possible to ignore it in the debug exception handler.

Generate a call to a helper to check CPU breakpoints and raise an
exception only if any breakpoint matches architecturally.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 14:48:56 +01:00
Sergey Fedorov e63a2d4d9e target-arm: Fix GDB breakpoint handling
GDB breakpoints have higher priority so they have to be checked first.
Should GDB breakpoint match, just return from the debug exception
handler.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 14:48:56 +01:00
Fam Zheng 6b826af7b0 blkdebug: Don't confuse image as backing file
The word "backing file" nowadays refers to the backing_hd in the
external snapshot sense (i.e. bs->backing_hd), instead of the file sense
(bs->file). Correct the comment to use the right term.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:35:48 +02:00
Kevin Wolf e394621fbd qcow2: Remove forward declaration of QCowAIOCB
This struct doesn't exist any more since commit 3fc48d09 in August 2011,
it's about time to remove its forward declaration.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-10-16 15:34:30 +02:00
Stefan Hajnoczi bb628e1af8 qemu-nbd: always compile in --aio=MODE option
The --aio=MODE option enables Linux AIO or Windows overlapped I/O.

The #ifdef CONFIG_LINUX_AIO was a layering violation that also prevented
Windows overlapped I/O from being used.

Now that raw-posix.c prints an error when Linux AIO has not been
compiled in, we can unconditionally compile the option into qemu-nbd.

After this patch qemu-nbd --aio=native works on Windows.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:30 +02:00
Stefan Hajnoczi 04d71322c1 blockdev: always compile in -drive aio= parsing
CONFIG_LINUX_AIO is an implementation detail of raw-posix.c.  Don't
mention CONFIG_LINUX_AIO in blockdev.c.  Let block drivers decide what
to do with BDRV_O_NATIVE_AIO.  They may print an error if it is
unsupported.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:30 +02:00
Stefan Hajnoczi 1501ecc1d8 raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable.
It is confusing when aio=native performance is identical to aio=threads
because the binary was accidentally built without libaio.

Print a deprecation warning if -drive aio=native is used with a binary
that does not support libaio.  There are probably users using aio=native
who would be inconvenienced if QEMU suddenly refused to start their
guests.  In the future this will become an error.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:30 +02:00
Jeff Cody 15489c769b block: auto-generated node-names
If a node-name is not specified, automatically generate the node-name.

Generated node-names will use the "block" sub-system identifier.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:30 +02:00
Jeff Cody a0f1913637 util - add automated ID generation utility
Multiple sub-systems in QEMU may find it useful to generate IDs
for objects that a user may reference via QMP or HMP.  This patch
presents a standardized way to do it, so that automatic ID generation
follows the same rules.

This patch enforces the following rules when generating an ID:

1.) Guarantee no collisions with a user-specified ID
2.) Identify the sub-system the ID belongs to
3.) Guarantee of uniqueness
4.) Spoiling predictability, to avoid creating an assumption
    of object ordering and parsing (i.e., we don't want users to think
    they can guess the next ID based on prior behavior).

The scheme for this is as follows (no spaces):

                # subsys D RR
Reserved char --|    |   | |
Subsystem String ----|   | |
Unique number (64-bit) --| |
Two-digit random number ---|

For example, a generated node-name for the block sub-system may look
like this:

    #block076

The caller of id_generate() is responsible for freeing the generated
node name string with g_free().

Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:30 +02:00
Kevin Wolf 7e39d3a2dd blkverify: Fix BDS leak in .bdrv_open error path
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
2015-10-16 15:34:30 +02:00
Kevin Wolf 779020cbdc block: Allow bdrv_unref_child(bs, NULL)
bdrv_unref() can be called with a NULL argument and doesn't do anything
then. Make bdrv_unref_child() consistent with it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
2015-10-16 15:34:30 +02:00
Kevin Wolf 8e419aefa0 block: Remove bdrv_swap()
bdrv_swap() is unused now. Remove it and all functions that have
no other users than bdrv_swap(). In particular, this removes the
.bdrv_rebind callbacks from block drivers.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:30 +02:00
Kevin Wolf 3f09bfbc7b block: Add and use bdrv_replace_in_backing_chain()
This cleans up the mess we left behind in the mirror code after the
previous patch. Instead of using bdrv_swap(), just change pointers.

The interface change of the mirror job that callers must consider is
that after job completion, their local BDS pointers still point to the
same node now. qemu-img must change its code accordingly (which makes it
easier to understand); the other callers stays unchanged because after
completion they don't do anything with the BDS, but just with the job,
and the job is still owned by the source BDS.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:30 +02:00
Kevin Wolf 8ccb9569a9 blockjob: Store device name at job creation
Some block jobs change the block device graph on completion. This means
that the device that owns the job and originally was addressed with its
device name may no longer be what the corresponding BlockBackend points
to.

Previously, the effects of bdrv_swap() ensured that the job was (at
least partially) transferred to the target image. Events that contain
the device name could still use bdrv_get_device_name(job->bs) and get
the same result.

After removing bdrv_swap(), this won't work any more. Instead, save the
device name at job creation and use that copy for QMP events and
anything else identifying the job.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:30 +02:00
Kevin Wolf dd62f1ca43 block: Implement bdrv_append() without bdrv_swap()
Remember all parent nodes and just change the pointers there instead of
swapping the contents of the BlockDriverState.

Handling of snapshot=on must be moved further down in bdrv_open()
because *pbs (which is the bs pointer in the BlockBackend) must already
be set before bdrv_append() is called. Otherwise bdrv_append() changes
the BB's pointer to the temporary snapshot, but bdrv_open() overwrites
it with the read-only original image.

We also need to be careful to update callers as the interface changes
(becomes less insane): Previously, the meaning of the two parameters was
inverted when bdrv_append() returns. Now any BDS pointers keep pointing
to the same node.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:30 +02:00
Kevin Wolf d42a8a935b block: Introduce parents list
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf a2d6190048 block-backend: Add blk_set_bs()
It allows changing the BlockDriverState that a BlockBackend points to.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 439db28cf9 block/io: Make bdrv_requests_pending() public
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 063dd40e11 block: Split bdrv_move_feature_fields()
After bdrv_swap(), some fields must be moved back to their original BDS
to compensate for the effects that a swap of the contents of the objects
has while keeping the old addresses. Other fields must be moved back
because they should logically be moved and must stay on top

When replacing bdrv_swap() with operations changing the pointers in the
parents, we only need the latter and must avoid swapping the former.
Split the function accordingly.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 5db15a5769 block: Manage backing file references in bdrv_set_backing_hd()
This simplifies the code somewhat, especially when dropping whole
backing file subchains.

The exception is the mirroring code that does adventurous things with
bdrv_swap() and in order to keep it working, I had to duplicate most of
bdrv_set_backing_hd() locally. We'll get rid again of this ugliness
shortly.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 760e006384 block: Convert bs->backing_hd to BdrvChild
This is the final step in converting all of the BlockDriverState
pointers that block drivers use to BdrvChild.

After this patch, bs->children contains the full list of child nodes
that are referenced by a given BDS, and these children are only
referenced through BdrvChild, so that updating the pointer in there is
enough for changing edges in the graph.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf b26e90f56a block: Remove bdrv_open_image()
It is unused now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 9a4f4c3156 block: Convert bs->file to BdrvChild
This patch removes the temporary duplication between bs->file and
bs->file_child by converting everything to BdrvChild.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 0bd6e91a7e quorum: Convert to BdrvChild
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 3e586be0b2 blkverify: Convert s->test_file to BdrvChild
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 24bc15d1f6 vmdk: Use BdrvChild instead of BDS for references to extents
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Kevin Wolf 1fdd693308 block: Introduce BDS.file_child
Store the BdrvChild for bs->file. At this point, bs->file_child->bs just
duplicates the bs->file pointer. Later, it will completely replace it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-16 15:34:29 +02:00
Jeff Cody 68e517a8d7 block: qemu-iotests - fix vmdk test 059.out
In commit fe646693ac, the option
printout format changed.

This updates the VMDK test 059.out to the correct output.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:29 +02:00
Kashyap Chamarthy a910523a24 qmp-commands.hx: Update the supported 'transaction' operations
Although the canonical source of reference for QMP commands is
qapi-schema.json, for consistency's sake, update qmp-commands.hx to
state the list of supported transactionable operations, namely:

    drive-backup
    blockdev-backup
    blockdev-snapshot-internal-sync
    abort
    block-dirty-bitmap-add
    block-dirty-bitmap-clear

Also update the possible values for the "type" action array.

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:29 +02:00
Alberto Garcia 317438e6db throttle: test that snapshots move the throttling configuration
If a snapshot is performed on a device that has I/O limits they should
be moved to the target image (the new active layer).

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:29 +02:00
Alberto Garcia efd0fbbcf5 iotests: disable core dumps in test 061
Commit 934659c460 disabled the supression of segmentation faults in
bash tests. The new output of test 061, however, assumes that a core
dump will be produced if a program aborts. This is not necessarily the
case because core dumps can be disabled using ulimit.

Since we cannot guarantee that abort() will produce a core dump, we
should use SIGKILL instead (that does not produce any) and update the
test output accordingly.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:29 +02:00
Sergey Fedorov 81669b8b81 target-arm: implement arm_debug_target_el()
Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
description of routing debug exceptions.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 13:34:02 +01:00
Alexander Gordeev 74de8c3568 hw/arm/virt: Allow zero address for PCI IO space
Currently PCI IO address 0 is not allowed even though
the IO space starts from 0. This update makes  PCI IO
address 0 usable.

CC: Peter Maydell <peter.maydell@linaro.org>
CC: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 13:34:02 +01:00
Sergey Fedorov 14cc7b5437 target-arm: Add MDCR_EL2
Add the MDCR_EL2 register. We don't implement any of
the debug-related traps this register controls yet, so
currently it simply reads back as written.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-id: 1444383794-16767-1-git-send-email-serge.fdrv@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: tweaked commit message; moved non-dummy definition from
debug_cp_reginfo to el2_cp_reginfo.]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 13:13:48 +01:00
Peter Crosthwaite c209b05372 misc: zynq_slcr: Fix MMIO writes
The /4 for offset calculation in MMIO writes was happening twice giving
wrong write offsets. Fix.

While touching the code, change the if-else to be a short returning if
and convert the debug message to a GUEST_ERROR, which is more accurate
for this condition.

Cc: qemu-stable@nongnu.org
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 13:13:47 +01:00
Peter Crosthwaite b64d64de1a arm: imx25-pdk: Fix machine name
ARM uses dashes instead of underscores for machine names. Fix imx25_pdk
which has not seen a release yet (so there is no legacy yet).

Cc: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Message-id: 1444445785-3648-1-git-send-email-crosthwaite.peter@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: Added change to tests/ds1338-test.c to use new machine name]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 11:14:53 +01:00
Ryo ONODERA ad1e8db894 target-arm: Provide model numbers for Sharp PDAs
* For Collie, Akita, Spitz, Borzoi, Terrier and Tosa PDAs, provide
  model numbers and manufacturer (Sharp) information.

Signed-off-by: Ryo ONODERA <ryo_on@yk.rim.or.jp>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 11:14:53 +01:00
Davorin Mista 1424ca8d43 target-arm: Implement AArch64 OSLAR/OSLSR_EL1 sysregs
Added oslar_write function to OSLAR_EL1 sysreg, using a status variable
in ARMCPUState.cp15 struct (oslsr_el1). This variable is also linked
to the newly added read-only OSLSR_EL1 register.

Linux reads from this register during its suspend/resume procedure.

Signed-off-by: Davorin Mista <davorin.mista@aggios.com>
[PMM: folded a long line and tweaked a comment]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 11:14:53 +01:00
Andrew Jones bab27ea2e3 hw/arm/virt: smbios: inform guest of kvm
ARM/AArch64 KVM guests don't have any way to identify
themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
could discuss all sorts of reasons why guests shouldn't need to
know that, but then there's always some case where it'd be
nice... Anyway, now that we have SMBIOS tables in ARM guests,
it's easy for the guest to know that it's a QEMU instance. This
patch takes that one step further, also identifying KVM, when
appropriate. Again, we could debate why generally nothing
should care whether it's of type QEMU or QEMU/KVM, but again,
sometimes it's nice to know...

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Wei Huang <wei@redhat.com>
Message-id: 1443017892-15567-1-git-send-email-drjones@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 11:14:53 +01:00
Sergey Sorokin 2cde031f5a target-arm: Avoid calling arm_el_is_aa64() function for unimplemented EL
It is incorrect to call arm_el_is_aa64() function for unimplemented EL.
This patch fixes several attempts to do so.

Signed-off-by: Sergey Sorokin <afarallax@yandex.ru>
[PMM: Reworked several of the comments to be more verbose.]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16 11:14:52 +01:00