KVM Hypervisor¶
Kernel-based Virtual Machine (KVM) is an open source virtualization technology for Linux on x86 hardware containing virtualization extensions (for instance, Intel® Virtualization Technology (Intel® VT)).
KVM consists of loadable kernel modules, for example, kvm.ko that provides the core virtualization infrastructure. KVM turns Linux into a hypervisor that allows host machine to run multiple, isolated virtual environments called virtual machine, running unmodified Linux or Microsoft Windows images.
Each virtual machine can have private virtual BIOS (basic input/output system) and private virtualized hardware: processor, memory, network cards, disk, graphics adapter, and so on.
KVM Terminology
| Term | Description | 
|---|---|
| VM | Hypervised operating systems (OS) are referred to as virtual machines or VMs. | 
| GVT-d | Graphics Virtualization Technology - VT-d | 
| IGD | Integrated Graphics Device | 
| BDF | Bus:Device.Function notation used to succinctly describe PCI and PCIe devices. | 
KVM Prerequisites¶
The following section is applicable to:
 
KVM and relevant modules are pre-installed in Linux kernel.
Do the following to set up the system:
- Add - intel_iommu=onto the kernel command line.
- Run the following command to install this component: - $ sudo apt install qemu-system-x86 
- Disable graphical desktop: - $ sudo systemctl set-default multi-user.target 
Real-Time VMs using KVM¶
With the correct host and guest configuration, it is possible to execute real-time workloads in a VM. For a complete tutorial, refer to Real-Time VMs using KVM.
Prepare Image for KVM¶
See the following sections for detailed tutorials on creating and booting VMs using Intel® Edge Controls for Industrial images or Microsoft Windows images.
Virtualize ECI Images with KVM¶
To create a core-bookworm or core-noble VM image on the KVM hypervisor, refer to Virtualize ECI Images with KVM.
Create Windows Image for KVM¶
To create a Microsoft Windows VM image on the KVM hypervisor, refer to Create Windows Image for KVM.
Set up QEMU Command to Boot Windows VM¶
To boot a Microsoft Windows VM image on the KVM hypervisor, refer to Set up QEMU Command to Boot Windows VM.
Build OVMF.fd for KVM¶
Do the following to  build OVMF.fd.
- Clone the - EDK2source from upstream and checkout to a specific release.- $ git clone https://github.com/tianocore/edk2.git $ cd edk2 $ git checkout edk2-stable202008 
- Apply the following patches on - EDK2using the- git applycommand.
- Build - OVMF.fd:- Refer to this document to build - OVMF.fd.- After the build is complete, - OVMF.fdwill be in- edk2/Build/Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd.
- Build GOP ROM file: - GOP is not mandatory, but if one wants to check UEFI interface of VM, follow below method to generate GOP rom file: 
- Prepare platform related - IntelGopDriver.efiand copy it into- /src_path. For GOP driver, go to https://premiersupport.intel.com/ (Login with your Intel® account) to ask support for your own platform.
- Get - device codesand- GPU PCI bus address- # lspci -Dnn | grep VGA 0000:00:02.0 VGA compatible controller [0300]: Intel Corporation Meteor Lake-P [Intel Graphics] [8086:7d45] (rev 08) 
- Generate - GOP.rom- source ./edksetup.sh make -C BaseTools/ ./BaseTools/BinWrappers/PosixLike/EfiRom -v -f 0x8086 -i 0x7d45 -e /src_path/IntelGopDriver.efi -o /dest_path/GOP.rom