Skip to content

Commit c364baa

Browse files
committed
KVM: VMX: Don't send UNBLOCK when starting device assignment without APICv
When starting device assignment, i.e. potential IRQ bypass, don't blast KVM_REQ_UNBLOCK if APICv is disabled/unsupported. There is no need to wake vCPUs if they can never use VT-d posted IRQs (sending UNBLOCK guards against races being vCPUs blocking and devices starting IRQ bypass). Opportunistically use kvm_arch_has_irq_bypass() for all relevant checks in the VMX Posted Interrupt code so that all checks in KVM x86 incorporate the same information (once AMD/AVIC is given similar treatment). Cc: Yosry Ahmed <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 87e4951 commit c364baa

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/x86/kvm/vmx/posted_intr.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,8 @@ void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu)
148148

149149
static bool vmx_can_use_vtd_pi(struct kvm *kvm)
150150
{
151-
return irqchip_in_kernel(kvm) && enable_apicv &&
152-
kvm_arch_has_assigned_device(kvm) &&
153-
irq_remapping_cap(IRQ_POSTING_CAP);
151+
return irqchip_in_kernel(kvm) && kvm_arch_has_irq_bypass() &&
152+
kvm_arch_has_assigned_device(kvm);
154153
}
155154

156155
/*
@@ -281,7 +280,7 @@ bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu)
281280
*/
282281
void vmx_pi_start_assignment(struct kvm *kvm)
283282
{
284-
if (!irq_remapping_cap(IRQ_POSTING_CAP))
283+
if (!kvm_arch_has_irq_bypass())
285284
return;
286285

287286
kvm_make_all_cpus_request(kvm, KVM_REQ_UNBLOCK);

0 commit comments

Comments
 (0)