---
title: "Hardware virtualization"
url: https://www.daytona.com/compute-glossary/virtualization/hardware-virtualization
---

# Hardware virtualization

Part of the [Compute Glossary](https://www.daytona.com/compute-glossary.md), section [Virtualization](https://www.daytona.com/compute-glossary/virtualization.md).

Also called Intel VT-x, AMD-V, Virtualization extensions.

Hardware virtualization is a set of processor features that let guest code run directly on the physical processor while a [hypervisor](https://www.daytona.com/compute-glossary/virtualization/hypervisor.md) keeps control of the machine. The processor runs the guest at full speed and stops it when it tries an operation that would affect the real hardware. The processor gains a separate mode for guests beside its usual privilege levels. A guest kernel can then run with its normal privileges, unaware that a hypervisor is watching.

Before these features existed, a hypervisor on x86 had to rewrite or interpret privileged guest instructions in software, because some of them failed silently instead of stopping the guest. That work was slow and made hypervisors complex and hard to trust. VMware made x86 virtualization practical with binary translation before hardware support arrived. Xen took another route, changing guest kernels so that they called the hypervisor directly.

Every mainstream hypervisor now relies on these features, and each processor family has its own version, such as VT-x on Intel and AMD-V on AMD. They let a [virtual machine](https://www.daytona.com/compute-glossary/virtualization/virtual-machine.md) be both fast and strongly isolated, because the processor itself enforces the line between guests. Arm processors have their own version too, with a privilege level set aside for the hypervisor. Without these features, renting out slices of one server at scale would cost far more.

## VM entry and exit

VM entry and exit are the two switches between a hypervisor and a guest. On entry, the [CPU](https://www.daytona.com/compute-glossary/hardware/cpu.md) loads the guest's state from a control structure that the hypervisor fills in, and runs the guest's own [kernel](https://www.daytona.com/compute-glossary/kernel/kernel.md) at native speed. Intel calls the control structure the VMCS and AMD calls it the VMCB. Each [vCPU](https://www.daytona.com/compute-glossary/virtualization/vcpu.md) has its own, and the hypervisor switches between them to run several guests on one core.

The same control structure lists the guest events that should end the entry and return control to the hypervisor. When one of them happens, the processor saves the guest's state and hands control back with the reason it stopped. The hypervisor chooses these events, so it can let a guest handle some things alone and trap others. A guest that never touches a listed event can run for a long time without an exit.

The hypervisor handles the event and enters the guest again. Each exit costs far more time than an ordinary instruction once the hypervisor's own work is counted, so much of hypervisor tuning is about avoiding exits. Paravirtual devices help by letting a guest batch work in shared memory instead of trapping on every device access. Newer processors also deliver some interrupts to a guest without an exit.

| **Exit cause**             | **Description**                                                               |
| -------------------------- | ----------------------------------------------------------------------------- |
| **I/O port access**        | The guest reads or writes a port that belongs to an emulated device.          |
| **Control register write** | The guest changes a processor setting that the hypervisor has to check first. |
| **External interrupt**     | A device or timer on the host raises an interrupt while the guest is running. |

## Second-level address translation

Second-level address translation is a processor feature that maps the addresses a guest treats as physical to real host [memory](https://www.daytona.com/compute-glossary/hardware/memory.md). The guest manages its own page tables, and the processor walks a second set of tables, controlled by the hypervisor, on top of them. Each guest has its own second set, so two guests can use the same guest-physical addresses without clashing. The guest never sees the second set and needs no changes to use it.

Intel calls it EPT and AMD calls it NPT. Before it existed, hypervisors kept shadow copies of every guest page table and trapped each change the guest made, which was slow and complex. Every change a guest made to its page tables forced an exit, which hurt workloads that start many processes. Second-level translation removed those exits, at the cost of longer walks after a translation miss.

Because only the hypervisor can change the second set of tables, a guest cannot reach memory that was not given to it. The processor walks both sets in hardware, so the guest manages its memory without stopping for the hypervisor. The hypervisor can also mark pages read-only in the second set to learn which ones a guest writes. That is how it tracks changed memory while moving a running guest to another host.

## IOMMU

An IOMMU is a unit that translates the memory addresses a device uses for direct memory access. It applies the idea of second-level translation to devices, so a network card or [GPU](https://www.daytona.com/compute-glossary/hardware/gpu.md) given to one guest can reach only that guest's memory. It sits between devices and memory and checks each access against tables that the hypervisor sets up. A device given to a guest can then use the guest's own addresses directly.

Without one, a device handed to a guest could read or write any host memory, because direct memory access bypasses the processor's page tables. Many IOMMUs can also remap interrupts, and with that enabled a device cannot send them to the wrong guest. Hosts without virtualization use an IOMMU too, to stop a faulty or hostile device from writing over the kernel. External ports that allow direct memory access are the usual worry.

Intel calls its version VT-d and AMD calls its version AMD-Vi. Together with second-level translation, the IOMMU makes device passthrough safe, letting a guest drive real hardware without being trusted with the whole host. Some devices split themselves into several virtual functions, each passed to a different guest, through a standard called SR-IOV. One physical card can then serve many guests, each with direct access to its own slice.

## Related terms

- [Hypervisor](https://www.daytona.com/compute-glossary/virtualization/hypervisor.md)
- [KVM](https://www.daytona.com/compute-glossary/virtualization/kvm.md)
- [Virtual machine](https://www.daytona.com/compute-glossary/virtualization/virtual-machine.md)
- [CPU](https://www.daytona.com/compute-glossary/hardware/cpu.md)
- [Memory](https://www.daytona.com/compute-glossary/hardware/memory.md)
- [vCPU](https://www.daytona.com/compute-glossary/virtualization/vcpu.md)
