[PATCH 07/10] KVM: SVM: use vmcb01 in svm_refresh_apicv_exec_ctrl

From: Maxim Levitsky
Date: Wed Jun 23 2021 - 07:30:55 EST


AVIC is not supported for nesting but in some corner
cases it is possible to have it still be enabled,
after we entered nesting, and use vmcb02.

Fix this by always using vmcb01 in svm_refresh_apicv_exec_ctrl

Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx>
---
arch/x86/kvm/svm/avic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 1d01da64c333..a8ad78a2faa1 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -646,7 +646,7 @@ static int svm_set_pi_irte_mode(struct kvm_vcpu *vcpu, bool activate)
void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);
- struct vmcb *vmcb = svm->vmcb;
+ struct vmcb *vmcb = svm->vmcb01.ptr;
bool activated = kvm_vcpu_apicv_active(vcpu);

if (!enable_apicv)
--
2.26.3