Commit graph

40226 commits

Author SHA1 Message Date
Peter Maydell dcc8a3ab63 Block layer patches for 2.4.0-rc2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVrQpYAAoJEH8JsnLIjy/WWWQQALQhq104YfaesafxHvr9XGsp
 LxQXyPue5vCapaUIVxCdopfxEV1mZnWnNoWt++d8dgITBq36hhtvBJEjs52awvP1
 uoNv3l4s2QsoAvJDBYHS1KpUs/oz410sJltqAa2rl9sy+uEVp6PtP7/ueWQdBfqg
 NjF9meK1MwR1W+iODmTagFc5iYqtiar2rcgOw9UxNokegvefJDiKbM4VSY18sn8o
 2yCagM2iWFODaf5U/BE7BVqEduCcfUR+nbM3qFRawm8ZxaTMb8+NeNHugL/xPabF
 ji8bMHgf2AjaxtYua0GQ4XDmKhZ5pm298wiLwO9fLW3Am01y9yuf+CpIJ7bCknpZ
 sH0YA1kF1ISffnL92zx3VZ0bvSDqIds39cBzCotuiWys/4UHSTksOC0Am8HUEBch
 D8nDnvkCPTObIf0tn9Ylepp6FnedTOH3qkE4Z+OijBWWirxcconru13H/mmazhRf
 t2kTP5zPStOC8mkMZwhB7Xycly4SmgQkHutn6JO29jnljlALDnEdbSxqYw2ujHDo
 ThySL9SKUBEu+KQYmUwwJQ/gfC56tkcyMBDnNFV5RtWssIualZuwx+My3YF0caJ7
 S1eNrMeng+imZimqR51vvbc+hHja17kfGz/jlWnOZgTvrV5fg9eCObrwOfTyOe/R
 GuFhgelfhXMoXNW5e+VI
 =cYpR
 -----END PGP SIGNATURE-----

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

Block layer patches for 2.4.0-rc2

# gpg: Signature made Mon Jul 20 15:48:56 2015 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  crypto: Fix aes_decrypt_wrapper()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-20 16:01:31 +01:00
Peter Maydell f73ca73634 virtio, vhost, pc fixes for 2.4
The only notable thing here is vhost-user multiqueue
 revert. We'll work on making it stable in 2.5,
 reverting now means we won't have to maintain
 bug for bug compability forever.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVrNpQAAoJECgfDbjSjVRp5EwH/jh1iiTG4iXDbSnxPJ/FWwJt
 9hgd+GeNT9K5Dc1A+X6d80OdeaH5bjFNqfUXSrIsLKDWYtj01AU2+dgGS3j0/Uv1
 FRrrWsnN5idcYuqlznk7X9Eu2mb7npGZnjF4PmDU5Hq5eRj/mgJbWvKYqMolLYtv
 cuSHxhbA3dlUTIjfXccMF94kvFQUpfs2A3ip9osmCKE15fDS2zXKT3mIj/itnj3o
 DFRwkmiKYJwwi9cl7F2svzYnqp00mAMaVJ3UrzYFZhPylzWQfIJCgu47PMfGsJAx
 kPvY+IA3WEk0sMTVRNSWj61QNax4G/oM8d4ipnRpt3k0UzWg1XNTZkRIAg40j8A=
 =SW7Q
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

virtio, vhost, pc fixes for 2.4

The only notable thing here is vhost-user multiqueue
revert. We'll work on making it stable in 2.5,
reverting now means we won't have to maintain
bug for bug compability forever.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Mon Jul 20 12:24:00 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:
  virtio-net: remove virtio queues if the guest doesn't support multiqueue
  virtio-net: Flush incoming queues when DRIVER_OK is being set
  pci_add_capability: remove duplicate comments
  virtio-net: unbreak any layout
  Revert "vhost-user: add multi queue support"
  ich9: fix skipped vmstate_memhp_state subsection

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-20 13:25:28 +01:00
Kevin Wolf bd09594603 crypto: Fix aes_decrypt_wrapper()
Commit d3462e3 broke qcow2's encryption functionality by using encrypt
instead of decrypt in the wrapper function it introduces. This was found
by qemu-iotests case 134.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
2015-07-20 13:35:45 +02:00
Wen Congyang f9d6dbf0bf virtio-net: remove virtio queues if the guest doesn't support multiqueue
commit da51a335 adds all queues in .realize(). But if the
guest doesn't support multiqueue, we forget to remove them. And
we cannot handle the ctrl vq corretly. The guest will hang.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
2015-07-20 14:19:42 +03:00
Fam Zheng 38705bb57b virtio-net: Flush incoming queues when DRIVER_OK is being set
This patch fixes network hang after "stop" then "cont", while network
packets keep arriving.

Tested both manually (tap, host pinging guest) and with Jason's qtest
series (plus his "[PATCH 2.4] socket: pass correct size in
net_socket_send()" fix).

As virtio_net_set_status is called when guest driver is setting status
byte and when vm state is changing, it is a good opportunity to flush
queued packets.

This is necessary because during vm stop the backend (e.g. tap) would
stop rx processing after .can_receive returns false, until the queue is
explicitly flushed or purged.

The other interesting condition in .can_receive, virtio_queue_ready(),
is handled by virtio_net_handle_rx() when guest kicks; the 3rd condition
is invalid queue index which doesn't need flushing.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-07-20 14:19:41 +03:00
Chen Hanxiao 9a2a66238e pci_add_capability: remove duplicate comments
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-07-20 14:19:41 +03:00
Jason Wang feb93f3617 virtio-net: unbreak any layout
Commit 032a74a1c0
("virtio-net: byteswap virtio-net header") breaks any layout by
requiring out_sg[0].iov_len >= n->guest_hdr_len. Fixing this by
copying header to temporary buffer if swap is needed, and then use
this buffer as part of out_sg.

Fixes 032a74a1c0
("virtio-net: byteswap virtio-net header")
Cc: qemu-stable@nongnu.org
Cc: clg@fr.ibm.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>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-07-20 14:19:41 +03:00
Michael S. Tsirkin d345ed2da3 Revert "vhost-user: add multi queue support"
This reverts commit 830d70db69.

The interface isn't fully backwards-compatible, which is bad.
Let's redo this properly after 2.4.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-07-20 14:19:40 +03:00
Paulo Alcantara 75d663611e ich9: fix skipped vmstate_memhp_state subsection
By declaring another .subsections array for vmstate_tco_io_state made
vmstate_memhp_state not registered anymore. There must be only one
.subsections array for all subsections.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>
Reported-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
2015-07-20 14:19:40 +03:00
Peter Maydell 71358470ee Fire timer only when required. Brings down wakeups by a big number.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVqQYUAAoJEB6aO1+FQIO2i5oP/22IEve0upRIprVvDKmBCh91
 ablALBirktxvfriSmKOY+d+v5Zgo9R96rp4atVeSDerzV9O9Ms41NWR0olIGU98t
 9ZMY8P4MTbGn3nBFn4mSIEFbVv3QFoaJwiah01caTJpEvK9wvlj30nuXEERHgcps
 2g+ncZWH8lWf/f7J3myS6rhsYfgH4UB6HxwOaAdiZhpFn+5ygViOQnaL5KJYcTcE
 QKpT8XA9jfQOQlegmHNqowmFqoTrx8DxiCklR/ntRFe51GfKDgZpBVJV3E9Z2+oa
 RfnIfrKZftjdzk0rVanhtnis5lCP5xb3gXELhDWoE4G8IQoXBQjrVc+mV2OWfGR0
 s6xdtL+w9d77kAO7/M+jeA6hR2tKJyiJ9auDW6EalMDKpsjBJMvPErAGmB7WIfib
 9fxG8xGUdObrxhnph4GUSErHOB6juFFITtAEeSVqo/JrhBO2+TVnYWnUE5JzRcfj
 u0u2KmT9OJTLHORkBoPlWHVPPSfSRgp8LFheyNMGXjRASocJfDZQZNgAhNpoar5N
 4HlSEgYvF9Ub3SRGPnE08JNdKSMO6plBNYhzIyivFuGKAGx5tMGzgrkPbsJ8ww/w
 9GgFAxmVZsiwpOhPw7HTtGt0hWHFJzqW+iK8fzXIscP/TXsSnrkTV0Jd3UKpIqem
 CvSiMklKIBCoKlHZhS33
 =zkW+
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/amit-virtio-rng/tags/vrng-2.4' into staging

Fire timer only when required.  Brings down wakeups by a big number.

# gpg: Signature made Fri Jul 17 14:41:40 2015 BST using RSA key ID 854083B6
# gpg: Good signature from "Amit Shah <amit@amitshah.net>"
# gpg:                 aka "Amit Shah <amit@kernel.org>"
# gpg:                 aka "Amit Shah <amitshah@gmx.net>"

* remotes/amit-virtio-rng/tags/vrng-2.4:
  virtio-rng: trigger timer only when guest requests for entropy

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-17 15:22:45 +01:00
Pankaj Gupta 621a20e081 virtio-rng: trigger timer only when guest requests for entropy
This patch triggers timer only when guest requests for
entropy. As soon as first request from guest for entropy
comes we set the timer. Timer bumps up the quota value
when it gets triggered.

Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Message-Id: <1436962608-9961-2-git-send-email-pagupta@redhat.com>

[Re-worded patch subject, removed extra whitespace -- Amit]

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-07-17 19:05:16 +05:30
Peter Maydell 5b5e8cdd7d usb: fixes for 2.4 (ccid, xhci and usb-host)
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVqOVGAAoJEEy22O7T6HE4AF0QAKD6X/Moe1KLFPjsStRlgSHC
 hjZl2q3+Yf8DZNNGNDwVxlnQLpv8bUukQF+AiMI2e7dZUBmepmIoE+2R9tcZQe5v
 GAJnT/7FfRWIOVEoI7gV9EaTY5RnNDvbj9KqBL8SjJSrpI7reMtzKlGH9PMO7i3Q
 K+4RDugQGrFgP+FJguJoidSTR2DWyVLflRMBd+P6UJmmqZN/nyiiGz0kRvKGg3QU
 EoyrcSRAUMyafbCnNwkRyEQqS4DPOQnaUVJAhGiDMxpvvzVDMc/qDiUw4UEkEMM3
 llGbqd9LIMfrcY/fdiBfCP/XtWkdHKeftTNsV78XFeWQFdNUa4eNlhrzEOOwW5Iy
 8Tmqkw+FuYCWMQbOP8I50zilRBLJJNhKyU8Ic3rWfBCtjY2RtTHLUDyEXaoYbibo
 n7wpcu/Y/zv6jcQLBRga3Pciaf21M4YHhGXDVMbiBn5oN+XuQRTfdkkkXwCaXP+F
 zHvopHJP2ZpEd3Rgcr6SkQ3xuwXCxXdwpcxE2pnP3fKZssx2veeaf3FpeC/CO7V2
 nCl1XhCATXbQCH9RzjnONouRyWEFgDkEDPtQkfeFNQSFzn6iMgKt4YcKFVeYeEBA
 yF6jWabkjkpHL9wYX/Z5HG8PJxBF8xmb4M9u8O9d2LP0VsaY2JpEsphpT5f4VceS
 L6NKatC/5DplDUFYuOT7
 =K2Ec
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20150717-1' into staging

usb: fixes for 2.4 (ccid, xhci and usb-host)

# gpg: Signature made Fri Jul 17 12:21:42 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-usb-20150717-1:
  Revert "xhci: set timer to retry xfers"
  usb-ccid: add missing wakeup calls
  usb-ccid: fix 61b4887b41
  Re-attach usb device to kernel while usb_host_open fails

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-17 12:39:12 +01:00
Gerd Hoffmann 92fdfa4bef Revert "xhci: set timer to retry xfers"
This reverts commit 4e8cfbe114.

We should not poll via timer, and with ccid being fixed
to properly notify us about pending transfers we don't have to.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-17 13:20:53 +02:00
Gerd Hoffmann 86d7e214c2 usb-ccid: add missing wakeup calls
Properly notify the host adapter that we have
data pending, so it doesn't has to poll us.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-17 13:20:53 +02:00
Gerd Hoffmann cfda2cef3d usb-ccid: fix 61b4887b41
QOMification dropped the parent device lookup, fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-17 13:19:59 +02:00
Peter Maydell fd1a9ef9c2 input: fixes for 2.4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVqKR9AAoJEEy22O7T6HE44kcP/3IifsLCdCm4yODTcVKy7Dae
 y+qsb4eBjuv5HZKl7TX4Hk/gPyrqCOgSK+3ktV9GevRFpagdlW3/Is5TJzJoCY0+
 JVFglihBeji3OxizVHpqLnxRXRlj4gLgZ8X5pa0dMSJsVlHZp1LgVJspqRJrWUz2
 /x7DNB9eEAHFB+ab6rdgqwyQYJ0FtoTCTrDOilt+0E4Am9FyMfSNAM6B/NGWgqey
 TC4DWAxsTdYECFGeSDraw8OG5ot6/rXUF537N+homJNL+9rzRoPwrgyEoLXewASG
 44yVxXtpiMAA+iZOp3/A4xWWXlivQnu0pGBvW2n0iiAisA6gc+U+rMOEaqFeiqk3
 BCRAIH5vcrbSPN6WEOVao8XMAtJhmM9u7QgSCZ3i+/lP+Sh92WvIO0b0Ot1CICT4
 g0XPt3/CxyUJhV979LxWNUdK5nyhdu5p7gPrfq4bRSNQsYHyIMG2RbrmtIAJN0Fq
 O4ZkNeDmpmMS7otCiJPWxQ1IrR7d+5wGQFaekSvqbQ00BG8VS5q89AG0sOdWboz4
 aegoN6HgbuLkS7RJRBqD3DkskG4zAtenodFkEQjDX3TRPJsf+gqkgLUmQs4yz8Re
 wxCYMG4ZtYPIHIscnKgEVcVAD+VGNJ+EsOc+bZoic2fzn0/QKSKbCqFZtkx418Ov
 dqXneY5M9mRCWbcPtU5S
 =+mFI
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150717-1' into staging

input: fixes for 2.4

# gpg: Signature made Fri Jul 17 07:45:17 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-input-20150717-1:
  hid: clarify hid_keyboard_process_keycode
  virtio-input: move sys/ioctl.h include
  virtio-input: fix segfault in virtio_input_hid_properties

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-17 10:52:12 +01:00
Paolo Bonzini 562f93754b hid: clarify hid_keyboard_process_keycode
Coverity thinks the fallthroughs are smelly.  They are correct, but
everything else in this function is like "wut?".

Refer explicitly to bits 8 and 9 of hs->kbd.modifiers instead of
shifting right first and using (1 << 7).  Document what the scancode
is when hid_code is 0xe0.  And add plenty of comments.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-17 08:44:41 +02:00
Peter Maydell b4329bf41c Update version for v2.4.0-rc1 release
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-16 20:32:20 +01:00
Peter Maydell b92304ee81 * MIPS-KVM fixes.
* Coverity fixes.
 * Nettle function prototype fixes.
 * Memory API refcount fix.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABCAAGBQJVp/F3AAoJEL/70l94x66DLqgH/0MMGJfs5M16chK4nA/oxYH8
 GtZgA7t0j8zKrjZ8StllGnpLXai2/+hp7qnlKBeAQ5U6qVuD2ETA9BA/5ppWgK2n
 HOjQUpHKOveF6bJxnQelIKHMCyZjjQeIcn4HzCzItfEY09OG1p+V7IR3z5OQvhFB
 iMx6/dLAaTt7m7fXCWRZ8C6PV8tmmX9jFLjQZAqG6dOFlUqbTw4po7S3gcvh9elD
 0vv47mkATWWwtVVWtopxk5+PYNcShI6JjhL1dhlPhUDZy+SIsbmaXHYMAP45gEen
 jLrmgE+RxE9c0siPrrBSNPInwHaADYqCm1q4sCbN0wpcIXoNgFqer543BTc2Q80=
 =dYcd
 -----END PGP SIGNATURE-----

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

* MIPS-KVM fixes.
* Coverity fixes.
* Nettle function prototype fixes.
* Memory API refcount fix.

# gpg: Signature made Thu Jul 16 19:01:27 2015 BST using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream:
  crypto: avoid undefined behavior in nettle calls
  crypto: fix build with nettle >= 3.0.0
  memory: fix refcount leak in memory_region_present
  RDMA: Fix error exits
  arm/xlnx-zynqmp: fix memory leak
  ppc/spapr_drc: fix memory leak
  mips/kvm: Sign extend registers written to KVM
  mips/kvm: Fix Big endian 32-bit register access

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-16 19:18:15 +01:00
Radim Krčmář d3462e378f crypto: avoid undefined behavior in nettle calls
Calling a function pointer that was cast from an incompatible function
results in undefined behavior.  'void *' isn't compatible with 'struct
XXX *', so we can't cast to nettle_cipher_func, but have to provide a
wrapper.  (Conversion from 'void *' to 'struct XXX *' might require
computation, which won't be done if we drop argument's true type, and
pointers can have different sizes so passing arguments on stack would
bug.)

Having two different prototypes based on nettle version doesn't make
this solution any nicer.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Message-Id: <1437062641-12684-3-git-send-email-rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:21 +02:00
Radim Krčmář becaeb726a crypto: fix build with nettle >= 3.0.0
In nettle 3, cbc_encrypt() accepts 'nettle_cipher_func' instead of
'nettle_crypt_func' and these two differ in 'const' qualifier of the
first argument.  The build fails with:

  In file included from crypto/cipher.c:71:0:
  ./crypto/cipher-nettle.c: In function ‘qcrypto_cipher_encrypt’:
  ./crypto/cipher-nettle.c:154:38: error: passing argument 2 of
  ‘nettle_cbc_encrypt’ from incompatible pointer type
           cbc_encrypt(ctx->ctx_encrypt, ctx->alg_encrypt,
                                               ^
  In file included from ./crypto/cipher-nettle.c:24:0,
                   from crypto/cipher.c:71:
  /usr/include/nettle/cbc.h:48:1: note: expected
  ‘void (*)(const void *, size_t, uint8_t *, const uint8_t *)
  but argument is of type
  ‘void (*)(      void *, size_t, uint8_t *, const uint8_t *)

To allow both versions, we switch to the new definition and #if typedef
it for old versions.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Message-Id: <1436548682-9315-2-git-send-email-rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:20 +02:00
Paolo Bonzini c6742b14fe memory: fix refcount leak in memory_region_present
memory_region_present() leaks a reference to a MemoryRegion in the
case "mr == container".  While fixing it, avoid reference counting
altogether for memory_region_present(), by using RCU only.

The return value could in principle be already invalid immediately
after memory_region_present returns, but presumably the caller knows
that and it's using memory_region_present to probe for devices that
are unpluggable, or something like that.  The RCU critical section
is needed anyway, because it protects as->current_map.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:20 +02:00
Dr. David Alan Gilbert 24b41d66c8 RDMA: Fix error exits
The error checks I added used 'break' after the error, but I'm
in a switch inside the while loop, so they need to be 'goto out'.

Spotted by coverity; entries 1311368 and 1311369

Fixes: afcddefd

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <1436555332-19076-1-git-send-email-dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:20 +02:00
Gonglei 5348c62cab arm/xlnx-zynqmp: fix memory leak
fix CID 1311372.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <1436489490-236-4-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:20 +02:00
Gonglei 586d2142a9 ppc/spapr_drc: fix memory leak
fix CID 1311373.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <1436489490-236-3-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:20 +02:00
James Hogan 02dae26ac4 mips/kvm: Sign extend registers written to KVM
In case we're running on a 64-bit host, be sure to sign extend the
general purpose registers and hi/lo/pc before writing them to KVM, so as
to take advantage of MIPS32/MIPS64 compatibility.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: kvm@vger.kernel.org
Cc: qemu-stable@nongnu.org
Message-Id: <1429871214-23514-3-git-send-email-james.hogan@imgtec.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:20 +02:00
James Hogan f8b3e48b2d mips/kvm: Fix Big endian 32-bit register access
Fix access to 32-bit registers on big endian targets. The pointer passed
to the kernel must be for the actual 32-bit value, not a temporary
64-bit value, otherwise on big endian systems the kernel will only
interpret the upper half.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: kvm@vger.kernel.org
Cc: qemu-stable@nongnu.org
Message-Id: <1429871214-23514-2-git-send-email-james.hogan@imgtec.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:20 +02:00
Peter Maydell 67ff64e082 qxl: allow to specify head limit to qxl driver
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVp85cAAoJEEy22O7T6HE4c3UP/0D60uiY5IypOcyVMvXPsOsB
 0ry2Bq/f6IE0EmD1xLvyedRNjaVeOE7GHRycZBkkzk1LEmeYCov3qXAsYCC0U6d8
 CYYSMpm0kyHpnaTzHVuK/w+FX8M1QiYJKLgs67foBNn/JzIto/X4/VJAnT4MaaaQ
 5Qaml8LfD4WFNrsZ1XwMtpYwZnd75OS1BZ/D98o0TGBHUDyPvJRP8bAQgdvKMP5S
 yHnD1O2eyPVDhIpENh74Id7j2PYd/Q8xmnfFYqIWLZBqks+EbAp7813UXQ54H7XL
 81JHXSS/KGMLmQOEUreWuyxivY8hbzXWR1HWzBk3xqcDa6vsoTFBJUgUTEq4nwXw
 jKtqw5cInNgQrPVq0ctuuENxv8YGgb3wHpZiTzNyLeNySljk4toQQROV1gG7KNOA
 xrEE3UYvEL4+Cu8+fL7Vz9ZXefxhdqQHBo7yNgNidw2knQpmehxjX8GeRlUc2Vbv
 K3yyx8HVblFfbYOik3qwo3DKKJgJUI/yq0gnhBxl79ExZtQmt+RwrjYp06+PpQtm
 7XsJH6yBEQTOaZNIUIFf8b4NzuRoO3t5dGY1GB1Gir7s9cdDVj20AyYFLUYsHUUy
 r5L60Fd1deYi6bkZaVLg48w080hdxWL4zioQiTQIRgRPh9KGmrgZZRZsBuE+FkYu
 VqHaHU8EPC6D9B3rbjYy
 =QNro
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20150716-1' into staging

qxl: allow to specify head limit to qxl driver

# gpg: Signature made Thu Jul 16 16:31:40 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-20150716-1:
  qxl: allow to specify head limit to qxl driver

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-16 16:55:00 +01:00
Lin Ma 6110ce59af Re-attach usb device to kernel while usb_host_open fails
Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-16 17:39:13 +02:00
Gerd Hoffmann e2f6bac301 virtio-input: move sys/ioctl.h include
Drop from include/standard-headers/linux/input.h
Add to hw/input/virtio-input-host.c instead.

That allows to build virtio-input (except pass-through) on windows.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-16 17:34:41 +02:00
Lin Ma 2a19b229f6 virtio-input: fix segfault in virtio_input_hid_properties
commit 5cce173 introduced virtio-input segfault, This patch fixes it.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-16 17:34:41 +02:00
Frediano Ziglio 567161fdd4 qxl: allow to specify head limit to qxl driver
This patch allow to limit number of heads using qxl driver. By default
qxl driver is not limited on any kind on head use so can decide to use
as much heads.

libvirt has this as a video card parameter (actually set to 1 but not
used). This parameter will allow to limit setting a use can do (which
could be confusing).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-16 17:31:05 +02:00
Peter Maydell 2d5ee9e7a7 MIPS patches 2015-07-16
Changes:
 * bug fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJVp2WoAAoJEFIRjjwLKdprb6IH/2LjKE10eFTn6M08glegVKMc
 8yt/Ba212lKnAMnp57L2iqL3zjTHgYofKc0iThqopBWpiS6+2UhlXSukExKcNcZ2
 8UgvR89zvEqadKchv64EXcKh+K8/ylMPPDkuf9UZJOGt+YQncdvGPNw/vqaCeEqj
 tUQQNyDITs/+JCaMksNtIURgrkOqCprOvI4/wYxvZUJjecSrN9kpmv1NI3Cmqwlw
 SlQ+HjecHNEms50C6T12OhQprNuuwEb+nOysWoJjldkWeayAuTmCg7g89flF9wu9
 dE0xZN3XtAVxmW9stTqHp0IwO3mwFAw13CZxiZ7dnT0rx5KGaq9nj53qlIqG9L0=
 =dHki
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150716' into staging

MIPS patches 2015-07-16

Changes:
* bug fixes

# gpg: Signature made Thu Jul 16 09:04:56 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-20150716:
  target-mips: fix page fault address for LWL/LWR/LDL/LDR
  linux-user: Fix MIPS N64 trap and break instruction bug
  target-mips: fix resource leak reported by Coverity
  target-mips: fix logically dead code reported by Coverity
  target-mips: correct DERET instruction
  target-mips: fix ASID synchronisation for MIPS MT
  disas/mips: fix disassembling R6 instructions
  target-mips: fix to clear MSACSR.Cause
  target-mips: fix MIPS64R6-generic configuration

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-16 10:40:23 +01:00
Peter Maydell 3749c11a72 X86 queue, 2015-07-15
Two bug fixes:
 * Memory leak due to extra g_strdup() when registering X86CPU alias properties
 * Fix CPUID levels so that W10 insider can run as guest OS
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJVpsITAAoJECgHk2+YTcWmpWoP/i0h19rtC/JNv/dEArp7mZ+M
 0/prt0cLFHv16I4NxD1QdVZmf4CDkLSQqq24PU4uXk7SQmmKctrhDrYIGm0/CLV2
 1ouU51DpW8k1djyeDuJjBiPKwBxJXW9Nz8NaG1OoHp+gCvLVaW9f5IiI1uizACeP
 aDl4OIeQ0RSKzMX24e2hI/OqUkCOn2ao4Z1e0XeksPCa5LvGeQA5p+iQQ8qOSXLz
 g1syWj/nNKfhVj02bi/oaweagnGMGBswtCpQbylZkQdDW7Zjt6Rms/IyjRN/CwGy
 oEr10VHK1zFjg6CD8hHIVEH4Na4nVNjGqtQ/8UvX1pinP4nPv2Zq+8/vxGIVDSSL
 gDTWenErmRYqA6Iw9CV7ffMfG8DIhpiYa1805Sj9ZQtbPA1hnxXtEQ5cIqbnuF1W
 J4mnJVSDOQ4veQSI8znr917yazRhcRbLaDVzg9qg4CP8eF4Hg2jqNCyytp5qAnsc
 Sumn1SBgWEEsLh2c7ENJyL/3jfsTlETpG0sFjBVVto5Rj2YK8V13Jq3K+sQjcK1d
 umRss45JdCnWg8Z0GmLiHYsM05eyoIoX5UG/A5yB0XtqF/JxysY59k8qchkSkvjs
 VEDqpQ0rLPa0K8PhAIDQGze+aU6+q0blWhTe2GELrU0oFi5iSxodTqWx+8C4Jl5j
 9lhPndGkoO+6JZfwJWw7
 =x5/Y
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging

X86 queue, 2015-07-15

Two bug fixes:
* Memory leak due to extra g_strdup() when registering X86CPU alias properties
* Fix CPUID levels so that W10 insider can run as guest OS

# gpg: Signature made Wed Jul 15 21:26:59 2015 BST using RSA key ID 984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-pull-request:
  target-i386: emulate CPUID level of real hardware
  target-i386: Don't strdup() alias property name

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-15 22:05:14 +01:00
Peter Maydell be0df8cd1e NUMA queue, 2015-07-15
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJVprwhAAoJECgHk2+YTcWmprIP/2DMmK4Y2yLoyfT6SMWM6blI
 Tj82U3xGjNx+AbD/44JsVNh6X2gzntuHVKi5P9GDkizeTf/YsbKlsgj4Kw1jvwMr
 MwsE8X4U2lhrzngVRm2rMk4PqhTcKPDETpbxwC1sw6S4u5Tbe52raBoLQ9jQ2GhM
 g+55fckwoHfNAQhXB/PkPSh1r/2jH0fGG+SUPpGm28AimOk2RT/scSGI27BKgbnn
 IHywBwk+Mu65GD8wYuNIf5niP3itpqoGzbsUCLhaMRA06HcchTvPY3tQzr3Sln7+
 dnOH+q5GgiYWE1CyZc3p45Vu1FBGML4HEPy/m2lwiEw5OQGR1NCl/f0YlIk4Qqbj
 V17/XQEiFO5Y6IYO27hc7Zh3q/QOrc5yAYaw3lX5rX/YPxtomzahhbxESFdzp3ut
 8ZaY8FA7L2fiIRFFWz+zHikc66WkguUArldyndLpc30yE8mdVQUQUn3N4m8IzqUe
 Ud2VSzB0ewL18A/eAMuwuqogUDj0RoW9mn0HJwLg/nzvPjn4I1I7tyZGJQt0+caF
 syIeG7sunJLCsQFPIsvOPiJf6LGPgs/NvNSeT+IRyznGDjjjIQdhTAXz4grYuuCv
 JKRkr5TG9I5iUFTrYYM0ZowGwRzzFKVgoalVcBgF4v05VBbHa8E0W/coe7szuvko
 NbTrX+ouLH7iKohYPxQe
 =LY8R
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/numa-pull-request' into staging

NUMA queue, 2015-07-15

# gpg: Signature made Wed Jul 15 21:01:37 2015 BST using RSA key ID 984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/numa-pull-request:
  numa: Fix memory leak in numa_set_mem_node_id()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-15 21:06:54 +01:00
Radim Krčmář 3046bb5deb target-i386: emulate CPUID level of real hardware
W10 insider has a bug where it ignores CPUID level and interprets
CPUID.(EAX=07H, ECX=0H) incorrectly, because CPUID in fact returned
CPUID.(EAX=04H, ECX=0H);  this resulted in execution of unsupported
instructions.

While it's a Windows bug, there is no reason to emulate incorrect level.

I used http://instlatx64.atw.hu/ as a source of CPUID and checked that
it matches Penryn Xeon X5472, Westmere Xeon W3520, SandyBridge i5-2540M,
and Haswell i5-4670T.

kvm64 and qemu64 were bumped to 0xD to allow all available features for
them (and to avoid the same Windows bug).

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-07-15 17:05:59 -03:00
Eduardo Habkost d461a44ca4 target-i386: Don't strdup() alias property name
Now object_property_add_alias() calls g_strdup() on the target property
name, so we don't need to call g_strdup() ourselves.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-07-15 17:02:14 -03:00
Bharata B Rao 672558d2ea numa: Fix memory leak in numa_set_mem_node_id()
Fix a memory leak in numa_set_mem_node_id().

Signed-off-by: Bharata B Rao <bharata@linux.vnet.com>
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-07-15 16:57:50 -03:00
Peter Maydell 7692401a08 target arm queue:
* handle broken AArch64 kernels which assume DTB won't cross a 2MB boundary
  * correct broken SCTLR_EL3 reset value
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJVpok4AAoJEDwlJe0UNgzerQcP/3Ko9kiRmhUhFGE5tvUafXms
 cCuZzk12+WWsucUVrYG7FNDK1us0uzaaQTxb9Oe1wH8F2KnI7zbhzBKh+02LiwT8
 yO8k+shVT76g7c1kNRKPhEO5OvsfyYhhdA+5mxCyBMH3qnfHbcpLDHkwTZsBbn69
 stYSwiVF0oD1bLTq9gVsLkfTpmtBEXu9eXg9lSoSXXROWtN6VnElddzNCqN2ML7S
 8QoS9QSWagXxuTbdXdum/+WDRZLMLaat9Nj/qpMbGQIYDFgE6SxV28t0kdjYDthr
 O2UJpLZibvgodKgAWoSIMKTjVp42Rkd3kpM9xV4iuBBXmWMNvfHvtm1EoIp0VXnD
 TTNh/+7lyGoOSl3hy6l/Emhk0NN/if5BDAJnwbTwrzisks5Em1nLigkRZ2reFqYj
 y876ynrn5mrgtZgQSX9j9yT0UGI5uoMybed9VUgrTJeRuaZjSObBkQqmurS8yIG4
 FOm8FMFb6vhSJmH1B550UoxxoQ8uWogeTy0p2S9/bsgTePEH+R0NHAfSIYugSZwR
 r0VvonWnQido8+9P8bAyb8yvSMhRyq/qSfnrRW6Bd7eNOyJNwVj2bVFX1IL3LABf
 HN9kiH13wXWiXtujq5tdIY7OAYarVueyKt3gZJ54OmMfVKzq6UOKkv31xwRYOmzA
 YotfqWATmS9LkE6/T5O4
 =JXJo
 -----END PGP SIGNATURE-----

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

target arm queue:
 * handle broken AArch64 kernels which assume DTB won't cross a 2MB boundary
 * correct broken SCTLR_EL3 reset value

# gpg: Signature made Wed Jul 15 17:24:24 2015 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20150715:
  hw/arm/boot: Increase fdt alignment
  target-arm: Fix broken SCTLR_EL3 reset

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-15 17:28:59 +01:00
Alexander Graf 76e2aef392 hw/arm/boot: Increase fdt alignment
The Linux kernel on aarch64 creates a page table entry at early bootup
that spans the 2MB range on memory spanning the fdt start address:

  [ ALIGN_DOWN(fdt, 2MB) ... ALIGN_DOWN(fdt, 2MB) + 2MB ]

This means that when our current 4k alignment happens to fall at the end
of the aligned region, Linux tries to access memory that is not mapped.

The easy fix is to instead increase the alignment to 2MB, making Linux's
logic always succeed.

We leave the existing 4k alignment for 32bit kernels to not cause any
regressions due to space constraints.

Reported-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-15 17:16:26 +01:00
Peter Maydell e46e1a74ef target-arm: Fix broken SCTLR_EL3 reset
The SCTLR_EL3 cpreg definition was implicitly resetting the
register state to 0, which is both wrong and clashes with
the reset done via the SCTLR definition (since sctlr[3]
is unioned with sctlr_s). This went unnoticed until recently,
when an unrelated change (commit a903c449b4) happened to
perturb the order of enumeration through the cpregs hashtable for
reset such that the erroneous reset happened after the correct one
rather than before it. Fix this by marking SCTLR_EL3 as an alias,
so its reset is left up to the AArch32 view.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
2015-07-15 17:16:26 +01:00
Peter Maydell 711dc6f36b -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQIcBAABAgAGBQJVpcSMAAoJEL2+eyfA3jBXCScP/16/YiMOCRsiud3YLssH1fZS
 vNxUrOchkP1vWKeZ0GsVxrqtvjpmC1PQ4ZnOXmfyxUVGXJ6vla07gipBY5WkKshZ
 Slaov7mCam2GLv/QHlQmB8AtLMeYe14AXo9B52Dpq49LMjJSd8sIGkcJyP92pogk
 nztEAFA53Obs1BPXfDUGXG/CgNOe0wqFtVKTu6mlIUOqZtOpYjwSAw+3kINGbRPy
 yEa/zUa5rKUbsCP4wpZP2+hOPb74/67/7MRfIgOq5QIe7j5bs5TI7mK7c8TgsebX
 lnKKqPIihoLEti8vX9iUNB4H49uJcrQcZy96D2lmk3lvi1IMHFm+BW2OkEV8GcoC
 AOYU2xGfSZ0QVNCL7AsewNhBqQtWKBc8qWGU0nD0b7WDVjO5xZ0UMPwed+QgP0Y6
 Bn2u5wTh0xIw04+JFEW+wvvX4Sl5KiNc3ebSA4qruL5KMx7lvhBGZUS/KOK4COuO
 EfjWt5MuoimFSLHpBV/h+0fMYEoxnCSD/lWC+NqG9sVcqbDjHP4G9GvbB10FNRoF
 4e9Tz3BiIcdhJBQYNzWXnM/Zf2Z11Qmm9G4+RymjTYa4yFEKfDciDAc2ulD7pQ8i
 UWhQOut+STv4ASaRLGPbFcTBI916GNZ/Ll5CH0VFFa81k4TK6keYaJWMvYHcTOws
 hoZ+n48kLLQAxCqJ5KPC
 =CaLG
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cody/tags/jtc-for-upstream-pull-request' into staging

# gpg: Signature made Wed Jul 15 03:25:16 2015 BST using RSA key ID C0DE3057
# gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
# gpg:                 aka "Jeffrey Cody <jeff@codyprime.org>"
# gpg:                 aka "Jeffrey Cody <codyprime@gmail.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* remotes/cody/tags/jtc-for-upstream-pull-request:
  block/curl: Don't lose original error when a connection fails.
  mirror: correct buf_size
  block: keep bitmap if incremental backup job is cancelled
  blockdev: no need to drain in qmp_block_commit
  block/mirror: Sleep periodically during bitmap scanning

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-15 14:23:58 +01:00
Aurelien Jarno 908680c644 target-mips: fix page fault address for LWL/LWR/LDL/LDR
When a LWL, LWR, LDL or LDR instruction triggers a page fault, QEMU
currently reports the aligned address in CP0 BadVAddr, while the Windows
NT kernel expects the unaligned address.

This patch adds a byte access with the unaligned address at the
beginning of the LWL/LWR/LDL/LDR instructions to possibly trigger a page
fault and fill the QEMU TLB.

Cc: Leon Alrae <leon.alrae@imgtec.com>
Reported-by: Hervé Poussineau <hpoussin@reactos.org>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-07-15 14:07:25 +01:00
Andrew Bennett f01a361bfc linux-user: Fix MIPS N64 trap and break instruction bug
For the MIPS N64 ABI when QEMU reads the break/trap instruction so that
it can inspect the break/trap code it reads 8 rather than 4 bytes
which means it finds the code field from the instruction after the
break/trap instruction.  This then causes the break/trap handling
code to fail because it does not understand the code number.

The fix forces QEMU to always read 4 bytes of instruction data rather
than deciding how much to read based on the ABI.

Signed-off-by: Andrew Bennett <andrew.bennett@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-07-15 14:07:25 +01:00
Leon Alrae 26e7e982b2 target-mips: fix resource leak reported by Coverity
UHI assert and link operations call lock_user_string() twice to obtain two
strings pointed by gpr[4] and gpr[5]. If the second lock_user_string()
fails, then the first one won't get freed. Fix this by introducing another
macro responsible for obtaining two strings and handling allocation
failure.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
2015-07-15 14:07:25 +01:00
Leon Alrae 47ada0ad34 target-mips: fix logically dead code reported by Coverity
Make use of CMPOP in floating-point compare instructions.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
2015-07-15 14:07:25 +01:00
Leon Alrae fe87c2b36a target-mips: correct DERET instruction
Fix Debug Mode flag clearing, and when DERET is placed between LL and SC
do not make SC fail.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
2015-07-15 14:07:25 +01:00
Aurelien Jarno 6a973e6b65 target-mips: fix ASID synchronisation for MIPS MT
When syncing the task ASID with EntryHi, correctly or the value instead
of assigning it.

Reported-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-07-15 14:07:25 +01:00
Yongbok Kim 6b9c26fb5e disas/mips: fix disassembling R6 instructions
In the Release 6 of the MIPS Architecture, LL, SC, LLD, SCD, PREF
and CACHE instructions have 9 bits offsets.

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>
2015-07-15 14:07:20 +01:00
Yongbok Kim d4f4f0d5d9 target-mips: fix to clear MSACSR.Cause
MSACSR.Cause bits are needed to be cleared before a vector floating-point
instructions.
FEXDO.df, FEXUPL.df and FEXUPR.df were missed out.

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>
2015-07-15 14:07:17 +01:00