2
0

codebase.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. ========
  2. Codebase
  3. ========
  4. This section presents the various parts of QEMU and how the codebase is
  5. organized.
  6. Beyond giving succinct descriptions, the goal is to offer links to various
  7. parts of the documentation/codebase.
  8. Subsystems
  9. ----------
  10. An exhaustive list of subsystems and associated files can be found in the
  11. `MAINTAINERS <https://gitlab.com/qemu-project/qemu/-/blob/master/MAINTAINERS>`_
  12. file.
  13. Some of the main QEMU subsystems are:
  14. - `Accelerators<Accelerators>`
  15. - Block devices and `disk images<disk images>` support
  16. - `CI<ci>` and `Tests<testing>`
  17. - `Devices<device-emulation>` & Board models
  18. - `Documentation <documentation-root>`
  19. - `GDB support<GDB usage>`
  20. - :ref:`Migration<migration>`
  21. - `Monitor<QEMU monitor>`
  22. - :ref:`QOM (QEMU Object Model)<qom>`
  23. - `System mode<System emulation>`
  24. - :ref:`TCG (Tiny Code Generator)<tcg>`
  25. - `User mode<user-mode>` (`Linux<linux-user-mode>` & `BSD<bsd-user-mode>`)
  26. - User Interfaces
  27. More documentation on QEMU subsystems can be found on :ref:`internal-subsystem`
  28. page.
  29. The Grand tour
  30. --------------
  31. We present briefly here what every folder in the top directory of the codebase
  32. contains. Hop on!
  33. The folder name links here will take you to that folder in our gitlab
  34. repository. Other links will take you to more detailed documentation for that
  35. subsystem, where we have it. Unfortunately not every subsystem has documentation
  36. yet, so sometimes the source code is all you have.
  37. * `accel <https://gitlab.com/qemu-project/qemu/-/tree/master/accel>`_:
  38. Infrastructure and architecture agnostic code related to the various
  39. `accelerators <Accelerators>` supported by QEMU
  40. (TCG, KVM, hvf, whpx, xen, nvmm).
  41. Contains interfaces for operations that will be implemented per
  42. `target <https://gitlab.com/qemu-project/qemu/-/tree/master/target>`_.
  43. * `audio <https://gitlab.com/qemu-project/qemu/-/tree/master/audio>`_:
  44. Audio (host) support.
  45. * `authz <https://gitlab.com/qemu-project/qemu/-/tree/master/authz>`_:
  46. `QEMU Authorization framework<client authorization>`.
  47. * `backends <https://gitlab.com/qemu-project/qemu/-/tree/master/backends>`_:
  48. Various backends that are used to access resources on the host (e.g. for
  49. random number generation, memory backing or cryptographic functions).
  50. * `block <https://gitlab.com/qemu-project/qemu/-/tree/master/block>`_:
  51. Block devices and `image formats<disk images>` implementation.
  52. * `bsd-user <https://gitlab.com/qemu-project/qemu/-/tree/master/bsd-user>`_:
  53. `BSD User mode<bsd-user-mode>`.
  54. * build: Where the code built goes by default. You can tell the QEMU build
  55. system to put the built code anywhere else you like.
  56. * `chardev <https://gitlab.com/qemu-project/qemu/-/tree/master/chardev>`_:
  57. Various backends used by char devices.
  58. * `common-user <https://gitlab.com/qemu-project/qemu/-/tree/master/common-user>`_:
  59. User-mode assembly code for dealing with signals occurring during syscalls.
  60. * `configs <https://gitlab.com/qemu-project/qemu/-/tree/master/configs>`_:
  61. Makefiles defining configurations to build QEMU.
  62. * `contrib <https://gitlab.com/qemu-project/qemu/-/tree/master/contrib>`_:
  63. Community contributed devices/plugins/tools.
  64. * `crypto <https://gitlab.com/qemu-project/qemu/-/tree/master/crypto>`_:
  65. Cryptographic algorithms used in QEMU.
  66. * `disas <https://gitlab.com/qemu-project/qemu/-/tree/master/disas>`_:
  67. Disassembly functions used by QEMU target code.
  68. * `docs <https://gitlab.com/qemu-project/qemu/-/tree/master/docs>`_:
  69. QEMU Documentation.
  70. * `dump <https://gitlab.com/qemu-project/qemu/-/tree/master/dump>`_:
  71. Code to dump memory of a running VM.
  72. * `ebpf <https://gitlab.com/qemu-project/qemu/-/tree/master/ebpf>`_:
  73. eBPF program support in QEMU. `virtio-net RSS<ebpf-rss>` uses it.
  74. * `fpu <https://gitlab.com/qemu-project/qemu/-/tree/master/fpu>`_:
  75. Floating-point software emulation.
  76. * `fsdev <https://gitlab.com/qemu-project/qemu/-/tree/master/fsdev>`_:
  77. `VirtFS <https://www.linux-kvm.org/page/VirtFS>`_ support.
  78. * `gdbstub <https://gitlab.com/qemu-project/qemu/-/tree/master/gdbstub>`_:
  79. `GDB <GDB usage>` support.
  80. * `gdb-xml <https://gitlab.com/qemu-project/qemu/-/tree/master/gdb-xml>`_:
  81. Set of XML files describing architectures and used by `gdbstub <GDB usage>`.
  82. * `host <https://gitlab.com/qemu-project/qemu/-/tree/master/host>`_:
  83. Various architecture specific header files (crypto, atomic, memory
  84. operations).
  85. * `linux-headers <https://gitlab.com/qemu-project/qemu/-/tree/master/linux-headers>`_:
  86. A subset of headers imported from Linux kernel and used for implementing
  87. KVM support and user-mode.
  88. * `linux-user <https://gitlab.com/qemu-project/qemu/-/tree/master/linux-user>`_:
  89. `User mode <user-mode>` implementation. Contains one folder per target
  90. architecture.
  91. * `.gitlab-ci.d <https://gitlab.com/qemu-project/qemu/-/tree/master/.gitlab-ci.d>`_:
  92. `CI <ci>` yaml and scripts.
  93. * `include <https://gitlab.com/qemu-project/qemu/-/tree/master/include>`_:
  94. All headers associated to different subsystems in QEMU. The hierarchy used
  95. mirrors source code organization and naming.
  96. * `hw <https://gitlab.com/qemu-project/qemu/-/tree/master/hw>`_:
  97. `Devices <device-emulation>` and boards emulation. Devices are categorized by
  98. type/protocol/architecture and located in associated subfolder.
  99. * `io <https://gitlab.com/qemu-project/qemu/-/tree/master/io>`_:
  100. QEMU `I/O channels <https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg04208.html>`_.
  101. * `libdecnumber <https://gitlab.com/qemu-project/qemu/-/tree/master/libdecnumber>`_:
  102. Import of gcc library, used to implement decimal number arithmetic.
  103. * `migration <https://gitlab.com/qemu-project/qemu/-/tree/master/migration>`__:
  104. :ref:`Migration framework <migration>`.
  105. * `monitor <https://gitlab.com/qemu-project/qemu/-/tree/master/monitor>`_:
  106. `Monitor <QEMU monitor>` implementation (HMP & QMP).
  107. * `nbd <https://gitlab.com/qemu-project/qemu/-/tree/master/nbd>`_:
  108. QEMU `NBD (Network Block Device) <nbd>` server.
  109. * `net <https://gitlab.com/qemu-project/qemu/-/tree/master/net>`_:
  110. Network (host) support.
  111. * `pc-bios <https://gitlab.com/qemu-project/qemu/-/tree/master/pc-bios>`_:
  112. Contains pre-built firmware binaries and boot images, ready to use in
  113. QEMU without compilation.
  114. * `plugins <https://gitlab.com/qemu-project/qemu/-/tree/master/plugins>`_:
  115. :ref:`TCG plugins <tcg-plugins>` core implementation. Plugins can be found in
  116. `tests <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/tcg/plugins>`__
  117. and `contrib <https://gitlab.com/qemu-project/qemu/-/tree/master/contrib/plugins>`__
  118. folders.
  119. * `po <https://gitlab.com/qemu-project/qemu/-/tree/master/po>`_:
  120. Translation files.
  121. * `python <https://gitlab.com/qemu-project/qemu/-/tree/master/python>`_:
  122. Python part of our build/test system.
  123. * `qapi <https://gitlab.com/qemu-project/qemu/-/tree/master/qapi>`_:
  124. `QAPI <qapi>` implementation.
  125. * `qobject <https://gitlab.com/qemu-project/qemu/-/tree/master/qobject>`_:
  126. QEMU Object implementation.
  127. * `qga <https://gitlab.com/qemu-project/qemu/-/tree/master/qga>`_:
  128. QEMU `Guest agent <qemu-ga>` implementation.
  129. * `qom <https://gitlab.com/qemu-project/qemu/-/tree/master/qom>`_:
  130. QEMU :ref:`Object model <qom>` implementation, with monitor associated commands.
  131. * `replay <https://gitlab.com/qemu-project/qemu/-/tree/master/replay>`_:
  132. QEMU :ref:`Record/replay <replay>` implementation.
  133. * `roms <https://gitlab.com/qemu-project/qemu/-/tree/master/roms>`_:
  134. Contains source code for various firmware and ROMs, which can be compiled if
  135. custom or updated versions are needed.
  136. * `rust <https://gitlab.com/qemu-project/qemu/-/tree/master/rust>`_:
  137. Rust integration in QEMU. It contains the new interfaces defined and
  138. associated devices using it.
  139. * `scripts <https://gitlab.com/qemu-project/qemu/-/tree/master/scripts>`_:
  140. Collection of scripts used in build and test systems, and various
  141. tools for QEMU codebase and execution traces.
  142. * `scsi <https://gitlab.com/qemu-project/qemu/-/tree/master/scsi>`_:
  143. Code related to SCSI support, used by SCSI devices.
  144. * `semihosting <https://gitlab.com/qemu-project/qemu/-/tree/master/semihosting>`_:
  145. QEMU `Semihosting <Semihosting>` implementation.
  146. * `stats <https://gitlab.com/qemu-project/qemu/-/tree/master/stats>`_:
  147. `Monitor <QEMU monitor>` stats commands implementation.
  148. * `storage-daemon <https://gitlab.com/qemu-project/qemu/-/tree/master/storage-daemon>`_:
  149. QEMU `Storage daemon <storage-daemon>` implementation.
  150. * `stubs <https://gitlab.com/qemu-project/qemu/-/tree/master/stubs>`_:
  151. Various stubs (empty functions) used to compile QEMU with specific
  152. configurations.
  153. * `subprojects <https://gitlab.com/qemu-project/qemu/-/tree/master/subprojects>`_:
  154. QEMU submodules used by QEMU build system.
  155. * `system <https://gitlab.com/qemu-project/qemu/-/tree/master/system>`_:
  156. QEMU `system mode <System emulation>` implementation (cpu, mmu, boot support).
  157. * `target <https://gitlab.com/qemu-project/qemu/-/tree/master/target>`_:
  158. Contains code for all target architectures supported (one subfolder
  159. per arch). For every architecture, you can find accelerator specific
  160. implementations.
  161. * `tcg <https://gitlab.com/qemu-project/qemu/-/tree/master/tcg>`_:
  162. :ref:`TCG <tcg>` related code.
  163. Contains one subfolder per host supported architecture.
  164. * `tests <https://gitlab.com/qemu-project/qemu/-/tree/master/tests>`_:
  165. QEMU `test <testing>` suite
  166. - `avocado <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/avocado>`_:
  167. Functional tests booting full VM using `Avocado framework <checkavocado-ref>`.
  168. Those tests will be transformed and moved into
  169. `tests/functional <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/functional>`_
  170. in the future.
  171. - `data <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/data>`_:
  172. Data for various tests.
  173. - `decode <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/decode>`_:
  174. Testsuite for :ref:`decodetree <decodetree>` implementation.
  175. - `docker <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/docker>`_:
  176. Code and scripts to create `containers <container-ref>` used in `CI <ci>`.
  177. - `fp <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/fp>`_:
  178. QEMU testsuite for soft float implementation.
  179. - `functional <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/functional>`_:
  180. `Functional tests <checkfunctional-ref>` (full VM boot).
  181. - `lcitool <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/lcitool>`_:
  182. Generate dockerfiles for CI containers.
  183. - `migration <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/migration>`_:
  184. Test scripts and data for :ref:`Migration framework <migration>`.
  185. - `multiboot <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/multiboot>`_:
  186. Test multiboot functionality for x86_64/i386.
  187. - `qapi-schema <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/qapi-schema>`_:
  188. Test scripts and data for `QAPI <qapi-tests>`.
  189. - `qemu-iotests <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/qemu-iotests>`_:
  190. `Disk image and block tests <qemu-iotests>`.
  191. - `qtest <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/qtest>`_:
  192. `Device emulation testing <qtest>`.
  193. - `tcg <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/tcg>`__:
  194. `TCG related tests <checktcg-ref>`. Contains code per architecture
  195. (subfolder) and multiarch tests as well.
  196. - `tsan <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/tsan>`_:
  197. `Suppressions <tsan-suppressions>` for thread sanitizer.
  198. - `uefi-test-tools <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/uefi-test-tools>`_:
  199. Test tool for UEFI support.
  200. - `unit <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/unit>`_:
  201. QEMU `Unit tests <unit-tests>`.
  202. * `trace <https://gitlab.com/qemu-project/qemu/-/tree/master/trace>`_:
  203. :ref:`Tracing framework <tracing>`. Used to print information associated to various
  204. events during execution.
  205. * `ui <https://gitlab.com/qemu-project/qemu/-/tree/master/ui>`_:
  206. QEMU User interfaces.
  207. * `util <https://gitlab.com/qemu-project/qemu/-/tree/master/util>`_:
  208. Utility code used by other parts of QEMU.