QEMU

QEMU

The free operating system ReactOS running within QEMU, which runs as a process on Linux
Original author(s) Fabrice Bellard
Developer(s) QEMU team:
Peter Maydell, et al.
Stable release 2.5.0 / December 16, 2015 (2015-12-16)[1]
Written in C
Operating system Linux, Microsoft Windows, Mac OS X and some other UNIX platforms
Type Hypervisor
License GNU GPL version 2
Website qemu.org

QEMU (short for Quick Emulator) is a free and open-source hosted hypervisor that performs hardware virtualization (not to be confused with hardware-assisted virtualization).

QEMU is a hosted virtual machine monitor: It emulates CPUs through dynamic binary translation and provides a set of device models, enabling it to run a variety of unmodified guest operating systems. It also can be used together with KVM in order to run virtual machines at near-native speed (requiring hardware virtualization extensions on x86 machines). QEMU can also be used purely for CPU emulation for user-level processes, allowing applications compiled for one architecture to be run on another.

Licensing

QEMU was written by Fabrice Bellard and is free software and is mainly licensed under GNU General Public License (GPL). Various parts are released under BSD license, GNU Lesser General Public License (LGPL) or other GPL-compatible licenses.[2] There is an option to use the proprietary FMOD library when running on Microsoft Windows, which, if used, disqualifies the use of a single open source software license. However, the default is to use DirectSound.

Operating modes

QEMU has multiple operating modes:[3]

User-mode emulation
In this mode QEMU runs single Linux or Darwin/Mac OS X programs that were compiled for a different instruction set. System calls are thunked for endianness and for 32/64 bit mismatches. Fast cross-compilation and cross-debugging are the main targets for user-mode emulation.
System emulation
In this mode QEMU emulates a full computer system, including peripherals. It can be used to provide virtual hosting of several virtual computers on a single computer. QEMU can boot many guest operating systems, including Linux, Solaris, Microsoft Windows, DOS, and BSD;[4] it supports emulating several instruction sets, including x86, MIPS, 32-bit ARMv7, ARMv8, PowerPC, SPARC, ETRAX CRIS and MicroBlaze.
KVM Hosting
Here QEMU deals with the setting up and migration of KVM images. It is still involved in the emulation of hardware, but the execution of the guest is done by KVM as requested by QEMU.
Xen Hosting
QEMU is involved only in the emulation of hardware; the execution of the guest is done within Xen and is totally hidden from QEMU.

Features

QEMU can save and restore the state of the virtual machine with all programs running. Guest operating-systems do not need patching in order to run inside QEMU.

QEMU supports the emulation of various architectures, including:

The virtual machine can interface with many types of physical host hardware. These include: hard disks, CD-ROM drives, network cards, audio interfaces, and USB devices. USB devices can be completely emulated (mass storage from image files, input devices), or the host's USB devices can be used (however, this requires administrator privileges and does not work with all devices).

Virtual disk images can be stored in a special format (qcow or qcow2) that only take up disk space that the guest OS actually uses. This way, an emulated 120 GB disk may occupy only a few hundred megabytes on the host. The QCOW2 format also allows the creation of overlay images that record the difference from another (unmodified) base image file. This provides the possibility for reverting the emulated disk's contents to an earlier state. For example, a base image could hold a fresh install of an operating system that is known to work, and the overlay images are used. Should the guest system become unusable (through virus attack, accidental system destruction, Windows X, ...), the user can delete the overlay and reconstruct an earlier emulated disk-image version.

QEMU can emulate network cards (of different models) which share the host system's connectivity by doing network address translation, effectively allowing the guest to use the same network as the host. The virtual network cards can also connect to network cards of other instances of QEMU or to local TAP interfaces. Network connectivity can also be achieved by bridging a TUN/TAP interface used by QEMU with a non-virtual Ethernet interface on the host OS using the host OS's bridging features.

QEMU integrates several services to allow the host and guest systems to communicate; for example, an integrated SMB server and network-port redirection (to allow incoming connections to the virtual machine). It can also boot Linux kernels without a bootloader.

QEMU does not depend on the presence of graphical output methods on the host system. Instead, it can allow one to access the screen of the guest OS via an integrated VNC server. It can also use an emulated serial line, without any screen, with applicable operating systems.

Simulating multiple CPUs running SMP is possible.

QEMU does not require administrative rights to run, unless additional kernel modules for improving speed are used (like KQEMU), or when some modes of its network connectivity model are utilized.

Tiny Code Generator

The Tiny Code Generator (TCG) aims to remove the shortcoming of relying on a particular version of GCC or any compiler, instead incorporating the compiler (code generator) into other tasks performed by QEMU at run time. The whole translation task thus consists of two parts: blocks of target code (TBs) being rewritten in TCG ops - a kind of machine-independent intermediate notation, and subsequently this notation being compiled for the host's architecture by TCG. Optional optimisation passes are performed between them.

TCG requires dedicated code written to support every architecture it runs on. It also requires that the target instruction translation be rewritten to take advantage of TCG ops, instead of the previously used dyngen ops.

Starting with QEMU Version 0.10.0, TCG ships with the QEMU stable release.[6]

Accelerator

KQEMU was a Linux kernel module, also written by Fabrice Bellard, which notably sped up emulation of x86 or x86-64 guests on platforms with the same CPU architecture. This worked by running user mode code (and optionally some kernel code) directly on the host computer's CPU, and by using processor and peripheral emulation only for kernel-mode and real-mode code. KQEMU could execute code from many guest OSes even if the host CPU did not support hardware-assisted virtualization. KQEMU was initially a closed-source product available free of charge, but starting from version 1.3.0pre10,[7] it was relicensed under the GNU General Public License. QEMU versions starting with 0.12.0 (as of August 2009) support large memory which makes them incompatible with KQEMU.[8] Newer releases of QEMU have completely removed support for KQEMU.

QVM86 was a GNU GPLv2 licensed drop-in replacement for the then closed-source KQEMU. The developers of QVM86 ceased development in January, 2007.

Kernel-based Virtual Machine (KVM) has mostly taken over as the Linux-based hardware-assisted virtualization solution for use with QEMU in the wake of the lack of support for KQEMU and QVM86.

Intel's Hardware Accelerated Execution Manager (HAXM) is a cost-free (but not open-source) alternative to KVM for x86-based hardware-assisted virtualization on Windows and Mac OS X. As of 2013 Intel mostly solicits its use with QEMU for Android development.[9]

Supported disk image formats

QEMU supports the following disk image formats:[10]

Hardware-assisted emulation

The MIPS-compatible Loongson-3 processor adds 200 new instructions to help QEMU translate x86 instructions; those new instructions lower the overhead of executing x86/CISC-style instructions in the MIPS pipeline. With additional improvements in QEMU by the Chinese Academy of Sciences, Loongson-3 achieves an average of 70% the performance of executing native binaries while running x86 binaries from nine benchmarks.[12]

Parallel emulation

Virtualization solutions that use QEMU are able to execute multiple virtual CPUs in parallel. QEMU is also able to run multiple threads in user-mode emulation mode.

For full system emulation, QEMU uses a single thread to emulate all the virtual CPUs and hardware. COREMU[13] is a patch to QEMU to eliminate this limitation. Each core uses a separate instance of QEMU binary translation engine, with a thin library layer to handle the inter-core and device communication and synchronization.

Integration with other virtualization solutions

VirtualBox

VirtualBox, released in January 2007, uses some of QEMU's virtual hardware devices, and has a built-in dynamic recompiler based on QEMU. As with KQEMU, VirtualBox runs nearly all guest code natively on the host via the VMM (Virtual Machine Manager) and uses the recompiler only as a fallback mechanism, e.g., when guest code executes in real mode.[14] In addition, VirtualBox does a lot of code analysis and patching using a built-in disassembler in order to minimize recompilation. VirtualBox is free and open-source (available under GPL), except for certain features.

Xen-HVM

Xen, a virtual machine monitor, can run in HVM (hardware virtual machine) mode, using Intel VT-x or AMD-V hardware x86 virtualization extensions and ARM Cortex-A7 and Cortex-A15 virtualization extension.[15] This means that instead of paravirtualized devices, a real set of virtual hardware is exposed to the domU to use real device drivers to talk to.

QEMU includes several components: CPU emulators, emulated devices, generic devices, machine descriptions, user interface, and a debugger. The emulated devices and generic devices in QEMU make up its device models for I/O virtualization.[16] They comprise a PIIX3 IDE (with some rudimentary PIIX4 capabilities), Cirrus Logic or plain VGA emulated video, RTL8139 or E1000 network emulation, and ACPI support.[17] APIC support is provided by Xen.

Xen-HVM has device emulation based on the QEMU project to provide I/O virtualization to the VMs. Hardware is emulated via a QEMU "device model" daemon running as a backend in dom0. Unlike other QEMU running modes (dynamic translation or KVM), virtual CPUs are completely managed to the hypervisor, which takes care of stopping them while QEMU is emulating memory-mapped I/O accesses.

KVM

KVM (Kernel Virtual Machine) is a FreeBSD and Linux kernel module that allows a user space program access to the hardware virtualization features of various processors, with which QEMU is able to offer virtualization for x86, PowerPC, and S/390 guests. When the target architecture is the same as the host architecture, QEMU can make use of KVM particular features, such as acceleration.

Win4Lin Pro Desktop

In early 2005, Win4Lin introduced Win4Lin Pro Desktop, based on a 'tuned' version of QEMU and KQEMU and it hosts NT-versions of Windows. In June 2006,[18] Win4Lin released Win4Lin Virtual Desktop Server based on the same code base. Win4Lin Virtual Desktop Server serves Microsoft Windows sessions to thin clients from a Linux server.

In September 2006, Win4Lin announced a change of the company name to Virtual Bridges with the release of Win4BSD Pro Desktop, a port of the product to FreeBSD and PC-BSD. Solaris support followed in May 2007 with the release of Win4Solaris Pro Desktop and Win4Solaris Virtual Desktop Server.[19]

SerialICE

SerialICE is a QEMU-based firmware debugging tool running system firmware inside of QEMU while accessing real hardware through a serial connection to a host system. This can be used as a cheap replacement for hardware ICEs.[20]

WinUAE

WinUAE Amiga emulator introduced in version 3.0.0 the support for CyberStorm PPC and Blizzard 603e boards using QEMU PPC core.[21]

Shortcomings

Emulated hardware platforms

x86

Besides the CPU (which is also configurable and can emulate the Intel Sandy Bridge[22]), the following devices are emulated:

The BIOS implementation used by QEMU starting from version 0.12 is SeaBIOS. The VGA BIOS implementation comes from Plex86/Bochs.

PowerPC

PowerMac

QEMU emulates the following PowerMac peripherals:

OpenBIOS is used as the firmware.

PREP

QEMU emulates the following PREP peripherals:

On the PREP target, Open Hack'Ware, an Open-Firmwarecompatible BIOS, is used.

IBM System p

QEMU can emulate the paravirtual sPAPR interface with the following peripherals:

On the sPAPR target, another Open-Firmwarecompatible BIOS is used, called SLOF.

ARM

QEMU booted into the ARM port of Fedora 8

QEMU emulates the ARMv7 instruction set (and down to ARMv5TEJ) with NEON extension.[26] It emulates full systems like Integrator/CP board, Versatile baseboard, RealView Emulation baseboard, XScale-based PDAs, Palm Tungsten|E PDA, Nokia N800 and Nokia N810 Internet tablets etc. QEMU also powers the Android emulator which is part of the Android SDK (most current Android implementations are ARM based). Starting from version 2.0.0 of their Bada SDK, Samsung has chosen QEMU to help development on emulated 'Wave' devices.

In 1.5.0 and 1.6.0 Samsung Exynos 4210 (dual-core Cortex a9) and Versatile Express ARM Cortex-A9 ARM Cortex-A15 are emulated. In 1.6.0, the 32-bit instructions of the ARMv8 (AARCH64) architecture are emulated, but 64-bit instructions are unsupported.

The Xilinx Cortex A9-based Zynq SoC is modelled, with the following elements:

SPARC

QEMU has support for both 32 and 64-bit SPARC architectures.

When the firmware in the JavaStation (sun4m-Architecture) became version 0.8.1 Proll,[27] a PROM replacement used in version 0.8.2, was replaced with OpenBIOS.

Sparc32

QEMU emulates the following sun4m/sun4c/sun4d peripherals:

Sparc64

Emulating Sun4u (UltraSPARC PC-like machine), Sun4v (T1 PC-like machine), or generic Niagara (T1) machine with the following peripherals:

MicroBlaze

Supported peripherals:

LatticeMico32

Supported peripherals:

From the Milkymist SoC

CRIS

Main article: ETRAX CRIS

OpenRISC

Main article: OpenRISC

External patches

External trees exist supporting the following targets:

See also

References

  1. "ChangeLog/2.5". QEMU. 2015-12-16. Retrieved 2015-12-16.
  2. QEMU license
  3. QEMU Internals
  4. QEMU Official OS Support List
  5. http://wiki.prplfoundation.org/wiki/QEMU_PRIP_1_-_support_for_MIPS64_Release_6
  6. QEMU 0.10.0 release announcement
  7. "KQEMU 1.3.0pre10 released - under the GPL [LWN.net]". Lwn.net. February 6, 2007. Retrieved 2009-01-03.
  8. Liguori, Anthony (10 August 2009). "[Qemu-devel] [PATCH 1/2] Unbreak large mem support by removing kqemu". Retrieved 2010-03-11.
  9. "Intel Hardware Accelerated Execution Manager". Intel. 2013-11-27. Retrieved 2014-05-12. The Intel Hardware Accelerated Execution Manager (Intel® HAXM) is a hardware-assisted virtualization engine (hypervisor) that uses Intel Virtualization Technology (Intel® VT) to speed up Android app emulation on a host machine.
  10. http://qemu.weilnetz.de/qemu-doc.html#disk_005fimages
  11. linux-tips
  12. "Godson-3: A Scalable Multicore RISC Processor with x86 Emulation". IEEE. Retrieved 2009-04-16.
  13. COREMU project page on SourceForge
  14. "VirtualBox Developer FAQ". Retrieved 2015-02-02.
  15. "Xen ARM with Virtualization Extensions".
  16. Solaris Operating System Hardware Virtualization Product Architecture
  17. Demystifying Xen HVM
  18. win4lin VDS announcement
  19. Win4Solaris announcement
  20. SerialICE web page
  21. "WinUAE 3.0.0". English Amiga Board. 2014-12-17. Retrieved 2016-03-25.
  22. Sandy Bridge support commit
  23. https://qemu.weilnetz.de/qemu-doc.html#pcsys_005fnetwork "i82551, i82557b, i82559er, ne2k_pci, ne2k_isa, pcnet, rtl8139, e1000, smc91c111, lance and mcf_fec"
  24. http://pclosmag.com/html/issues/201208/page11.html Networking on QEMU: Setting Up The E1000 & Novell NE2000 ISA Evaluation
  25. "ChangeLog/0.14". Retrieved 2011-08-08.
  26. https://gitorious.org/rowboat/external-qemu/commit/bcc6ae14820ddb24e2403d84b420ce61f371ae94
  27. "Zaitcev's Linux". 090427 people.redhat.com
  28. "QEMU Z80 Target". 090506 homepage.ntlworld.com
  29. "Download - RISC-V".

External links

Wikimedia Commons has media related to QEMU.
Wikibooks has more on the topic of: QEMU
This article is issued from Wikipedia - version of the Wednesday, April 06, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.