KVM: x86: Move SVM's APICv sanity check to common x86
authorSean Christopherson <seanjc@google.com>
Fri, 22 Oct 2021 00:49:25 +0000 (17:49 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 22 Oct 2021 15:20:16 +0000 (11:20 -0400)
commitee49a89329711f84601bcb65ac8e8ef54fdac771
treee025f67475e4086433168561d5c09a7596920a6a
parent9b4eb77099f6ba37a8da7d7c5d409db309eb995e
KVM: x86: Move SVM's APICv sanity check to common x86

Move SVM's assertion that vCPU's APICv state is consistent with its VM's
state out of svm_vcpu_run() and into x86's common inner run loop.  The
assertion and underlying logic is not unique to SVM, it's just that SVM
has more inhibiting conditions and thus is more likely to run headfirst
into any KVM bugs.

Add relevant comments to document exactly why the update path has unusual
ordering between the update the kick, why said ordering is safe, and also
the basic rules behind the assertion in the run loop.

Cc: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20211022004927.1448382-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c
arch/x86/kvm/x86.c