Add cpu model configuration support..

This is a reimplementation of prior versions which adds
the ability to define cpu models for contemporary processors.
The added models are likewise selected via -cpu <name>,
and are intended to displace the existing convention
of "-cpu qemu64" augmented with a series of feature flags.

A primary motivation was determination of a least common
denominator within a given processor class to simplify guest
migration.  It is still possible to modify an arbitrary model
via additional feature flags however the goal here was to
make doing so unnecessary in typical usage.  The other
consideration was providing models names reflective of
current processors.  Both AMD and Intel have reviewed the
models in terms of balancing generality of migration vs.
excessive feature downgrade relative to released silicon.

This version of the patch replaces the prior hard wired
definitions with a configuration file approach for new
models.  Existing models are thus far left as-is but may
easily be transitioned to (or may be overridden by) the
configuration file representation.

Proposed new model definitions are provided here for current
AMD and Intel processors.  Each model consists of a name
used to select it on the command line (-cpu <name>), and a
model_id which corresponds to a least common denominator
commercial instance of the processor class.

A table of names/model_ids may be queried via "-cpu ?model":

        :
    x86       Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)
    x86       Opteron_G2  AMD Opteron 22xx (Gen 2 Class Opteron)
    x86       Opteron_G1  AMD Opteron 240 (Gen 1 Class Opteron)
    x86          Nehalem  Intel Core i7 9xx (Nehalem Class Core i7)
    x86           Penryn  Intel Core 2 Duo P9xxx (Penryn Class Core 2)
    x86           Conroe  Intel Celeron_4x0 (Conroe/Merom Class Core 2)
        :

Also added is "-cpu ?dump" which exhaustively outputs all config
data for all defined models, and "-cpu ?cpuid" which enumerates
all qemu recognized CPUID feature flags.

The pseudo cpuid flag 'check' when added to the feature flag list
will warn when feature flags (either implicit in a cpu model or
explicit on the command line) would have otherwise been quietly
unavailable to a guest:

    # qemu-system-x86_64 ... -cpu Nehalem,check
    warning: host cpuid 0000_0001 lacks requested flag 'sse4.2|sse4_2' [0x00100000]
    warning: host cpuid 0000_0001 lacks requested flag 'popcnt' [0x00800000]

A similar 'enforce' pseudo flag exists which in addition
to the above causes qemu to error exit if requested flags are
unavailable.

Configuration data for a cpu model resides in the target config
file which by default will be installed as:

    /usr/local/etc/qemu/target-<arch>.conf

The format of this file should be self explanatory given the
definitions for the above six models and essentially mimics
the structure of the static x86_def_t x86_defs.

Encoding of cpuid flags names now allows aliases for both the
configuration file and the command line which reconciles some
Intel/AMD/Linux/Qemu naming differences.

This patch was tested relative to qemu.git.

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