Skip to content

Commit d6c20d1

Browse files
committed
KVM: SVM: Assert that Hyper-V's HV_SVM_EXITCODE_ENL == SVM_EXIT_SW
Add a build-time assertiont that Hyper-V's "enlightened" exit code is that, same as the AMD-defined "Reserved for Host" exit code, mostly to help readers connect the dots and understand why synthesizing a software-defined exit code is safe/ok. Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> Link: https://patch.msgid.link/20251230211347.4099600-9-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 1e3ddda commit d6c20d1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

arch/x86/kvm/svm/hyperv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ void svm_hv_inject_synthetic_vmexit_post_tlb_flush(struct kvm_vcpu *vcpu)
1010
{
1111
struct vcpu_svm *svm = to_svm(vcpu);
1212

13+
/*
14+
* The exit code used by Hyper-V for software-defined exits is reserved
15+
* by AMD specifically for such use cases.
16+
*/
17+
BUILD_BUG_ON(HV_SVM_EXITCODE_ENL != SVM_EXIT_SW);
18+
1319
svm->vmcb->control.exit_code = HV_SVM_EXITCODE_ENL;
1420
svm->vmcb->control.exit_info_1 = HV_SVM_ENL_EXITCODE_TRAP_AFTER_FLUSH;
1521
svm->vmcb->control.exit_info_2 = 0;

0 commit comments

Comments
 (0)