When doing a virtual vmexit (ie: a vmexit handled by the L1 VMM)
interrupts shouldn't be injected using the virtual interrupt delivery
mechanism unless the Ack on exit vmexit control bit isn't set in the
nested vmcs.
Gate the call to nvmx_update_apicv helper on whether the nested vmcs
has the Ack on exit bit set in the vmexit control field.
Note that this fixes the usage of x2APIC by the L1 VMM, at least when
the L1 VMM is Xen.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
/* updating host cr0 to sync TS bit */
__vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
- if ( cpu_has_vmx_virtual_intr_delivery )
+ if ( cpu_has_vmx_virtual_intr_delivery &&
+ /*
+ * Only inject the vector if the Ack on exit bit is not set, else the
+ * interrupt will be signaled in the vmcs VM_EXIT_INTR_INFO field.
+ */
+ !(get_vvmcs(v, VM_EXIT_CONTROLS) & VM_EXIT_ACK_INTR_ON_EXIT) )
nvmx_update_apicv(v);
nvcpu->nv_vmswitch_in_progress = 0;