Trying to Explain QEMU in Simple Terms (Part 5):QEMU-KVM
Introduction
In the previous article (Part 4), we explained address translation in QEMU, Soft-MMU, system mode, and user mode.
In this article (Part 5), we will explain QEMU-KVM. QEMU-KVM is faster than regular QEMU, but certain conditions must be met in order to achieve this high performance.
KVM(Kernel-based Virtual Machine)
As shown in Figure 1, consider the case where x86-based Windows 10 is running on x86-based Linux on an x86-based PC.

At this time, the QEMU running on Linux converts and executes the Windows 10 source code (guest machine code) into host machine code, as shown in Figure 2. For details on machine code translation in QEMU, please refer to Part 2.

In this case, even though both the guest and host are using the same CPU architecture (x86 in this case), it seems unnecessary to perform machine code translation using QEMU’s TCG (Tiny Code Generator).
In QEMU-KVM, the guest machine code is executed directly, without conversion, in a separate thread from the main QEMU process. The details of this are omitted, but simply running it in a separate thread is not possible; it requires the use of the host CPU’s virtualization support and the host Linux kernel’s capabilities. As a result, starting from RHEL (Red Hat Enterprise Linux) 5, a virtualization feature called KVM (Kernel-based Virtual Machine) was introduced. The KVM in RHEL 5 requires a CPU that supports KVM (such as Intel VT-x or AMD-V).
In KVM, the guest machine code is executed in a separate thread, and when there are IO accesses or other events, control is transferred to QEMU, which then executes tasks such as running the peripheral models.
To summarize, QEMU-KVM can be used when all of the following conditions are met:
- The guest and host CPUs have the same architecture.
- The CPU supports hardware virtualization (Intel VT-x, AMD-V, ARM Virtualization Extensions).
- The host OS, Linux, supports KVM.
- QEMU is used in system mode (user mode in QEMU is not sufficient).
End of Series
In this article (Part 5), we explained QEMU-KVM. Although the explanation was fairly brief, we hope you have gained an understanding of what KVM is.
We have covered QEMU over the course of five articles. With this, the series will be concluded.