Commit Graph

40216 Commits

Author SHA1 Message Date
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
Yongbok Kim
4dc89b7820 target-mips: fix MIPS64R6-generic configuration
Fix core configuration for MIPS64R6-generic to make it as close as
I6400.
I6400 core has 48-bit of Virtual Address available (SEGBITS).
MIPS SIMD Architecture is available.
Rearrange order of bits to match the specification.

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:10 +01:00
Peter Maydell
f5dec79ee8 migration/next for 20150715
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJVpjSlAAoJEPSH7xhYctcjC3MQAI+abK4X3dYKm9SGRl2LQp6r
 WWwjLLVk/bWUodsI0RnUXhYMWnYb4QBKHmAZ3Tar6QS6FkA59VvzFL89xBsjkM6n
 egZ1CqCFt+msRX6wqy4npirlBSACUzsA7ZUWU3Rp/ngNEM0SQFFpSDvnAEV8M+sn
 aIvYrhfk28Nn2bgEAQBcrtzYh9ZcKStr6Z7opP7is4FyuA0+fqGnKXm8ahITwc75
 ih/bI6XDg6Vr9rIn5NUNbvfhHnQS18fD4E3x7WShCO/rh9pbq63OD6RPgw6uoW85
 s0IJ7QESwxv0NjE2HJ9g2WsR7YstndjoneM9EkJDW/agOEkux4swY7n3HAgsP3Uz
 RGUzfALy2jb0kWPDcX1egx0vtriC8xcwSv361p1/bip5TnEB78quNOknpmDPwPIh
 VnbC3ANVtd1xB14vBEcZkQpTfL7yqBA2DeCZtDe6JrA5eXNkiROslSaw+baICbso
 9U43HKyY9m6gJ7Cz/MQTHMleiUFe11QoR4paYHZRFAyjpqgGCPWVY5P3W++CXb3K
 8nCPEsPJ1IfRGqI9up4hIGJIXA6p6hVPWzUnHR3Sry/Ve4M9Y/WcZJtPiEj53g7a
 8OAXmaKTAa4BUPIBDER0TTQMWlMhDzs3FaxD1iKr7Z5oxC3DGv0BULKWaXekM73s
 t7BEoP+xe0RNg83omi/U
 =g6Rf
 -----END PGP SIGNATURE-----

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

migration/next for 20150715

# gpg: Signature made Wed Jul 15 11:23:33 2015 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/20150715-1:
  migration: We also want to store the global state for savevm
  migration: reduce the count of strlen call
  migration: Register global state section before loadvm
  migration: Write documetation for events capabilites
  migration: Trace event and migration event are different things
  migration: Only change state after migration has finished

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-15 12:22:31 +01:00
Juan Quintela
560d027b54 migration: We also want to store the global state for savevm
Commit df4b102452 introduced global_state
section.  But it only filled the state while doing migration.  While
doing a savevm, we stored an empty string as state.  So when we did a
loadvm, it complained that state was invalid.

Fedora 21, 4.1.1, qemu 2.4.0-rc0
> ../../configure --target-list="x86_64-softmmu"

068 2s ... - output mismatch (see 068.out.bad)
--- /home/bos/jhuston/src/qemu/tests/qemu-iotests/068.out	2015-07-08
17:56:18.588164979 -0400
+++ 068.out.bad	2015-07-09 17:39:58.636651317 -0400
@@ -6,6 +6,8 @@
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) savevm 0
 (qemu) quit
+qemu-system-x86_64: Unknown savevm section or instance 'globalstate' 0
+qemu-system-x86_64: Error -22 while loading VM state
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 *** done
Failures: 068
Failed 1 of 1 tests

Actually, there were two problems here:
- we registered global_state too late for load_vm (fixed on another
  patch on the list)
- we didn't store a valid state for savevm (fixed by this patch).

Reported-by: John Snow <jsnow@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Tested-by:  Christian Borntraeger <borntraeger@de.ibm.com>
2015-07-15 12:22:54 +02:00
Liang Li
9f5f380b54 migration: reduce the count of strlen call
'strlen' is called three times in 'save_page_header', it's
inefficient.

Signed-off-by: Liang Li <liang.z.li@intel.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-07-15 12:21:28 +02:00
Juan Quintela
48212d87d6 migration: Register global state section before loadvm
Otherwise, it is not found

Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-07-15 09:07:54 +02:00
Juan Quintela
72e72e1a71 migration: Write documetation for events capabilites
Reported-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-07-15 09:07:54 +02:00
Juan Quintela
4ba4bc5e9b migration: Trace event and migration event are different things
We can want the trace event even without migration events enabled.

Reported-by:  Wen Congyang <ghostwcy@gmail.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2015-07-15 09:07:54 +02:00
Juan Quintela
172c4356f3 migration: Only change state after migration has finished
On previous change, we changed state at post load time if it was not
running, special casing the "running" change.  Now, we change any states
at the end of the migration.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-07-15 09:07:54 +02:00
Richard W.M. Jones
796a060bc0 block/curl: Don't lose original error when a connection fails.
Currently if qemu is connected to a curl source (eg. web server), and
the web server fails / times out / dies, you always see a bogus EIO
"Input/output error".

For example, choose a large file located on any local webserver which
you control:

  $ qemu-img convert -p http://example.com/large.iso /tmp/test

Once it starts copying the file, stop the webserver and you will see
qemu-img fail with:

  qemu-img: error while reading sector 61440: Input/output error

This patch does two things: Firstly print the actual error from curl
so it doesn't get lost.  Secondly, change EIO to EPROTO.  EPROTO is a
POSIX.1 compatible errno which more accurately reflects that there was
a protocol error, rather than some kind of hardware failure.

After this patch is applied, the error changes to:

  $ qemu-img convert -p http://example.com/large.iso /tmp/test
  qemu-img: curl: transfer closed with 469989 bytes remaining to read
  qemu-img: error while reading sector 16384: Protocol error

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
2015-07-14 21:50:13 -04:00
Wen Congyang
48ac0a4df8 mirror: correct buf_size
If bus_size is less than 0, the command fails.
If buf_size is 0, use DEFAULT_MIRROR_BUF_SIZE.
If buf_size % granularity is not 0, mirror_free_init() will
do dangerous things.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 5555A588.3080907@cn.fujitsu.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
2015-07-14 21:50:13 -04:00