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