lkml.org 
[lkml]   [2021]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/5] KVM: nSVM: set a dummy exit reason in L1 vmcb when loading the nested state
Date
Since the nested migration is a result of a VMRUN, this makes it
possible to keep a warning that L1 vmcb should always have
VMRUN exit reason when switching back to it, which
otherwise triggers incorrectly.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
arch/x86/kvm/svm/nested.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 12a12ae940fa..146be4b5084b 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -1338,6 +1338,12 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
svm->vmcb01.ptr->save.rip = save->rip;
svm->vmcb01.ptr->save.cpl = 0;

+ /*
+ * For consistency sake, restore the L1 exit reason
+ * (that happened prior to the migration) to SVM_EXIT_VMRUN.
+ */
+ svm->vmcb->control.exit_code = SVM_EXIT_VMRUN;
+
nested_load_control_from_vmcb12(svm, ctl);

svm_switch_vmcb(svm, &svm->nested.vmcb02);
--
2.26.2
\
 
 \ /
  Last update: 2021-05-03 14:56    [W:1.423 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site