[RFC PATCH 6/9] KVM: SVM: Inject #HV into VMPL0 with Alternate Injection enabled

From: Melody Wang

Date: Tue Nov 10 2026 - 03:38:35 EST


With Alternate Injection enabled, interrupts for VMPL1-3 are saved in
the doorbell page, and by using #HV injected into VMPL0. Then, the SVSM
at VMPL0 is run to inject them into the target VMPL of the guest.

Signed-off-by: Melody Wang <huibo.wang@xxxxxxx>
---
arch/x86/kvm/svm/sev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 543851bfb94d..40f55e7a78e3 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -5836,9 +5836,11 @@ bool sev_snp_ai_inject(struct kvm_vcpu *vcpu)
struct kvm_host_map hvdb_map;
struct hvdb *hvdb;
struct vcpu_svm *svm0;
+ struct vcpu_svm *svm;

vcpu_plane0 = vcpu->common->vcpus[0];
svm0 = to_svm(vcpu_plane0);
+ svm = to_svm(vcpu);

hvdb = map_hvdb(vcpu_plane0, &hvdb_map);
if (!hvdb)
@@ -5848,7 +5850,7 @@ bool sev_snp_ai_inject(struct kvm_vcpu *vcpu)
goto unmap;

prepare_hv_injection(svm0, hvdb);
-
+ __sev_snp_run_vmpl(svm, 0);
unmap:
unmap_hvdb(vcpu_plane0, &hvdb_map);

--
2.43.0