QEMU: Difference between revisions
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[File:Qemu.png|thumb|350px|QEMU running [[Windows 2000]] on Red Hat Linux.]] |
[[File:Qemu.png|thumb|350px|QEMU system emulation running [[Windows 2000]] on Red Hat Linux.]] |
||
'''QEMU''' ('''Q'''uick '''Emu'''lator) is a free, open-source hypervisor and emulator that runs on several operating systems, including many major Linux distros, macOS, Microsoft Windows, BSD, as well as a few others. |
'''QEMU''' ('''Q'''uick '''Emu'''lator) is a free, open-source hypervisor and emulator that runs on several operating systems, including many major Linux distros, macOS, Microsoft Windows, BSD, as well as a few others. |
||
It is capable of running pretty much all major x86 operating systems, including Windows, Linux, MS-DOS and BSD (and much more), and in addition is also capable of emulating other architectures, including ARM, MIPS, SPARC, PowerPC and MicroBlaze |
It is capable of running pretty much all major x86 operating systems, including Windows, Linux, MS-DOS and BSD (and much more), and in addition is also capable of emulating other architectures, including ARM, MIPS, SPARC, PowerPC and MicroBlaze. There are also many forks of QEMU that add emulation of other systems and processors, like the Xbox, Zilog Z80 and Macintosh 128K. |
||
QEMU is the only emulator supported in CollabVM 1.2. CollabVM 2.0 has a wider selection of virtualizers and emulators. |
QEMU is the only emulator supported in CollabVM 1.2. CollabVM 2.0 has a wider selection of virtualizers and emulators. |
||
Line 11: | Line 11: | ||
===User emulation=== |
===User emulation=== |
||
User emulation mode emulates a target CPU (always using the Tiny Code Generator), and additionally a given system call ABI (usually Linux), allowing programs from another architecture to run as if they are native applications (in most cases). This is useful for poking around embedded Linux firmware, for instance |
User emulation mode emulates a target CPU (always using the Tiny Code Generator), and additionally a given system call ABI (usually Linux), allowing programs from another architecture or operating system to run as if they are native applications (in most cases). This is useful for poking around embedded Linux firmware, for instance, but beyond that generally is more of a curiosity than something useful. |
||
===System emulation=== |
===System emulation=== |
||
System emulation mode (known also as <code>softmmu</code>) emulates an entire computer system, including peripherals. As mentioned above, it is capable of booting practically all major operating systems. By default, system emulation uses the Tiny Code Generator (TCG), which is generally slower (although faster than Bochs, at a cost of accuracy) |
System emulation mode (known also as <code>softmmu</code>) emulates an entire computer system, including peripherals. As mentioned above, it is capable of booting practically all major operating systems. By default, system emulation uses the Tiny Code Generator (TCG), which is generally slower (although faster than Bochs, at a cost of accuracy). |
||
TCG should only be used if: |
|||
*The host server does not have KVM/virtualization enabled. |
*The host server does not have KVM/virtualization enabled. |
||
Line 21: | Line 23: | ||
*The host operating system does not run well with KVM (e.g. [[Windows 98]] does not run with KVM on most systems) |
*The host operating system does not run well with KVM (e.g. [[Windows 98]] does not run with KVM on most systems) |
||
===System |
===System emulation under a hypervisor=== |
||
With KVM, the Linux kernel's API for utilizing CPU native virtualization support, QEMU can run operating systems at near native speeds. |
|||
Alternatively, QEMU can use a hypervisor API provided by the host operating system to run the virtual CPUs (vCPUs), which allows it to run operating systems at near native speed. |
|||
When a given hypervisor is enabled, instead of using TCG to ''emulate'' each vCPU present in the configured machine, QEMU will instead request the hypervisor run the vCPU, which will use native virtualization features that are a part of the CPU. |
|||
⚫ | |||
QEMU supports the following hypervisor APIs: |
|||
⚫ | |||
{| class="wikitable sortable" |
|||
You can enable KVM by adding <kbd>-accel kvm</kbd> to the startup arguments, or by appending <kbd>,accel=kvm</kbd> to your <kbd>-machine</kbd>/<kbd>-M</kbd> option. |
|||
|+ Hypervisor APIs |
|||
|- |
|||
! API !! Platforms !! Details |
|||
|- |
|||
| KVM (<kbd>-accel kvm</kbd>) || Linux || Linux's native hypervisor API, which works on x86_64, ppc, arm, aarch64, s390x and others. You can check for KVM support by running the command <kbd>kvm-ok</kbd>, or alternatively <kbd>ls /dev/kvm</kbd>. |
|||
|- |
|||
| HAXM (<kbd>-accel haxm</kbd>) || Windows, macOS, FreeBSD, Linux || A deprecated hypervisor layer written by Intel for x86 platforms. Not recommended for use. |
|||
|- |
|||
| WHPX (<kbd>-accel whpx</kbd>) || Windows || Windows Hypervisor Platform. Essentially the hypervisor core of Hyper-V turned into an API. This does not run very well, and certain OSes do not run properly or very slowly under it. |
|||
|- |
|||
| GVM/AEHD (<kbd>-accel kvm</kbd>) || Windows || Google-backed port of KVM to Windows, mainly used for the Android Virtual Device emulator, which is based on QEMU. Needs a [https://github.com/qemu-gvm/qemu-gvm fork] of QEMU patched to support it, and is rather unstable. |
|||
|- |
|||
| Hypervisor.framework (<kbd>-accel hvf</kbd>) || macOS || macOS specific hypervisor API. |
|||
|} |
|||
Note that you can also use <kbd>-M ...,accel=<hypervisor></kbd> to enable a given hypervisor as well. |
|||
If installed, you can check if you are ready to enable kvm by checking the command <kbd>kvm-ok</kbd>, or alternatively <kbd>ls /dev/kvm</kbd>. |
|||
==Table of contents== |
==Table of contents== |
Latest revision as of 10:43, 21 August 2024
QEMU (Quick Emulator) is a free, open-source hypervisor and emulator that runs on several operating systems, including many major Linux distros, macOS, Microsoft Windows, BSD, as well as a few others.
It is capable of running pretty much all major x86 operating systems, including Windows, Linux, MS-DOS and BSD (and much more), and in addition is also capable of emulating other architectures, including ARM, MIPS, SPARC, PowerPC and MicroBlaze. There are also many forks of QEMU that add emulation of other systems and processors, like the Xbox, Zilog Z80 and Macintosh 128K.
QEMU is the only emulator supported in CollabVM 1.2. CollabVM 2.0 has a wider selection of virtualizers and emulators.
Operating modes
User emulation
User emulation mode emulates a target CPU (always using the Tiny Code Generator), and additionally a given system call ABI (usually Linux), allowing programs from another architecture or operating system to run as if they are native applications (in most cases). This is useful for poking around embedded Linux firmware, for instance, but beyond that generally is more of a curiosity than something useful.
System emulation
System emulation mode (known also as softmmu
) emulates an entire computer system, including peripherals. As mentioned above, it is capable of booting practically all major operating systems. By default, system emulation uses the Tiny Code Generator (TCG), which is generally slower (although faster than Bochs, at a cost of accuracy).
TCG should only be used if:
- The host server does not have KVM/virtualization enabled.
- The host server is running an OpenVZ variant of Linux.
- You are NOT in the kvm user group, or have not started the kvm module on the OS.
- The host operating system does not run well with KVM (e.g. Windows 98 does not run with KVM on most systems)
System emulation under a hypervisor
Alternatively, QEMU can use a hypervisor API provided by the host operating system to run the virtual CPUs (vCPUs), which allows it to run operating systems at near native speed.
When a given hypervisor is enabled, instead of using TCG to emulate each vCPU present in the configured machine, QEMU will instead request the hypervisor run the vCPU, which will use native virtualization features that are a part of the CPU.
Most of QEMU's hardware/system emulation still runs in usermode with a hypervisor enabled. On KVM, chipset emulation functionality is by default moved into the kernel, helping increase performance further.
QEMU supports the following hypervisor APIs:
API | Platforms | Details |
---|---|---|
KVM (-accel kvm) | Linux | Linux's native hypervisor API, which works on x86_64, ppc, arm, aarch64, s390x and others. You can check for KVM support by running the command kvm-ok, or alternatively ls /dev/kvm. |
HAXM (-accel haxm) | Windows, macOS, FreeBSD, Linux | A deprecated hypervisor layer written by Intel for x86 platforms. Not recommended for use. |
WHPX (-accel whpx) | Windows | Windows Hypervisor Platform. Essentially the hypervisor core of Hyper-V turned into an API. This does not run very well, and certain OSes do not run properly or very slowly under it. |
GVM/AEHD (-accel kvm) | Windows | Google-backed port of KVM to Windows, mainly used for the Android Virtual Device emulator, which is based on QEMU. Needs a fork of QEMU patched to support it, and is rather unstable. |
Hypervisor.framework (-accel hvf) | macOS | macOS specific hypervisor API. |
Note that you can also use -M ...,accel=<hypervisor> to enable a given hypervisor as well.
Table of contents
- Devices
- Devices/Machines
- Devices/Network
- Devices/Sound cards
- Devices/Video cards
- Getting started
- Guests
- Guests/Linux
- Guests/MS-DOS 3.30
- Guests/Mac OS 9
- Guests/Ubuntu 12.04 (PowerPC)
- Guests/Ubuntu 14.04
- Guests/Ubuntu 16.04
- Guests/Windows
- Guests/Windows 1.x-2.x
- Guests/Windows 10
- Guests/Windows 11
- Guests/Windows 2000
- Guests/Windows 3.1
- Guests/Windows 7
- Guests/Windows 8
- Guests/Windows 95
- Guests/Windows 98
- Guests/Windows Longhorn
- Guests/Windows ME
- Guests/Windows NT 3.x-4.0 (MIPS)
- Guests/Windows NT 4.0
- Guests/Windows Vista
- Guests/Windows XP
- Guests/macOS
- Installation
- Network
- PowerPC
- x86