Skip to contentSkip to conversation

KVM: SVM: remove unnecessary check on INIT intercept

PATCH Applied Paolo Bonzini 3 participants 3 messages Aug 19, 2022 – Aug 30, 2022

Subsystems (3)
lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

PATCH 1/1 KVM: SVM: remove unnecessary check on INIT intercept

Since svm_check_nested_events() is now handling INIT signals, there is no need to latch it until the VMEXIT is injected. The only condition under which INIT signals are latched is GIF=0.

---
 arch/x86/kvm/svm/svm.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
arch/x86/kvm/svm/svm.c +1 -9
index f3813dbacb9f..26a348389ece 100644
@@ -4697,15 +4697,7 @@ static bool svm_apic_init_signal_blocked(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
-	/*
-	 * TODO: Last condition latch INIT signals on vCPU when
-	 * vCPU is in guest-mode and vmcb12 defines intercept on INIT.
-	 * To properly emulate the INIT intercept,
-	 * svm_check_nested_events() should call nested_svm_vmexit()
-	 * if an INIT signal is pending.
-	 */
-	return !gif_set(svm) ||
-		   (vmcb_is_intercept(&svm->vmcb->control, INTERCEPT_INIT));
+	return !gif_set(svm);
 }
 
 static void svm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector)
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Paolo Bonzini

Since svm_check_nested_events() is now handling INIT signals, there is no need to latch it until the VMEXIT is injected.  The only condition under which INIT signals are latched is GIF=0.

---
 arch/x86/kvm/svm/svm.c | 10 +---------

 1 file changed, 1 insertion(+), 9 deletions(-)
arch/x86/kvm/svm/svm.c +0 -0
index f3813dbacb9f..26a348389ece 100644
@@ -4697,15 +4697,7 @@ static bool svm_apic_init_signal_blocked(struct kvm_vcpu *vcpu)
  {
         struct vcpu_svm *svm = to_svm(vcpu);


-       /*
-        * TODO: Last condition latch INIT signals on vCPU when -        * vCPU is in guest-mode and vmcb12 defines intercept on INIT. -        * To properly emulate the INIT intercept,
-        * svm_check_nested_events() should call nested_svm_vmexit()

Quoted 8 lines

-        * if an INIT signal is pending.
-        */
-       return !gif_set(svm) ||
-                  (vmcb_is_intercept(&svm->vmcb->control, INTERCEPT_INIT)); +       return !gif_set(svm);
 }

 static void svm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector)

Best regards,
Maxim Levitsky

maintainer Applied
#2 lore raw
In reply to Paolo Bonzini
Quoted 7 lines · Paolo Bonzini

Since svm_check_nested_events() is now handling INIT signals, there is no need to latch it until the VMEXIT is injected. The only condition under which INIT signals are latched is GIF=0.

---

Pushed to branch for_paolo/6.1 at:

https://github.com/sean-jc/linux.git

Unless you hear otherwise, it will make its way to kvm/queue "soon", thus completing the circle.

Note, the commit IDs are not guaranteed to be stable.