ppc64: Rudimentary Support for extra page sizes on server CPUs

More recent Power server chips (i.e. based on the 64 bit hash MMU)
support more than just the traditional 4k and 16M page sizes.  This
can get quite complicated, because which page sizes are supported,
which combinations are supported within an MMU segment and how these
page sizes are encoded both in the SLB entry and the hash PTE can vary
depending on the CPU model (they are not specified by the
architecture).  In addition the firmware or hypervisor may not permit
use of certain page sizes, for various reasons.  Whether various page
sizes are supported on KVM, for example, depends on whether the PR or
HV variant of KVM is in use, and on the page size of the memory
backing the guest's RAM.

This patch adds information to the CPUState and cpu defs to describe
the supported page sizes and encodings.  Since TCG does not yet
support any extended page sizes, we just set this to NULL in the
static CPU definitions, expanding this to the default 4k and 16M page
sizes when we initialize the cpu state.  When using KVM, however, we
instead determine available page sizes using the new
KVM_PPC_GET_SMMU_INFO call.  For old kernels without that call, we use
some defaults, with some guesswork which should do the right thing for
existing HV and PR implementations.  The fallback might not be correct
for future versions, but that's ok, because they'll have
KVM_PPC_GET_SMMU_INFO.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 files changed
tree: a8eec4470ce0817b5c38f01b1e365d759419c3bb
  1. audio/
  2. block/
  3. bsd-user/
  4. default-configs/
  5. docs/
  6. fpu/
  7. fsdev/
  8. gdb-xml/
  9. hw/
  10. include/
  11. libcacard/
  12. linux-headers/
  13. linux-user/
  14. net/
  15. pc-bios/
  16. qapi/
  17. qga/
  18. QMP/
  19. qom/
  20. roms/
  21. scripts/
  22. slirp/
  23. sysconfigs/
  24. target-alpha/
  25. target-arm/
  26. target-cris/
  27. target-i386/
  28. target-lm32/
  29. target-m68k/
  30. target-microblaze/
  31. target-mips/
  32. target-ppc/
  33. target-s390x/
  34. target-sh4/
  35. target-sparc/
  36. target-unicore32/
  37. target-xtensa/
  38. tcg/
  39. tests/
  40. trace/
  41. ui/
  42. .gitignore
  43. .gitmodules
  44. .mailmap
  45. a.out.h
  46. acl.c
  47. acl.h
  48. aes.c
  49. aes.h
  50. aio.c
  51. alpha-dis.c
  52. alpha.ld
  53. arch_init.c
  54. arch_init.h
  55. arm-dis.c
  56. arm.ld
  57. async.c
  58. balloon.c
  59. balloon.h
  60. bitmap.c
  61. bitmap.h
  62. bitops.c
  63. bitops.h
  64. block-migration.c
  65. block-migration.h
  66. block.c
  67. block.h
  68. block_int.h
  69. blockdev.c
  70. blockdev.h
  71. bswap.h
  72. bt-host.c
  73. bt-host.h
  74. bt-vhci.c
  75. buffered_file.c
  76. buffered_file.h
  77. cache-utils.c
  78. cache-utils.h
  79. Changelog
  80. cmd.c
  81. cmd.h
  82. CODING_STYLE
  83. compatfd.c
  84. compatfd.h
  85. compiler.h
  86. config.h
  87. configure
  88. console.c
  89. console.h
  90. COPYING
  91. COPYING.LIB
  92. coroutine-gthread.c
  93. coroutine-sigaltstack.c
  94. coroutine-ucontext.c
  95. coroutine-win32.c
  96. cpu-all.h
  97. cpu-common.h
  98. cpu-defs.h
  99. cpu-exec.c
  100. cpus.c
  101. cpus.h
  102. cputlb.c
  103. cputlb.h
  104. cris-dis.c
  105. cursor.c
  106. cursor_hidden.xpm
  107. cursor_left_ptr.xpm
  108. cutils.c
  109. def-helper.h
  110. device_tree.c
  111. device_tree.h
  112. dis-asm.h
  113. disas.c
  114. disas.h
  115. dma-helpers.c
  116. dma.h
  117. dump-stub.c
  118. dump.c
  119. dump.h
  120. dyngen-exec.h
  121. elf.h
  122. envlist.c
  123. envlist.h
  124. error.c
  125. error.h
  126. error_int.h
  127. event_notifier.c
  128. event_notifier.h
  129. exec-all.h
  130. exec-memory.h
  131. exec-obsolete.h
  132. exec.c
  133. gdbstub.c
  134. gdbstub.h
  135. gen-icount.h
  136. HACKING
  137. hmp-commands.hx
  138. hmp.c
  139. hmp.h
  140. host-utils.c
  141. host-utils.h
  142. hppa-dis.c
  143. hppa.ld
  144. i386-dis.c
  145. i386.ld
  146. ia64-dis.c
  147. ia64.ld
  148. input.c
  149. int128.h
  150. iohandler.c
  151. ioport.c
  152. ioport.h
  153. iorange.h
  154. iov.c
  155. iov.h
  156. json-lexer.c
  157. json-lexer.h
  158. json-parser.c
  159. json-parser.h
  160. json-streamer.c
  161. json-streamer.h
  162. kvm-all.c
  163. kvm-stub.c
  164. kvm.h
  165. libfdt_env.h
  166. LICENSE
  167. linux-aio.c
  168. lm32-dis.c
  169. m68k-dis.c
  170. m68k.ld
  171. main-loop.c
  172. main-loop.h
  173. MAINTAINERS
  174. Makefile
  175. Makefile.dis
  176. Makefile.hw
  177. Makefile.objs
  178. Makefile.target
  179. Makefile.user
  180. memory.c
  181. memory.h
  182. memory_mapping-stub.c
  183. memory_mapping.c
  184. memory_mapping.h
  185. microblaze-dis.c
  186. migration-exec.c
  187. migration-fd.c
  188. migration-tcp.c
  189. migration-unix.c
  190. migration.c
  191. migration.h
  192. mips-dis.c
  193. mips.ld
  194. module.c
  195. module.h
  196. monitor.c
  197. monitor.h
  198. nbd.c
  199. nbd.h
  200. net.c
  201. net.h
  202. notify.c
  203. notify.h
  204. os-posix.c
  205. os-win32.c
  206. osdep.c
  207. osdep.h
  208. oslib-posix.c
  209. oslib-win32.c
  210. path.c
  211. pci-ids.txt
  212. pflib.c
  213. pflib.h
  214. poison.h
  215. posix-aio-compat.c
  216. ppc-dis.c
  217. ppc.ld
  218. ppc64.ld
  219. qapi-schema-guest.json
  220. qapi-schema-test.json
  221. qapi-schema.json
  222. qbool.c
  223. qbool.h
  224. qdict-test-data.txt
  225. qdict.c
  226. qdict.h
  227. qemu-aio.h
  228. qemu-barrier.h
  229. qemu-bridge-helper.c
  230. qemu-char.c
  231. qemu-char.h
  232. qemu-common.h
  233. qemu-config.c
  234. qemu-config.h
  235. qemu-coroutine-int.h
  236. qemu-coroutine-io.c
  237. qemu-coroutine-lock.c
  238. qemu-coroutine-sleep.c
  239. qemu-coroutine.c
  240. qemu-coroutine.h
  241. qemu-doc.texi
  242. qemu-error.c
  243. qemu-error.h
  244. qemu-file.h
  245. qemu-ga.c
  246. qemu-img-cmds.hx
  247. qemu-img.c
  248. qemu-img.texi
  249. qemu-io.c
  250. qemu-lock.h
  251. qemu-log.c
  252. qemu-log.h
  253. qemu-nbd.c
  254. qemu-nbd.texi
  255. qemu-objects.h
  256. qemu-option.c
  257. qemu-option.h
  258. qemu-options-wrapper.h
  259. qemu-options.h
  260. qemu-options.hx
  261. qemu-os-posix.h
  262. qemu-os-win32.h
  263. qemu-progress.c
  264. qemu-queue.h
  265. qemu-sockets.c
  266. qemu-tech.texi
  267. qemu-thread-posix.c
  268. qemu-thread-posix.h
  269. qemu-thread-win32.c
  270. qemu-thread-win32.h
  271. qemu-thread.h
  272. qemu-timer-common.c
  273. qemu-timer.c
  274. qemu-timer.h
  275. qemu-tls.h
  276. qemu-tool.c
  277. qemu-user.c
  278. qemu-x509.h
  279. qemu-xattr.h
  280. qemu.sasl
  281. qemu_socket.h
  282. qerror.c
  283. qerror.h
  284. qfloat.c
  285. qfloat.h
  286. qint.c
  287. qint.h
  288. qjson.c
  289. qjson.h
  290. qlist.c
  291. qlist.h
  292. qmp-commands.hx
  293. qmp.c
  294. qobject.h
  295. qstring.c
  296. qstring.h
  297. qtest.c
  298. qtest.h
  299. range.h
  300. readline.c
  301. readline.h
  302. README
  303. rules.mak
  304. s390-dis.c
  305. s390.ld
  306. savevm.c
  307. sh4-dis.c
  308. softmmu-semi.h
  309. softmmu_defs.h
  310. softmmu_exec.h
  311. softmmu_header.h
  312. softmmu_template.h
  313. sparc-dis.c
  314. sparc.ld
  315. sparc64.ld
  316. spice-qemu-char.c
  317. sysemu.h
  318. targphys.h
  319. tcg-runtime.c
  320. tci-dis.c
  321. tci.c
  322. thunk.c
  323. thunk.h
  324. TODO
  325. trace-events
  326. translate-all.c
  327. uboot_image.h
  328. user-exec.c
  329. VERSION
  330. version.rc
  331. vgafont.h
  332. vl.c
  333. vmstate.h
  334. x86_64.ld
  335. xen-all.c
  336. xen-mapcache.c
  337. xen-mapcache.h
  338. xen-stub.c