Skip to content

Commit 7f63144

Browse files
pbo-linarostsquad
authored andcommitted
docs/devel: add a codebase section
Present the various parts of QEMU and organization of codebase. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20241209183104.365796-6-pierrick.bouvier@linaro.org> [AJB: tweak commit summary, update MAINTAINERS] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250116160306.1709518-36-alex.bennee@linaro.org>
1 parent 75dbfba commit 7f63144

File tree

16 files changed

+257
-1
lines changed

16 files changed

+257
-1
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ W: https://www.qemu.org/docs/master/devel/index.html
7474
S: Odd Fixes
7575
F: docs/devel/build-environment.rst
7676
F: docs/devel/code-of-conduct.rst
77+
F: docs/devel/codebase.rst
7778
F: docs/devel/conflict-resolution.rst
7879
F: docs/devel/style.rst
7980
F: docs/devel/submitting-a-patch.rst

docs/about/emulation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ for that architecture.
176176
- System
177177
- Tensilica ISS SIMCALL
178178

179+
.. _tcg-plugins:
180+
179181
TCG Plugins
180182
-----------
181183

docs/devel/codebase.rst

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
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 succint 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+
- `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 occuring 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 hierachy 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+
`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) <nbd>` 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+
- `avocado <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/avocado>`_:
179+
Functional tests booting full VM using `Avocado framework <checkavocado-ref>`.
180+
Those tests will be transformed and moved into
181+
`tests/functional <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/functional>`_
182+
in the future.
183+
- `data <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/data>`_:
184+
Data for various tests.
185+
- `decode <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/decode>`_:
186+
Testsuite for :ref:`decodetree <decodetree>` implementation.
187+
- `docker <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/docker>`_:
188+
Code and scripts to create `containers <container-ref>` used in `CI <ci>`.
189+
- `fp <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/fp>`_:
190+
QEMU testsuite for soft float implementation.
191+
- `functional <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/functional>`_:
192+
`Functional tests <checkfunctional-ref>` (full VM boot).
193+
- `lcitool <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/lcitool>`_:
194+
Generate dockerfiles for CI containers.
195+
- `migration <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/migration>`_:
196+
Test scripts and data for `Migration framework <migration>`.
197+
- `multiboot <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/multiboot>`_:
198+
Test multiboot functionality for x86_64/i386.
199+
- `qapi-schema <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/qapi-schema>`_:
200+
Test scripts and data for `QAPI <qapi-tests>`.
201+
- `qemu-iotests <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/qemu-iotests>`_:
202+
`Disk image and block tests <qemu-iotests>`.
203+
- `qtest <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/qtest>`_:
204+
`Device emulation testing <qtest>`.
205+
- `tcg <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/tcg>`__:
206+
`TCG related tests <checktcg-ref>`. Contains code per architecture
207+
(subfolder) and multiarch tests as well.
208+
- `tsan <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/tsan>`_:
209+
`Suppressions <tsan-suppressions>` for thread sanitizer.
210+
- `uefi-test-tools <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/uefi-test-tools>`_:
211+
Test tool for UEFI support.
212+
- `unit <https://gitlab.com/qemu-project/qemu/-/tree/master/tests/unit>`_:
213+
QEMU `Unit tests <unit-tests>`.
214+
* `trace <https://gitlab.com/qemu-project/qemu/-/tree/master/trace>`_:
215+
:ref:`Tracing framework <tracing>`. Used to print information associated to various
216+
events during execution.
217+
* `ui <https://gitlab.com/qemu-project/qemu/-/tree/master/ui>`_:
218+
QEMU User interfaces.
219+
* `util <https://gitlab.com/qemu-project/qemu/-/tree/master/util>`_:
220+
Utility code used by other parts of QEMU.

docs/devel/decodetree.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _decodetree:
2+
13
========================
24
Decodetree Specification
35
========================

docs/devel/ebpf_rss.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _ebpf-rss:
2+
13
===========================
24
eBPF RSS virtio-net support
35
===========================

docs/devel/index-internals.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _internal-subsystem:
2+
13
Internal Subsystem Information
24
------------------------------
35

docs/devel/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ the :ref:`tcg_internals`.
3535
index-api
3636
index-internals
3737
index-tcg
38+
codebase

docs/devel/migration/main.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _migration:
2+
13
===================
24
Migration framework
35
===================

docs/devel/qapi-code-gen.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ How to use the QAPI code generator
99
This work is licensed under the terms of the GNU GPL, version 2 or
1010
later. See the COPYING file in the top-level directory.
1111

12+
.. _qapi:
1213

1314
Introduction
1415
============

docs/devel/testing/main.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Before running tests, it is best to build QEMU programs first. Some tests
3939
expect the executables to exist and will fail with obscure messages if they
4040
cannot find them.
4141

42+
.. _unit-tests:
43+
4244
Unit tests
4345
~~~~~~~~~~
4446

@@ -126,6 +128,8 @@ successfully on various hosts. The following list shows some best practices:
126128
#ifdef in the codes. If the whole test suite cannot run on Windows, disable
127129
the build in the meson.build file.
128130

131+
.. _qapi-tests:
132+
129133
QAPI schema tests
130134
~~~~~~~~~~~~~~~~~
131135

@@ -160,6 +164,8 @@ check-block
160164
are in the "auto" group).
161165
See the "QEMU iotests" section below for more information.
162166

167+
.. _qemu-iotests:
168+
163169
QEMU iotests
164170
------------
165171

@@ -679,6 +685,8 @@ The above exitcode=0 has TSan continue without error if any warnings are found.
679685
This allows for running the test and then checking the warnings afterwards.
680686
If you want TSan to stop and exit with error on warnings, use exitcode=66.
681687

688+
.. _tsan-suppressions:
689+
682690
TSan Suppressions
683691
~~~~~~~~~~~~~~~~~
684692
Keep in mind that for any data race warning, although there might be a data race
@@ -901,7 +909,6 @@ You can run the avocado tests simply by executing:
901909
902910
See :ref:`checkavocado-ref` for more details.
903911

904-
905912
.. _checktcg-ref:
906913

907914
Testing with "make check-tcg"

0 commit comments

Comments
 (0)