Intel 64 and IA-32 Architectures Software Developers Manual Volume 3B, System Programming Guide Part 2

Table Of Contents
Vol. 3 28-9
HANDLING BOUNDARY CONDITIONS IN A VIRTUAL MACHINE MONITOR
28.3.3.2 Processor Treatment of External Interrupt
Interrupts are automatically masked by hardware in the processor on VM exit by
clearing RFLAGS.IF. The exit-reason field in VMCS is set to 1 to indicate an external
interrupt as the exit reason.
If the VMM is utilizing the acknowledge-on-exit feature (by setting the acknowledge-
interrupt-on-exit bit in guest VM-exit control field), the processor acknowledges the
interrupt, retrieves the host vector, and saves the interrupt in the exit-interruption-
information field (in the VM-exit information region of the VMCS) before transitioning
control to the VMM.
28.3.3.3 Processing of External Interrupts by VMM
Upon VM exit, the VMM can determine the exit cause of an external interrupt by
checking the exit-reason field (value = 1) in VMCS. If the acknowledge-interrupt-on-
exit control (see Section 20.7.1) is enabled, the VMM can use the saved host vector
(in the exit-interruption-information field) to switch to the appropriate interrupt
handler. If acknowledge-interrupt-on-exit is not enabled, the VMM may re-enable
interrupts (by setting RFLAGS.IF) to allow vectoring of external interrupts through
the monitor/host IDT.
The following steps may need to be performed by the VMM to process an external
interrupt:
Host Owned I/O Devices: For host-owned I/O devices, the interrupting device
is owned by the VMM (or hosting OS in a hosted VMM). In this model, the
interrupt service routine in the VMM/host driver is invoked and, upon ISR
completion, the appropriate write sequences (TPR updates, EOI etc.) to
respective interrupt controllers are performed as normal. If the work completion
indicated by the driver implies virtual device activity, the VMM runs the virtual
device emulation. Depending on the device class, physical device activity could
imply activity by multiple virtual devices mapped over the device. For each
affected virtual device, the VMM injects a virtual external interrupt event to
respective guest virtual machines. The guest driver interacts with the emulated
virtual device to process the virtual interrupt. The interrupt controller emulation
in the VMM supports various guest accesses to the VMM’s virtual interrupt
controller.
Guest Assigned I/O Devices: For assigned I/O devices, either the VMM uses a
software proxy or it can directly map the physical device to the assigned VM. In
both cases, servicing of the interrupt condition on the physical device is initiated
by the driver running inside the guest VM. With host control of external
interrupts, interrupts from assigned physical devices cause VM exits to the VMM
and vectoring through the host IDT to the registered VMM interrupt handler. To
unblock delivery of other low priority platform interrupts, the VMM interrupt
handler must mask the interrupt source (for level triggered interrupts) and issue
the appropriate EOI write sequences.