qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

virt.rst (6829B)


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