# QEMU KVM Acceleration **KVM (Kernel-based Virtual Machine)** accelerates QEMU when the guest and host architectures match. QEMU hands off instruction execution to the CPU's hardware virtualization extensions, yielding near-native VM performance instead of the much slower software instruction translation (TCG). ```bash qemu-system-x86_64 -enable-kvm -m 4G -smp 4 -hda disk.img # with KVM qemu-system-x86_64 -m 4G -smp 4 -hda disk.img # without (TCG, slow) ``` KVM requires the host CPU to support virtualization extensions: Intel's `vmx` or AMD's `svm`. Check with: ```bash grep -c '(vmx|svm)' /proc/cpuinfo # nonzero means supported kvm-ok # Ubuntu utility ``` KVM also requires the `kvm` kernel module to be loaded and the host to have `/dev/kvm` readable by the QEMU process. Check with: ```bash ls -l /dev/kvm # should be readable by your user/group lsmod | grep kvm # should show kvm and kvm_intel or kvm_amd ``` When `-enable-kvm` is used and KVM is unavailable, QEMU falls back to TCG (Tiny Code Generator)—its software CPU emulator, which is much slower. TCG is what enables cross-architecture emulation (ARM on x86) at all, but it trades speed for flexibility. KVM cannot emulate different architectures—only the same one as the host. Run `qemu-system-aarch64` on an ARM host to get KVM; on x86, only `qemu-system-x86_64` can use `-enable-kvm`. For x86 VMs, use `-enable-kvm` unless testing legacy CPUs. For embedded (ARM, RISC-V) testing, KVM is unavailable; QEMU falls back to TCG (slower but still useful).