pseries: Use Book3S-HV TCE acceleration capabilities

The pseries machine of qemu implements the TCE mechanism used as a
virtual IOMMU for the PAPR defined virtual IO devices.  Because the
PAPR spec only defines a small DMA address space, the guest VIO
drivers need to update TCE mappings very frequently - the virtual
network device is particularly bad.  This means many slow exits to
qemu to emulate the H_PUT_TCE hypercall.

Sufficiently recent kernels allow this to be mitigated by implementing
H_PUT_TCE in the host kernel.  To make use of this, however, qemu
needs to initialize the necessary TCE tables, and map them into itself
so that the VIO device implementations can retrieve the mappings when
they access guest memory (which is treated as a virtual DMA
operation).

This patch adds the necessary calls to use the KVM TCE acceleration.
If the kernel does not support acceleration, or there is some other
error creating the accelerated TCE table, then it will still fall back
to full userspace TCE implementation.

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