KVM: nSVM: fix few bugs in the vmcb02 caching logic
authorMaxim Levitsky <mlevitsk@redhat.com>
Mon, 3 May 2021 12:54:43 +0000 (15:54 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 3 May 2021 15:25:37 +0000 (11:25 -0400)
commitc74ad08f3333db2e44d3346b863f6d10d35e37dd
tree3344853b461f63f5ed583b7218742c3466248007
parentdeee59bacb2402c20e6b1b6800f9a5127367eb2a
KVM: nSVM: fix few bugs in the vmcb02 caching logic

* Define and use an invalid GPA (all ones) for init value of last
  and current nested vmcb physical addresses.

* Reset the current vmcb12 gpa to the invalid value when leaving
  the nested mode, similar to what is done on nested vmexit.

* Reset the last seen vmcb12 address when disabling the nested SVM,
  as it relies on vmcb02 fields which are freed at that point.

Fixes: 4995a3685f1b ("KVM: SVM: Use a separate vmcb for the nested L2 guest")

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20210503125446.1353307-3-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/svm/nested.c
arch/x86/kvm/svm/svm.c