Add stub functions for PCI device models to do PCI DMA

This patch adds functions to pci.[ch] to perform PCI DMA operations.
At present, these are just stubs which perform directly cpu physical
memory accesses.  Stubs are included which are analogous to
cpu_physical_memory_{read,write}(), the stX_phys() and ldX_phys()
functions and cpu_physical_memory_{map,unmap}().

In addition, a wrapper around qemu_sglist_init() is provided, which
also takes a PCIDevice *.  It's assumed that _init() is the only
sglist function which will need wrapping, the idea being that once we
have IOMMU support whatever IOMMU context handle the wrapper derives
from the PCI device will be stored within the sglist structure for
later use.

Using these stubs, however, distinguishes PCI device DMA transactions from
other accesses to physical memory, which will allow PCI IOMMU support to
be added in one place, rather than updating every PCI driver at that time.

That is, it allows us to update individual PCI drivers to support an IOMMU
without having yet determined the details of how the IOMMU emulation will
operate.  This will let us remove the most bitrot-sensitive part of an
IOMMU patch in advance.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
1 file changed
tree: d9f1cf8b3f35d90068c5b86dbb171bafbec69ee6
  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-tls.h
  263. qemu-tool.c
  264. qemu-x509.h
  265. qemu.sasl
  266. qemu_socket.h
  267. qerror.c
  268. qerror.h
  269. qfloat.c
  270. qfloat.h
  271. qint.c
  272. qint.h
  273. qjson.c
  274. qjson.h
  275. qlist.c
  276. qlist.h
  277. qmp-commands.hx
  278. qmp.c
  279. qobject.h
  280. qstring.c
  281. qstring.h
  282. range.h
  283. readline.c
  284. readline.h
  285. README
  286. rules.mak
  287. s390-dis.c
  288. s390.ld
  289. savevm.c
  290. sh4-dis.c
  291. softmmu-semi.h
  292. softmmu_defs.h
  293. softmmu_exec.h
  294. softmmu_header.h
  295. softmmu_template.h
  296. sparc-dis.c
  297. sparc.ld
  298. sparc64.ld
  299. spice-qemu-char.c
  300. sysemu.h
  301. targphys.h
  302. tcg-runtime.c
  303. test-coroutine.c
  304. test-qmp-commands.c
  305. test-visitor.c
  306. thunk.c
  307. thunk.h
  308. TODO
  309. trace-events
  310. translate-all.c
  311. uboot_image.h
  312. usb-bsd.c
  313. usb-linux.c
  314. usb-redir.c
  315. usb-stub.c
  316. user-exec.c
  317. VERSION
  318. version.rc
  319. vgafont.h
  320. vl.c
  321. x86_64.ld
  322. xen-all.c
  323. xen-mapcache.c
  324. xen-mapcache.h
  325. xen-stub.c
  326. xtensa-semi.c