1.. _arm-virt: 2 3'virt' generic virtual platform (``virt``) 4========================================== 5 6The ``virt`` board is a platform which does not correspond to any 7real hardware; it is designed for use in virtual machines. 8It is the recommended board type if you simply want to run 9a guest such as Linux and do not care about reproducing the 10idiosyncrasies and limitations of a particular bit of real-world 11hardware. 12 13This is a "versioned" board model, so as well as the ``virt`` machine 14type itself (which may have improvements, bugfixes and other minor 15changes between QEMU versions) a version is provided that guarantees 16to have the same behaviour as that of previous QEMU releases, so 17that VM migration will work between QEMU versions. For instance the 18``virt-5.0`` machine type will behave like the ``virt`` machine from 19the QEMU 5.0 release, and migration should work between ``virt-5.0`` 20of the 5.0 release and ``virt-5.0`` of the 5.1 release. Migration 21is not guaranteed to work between different QEMU releases for 22the non-versioned ``virt`` machine type. 23 24VM migration is not guaranteed when using ``-cpu max``, as features 25supported may change between QEMU versions. To ensure your VM can be 26migrated, it is recommended to use another cpu model instead. 27 28Supported devices 29""""""""""""""""" 30 31The virt board supports: 32 33- PCI/PCIe devices 34- CXL Fixed memory windows, root bridges and devices. 35- Flash memory 36- Either one or two PL011 UARTs for the NonSecure World 37- An RTC 38- The fw_cfg device that allows a guest to obtain data from QEMU 39- A PL061 GPIO controller 40- An optional SMMUv3 IOMMU 41- hotpluggable DIMMs 42- hotpluggable NVDIMMs 43- An MSI controller (GICv2M or ITS). GICv2M is selected by default along 44 with GICv2. ITS is selected by default with GICv3 (>= virt-2.7). Note 45 that ITS is not modeled in TCG mode. 46- 32 virtio-mmio transport devices 47- running guests using the KVM accelerator on aarch64 hardware 48- large amounts of RAM (at least 255GB, and more if using highmem) 49- many CPUs (up to 512 if using a GICv3 and highmem) 50- Secure-World-only devices if the CPU has TrustZone: 51 52 - A second PL011 UART 53 - A second PL061 GPIO controller, with GPIO lines for triggering 54 a system reset or system poweroff 55 - A secure flash memory 56 - 16MB of secure RAM 57 58The second NonSecure UART only exists if a backend is configured 59explicitly (e.g. with a second -serial command line option) and 60TrustZone emulation is not enabled. 61 62Supported guest CPU types: 63 64- ``cortex-a7`` (32-bit) 65- ``cortex-a15`` (32-bit; the default) 66- ``cortex-a35`` (64-bit) 67- ``cortex-a53`` (64-bit) 68- ``cortex-a55`` (64-bit) 69- ``cortex-a57`` (64-bit) 70- ``cortex-a72`` (64-bit) 71- ``cortex-a76`` (64-bit) 72- ``cortex-a710`` (64-bit) 73- ``a64fx`` (64-bit) 74- ``host`` (with KVM and HVF only) 75- ``neoverse-n1`` (64-bit) 76- ``neoverse-v1`` (64-bit) 77- ``neoverse-n2`` (64-bit) 78- ``max`` (same as ``host`` for KVM and HVF; best possible emulation with TCG) 79 80Note that the default is ``cortex-a15``, so for an AArch64 guest you must 81specify a CPU type. 82 83Also, please note that passing ``max`` CPU (i.e. ``-cpu max``) won't 84enable all the CPU features for a given ``virt`` machine. Where a CPU 85architectural feature requires support in both the CPU itself and in the 86wider system (e.g. the MTE feature), it may not be enabled by default, 87but instead requires a machine option to enable it. 88 89For example, MTE support must be enabled with ``-machine virt,mte=on``, 90as well as by selecting an MTE-capable CPU (e.g., ``max``) with the 91``-cpu`` option. 92 93See the machine-specific options below, or check them for a given machine 94by passing the ``help`` suboption, like: ``-machine virt-9.0,help``. 95 96Graphics output is available, but unlike the x86 PC machine types 97there is no default display device enabled: you should select one from 98the Display devices section of "-device help". The recommended option 99is ``virtio-gpu-pci``; this is the only one which will work correctly 100with KVM. You may also need to ensure your guest kernel is configured 101with support for this; see below. 102 103Machine-specific options 104"""""""""""""""""""""""" 105 106The following machine-specific options are supported: 107 108secure 109 Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the 110 Arm Security Extensions (TrustZone). The default is ``off``. 111 112virtualization 113 Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the 114 Arm Virtualization Extensions. The default is ``off``. 115 116mte 117 Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the 118 Arm Memory Tagging Extensions. The default is ``off``. 119 120highmem 121 Set ``on``/``off`` to enable/disable placing devices and RAM in physical 122 address space above 32 bits. The default is ``on`` for machine types 123 later than ``virt-2.12`` when the CPU supports an address space 124 bigger than 32 bits (i.e. 64-bit CPUs, and 32-bit CPUs with the 125 Large Physical Address Extension (LPAE) feature). If you want to 126 boot a 32-bit kernel which does not have ``CONFIG_LPAE`` enabled on 127 a CPU type which implements LPAE, you will need to manually set 128 this to ``off``; otherwise some devices, such as the PCI controller, 129 will not be accessible. 130 131compact-highmem 132 Set ``on``/``off`` to enable/disable the compact layout for high memory regions. 133 The default is ``on`` for machine types later than ``virt-7.2``. 134 135highmem-redists 136 Set ``on``/``off`` to enable/disable the high memory region for GICv3 or 137 GICv4 redistributor. The default is ``on``. Setting this to ``off`` will 138 limit the maximum number of CPUs when GICv3 or GICv4 is used. 139 140highmem-ecam 141 Set ``on``/``off`` to enable/disable the high memory region for PCI ECAM. 142 The default is ``on`` for machine types later than ``virt-3.0``. 143 144highmem-mmio 145 Set ``on``/``off`` to enable/disable the high memory region for PCI MMIO. 146 The default is ``on``. 147 148highmem-mmio-size 149 Set the high memory region size for PCI MMIO. Must be a power of 2 and 150 greater than or equal to the default size (512G). 151 152gic-version 153 Specify the version of the Generic Interrupt Controller (GIC) to provide. 154 Valid values are: 155 156 ``2`` 157 GICv2. Note that this limits the number of CPUs to 8. 158 ``3`` 159 GICv3. This allows up to 512 CPUs. 160 ``4`` 161 GICv4. Requires ``virtualization`` to be ``on``; allows up to 317 CPUs. 162 ``host`` 163 Use the same GIC version the host provides, when using KVM 164 ``max`` 165 Use the best GIC version possible (same as host when using KVM; 166 with TCG this is currently ``3`` if ``virtualization`` is ``off`` and 167 ``4`` if ``virtualization`` is ``on``, but this may change in future) 168 169its 170 Set ``on``/``off`` to enable/disable ITS instantiation. The default is ``on`` 171 for machine types later than ``virt-2.7``. 172 173iommu 174 Set the IOMMU type to create for the guest. Valid values are: 175 176 ``none`` 177 Don't create an IOMMU (the default) 178 ``smmuv3`` 179 Create an SMMUv3 180 181default-bus-bypass-iommu 182 Set ``on``/``off`` to enable/disable `bypass_iommu 183 <https://gitlab.com/qemu-project/qemu/-/blob/master/docs/bypass-iommu.txt>`_ 184 for default root bus. 185 186ras 187 Set ``on``/``off`` to enable/disable reporting host memory errors to a guest 188 using ACPI and guest external abort exceptions. The default is off. 189 190acpi 191 Set ``on``/``off``/``auto`` to enable/disable ACPI. 192 193cxl 194 Set ``on``/``off`` to enable/disable CXL. More details in 195 :doc:`../devices/cxl`. The default is off. 196 197cxl-fmw 198 Array of CXL fixed memory windows describing fixed address routing to 199 target CXL host bridges. See :doc:`../devices/cxl`. 200 201dtb-randomness 202 Set ``on``/``off`` to pass random seeds via the guest DTB 203 rng-seed and kaslr-seed nodes (in both "/chosen" and 204 "/secure-chosen") to use for features like the random number 205 generator and address space randomisation. The default is 206 ``on``. You will want to disable it if your trusted boot chain 207 will verify the DTB it is passed, since this option causes the 208 DTB to be non-deterministic. It would be the responsibility of 209 the firmware to come up with a seed and pass it on if it wants to. 210 211dtb-kaslr-seed 212 A deprecated synonym for dtb-randomness. 213 214x-oem-id 215 Set string (up to 6 bytes) to override the default value of field OEMID in ACPI 216 table header. 217 218x-oem-table-id 219 Set string (up to 8 bytes) to override the default value of field OEM Table ID 220 in ACPI table header. 221 222Linux guest kernel configuration 223"""""""""""""""""""""""""""""""" 224 225The 'defconfig' for Linux arm and arm64 kernels should include the 226right device drivers for virtio and the PCI controller; however some older 227kernel versions, especially for 32-bit Arm, did not have everything 228enabled by default. If you're not seeing PCI devices that you expect, 229then check that your guest config has:: 230 231 CONFIG_PCI=y 232 CONFIG_VIRTIO_PCI=y 233 CONFIG_PCI_HOST_GENERIC=y 234 235If you want to use the ``virtio-gpu-pci`` graphics device you will also 236need:: 237 238 CONFIG_DRM=y 239 CONFIG_DRM_VIRTIO_GPU=y 240 241Hardware configuration information for bare-metal programming 242""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 243 244The ``virt`` board automatically generates a device tree blob ("dtb") 245which it passes to the guest. This provides information about the 246addresses, interrupt lines and other configuration of the various devices 247in the system. Guest code can rely on and hard-code the following 248addresses: 249 250- Flash memory starts at address 0x0000_0000 251 252- RAM starts at 0x4000_0000 253 254All other information about device locations may change between 255QEMU versions, so guest code must look in the DTB. 256 257QEMU supports two types of guest image boot for ``virt``, and 258the way for the guest code to locate the dtb binary differs: 259 260- For guests using the Linux kernel boot protocol (this means any 261 non-ELF file passed to the QEMU ``-kernel`` option) the address 262 of the DTB is passed in a register (``r2`` for 32-bit guests, 263 or ``x0`` for 64-bit guests) 264 265- For guests booting as "bare-metal" (any other kind of boot), 266 the DTB is at the start of RAM (0x4000_0000) 267