qemu-kvm: fix segfault when running kvm without /dev/kvm, falling back to non-accelerated mode

qemu-kvm: fix segfault when running kvm without /dev/kvm, falling back
to non-accelerated mode

We're seeing segfaults on systems without access to /dev/kvm.  It
looks like the global kvm_allowed is being set just a little too late
in vl.c.  This patch moves the kvm initialization a bit higher in the
vl.c main, just after options processing, and solves the segfaults.
We're carrying this patch in Ubuntu 9.10 Alpha.  Please apply
upstream, or advise if and why this might not be the optimal solution.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>

Move the kvm_init() call a bit higher to fix a segfault when
/dev/kvm is not available.  The kvm_allowed global needs
to be set correctly a little earlier.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
1 file changed
tree: 8ce754da5f4a34a8873eddae54824b9894e29b01
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. fpu/
  6. gdb-xml/
  7. hw/
  8. linux-user/
  9. pc-bios/
  10. roms/
  11. slirp/
  12. target-alpha/
  13. target-arm/
  14. target-cris/
  15. target-i386/
  16. target-m68k/
  17. target-microblaze/
  18. target-mips/
  19. target-ppc/
  20. target-sh4/
  21. target-sparc/
  22. tcg/
  23. tests/
  24. .gitignore
  25. .gitmodules
  26. a.out.h
  27. acl.c
  28. acl.h
  29. aes.c
  30. aes.h
  31. aio.c
  32. alpha-dis.c
  33. alpha.ld
  34. arm-dis.c
  35. arm-semi.c
  36. arm.ld
  37. balloon.h
  38. block.c
  39. block.h
  40. block_int.h
  41. bswap.h
  42. bt-host.c
  43. bt-host.h
  44. bt-vhci.c
  45. buffered_file.c
  46. buffered_file.h
  47. cache-utils.c
  48. cache-utils.h
  49. Changelog
  50. check-qdict.c
  51. check-qint.c
  52. check-qstring.c
  53. cmd.c
  54. cmd.h
  55. cocoa.m
  56. CODING_STYLE
  57. configure
  58. console.c
  59. console.h
  60. COPYING
  61. COPYING.LIB
  62. cpu-all.h
  63. cpu-common.h
  64. cpu-defs.h
  65. cpu-exec.c
  66. create_config
  67. cris-dis.c
  68. curses.c
  69. curses_keys.h
  70. cutils.c
  71. d3des.c
  72. d3des.h
  73. def-helper.h
  74. device_tree.c
  75. device_tree.h
  76. dis-asm.h
  77. disas.c
  78. disas.h
  79. dma-helpers.c
  80. dma.h
  81. dyngen-exec.h
  82. elf.h
  83. elf_ops.h
  84. envlist.c
  85. envlist.h
  86. exec-all.h
  87. exec.c
  88. feature_to_c.sh
  89. gdbstub.c
  90. gdbstub.h
  91. gen-icount.h
  92. host-utils.c
  93. host-utils.h
  94. hostregs_helper.h
  95. hpet.h
  96. hppa-dis.c
  97. hppa.ld
  98. hxtool
  99. i386-dis.c
  100. i386.ld
  101. ia64.ld
  102. ioport-user.c
  103. ioport.c
  104. ioport.h
  105. keymaps.c
  106. keymaps.h
  107. kvm-all.c
  108. kvm.h
  109. libfdt_env.h
  110. LICENSE
  111. linux-aio.c
  112. loader.c
  113. m68k-dis.c
  114. m68k-semi.c
  115. m68k.ld
  116. MAINTAINERS
  117. Makefile
  118. Makefile.hw
  119. Makefile.target
  120. microblaze-dis.c
  121. migration-exec.c
  122. migration-fd.c
  123. migration-tcp.c
  124. migration-unix.c
  125. migration.c
  126. migration.h
  127. mips-dis.c
  128. mips.ld
  129. module.c
  130. module.h
  131. monitor.c
  132. monitor.h
  133. nbd.c
  134. nbd.h
  135. net-checksum.c
  136. net.c
  137. net.h
  138. osdep.c
  139. osdep.h
  140. path.c
  141. pci-ids.txt
  142. posix-aio-compat.c
  143. ppc-dis.c
  144. ppc.ld
  145. ppc64.ld
  146. qdict-test-data.txt
  147. qdict.c
  148. qdict.h
  149. qemu-aio.h
  150. qemu-binfmt-conf.sh
  151. qemu-char.c
  152. qemu-char.h
  153. qemu-common.h
  154. qemu-config.c
  155. qemu-config.h
  156. qemu-doc.texi
  157. qemu-img-cmds.hx
  158. qemu-img.c
  159. qemu-img.texi
  160. qemu-io.c
  161. qemu-lock.h
  162. qemu-log.h
  163. qemu-malloc.c
  164. qemu-monitor.hx
  165. qemu-nbd.c
  166. qemu-nbd.texi
  167. qemu-option.c
  168. qemu-option.h
  169. qemu-options.hx
  170. qemu-sockets.c
  171. qemu-tech.texi
  172. qemu-thread.c
  173. qemu-thread.h
  174. qemu-timer.h
  175. qemu-tool.c
  176. qemu.sasl
  177. qemu_socket.h
  178. qint.c
  179. qint.h
  180. qobject.h
  181. qstring.c
  182. qstring.h
  183. readline.c
  184. readline.h
  185. README
  186. rules.mak
  187. s390-dis.c
  188. s390.ld
  189. savevm.c
  190. sdl.c
  191. sdl_keysym.h
  192. sdl_zoom.c
  193. sdl_zoom.h
  194. sdl_zoom_template.h
  195. sh4-dis.c
  196. softmmu-semi.h
  197. softmmu_defs.h
  198. softmmu_exec.h
  199. softmmu_header.h
  200. softmmu_template.h
  201. sparc-dis.c
  202. sparc.ld
  203. sparc64.ld
  204. sys-queue.h
  205. sysemu.h
  206. tap-win32.c
  207. targphys.h
  208. texi2pod.pl
  209. thunk.c
  210. thunk.h
  211. TODO
  212. translate-all.c
  213. uboot_image.h
  214. usb-bsd.c
  215. usb-linux.c
  216. usb-stub.c
  217. VERSION
  218. vgafont.h
  219. vl.c
  220. vnc-auth-sasl.c
  221. vnc-auth-sasl.h
  222. vnc-auth-vencrypt.c
  223. vnc-auth-vencrypt.h
  224. vnc-tls.c
  225. vnc-tls.h
  226. vnc.c
  227. vnc.h
  228. vnc_keysym.h
  229. vnchextile.h
  230. x86_64.ld
  231. x_keymap.c
  232. x_keymap.h