Fix exit on 'pci_add' Monitor command

If the user issues one of the following commands to the Monitor:

pci_add pci_addr=auto nic model=None
pci_add pci_addr=auto nic model=?

QEMU will exit, because the function used to perform sanity
checks (qemu_check_nic_model_list()) exits on error.

This function is used by the startup code, where it makes
sense to exit on error, but in the Monitor it doesn't.

Changing qemu_check_nic_model_list() to not exit on error
is not possible though, as it's used by the board init
code (the PC one), where all board specific code must have
void return.

The way I've chosen to fix this was to introduce a new function
called pci_nic_supported(), which checks if the NIC is supported
and returns true or false accordingly.

The new function is used only by the Monitor, it performs the
necessary check and returns an error in case the NIC is not
supported, thus qemu_check_nic_model_list()'s exit is never trigged.

The following should be observed:

1. Only the specified NIC is checked, the default one is assumed
to be supported

2. The NIC query command (model=?) won't work with pci_add, the
right way to do this with the Monitor is to add a new command

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
3 files changed
tree: 8716c085665e653cc45ac7344460f19eff37fc7d
  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. envlist.c
  84. envlist.h
  85. exec-all.h
  86. exec.c
  87. feature_to_c.sh
  88. gdbstub.c
  89. gdbstub.h
  90. gen-icount.h
  91. host-utils.c
  92. host-utils.h
  93. hostregs_helper.h
  94. hpet.h
  95. hppa-dis.c
  96. hppa.ld
  97. hxtool
  98. i386-dis.c
  99. i386.ld
  100. ia64.ld
  101. ioport-user.c
  102. ioport.c
  103. ioport.h
  104. keymaps.c
  105. keymaps.h
  106. kvm-all.c
  107. kvm.h
  108. libfdt_env.h
  109. LICENSE
  110. linux-aio.c
  111. m68k-dis.c
  112. m68k-semi.c
  113. m68k.ld
  114. MAINTAINERS
  115. Makefile
  116. Makefile.hw
  117. Makefile.target
  118. Makefile.user
  119. microblaze-dis.c
  120. migration-exec.c
  121. migration-fd.c
  122. migration-tcp.c
  123. migration-unix.c
  124. migration.c
  125. migration.h
  126. mips-dis.c
  127. mips.ld
  128. module.c
  129. module.h
  130. monitor.c
  131. monitor.h
  132. nbd.c
  133. nbd.h
  134. net-checksum.c
  135. net.c
  136. net.h
  137. osdep.c
  138. osdep.h
  139. path.c
  140. pci-ids.txt
  141. posix-aio-compat.c
  142. ppc-dis.c
  143. ppc.ld
  144. ppc64.ld
  145. qdict-test-data.txt
  146. qdict.c
  147. qdict.h
  148. qemu-aio.h
  149. qemu-binfmt-conf.sh
  150. qemu-char.c
  151. qemu-char.h
  152. qemu-common.h
  153. qemu-config.c
  154. qemu-config.h
  155. qemu-doc.texi
  156. qemu-img-cmds.hx
  157. qemu-img.c
  158. qemu-img.texi
  159. qemu-io.c
  160. qemu-lock.h
  161. qemu-log.h
  162. qemu-malloc.c
  163. qemu-monitor.hx
  164. qemu-nbd.c
  165. qemu-nbd.texi
  166. qemu-option.c
  167. qemu-option.h
  168. qemu-options.hx
  169. qemu-queue.h
  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. sysemu.h
  205. tap-win32.c
  206. targphys.h
  207. tcg-runtime.c
  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