Commit 194c17bf authored by Sean Christopherson's avatar Sean Christopherson
Browse files

KVM: SVM: Check for an unexpected VM-Exit after RETPOLINE "fast" handling



Check for an unexpected/unhandled VM-Exit after the manual RETPOLINE=y
handling.  The entire point of the RETPOLINE checks is to optimize for
common VM-Exits, i.e. checking for the rare case of an unsupported
VM-Exit is counter-productive.  This also aligns SVM and VMX exit handling.

No functional change intended.

Reviewed-by: default avatarYosry Ahmed <yosry.ahmed@linux.dev>
Link: https://patch.msgid.link/20251230211347.4099600-4-seanjc@google.com


Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 2450c977
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -3469,12 +3469,6 @@ static void dump_vmcb(struct kvm_vcpu *vcpu)

int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code)
{
	if (exit_code >= ARRAY_SIZE(svm_exit_handlers))
		goto unexpected_vmexit;

	if (!svm_exit_handlers[exit_code])
		goto unexpected_vmexit;

#ifdef CONFIG_MITIGATION_RETPOLINE
	if (exit_code == SVM_EXIT_MSR)
		return msr_interception(vcpu);
@@ -3491,6 +3485,12 @@ int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code)
		return sev_handle_vmgexit(vcpu);
#endif
#endif
	if (exit_code >= ARRAY_SIZE(svm_exit_handlers))
		goto unexpected_vmexit;

	if (!svm_exit_handlers[exit_code])
		goto unexpected_vmexit;

	return svm_exit_handlers[exit_code](vcpu);

unexpected_vmexit: