Fixed rudimentary suspend/resume.

This patch replaces the failing asynchronous I/O code in the qcow2
driver with a working synchronous implementation and fixes another
minor bug in iteration over QField structs. As a result, the VM can
now be suspended and resumed with the savevm and loadvm commands,
albeit with the following (major) caveats:

 1. The ADBd and other network services do not resume correctly.
 2. Normal SD card usage is blocked, since snapshots are written to a
    qcow2 image that must (for now) be mounted on hda.
 3. Resume only works after the emulator is fully booted. It is not
    (yet) possible to load an image immediately after the machine
    started.

The synchronous I/O code is ported from commit ef845c3b in mainline
QEMU, which addresses a similar issue. Further upstream mainline also
introduces a fix for the async I/O, but that patch is quite involved,
and for now this relatively simple fix works.

Change-Id: I660c19c22316aecdd7dcae357e66da20e0ab6d80
4 files changed
tree: 7c73ed8c8452f90b816689b14f691297241659ba
  1. android/
  2. audio/
  3. block/
  4. distrib/
  5. docs/
  6. elff/
  7. fpu/
  8. gdb-xml/
  9. hw/
  10. images/
  11. memcheck/
  12. proxy/
  13. slirp/
  14. slirp-android/
  15. target-arm/
  16. tcg/
  17. telephony/
  18. .gitignore
  19. a.out.h
  20. acl.c
  21. acl.h
  22. aes.c
  23. aes.h
  24. aio-android.c
  25. aio.c
  26. alpha.ld
  27. android-configure.sh
  28. android-rebuild.sh
  29. Android.mk
  30. arm-dis.c
  31. arm-semi.c
  32. arm.ld
  33. balloon.h
  34. block.c
  35. block.h
  36. block_int.h
  37. bswap.h
  38. bt-host.c
  39. bt-host.h
  40. bt-vhci.c
  41. buffered_file.c
  42. buffered_file.h
  43. cache-utils.c
  44. cache-utils.h
  45. cbuffer.c
  46. cbuffer.h
  47. Changelog
  48. CHANGES.TXT
  49. charpipe.c
  50. charpipe.h
  51. CleanSpec.mk
  52. compatfd.c
  53. compatfd.h
  54. console.c
  55. console.h
  56. COPYING
  57. COPYING.LIB
  58. cpu-all.h
  59. cpu-common.h
  60. cpu-defs.h
  61. cpu-exec.c
  62. curses.c
  63. curses_keys.h
  64. cutils.c
  65. d3des.c
  66. d3des.h
  67. dcache.c
  68. dcache.h
  69. def-helper.h
  70. device_tree.c
  71. device_tree.h
  72. dis-asm.h
  73. disas.c
  74. disas.h
  75. dma-helpers.c
  76. dma.h
  77. dyngen-exec.h
  78. dynlink-static.c
  79. dynlink.h
  80. elf.h
  81. elf_ops.h
  82. envlist.c
  83. envlist.h
  84. exec-all.h
  85. exec.c
  86. feature_to_c.sh
  87. framebuffer.c
  88. framebuffer.h
  89. gdbstub.c
  90. gdbstub.h
  91. gen-charmap.py
  92. gen-icount.h
  93. gen-skin.py
  94. host-defs.h
  95. host-utils.c
  96. host-utils.h
  97. hostregs_helper.h
  98. hpet.h
  99. hxtool
  100. i386-dis.c
  101. i386-vl.ld
  102. i386.ld
  103. ia64.ld
  104. INSTALL
  105. iolooper-select.c
  106. iolooper.h
  107. ioport-user.c
  108. ioport.c
  109. ioport.h
  110. json-lexer.c
  111. json-lexer.h
  112. json-parser.c
  113. json-parser.h
  114. json-streamer.c
  115. json-streamer.h
  116. keymaps.c
  117. keymaps.h
  118. kqemu.c
  119. kqemu.h
  120. kvm.h
  121. LICENSE
  122. linux_keycodes.h
  123. loader.c
  124. loadpng.c
  125. m68k.ld
  126. Makefile
  127. Makefile.android
  128. migration-dummy-android.c
  129. migration-exec.c
  130. migration-tcp-android.c
  131. migration-tcp.c
  132. migration.c
  133. migration.h
  134. module.c
  135. module.h
  136. MODULE_LICENSE_GPL
  137. monitor.c
  138. monitor.h
  139. net-android.c
  140. net-checksum.c
  141. net.c
  142. net.h
  143. NOTICE
  144. offset_layout.py
  145. osdep.c
  146. osdep.h
  147. ppc-dis.c
  148. ppc.ld
  149. qbool.c
  150. qbool.h
  151. qdict.c
  152. qdict.h
  153. qemu-aio.h
  154. qemu-char-android.c
  155. qemu-char.c
  156. qemu-char.h
  157. qemu-common.h
  158. qemu-io.c
  159. qemu-lock.h
  160. qemu-log.h
  161. qemu-malloc.c
  162. qemu-monitor.hx
  163. qemu-objects.h
  164. qemu-option.c
  165. qemu-option.h
  166. qemu-options.hx
  167. qemu-queue.h
  168. qemu-sockets-android.c
  169. qemu-sockets.c
  170. qemu-thread.c
  171. qemu-thread.h
  172. qemu-timer.h
  173. qemu_debug.h
  174. qemu_file.h
  175. qemu_socket.h
  176. qemu_timers.h
  177. qerror.c
  178. qerror.h
  179. qfloat.c
  180. qfloat.h
  181. qint.c
  182. qint.h
  183. qjson.c
  184. qjson.h
  185. qlist.c
  186. qlist.h
  187. qobject.h
  188. qstring.c
  189. qstring.h
  190. readline.c
  191. readline.h
  192. README
  193. savevm.c
  194. sdl_keysym.h
  195. shaper.c
  196. shaper.h
  197. sockets.c
  198. sockets.h
  199. softmmu-semi.h
  200. softmmu_defs.h
  201. softmmu_exec.h
  202. softmmu_header.h
  203. softmmu_outside_jit.c
  204. softmmu_outside_jit.h
  205. softmmu_template.h
  206. sparc.ld
  207. sys-tree.h
  208. sysemu.h
  209. tap-win32.c
  210. targphys.h
  211. tcpdump.c
  212. tcpdump.h
  213. thunk.c
  214. thunk.h
  215. trace.c
  216. trace.h
  217. trace_common.h
  218. translate-all.c
  219. translate-op.c
  220. translate.make
  221. uboot_image.h
  222. usb-dummy-android.c
  223. usb-linux.c
  224. user-events-qemu.c
  225. user-events.h
  226. varint.c
  227. varint.h
  228. vgafont.h
  229. vl-android.c
  230. vl.c
  231. vnc-android.c
  232. vnc-tls.h
  233. vnc.c
  234. vnc.h
  235. vnc_keysym.h
  236. vnchextile.h
  237. x86_64.ld