xref: /qemu/docs/system/arm/virt.rst (revision a4340e7c522e3f20abeac061a5a8b319f715c1d0)
1*a4340e7cSPierrick Bouvier.. _arm-virt:
2*a4340e7cSPierrick Bouvier
36a0b7505SPeter Maydell'virt' generic virtual platform (``virt``)
46a0b7505SPeter Maydell==========================================
56a0b7505SPeter Maydell
66df743dcSPeter MaydellThe ``virt`` board is a platform which does not correspond to any
76a0b7505SPeter Maydellreal hardware; it is designed for use in virtual machines.
86a0b7505SPeter MaydellIt is the recommended board type if you simply want to run
96a0b7505SPeter Maydella guest such as Linux and do not care about reproducing the
106a0b7505SPeter Maydellidiosyncrasies and limitations of a particular bit of real-world
116a0b7505SPeter Maydellhardware.
126a0b7505SPeter Maydell
136a0b7505SPeter MaydellThis is a "versioned" board model, so as well as the ``virt`` machine
146a0b7505SPeter Maydelltype itself (which may have improvements, bugfixes and other minor
156a0b7505SPeter Maydellchanges between QEMU versions) a version is provided that guarantees
166a0b7505SPeter Maydellto have the same behaviour as that of previous QEMU releases, so
176a0b7505SPeter Maydellthat VM migration will work between QEMU versions. For instance the
186a0b7505SPeter Maydell``virt-5.0`` machine type will behave like the ``virt`` machine from
196a0b7505SPeter Maydellthe QEMU 5.0 release, and migration should work between ``virt-5.0``
206a0b7505SPeter Maydellof the 5.0 release and ``virt-5.0`` of the 5.1 release. Migration
216a0b7505SPeter Maydellis not guaranteed to work between different QEMU releases for
226a0b7505SPeter Maydellthe non-versioned ``virt`` machine type.
236a0b7505SPeter Maydell
24435d260eSPierrick BouvierVM migration is not guaranteed when using ``-cpu max``, as features
25435d260eSPierrick Bouviersupported may change between QEMU versions.  To ensure your VM can be
26435d260eSPierrick Bouviermigrated, it is recommended to use another cpu model instead.
27435d260eSPierrick Bouvier
286a0b7505SPeter MaydellSupported devices
296a0b7505SPeter Maydell"""""""""""""""""
306a0b7505SPeter Maydell
316a0b7505SPeter MaydellThe virt board supports:
326a0b7505SPeter Maydell
336a0b7505SPeter Maydell- PCI/PCIe devices
346a0b7505SPeter Maydell- Flash memory
35e7100972SPeter Maydell- Either one or two PL011 UARTs for the NonSecure World
366a0b7505SPeter Maydell- An RTC
376a0b7505SPeter Maydell- The fw_cfg device that allows a guest to obtain data from QEMU
386a0b7505SPeter Maydell- A PL061 GPIO controller
396a0b7505SPeter Maydell- An optional SMMUv3 IOMMU
406a0b7505SPeter Maydell- hotpluggable DIMMs
416a0b7505SPeter Maydell- hotpluggable NVDIMMs
426a0b7505SPeter Maydell- An MSI controller (GICv2M or ITS). GICv2M is selected by default along
436a0b7505SPeter Maydell  with GICv2. ITS is selected by default with GICv3 (>= virt-2.7). Note
446a0b7505SPeter Maydell  that ITS is not modeled in TCG mode.
456a0b7505SPeter Maydell- 32 virtio-mmio transport devices
466a0b7505SPeter Maydell- running guests using the KVM accelerator on aarch64 hardware
476a0b7505SPeter Maydell- large amounts of RAM (at least 255GB, and more if using highmem)
486a0b7505SPeter Maydell- many CPUs (up to 512 if using a GICv3 and highmem)
496a0b7505SPeter Maydell- Secure-World-only devices if the CPU has TrustZone:
506a0b7505SPeter Maydell
516a0b7505SPeter Maydell  - A second PL011 UART
52daa726d9SMaxim Uvarov  - A second PL061 GPIO controller, with GPIO lines for triggering
53daa726d9SMaxim Uvarov    a system reset or system poweroff
546a0b7505SPeter Maydell  - A secure flash memory
556a0b7505SPeter Maydell  - 16MB of secure RAM
566a0b7505SPeter Maydell
57e7100972SPeter MaydellThe second NonSecure UART only exists if a backend is configured
58e7100972SPeter Maydellexplicitly (e.g. with a second -serial command line option) and
59e7100972SPeter MaydellTrustZone emulation is not enabled.
60e7100972SPeter Maydell
616a0b7505SPeter MaydellSupported guest CPU types:
626a0b7505SPeter Maydell
636a0b7505SPeter Maydell- ``cortex-a7`` (32-bit)
646a0b7505SPeter Maydell- ``cortex-a15`` (32-bit; the default)
653b16766bSHao Wu- ``cortex-a35`` (64-bit)
666a0b7505SPeter Maydell- ``cortex-a53`` (64-bit)
6794bc3b06STimofey Kutergin- ``cortex-a55`` (64-bit)
686a0b7505SPeter Maydell- ``cortex-a57`` (64-bit)
696a0b7505SPeter Maydell- ``cortex-a72`` (64-bit)
702f6283fcSRichard Henderson- ``cortex-a76`` (64-bit)
71e3d45c0aSRichard Henderson- ``cortex-a710`` (64-bit)
724d39fcd8SShuuichirou Ishii- ``a64fx`` (64-bit)
736a0b7505SPeter Maydell- ``host`` (with KVM only)
745db6de80SRichard Henderson- ``neoverse-n1`` (64-bit)
75c74138c6SPeter Maydell- ``neoverse-v1`` (64-bit)
76dfff1000SPeter Maydell- ``neoverse-n2`` (64-bit)
776a0b7505SPeter Maydell- ``max`` (same as ``host`` for KVM; best possible emulation with TCG)
786a0b7505SPeter Maydell
796a0b7505SPeter MaydellNote that the default is ``cortex-a15``, so for an AArch64 guest you must
806a0b7505SPeter Maydellspecify a CPU type.
816a0b7505SPeter Maydell
821acf2159SGustavo RomeroAlso, please note that passing ``max`` CPU (i.e. ``-cpu max``) won't
831acf2159SGustavo Romeroenable all the CPU features for a given ``virt`` machine. Where a CPU
841acf2159SGustavo Romeroarchitectural feature requires support in both the CPU itself and in the
851acf2159SGustavo Romerowider system (e.g. the MTE feature), it may not be enabled by default,
861acf2159SGustavo Romerobut instead requires a machine option to enable it.
871acf2159SGustavo Romero
881acf2159SGustavo RomeroFor example, MTE support must be enabled with ``-machine virt,mte=on``,
891acf2159SGustavo Romeroas well as by selecting an MTE-capable CPU (e.g., ``max``) with the
901acf2159SGustavo Romero``-cpu`` option.
911acf2159SGustavo Romero
921acf2159SGustavo RomeroSee the machine-specific options below, or check them for a given machine
931acf2159SGustavo Romeroby passing the ``help`` suboption, like: ``-machine virt-9.0,help``.
941acf2159SGustavo Romero
956a0b7505SPeter MaydellGraphics output is available, but unlike the x86 PC machine types
966a0b7505SPeter Maydellthere is no default display device enabled: you should select one from
976a0b7505SPeter Maydellthe Display devices section of "-device help". The recommended option
986a0b7505SPeter Maydellis ``virtio-gpu-pci``; this is the only one which will work correctly
996a0b7505SPeter Maydellwith KVM. You may also need to ensure your guest kernel is configured
1006a0b7505SPeter Maydellwith support for this; see below.
1016a0b7505SPeter Maydell
1026a0b7505SPeter MaydellMachine-specific options
1036a0b7505SPeter Maydell""""""""""""""""""""""""
1046a0b7505SPeter Maydell
1056a0b7505SPeter MaydellThe following machine-specific options are supported:
1066a0b7505SPeter Maydell
1076a0b7505SPeter Maydellsecure
1086a0b7505SPeter Maydell  Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
1096a0b7505SPeter Maydell  Arm Security Extensions (TrustZone). The default is ``off``.
1106a0b7505SPeter Maydell
1116a0b7505SPeter Maydellvirtualization
1126a0b7505SPeter Maydell  Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
1136a0b7505SPeter Maydell  Arm Virtualization Extensions. The default is ``off``.
1146a0b7505SPeter Maydell
115222f45b7SPeter Maydellmte
116222f45b7SPeter Maydell  Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
117222f45b7SPeter Maydell  Arm Memory Tagging Extensions. The default is ``off``.
118222f45b7SPeter Maydell
1196a0b7505SPeter Maydellhighmem
1206a0b7505SPeter Maydell  Set ``on``/``off`` to enable/disable placing devices and RAM in physical
1216a0b7505SPeter Maydell  address space above 32 bits. The default is ``on`` for machine types
1228cf1da72SPeter Maydell  later than ``virt-2.12`` when the CPU supports an address space
1238cf1da72SPeter Maydell  bigger than 32 bits (i.e. 64-bit CPUs, and 32-bit CPUs with the
1248cf1da72SPeter Maydell  Large Physical Address Extension (LPAE) feature). If you want to
1258cf1da72SPeter Maydell  boot a 32-bit kernel which does not have ``CONFIG_LPAE`` enabled on
1268cf1da72SPeter Maydell  a CPU type which implements LPAE, you will need to manually set
1278cf1da72SPeter Maydell  this to ``off``; otherwise some devices, such as the PCI controller,
1288cf1da72SPeter Maydell  will not be accessible.
1296a0b7505SPeter Maydell
130f40408a9SGavin Shancompact-highmem
131f40408a9SGavin Shan  Set ``on``/``off`` to enable/disable the compact layout for high memory regions.
132f40408a9SGavin Shan  The default is ``on`` for machine types later than ``virt-7.2``.
133f40408a9SGavin Shan
1346a48c64eSGavin Shanhighmem-redists
1356a48c64eSGavin Shan  Set ``on``/``off`` to enable/disable the high memory region for GICv3 or
1366a48c64eSGavin Shan  GICv4 redistributor. The default is ``on``. Setting this to ``off`` will
1376a48c64eSGavin Shan  limit the maximum number of CPUs when GICv3 or GICv4 is used.
1386a48c64eSGavin Shan
1396a48c64eSGavin Shanhighmem-ecam
1406a48c64eSGavin Shan  Set ``on``/``off`` to enable/disable the high memory region for PCI ECAM.
1416a48c64eSGavin Shan  The default is ``on`` for machine types later than ``virt-3.0``.
1426a48c64eSGavin Shan
1436a48c64eSGavin Shanhighmem-mmio
1446a48c64eSGavin Shan  Set ``on``/``off`` to enable/disable the high memory region for PCI MMIO.
1456a48c64eSGavin Shan  The default is ``on``.
1466a48c64eSGavin Shan
1476a0b7505SPeter Maydellgic-version
1486a0b7505SPeter Maydell  Specify the version of the Generic Interrupt Controller (GIC) to provide.
1496a0b7505SPeter Maydell  Valid values are:
1506a0b7505SPeter Maydell
1516a0b7505SPeter Maydell  ``2``
15201130173SHeinrich Schuchardt    GICv2. Note that this limits the number of CPUs to 8.
1536a0b7505SPeter Maydell  ``3``
15401130173SHeinrich Schuchardt    GICv3. This allows up to 512 CPUs.
1557cf3f8d2SPeter Maydell  ``4``
1567cf3f8d2SPeter Maydell    GICv4. Requires ``virtualization`` to be ``on``; allows up to 317 CPUs.
1576a0b7505SPeter Maydell  ``host``
1586a0b7505SPeter Maydell    Use the same GIC version the host provides, when using KVM
1596a0b7505SPeter Maydell  ``max``
1606a0b7505SPeter Maydell    Use the best GIC version possible (same as host when using KVM;
1617cf3f8d2SPeter Maydell    with TCG this is currently ``3`` if ``virtualization`` is ``off`` and
1627cf3f8d2SPeter Maydell    ``4`` if ``virtualization`` is ``on``, but this may change in future)
1636a0b7505SPeter Maydell
1646a0b7505SPeter Maydellits
1656a0b7505SPeter Maydell  Set ``on``/``off`` to enable/disable ITS instantiation. The default is ``on``
1666a0b7505SPeter Maydell  for machine types later than ``virt-2.7``.
1676a0b7505SPeter Maydell
1686a0b7505SPeter Maydelliommu
1696a0b7505SPeter Maydell  Set the IOMMU type to create for the guest. Valid values are:
1706a0b7505SPeter Maydell
1716a0b7505SPeter Maydell  ``none``
1726a0b7505SPeter Maydell    Don't create an IOMMU (the default)
1736a0b7505SPeter Maydell  ``smmuv3``
1746a0b7505SPeter Maydell    Create an SMMUv3
1756a0b7505SPeter Maydell
176e30e6fdcSPierrick Bouvierdefault-bus-bypass-iommu
177e30e6fdcSPierrick Bouvier  Set ``on``/``off`` to enable/disable `bypass_iommu
178e30e6fdcSPierrick Bouvier  <https://gitlab.com/qemu-project/qemu/-/blob/master/docs/bypass-iommu.txt>`_
179e30e6fdcSPierrick Bouvier  for default root bus.
180e30e6fdcSPierrick Bouvier
1816a0b7505SPeter Maydellras
1826a0b7505SPeter Maydell  Set ``on``/``off`` to enable/disable reporting host memory errors to a guest
1836a0b7505SPeter Maydell  using ACPI and guest external abort exceptions. The default is off.
1846a0b7505SPeter Maydell
185e30e6fdcSPierrick Bouvieracpi
186e30e6fdcSPierrick Bouvier  Set ``on``/``off``/``auto`` to enable/disable ACPI.
187e30e6fdcSPierrick Bouvier
1885242876fSJason A. Donenfelddtb-randomness
1895242876fSJason A. Donenfeld  Set ``on``/``off`` to pass random seeds via the guest DTB
1905242876fSJason A. Donenfeld  rng-seed and kaslr-seed nodes (in both "/chosen" and
1915242876fSJason A. Donenfeld  "/secure-chosen") to use for features like the random number
1925242876fSJason A. Donenfeld  generator and address space randomisation. The default is
1935242876fSJason A. Donenfeld  ``on``. You will want to disable it if your trusted boot chain
1945242876fSJason A. Donenfeld  will verify the DTB it is passed, since this option causes the
1955242876fSJason A. Donenfeld  DTB to be non-deterministic. It would be the responsibility of
1965242876fSJason A. Donenfeld  the firmware to come up with a seed and pass it on if it wants to.
1975242876fSJason A. Donenfeld
19833973e1eSAlex Bennéedtb-kaslr-seed
1995242876fSJason A. Donenfeld  A deprecated synonym for dtb-randomness.
20033973e1eSAlex Bennée
201e30e6fdcSPierrick Bouvierx-oem-id
202e30e6fdcSPierrick Bouvier  Set string (up to 6 bytes) to override the default value of field OEMID in ACPI
203e30e6fdcSPierrick Bouvier  table header.
204e30e6fdcSPierrick Bouvier
205e30e6fdcSPierrick Bouvierx-oem-table-id
206e30e6fdcSPierrick Bouvier  Set string (up to 8 bytes) to override the default value of field OEM Table ID
207e30e6fdcSPierrick Bouvier  in ACPI table header.
208e30e6fdcSPierrick Bouvier
2096a0b7505SPeter MaydellLinux guest kernel configuration
2106a0b7505SPeter Maydell""""""""""""""""""""""""""""""""
2116a0b7505SPeter Maydell
2126a0b7505SPeter MaydellThe 'defconfig' for Linux arm and arm64 kernels should include the
2136a0b7505SPeter Maydellright device drivers for virtio and the PCI controller; however some older
2146a0b7505SPeter Maydellkernel versions, especially for 32-bit Arm, did not have everything
2156a0b7505SPeter Maydellenabled by default. If you're not seeing PCI devices that you expect,
2166a0b7505SPeter Maydellthen check that your guest config has::
2176a0b7505SPeter Maydell
2186a0b7505SPeter Maydell  CONFIG_PCI=y
2196a0b7505SPeter Maydell  CONFIG_VIRTIO_PCI=y
2206a0b7505SPeter Maydell  CONFIG_PCI_HOST_GENERIC=y
2216a0b7505SPeter Maydell
2226a0b7505SPeter MaydellIf you want to use the ``virtio-gpu-pci`` graphics device you will also
2236a0b7505SPeter Maydellneed::
2246a0b7505SPeter Maydell
2256a0b7505SPeter Maydell  CONFIG_DRM=y
2266a0b7505SPeter Maydell  CONFIG_DRM_VIRTIO_GPU=y
2276a0b7505SPeter Maydell
2286a0b7505SPeter MaydellHardware configuration information for bare-metal programming
2296a0b7505SPeter Maydell"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2306a0b7505SPeter Maydell
2316a0b7505SPeter MaydellThe ``virt`` board automatically generates a device tree blob ("dtb")
2326a0b7505SPeter Maydellwhich it passes to the guest. This provides information about the
2336a0b7505SPeter Maydelladdresses, interrupt lines and other configuration of the various devices
2346a0b7505SPeter Maydellin the system. Guest code can rely on and hard-code the following
2356a0b7505SPeter Maydelladdresses:
2366a0b7505SPeter Maydell
2376a0b7505SPeter Maydell- Flash memory starts at address 0x0000_0000
2386a0b7505SPeter Maydell
2396a0b7505SPeter Maydell- RAM starts at 0x4000_0000
2406a0b7505SPeter Maydell
2416a0b7505SPeter MaydellAll other information about device locations may change between
2426a0b7505SPeter MaydellQEMU versions, so guest code must look in the DTB.
2436a0b7505SPeter Maydell
2446a0b7505SPeter MaydellQEMU supports two types of guest image boot for ``virt``, and
2456a0b7505SPeter Maydellthe way for the guest code to locate the dtb binary differs:
2466a0b7505SPeter Maydell
2476a0b7505SPeter Maydell- For guests using the Linux kernel boot protocol (this means any
2486a0b7505SPeter Maydell  non-ELF file passed to the QEMU ``-kernel`` option) the address
2496a0b7505SPeter Maydell  of the DTB is passed in a register (``r2`` for 32-bit guests,
2506a0b7505SPeter Maydell  or ``x0`` for 64-bit guests)
2516a0b7505SPeter Maydell
2526a0b7505SPeter Maydell- For guests booting as "bare-metal" (any other kind of boot),
2536a0b7505SPeter Maydell  the DTB is at the start of RAM (0x4000_0000)
254