xref: /openbmc/qemu/docs/system/arm/virt.rst (revision eabfeb0c)
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 secure flash memory
47  - 16MB of secure RAM
48
49Supported guest CPU types:
50
51- ``cortex-a7`` (32-bit)
52- ``cortex-a15`` (32-bit; the default)
53- ``cortex-a53`` (64-bit)
54- ``cortex-a57`` (64-bit)
55- ``cortex-a72`` (64-bit)
56- ``host`` (with KVM only)
57- ``max`` (same as ``host`` for KVM; best possible emulation with TCG)
58
59Note that the default is ``cortex-a15``, so for an AArch64 guest you must
60specify a CPU type.
61
62Graphics output is available, but unlike the x86 PC machine types
63there is no default display device enabled: you should select one from
64the Display devices section of "-device help". The recommended option
65is ``virtio-gpu-pci``; this is the only one which will work correctly
66with KVM. You may also need to ensure your guest kernel is configured
67with support for this; see below.
68
69Machine-specific options
70""""""""""""""""""""""""
71
72The following machine-specific options are supported:
73
74secure
75  Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
76  Arm Security Extensions (TrustZone). The default is ``off``.
77
78virtualization
79  Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
80  Arm Virtualization Extensions. The default is ``off``.
81
82highmem
83  Set ``on``/``off`` to enable/disable placing devices and RAM in physical
84  address space above 32 bits. The default is ``on`` for machine types
85  later than ``virt-2.12``.
86
87gic-version
88  Specify the version of the Generic Interrupt Controller (GIC) to provide.
89  Valid values are:
90
91  ``2``
92    GICv2
93  ``3``
94    GICv3
95  ``host``
96    Use the same GIC version the host provides, when using KVM
97  ``max``
98    Use the best GIC version possible (same as host when using KVM;
99    currently same as ``3``` for TCG, but this may change in future)
100
101its
102  Set ``on``/``off`` to enable/disable ITS instantiation. The default is ``on``
103  for machine types later than ``virt-2.7``.
104
105iommu
106  Set the IOMMU type to create for the guest. Valid values are:
107
108  ``none``
109    Don't create an IOMMU (the default)
110  ``smmuv3``
111    Create an SMMUv3
112
113ras
114  Set ``on``/``off`` to enable/disable reporting host memory errors to a guest
115  using ACPI and guest external abort exceptions. The default is off.
116
117Linux guest kernel configuration
118""""""""""""""""""""""""""""""""
119
120The 'defconfig' for Linux arm and arm64 kernels should include the
121right device drivers for virtio and the PCI controller; however some older
122kernel versions, especially for 32-bit Arm, did not have everything
123enabled by default. If you're not seeing PCI devices that you expect,
124then check that your guest config has::
125
126  CONFIG_PCI=y
127  CONFIG_VIRTIO_PCI=y
128  CONFIG_PCI_HOST_GENERIC=y
129
130If you want to use the ``virtio-gpu-pci`` graphics device you will also
131need::
132
133  CONFIG_DRM=y
134  CONFIG_DRM_VIRTIO_GPU=y
135
136Hardware configuration information for bare-metal programming
137"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
138
139The ``virt`` board automatically generates a device tree blob ("dtb")
140which it passes to the guest. This provides information about the
141addresses, interrupt lines and other configuration of the various devices
142in the system. Guest code can rely on and hard-code the following
143addresses:
144
145- Flash memory starts at address 0x0000_0000
146
147- RAM starts at 0x4000_0000
148
149All other information about device locations may change between
150QEMU versions, so guest code must look in the DTB.
151
152QEMU supports two types of guest image boot for ``virt``, and
153the way for the guest code to locate the dtb binary differs:
154
155- For guests using the Linux kernel boot protocol (this means any
156  non-ELF file passed to the QEMU ``-kernel`` option) the address
157  of the DTB is passed in a register (``r2`` for 32-bit guests,
158  or ``x0`` for 64-bit guests)
159
160- For guests booting as "bare-metal" (any other kind of boot),
161  the DTB is at the start of RAM (0x4000_0000)
162