16a0b7505SPeter Maydell'virt' generic virtual platform (``virt``) 26a0b7505SPeter Maydell========================================== 36a0b7505SPeter Maydell 46df743dcSPeter MaydellThe ``virt`` board is a platform which does not correspond to any 56a0b7505SPeter Maydellreal hardware; it is designed for use in virtual machines. 66a0b7505SPeter MaydellIt is the recommended board type if you simply want to run 76a0b7505SPeter Maydella guest such as Linux and do not care about reproducing the 86a0b7505SPeter Maydellidiosyncrasies and limitations of a particular bit of real-world 96a0b7505SPeter Maydellhardware. 106a0b7505SPeter Maydell 116a0b7505SPeter MaydellThis is a "versioned" board model, so as well as the ``virt`` machine 126a0b7505SPeter Maydelltype itself (which may have improvements, bugfixes and other minor 136a0b7505SPeter Maydellchanges between QEMU versions) a version is provided that guarantees 146a0b7505SPeter Maydellto have the same behaviour as that of previous QEMU releases, so 156a0b7505SPeter Maydellthat VM migration will work between QEMU versions. For instance the 166a0b7505SPeter Maydell``virt-5.0`` machine type will behave like the ``virt`` machine from 176a0b7505SPeter Maydellthe QEMU 5.0 release, and migration should work between ``virt-5.0`` 186a0b7505SPeter Maydellof the 5.0 release and ``virt-5.0`` of the 5.1 release. Migration 196a0b7505SPeter Maydellis not guaranteed to work between different QEMU releases for 206a0b7505SPeter Maydellthe non-versioned ``virt`` machine type. 216a0b7505SPeter Maydell 226a0b7505SPeter MaydellSupported devices 236a0b7505SPeter Maydell""""""""""""""""" 246a0b7505SPeter Maydell 256a0b7505SPeter MaydellThe virt board supports: 266a0b7505SPeter Maydell 276a0b7505SPeter Maydell- PCI/PCIe devices 286a0b7505SPeter Maydell- Flash memory 296a0b7505SPeter Maydell- One PL011 UART 306a0b7505SPeter Maydell- An RTC 316a0b7505SPeter Maydell- The fw_cfg device that allows a guest to obtain data from QEMU 326a0b7505SPeter Maydell- A PL061 GPIO controller 336a0b7505SPeter Maydell- An optional SMMUv3 IOMMU 346a0b7505SPeter Maydell- hotpluggable DIMMs 356a0b7505SPeter Maydell- hotpluggable NVDIMMs 366a0b7505SPeter Maydell- An MSI controller (GICv2M or ITS). GICv2M is selected by default along 376a0b7505SPeter Maydell with GICv2. ITS is selected by default with GICv3 (>= virt-2.7). Note 386a0b7505SPeter Maydell that ITS is not modeled in TCG mode. 396a0b7505SPeter Maydell- 32 virtio-mmio transport devices 406a0b7505SPeter Maydell- running guests using the KVM accelerator on aarch64 hardware 416a0b7505SPeter Maydell- large amounts of RAM (at least 255GB, and more if using highmem) 426a0b7505SPeter Maydell- many CPUs (up to 512 if using a GICv3 and highmem) 436a0b7505SPeter Maydell- Secure-World-only devices if the CPU has TrustZone: 446a0b7505SPeter Maydell 456a0b7505SPeter Maydell - A second PL011 UART 46daa726d9SMaxim Uvarov - A second PL061 GPIO controller, with GPIO lines for triggering 47daa726d9SMaxim Uvarov a system reset or system poweroff 486a0b7505SPeter Maydell - A secure flash memory 496a0b7505SPeter Maydell - 16MB of secure RAM 506a0b7505SPeter Maydell 516a0b7505SPeter MaydellSupported guest CPU types: 526a0b7505SPeter Maydell 536a0b7505SPeter Maydell- ``cortex-a7`` (32-bit) 546a0b7505SPeter Maydell- ``cortex-a15`` (32-bit; the default) 556a0b7505SPeter Maydell- ``cortex-a53`` (64-bit) 566a0b7505SPeter Maydell- ``cortex-a57`` (64-bit) 576a0b7505SPeter Maydell- ``cortex-a72`` (64-bit) 58*4d39fcd8SShuuichirou Ishii- ``a64fx`` (64-bit) 596a0b7505SPeter Maydell- ``host`` (with KVM only) 606a0b7505SPeter Maydell- ``max`` (same as ``host`` for KVM; best possible emulation with TCG) 616a0b7505SPeter Maydell 626a0b7505SPeter MaydellNote that the default is ``cortex-a15``, so for an AArch64 guest you must 636a0b7505SPeter Maydellspecify a CPU type. 646a0b7505SPeter Maydell 656a0b7505SPeter MaydellGraphics output is available, but unlike the x86 PC machine types 666a0b7505SPeter Maydellthere is no default display device enabled: you should select one from 676a0b7505SPeter Maydellthe Display devices section of "-device help". The recommended option 686a0b7505SPeter Maydellis ``virtio-gpu-pci``; this is the only one which will work correctly 696a0b7505SPeter Maydellwith KVM. You may also need to ensure your guest kernel is configured 706a0b7505SPeter Maydellwith support for this; see below. 716a0b7505SPeter Maydell 726a0b7505SPeter MaydellMachine-specific options 736a0b7505SPeter Maydell"""""""""""""""""""""""" 746a0b7505SPeter Maydell 756a0b7505SPeter MaydellThe following machine-specific options are supported: 766a0b7505SPeter Maydell 776a0b7505SPeter Maydellsecure 786a0b7505SPeter Maydell Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the 796a0b7505SPeter Maydell Arm Security Extensions (TrustZone). The default is ``off``. 806a0b7505SPeter Maydell 816a0b7505SPeter Maydellvirtualization 826a0b7505SPeter Maydell Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the 836a0b7505SPeter Maydell Arm Virtualization Extensions. The default is ``off``. 846a0b7505SPeter Maydell 85222f45b7SPeter Maydellmte 86222f45b7SPeter Maydell Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the 87222f45b7SPeter Maydell Arm Memory Tagging Extensions. The default is ``off``. 88222f45b7SPeter Maydell 896a0b7505SPeter Maydellhighmem 906a0b7505SPeter Maydell Set ``on``/``off`` to enable/disable placing devices and RAM in physical 916a0b7505SPeter Maydell address space above 32 bits. The default is ``on`` for machine types 926a0b7505SPeter Maydell later than ``virt-2.12``. 936a0b7505SPeter Maydell 946a0b7505SPeter Maydellgic-version 956a0b7505SPeter Maydell Specify the version of the Generic Interrupt Controller (GIC) to provide. 966a0b7505SPeter Maydell Valid values are: 976a0b7505SPeter Maydell 986a0b7505SPeter Maydell ``2`` 996a0b7505SPeter Maydell GICv2 1006a0b7505SPeter Maydell ``3`` 1016a0b7505SPeter Maydell GICv3 1026a0b7505SPeter Maydell ``host`` 1036a0b7505SPeter Maydell Use the same GIC version the host provides, when using KVM 1046a0b7505SPeter Maydell ``max`` 1056a0b7505SPeter Maydell Use the best GIC version possible (same as host when using KVM; 1066a0b7505SPeter Maydell currently same as ``3``` for TCG, but this may change in future) 1076a0b7505SPeter Maydell 1086a0b7505SPeter Maydellits 1096a0b7505SPeter Maydell Set ``on``/``off`` to enable/disable ITS instantiation. The default is ``on`` 1106a0b7505SPeter Maydell for machine types later than ``virt-2.7``. 1116a0b7505SPeter Maydell 1126a0b7505SPeter Maydelliommu 1136a0b7505SPeter Maydell Set the IOMMU type to create for the guest. Valid values are: 1146a0b7505SPeter Maydell 1156a0b7505SPeter Maydell ``none`` 1166a0b7505SPeter Maydell Don't create an IOMMU (the default) 1176a0b7505SPeter Maydell ``smmuv3`` 1186a0b7505SPeter Maydell Create an SMMUv3 1196a0b7505SPeter Maydell 1206a0b7505SPeter Maydellras 1216a0b7505SPeter Maydell Set ``on``/``off`` to enable/disable reporting host memory errors to a guest 1226a0b7505SPeter Maydell using ACPI and guest external abort exceptions. The default is off. 1236a0b7505SPeter Maydell 1246a0b7505SPeter MaydellLinux guest kernel configuration 1256a0b7505SPeter Maydell"""""""""""""""""""""""""""""""" 1266a0b7505SPeter Maydell 1276a0b7505SPeter MaydellThe 'defconfig' for Linux arm and arm64 kernels should include the 1286a0b7505SPeter Maydellright device drivers for virtio and the PCI controller; however some older 1296a0b7505SPeter Maydellkernel versions, especially for 32-bit Arm, did not have everything 1306a0b7505SPeter Maydellenabled by default. If you're not seeing PCI devices that you expect, 1316a0b7505SPeter Maydellthen check that your guest config has:: 1326a0b7505SPeter Maydell 1336a0b7505SPeter Maydell CONFIG_PCI=y 1346a0b7505SPeter Maydell CONFIG_VIRTIO_PCI=y 1356a0b7505SPeter Maydell CONFIG_PCI_HOST_GENERIC=y 1366a0b7505SPeter Maydell 1376a0b7505SPeter MaydellIf you want to use the ``virtio-gpu-pci`` graphics device you will also 1386a0b7505SPeter Maydellneed:: 1396a0b7505SPeter Maydell 1406a0b7505SPeter Maydell CONFIG_DRM=y 1416a0b7505SPeter Maydell CONFIG_DRM_VIRTIO_GPU=y 1426a0b7505SPeter Maydell 1436a0b7505SPeter MaydellHardware configuration information for bare-metal programming 1446a0b7505SPeter Maydell""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 1456a0b7505SPeter Maydell 1466a0b7505SPeter MaydellThe ``virt`` board automatically generates a device tree blob ("dtb") 1476a0b7505SPeter Maydellwhich it passes to the guest. This provides information about the 1486a0b7505SPeter Maydelladdresses, interrupt lines and other configuration of the various devices 1496a0b7505SPeter Maydellin the system. Guest code can rely on and hard-code the following 1506a0b7505SPeter Maydelladdresses: 1516a0b7505SPeter Maydell 1526a0b7505SPeter Maydell- Flash memory starts at address 0x0000_0000 1536a0b7505SPeter Maydell 1546a0b7505SPeter Maydell- RAM starts at 0x4000_0000 1556a0b7505SPeter Maydell 1566a0b7505SPeter MaydellAll other information about device locations may change between 1576a0b7505SPeter MaydellQEMU versions, so guest code must look in the DTB. 1586a0b7505SPeter Maydell 1596a0b7505SPeter MaydellQEMU supports two types of guest image boot for ``virt``, and 1606a0b7505SPeter Maydellthe way for the guest code to locate the dtb binary differs: 1616a0b7505SPeter Maydell 1626a0b7505SPeter Maydell- For guests using the Linux kernel boot protocol (this means any 1636a0b7505SPeter Maydell non-ELF file passed to the QEMU ``-kernel`` option) the address 1646a0b7505SPeter Maydell of the DTB is passed in a register (``r2`` for 32-bit guests, 1656a0b7505SPeter Maydell or ``x0`` for 64-bit guests) 1666a0b7505SPeter Maydell 1676a0b7505SPeter Maydell- For guests booting as "bare-metal" (any other kind of boot), 1686a0b7505SPeter Maydell the DTB is at the start of RAM (0x4000_0000) 169