xref: /openbmc/qemu/docs/system/arm/virt.rst (revision 0a19d879)
1'virt' generic virtual platform (``virt``)
2==========================================
3
4The ``virt`` board is a platform which does not correspond to any
5real hardware; it is designed for use in virtual machines.
6It is the recommended board type if you simply want to run
7a guest such as Linux and do not care about reproducing the
8idiosyncrasies and limitations of a particular bit of real-world
9hardware.
10
11This is a "versioned" board model, so as well as the ``virt`` machine
12type itself (which may have improvements, bugfixes and other minor
13changes between QEMU versions) a version is provided that guarantees
14to have the same behaviour as that of previous QEMU releases, so
15that VM migration will work between QEMU versions. For instance the
16``virt-5.0`` machine type will behave like the ``virt`` machine from
17the QEMU 5.0 release, and migration should work between ``virt-5.0``
18of the 5.0 release and ``virt-5.0`` of the 5.1 release. Migration
19is not guaranteed to work between different QEMU releases for
20the non-versioned ``virt`` machine type.
21
22Supported devices
23"""""""""""""""""
24
25The virt board supports:
26
27- PCI/PCIe devices
28- Flash memory
29- One PL011 UART
30- An RTC
31- The fw_cfg device that allows a guest to obtain data from QEMU
32- A PL061 GPIO controller
33- An optional SMMUv3 IOMMU
34- hotpluggable DIMMs
35- hotpluggable NVDIMMs
36- An MSI controller (GICv2M or ITS). GICv2M is selected by default along
37  with GICv2. ITS is selected by default with GICv3 (>= virt-2.7). Note
38  that ITS is not modeled in TCG mode.
39- 32 virtio-mmio transport devices
40- running guests using the KVM accelerator on aarch64 hardware
41- large amounts of RAM (at least 255GB, and more if using highmem)
42- many CPUs (up to 512 if using a GICv3 and highmem)
43- Secure-World-only devices if the CPU has TrustZone:
44
45  - A second PL011 UART
46  - A second PL061 GPIO controller, with GPIO lines for triggering
47    a system reset or system poweroff
48  - A secure flash memory
49  - 16MB of secure RAM
50
51Supported guest CPU types:
52
53- ``cortex-a7`` (32-bit)
54- ``cortex-a15`` (32-bit; the default)
55- ``cortex-a35`` (64-bit)
56- ``cortex-a53`` (64-bit)
57- ``cortex-a55`` (64-bit)
58- ``cortex-a57`` (64-bit)
59- ``cortex-a72`` (64-bit)
60- ``cortex-a76`` (64-bit)
61- ``a64fx`` (64-bit)
62- ``host`` (with KVM only)
63- ``neoverse-n1`` (64-bit)
64- ``neoverse-v1`` (64-bit)
65- ``max`` (same as ``host`` for KVM; best possible emulation with TCG)
66
67Note that the default is ``cortex-a15``, so for an AArch64 guest you must
68specify a CPU type.
69
70Graphics output is available, but unlike the x86 PC machine types
71there is no default display device enabled: you should select one from
72the Display devices section of "-device help". The recommended option
73is ``virtio-gpu-pci``; this is the only one which will work correctly
74with KVM. You may also need to ensure your guest kernel is configured
75with support for this; see below.
76
77Machine-specific options
78""""""""""""""""""""""""
79
80The following machine-specific options are supported:
81
82secure
83  Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
84  Arm Security Extensions (TrustZone). The default is ``off``.
85
86virtualization
87  Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
88  Arm Virtualization Extensions. The default is ``off``.
89
90mte
91  Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
92  Arm Memory Tagging Extensions. The default is ``off``.
93
94highmem
95  Set ``on``/``off`` to enable/disable placing devices and RAM in physical
96  address space above 32 bits. The default is ``on`` for machine types
97  later than ``virt-2.12``.
98
99compact-highmem
100  Set ``on``/``off`` to enable/disable the compact layout for high memory regions.
101  The default is ``on`` for machine types later than ``virt-7.2``.
102
103highmem-redists
104  Set ``on``/``off`` to enable/disable the high memory region for GICv3 or
105  GICv4 redistributor. The default is ``on``. Setting this to ``off`` will
106  limit the maximum number of CPUs when GICv3 or GICv4 is used.
107
108highmem-ecam
109  Set ``on``/``off`` to enable/disable the high memory region for PCI ECAM.
110  The default is ``on`` for machine types later than ``virt-3.0``.
111
112highmem-mmio
113  Set ``on``/``off`` to enable/disable the high memory region for PCI MMIO.
114  The default is ``on``.
115
116gic-version
117  Specify the version of the Generic Interrupt Controller (GIC) to provide.
118  Valid values are:
119
120  ``2``
121    GICv2. Note that this limits the number of CPUs to 8.
122  ``3``
123    GICv3. This allows up to 512 CPUs.
124  ``4``
125    GICv4. Requires ``virtualization`` to be ``on``; allows up to 317 CPUs.
126  ``host``
127    Use the same GIC version the host provides, when using KVM
128  ``max``
129    Use the best GIC version possible (same as host when using KVM;
130    with TCG this is currently ``3`` if ``virtualization`` is ``off`` and
131    ``4`` if ``virtualization`` is ``on``, but this may change in future)
132
133its
134  Set ``on``/``off`` to enable/disable ITS instantiation. The default is ``on``
135  for machine types later than ``virt-2.7``.
136
137iommu
138  Set the IOMMU type to create for the guest. Valid values are:
139
140  ``none``
141    Don't create an IOMMU (the default)
142  ``smmuv3``
143    Create an SMMUv3
144
145ras
146  Set ``on``/``off`` to enable/disable reporting host memory errors to a guest
147  using ACPI and guest external abort exceptions. The default is off.
148
149dtb-randomness
150  Set ``on``/``off`` to pass random seeds via the guest DTB
151  rng-seed and kaslr-seed nodes (in both "/chosen" and
152  "/secure-chosen") to use for features like the random number
153  generator and address space randomisation. The default is
154  ``on``. You will want to disable it if your trusted boot chain
155  will verify the DTB it is passed, since this option causes the
156  DTB to be non-deterministic. It would be the responsibility of
157  the firmware to come up with a seed and pass it on if it wants to.
158
159dtb-kaslr-seed
160  A deprecated synonym for dtb-randomness.
161
162Linux guest kernel configuration
163""""""""""""""""""""""""""""""""
164
165The 'defconfig' for Linux arm and arm64 kernels should include the
166right device drivers for virtio and the PCI controller; however some older
167kernel versions, especially for 32-bit Arm, did not have everything
168enabled by default. If you're not seeing PCI devices that you expect,
169then check that your guest config has::
170
171  CONFIG_PCI=y
172  CONFIG_VIRTIO_PCI=y
173  CONFIG_PCI_HOST_GENERIC=y
174
175If you want to use the ``virtio-gpu-pci`` graphics device you will also
176need::
177
178  CONFIG_DRM=y
179  CONFIG_DRM_VIRTIO_GPU=y
180
181Hardware configuration information for bare-metal programming
182"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
183
184The ``virt`` board automatically generates a device tree blob ("dtb")
185which it passes to the guest. This provides information about the
186addresses, interrupt lines and other configuration of the various devices
187in the system. Guest code can rely on and hard-code the following
188addresses:
189
190- Flash memory starts at address 0x0000_0000
191
192- RAM starts at 0x4000_0000
193
194All other information about device locations may change between
195QEMU versions, so guest code must look in the DTB.
196
197QEMU supports two types of guest image boot for ``virt``, and
198the way for the guest code to locate the dtb binary differs:
199
200- For guests using the Linux kernel boot protocol (this means any
201  non-ELF file passed to the QEMU ``-kernel`` option) the address
202  of the DTB is passed in a register (``r2`` for 32-bit guests,
203  or ``x0`` for 64-bit guests)
204
205- For guests booting as "bare-metal" (any other kind of boot),
206  the DTB is at the start of RAM (0x4000_0000)
207