CHAPTER 29 APIC VIRTUALIZATION AND VIRTUAL INTERRUPTS

CHAPTER 29 APIC VIRTUALIZATION AND VIRTUAL INTERRUPTS



Object:
The VMCS includes controls that enable the virtualization of interrupts and the Advanced Programmable Interrupt Controller (APIC).


Usage/means:
When these controls are used, the processor will emulate many accesses to the APIC, track the state of the virtual APIC, and deliver virtual interrupts — all in VMX non-root operation with out a VM exit.


Implementation:
The processor tracks the state of the virtual APIC using a virtual-APIC page identified by the virtual-machine monitor (VMM). 


29.1  VIRTUAL APIC STATE

The virtual-APIC page is a 4-KByte region of memory that the processor uses the virtual-APIC page to virtualize certain accesses to APIC registers and to manage virtual interrupts. The physical address of the virtual-APIC page is the virtual-APIC address, a 64-bit VM-execution control field in the VMCS


 Virtualized APIC Registers
 


CHAPTER 32 VIRTUALIZATION OF SYSTEM RESOURCES 



32.3.1  Processor Operating Modes & Memory Virtualization

 To support guest real-mode execution, the VMM may establish a simple flat page table for guest linear to host physical address mapping.


CHAPTER 33 HANDLING BOUNDARY CONDITIONS IN A VIRTUAL MACHINE MONITOR 

 
 Event injection. VMX operation allows injecting interruptions to a guest virtual machine through the use of 
VM-entry interrupt-information field in VMCS. Injectable interruptions include external interrupts, NMI, 
processor exceptions, software generated interrupts, and software traps. If the interrupt-information field 
indicates a valid interrupt, exception or trap event upon the next VM entry; the processor will use the 
information in the field to vector a virtual interruption through the guest IDT after all guest state and MSRs are 
loaded. Delivery through the guest IDT emulates vectoring in non-VMX operation by doing the normal privilege 
checks and pushing appropriate entries to the guest stack (entries may include RFLAGS, EIP and exception 
error code). A VMM with host control of NMI and external interrupts can use the event-injection facility to 
forward virtual interruptions to various guest virtual machines.


33.2  INTERRUPT HANDLING IN VMX OPERATION 



Control of external interrupts. 
VMX allows both host and guest control of external interrupts through the 
“external-interrupt exiting” VM execution control. If the control is 0, external-interrupts do not cause VM exits 
and the interrupt delivery is masked by the guest programmed RFLAGS.IF value.
 If the control is 1, external-interrupts causes VM exits and are not masked by RFLAGS.IF. The VMM can identify VM exits due to external 
interrupts by checking the exit reason for an “external interrupt” (value = 1).




33.3  EXTERNAL INTERRUPT VIRTUALIZATION

VMX operation allows both host and guest control of external interrupts. While guest control of external interrupts 
might be suitable for partitioned usages (different CPU cores/threads and I/O devices partitioned to independent 
virtual machines), most VMMs built upon VMX are expected to utilize host control of external interrupts. 


With host control of external interrupts, the VMM (or the host OS in a hosted VMM model) manages the physical 
interrupt controllers in the platform and the interrupts generated through them. The VMM exposes software-
emulated virtual interrupt controller devices (such as PIC and APIC) to each guest virtual machine instance.
软件模拟 PIC, APIC


33.3.1  Virtualization of Interrupt Vector Space



Interrupts from assigned physical devices: Hardware support for I/O device assignment allows physical I/O 
devices in the host platform to be assigned (direct-mapped) to VMs. Guest vectors for interrupts from direct-
mapped physical devices take up equivalent space from the host vector space, and require the VMM to perform 
host-vector to guest-vector mapping for interrupts. 




33.3.3  Examples of Handling of External Interrupts

The following sections illustrate interrupt processing in a VMM (when used to support the external interrupt virtu-
alization requirements). 


33.3.3.1   Guest Setup
The VMM sets up the guest to cause a VM exit to the VMM on external interrupts. This is done by setting the 
“external-interrupt exiting” VM-execution control in the guest controlling-VMCS. 


33.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. 


33.3.3.3   Processing of External Interrupts by VMM
Host Owned I/O Devices
Guest Assigned I/O Devices


33.3.3.4   Generation of Virtual Interrupt Events by VMM





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值