Skip to content

Commit ccf8d68

Browse files
sean-jcbonzini
authored andcommitted
KVM: VMX: Fold fallback path into triggering posted IRQ helper
Move the fallback "wake_up" path into the helper to trigger posted interrupt helper now that the nested and non-nested paths are identical. No functional change intended. Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Maxim Levitsky <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 296aa26 commit ccf8d68

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3931,7 +3931,7 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu)
39313931
pt_update_intercept_for_msr(vcpu);
39323932
}
39333933

3934-
static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu,
3934+
static inline void kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu,
39353935
int pi_vec)
39363936
{
39373937
#ifdef CONFIG_SMP
@@ -3962,10 +3962,15 @@ static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu,
39623962
*/
39633963

39643964
apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), pi_vec);
3965-
return true;
3965+
return;
39663966
}
39673967
#endif
3968-
return false;
3968+
/*
3969+
* The vCPU isn't in the guest; wake the vCPU in case it is blocking,
3970+
* otherwise do nothing as KVM will grab the highest priority pending
3971+
* IRQ via ->sync_pir_to_irr() in vcpu_enter_guest().
3972+
*/
3973+
kvm_vcpu_wake_up(vcpu);
39693974
}
39703975

39713976
static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu,
@@ -3995,8 +4000,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu,
39954000
smp_mb__after_atomic();
39964001

39974002
/* the PIR and ON have been set by L1. */
3998-
if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR))
3999-
kvm_vcpu_wake_up(vcpu);
4003+
kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR);
40004004
return 0;
40014005
}
40024006
return -1;
@@ -4033,9 +4037,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector)
40334037
* guaranteed to see PID.ON=1 and sync the PIR to IRR if triggering a
40344038
* posted interrupt "fails" because vcpu->mode != IN_GUEST_MODE.
40354039
*/
4036-
if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR))
4037-
kvm_vcpu_wake_up(vcpu);
4038-
4040+
kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR);
40394041
return 0;
40404042
}
40414043

0 commit comments

Comments
 (0)