aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2009-10-09 10:08:25 -0400
committerAvi Kivity <avi@redhat.com>2009-12-03 02:32:14 -0500
commit8d23c4662427507f432c96ac4fa3b76f0a8360cd (patch)
tree2390dd2597dae341903d98b12c66a43368674270 /arch/x86/kvm/svm.c
parente3267cbbbfbcbe9c18833e89b10beabb1117cb55 (diff)
KVM: SVM: Notify nested hypervisor of lost event injections
If event_inj is valid on a #vmexit the host CPU would write the contents to exit_int_info, so the hypervisor knows that the event wasn't injected. We don't do this in nested SVM by now which is a bug and fixed by this patch. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r--arch/x86/kvm/svm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 279a2ae21b4f..e37285446cb7 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1615,6 +1615,22 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
1615 nested_vmcb->control.exit_info_2 = vmcb->control.exit_info_2; 1615 nested_vmcb->control.exit_info_2 = vmcb->control.exit_info_2;
1616 nested_vmcb->control.exit_int_info = vmcb->control.exit_int_info; 1616 nested_vmcb->control.exit_int_info = vmcb->control.exit_int_info;
1617 nested_vmcb->control.exit_int_info_err = vmcb->control.exit_int_info_err; 1617 nested_vmcb->control.exit_int_info_err = vmcb->control.exit_int_info_err;
1618
1619 /*
1620 * If we emulate a VMRUN/#VMEXIT in the same host #vmexit cycle we have
1621 * to make sure that we do not lose injected events. So check event_inj
1622 * here and copy it to exit_int_info if it is valid.
1623 * Exit_int_info and event_inj can't be both valid because the case
1624 * below only happens on a VMRUN instruction intercept which has
1625 * no valid exit_int_info set.
1626 */
1627 if (vmcb->control.event_inj & SVM_EVTINJ_VALID) {
1628 struct vmcb_control_area *nc = &nested_vmcb->control;
1629
1630 nc->exit_int_info = vmcb->control.event_inj;
1631 nc->exit_int_info_err = vmcb->control.event_inj_err;
1632 }
1633
1618 nested_vmcb->control.tlb_ctl = 0; 1634 nested_vmcb->control.tlb_ctl = 0;
1619 nested_vmcb->control.event_inj = 0; 1635 nested_vmcb->control.event_inj = 0;
1620 nested_vmcb->control.event_inj_err = 0; 1636 nested_vmcb->control.event_inj_err = 0;