mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-14 06:22:34 +02:00
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>
24 lines
654 B
C
24 lines
654 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* AMD SVM specific code for Hyper-V on KVM.
|
|
*
|
|
* Copyright 2022 Red Hat, Inc. and/or its affiliates.
|
|
*/
|
|
#include "hyperv.h"
|
|
|
|
void svm_hv_inject_synthetic_vmexit_post_tlb_flush(struct kvm_vcpu *vcpu)
|
|
{
|
|
struct vcpu_svm *svm = to_svm(vcpu);
|
|
|
|
/*
|
|
* The exit code used by Hyper-V for software-defined exits is reserved
|
|
* by AMD specifically for such use cases.
|
|
*/
|
|
BUILD_BUG_ON(HV_SVM_EXITCODE_ENL != SVM_EXIT_SW);
|
|
|
|
svm->vmcb->control.exit_code = HV_SVM_EXITCODE_ENL;
|
|
svm->vmcb->control.exit_info_1 = HV_SVM_ENL_EXITCODE_TRAP_AFTER_FLUSH;
|
|
svm->vmcb->control.exit_info_2 = 0;
|
|
nested_svm_vmexit(svm);
|
|
}
|