From: Wei Yang Date: Mon, 1 Apr 2019 02:17:21 +0000 (-0700) Subject: kvm: x86: check kvm_apic_sw_enabled() is enough X-Git-Tag: 5.3-smb3-fixes~78^2~84 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=7d2296bfa52cc9b63063935dd21ca5fa0d790754;p=sfrench%2Fcifs-2.6.git kvm: x86: check kvm_apic_sw_enabled() is enough On delivering irq to apic, we iterate on vcpu and do the check like this: kvm_apic_present(vcpu) kvm_lapic_enabled(vpu) kvm_apic_present(vcpu) && kvm_apic_sw_enabled(vcpu->arch.apic) Since we have already checked kvm_apic_present(), it is reasonable to replace kvm_lapic_enabled() with kvm_apic_sw_enabled(). Signed-off-by: Wei Yang Signed-off-by: Paolo Bonzini --- diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c index 3cc3b2d130a0..188beb301cc5 100644 --- a/arch/x86/kvm/irq_comm.c +++ b/arch/x86/kvm/irq_comm.c @@ -86,7 +86,7 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, if (r < 0) r = 0; r += kvm_apic_set_irq(vcpu, irq, dest_map); - } else if (kvm_lapic_enabled(vcpu)) { + } else if (kvm_apic_sw_enabled(vcpu->arch.apic)) { if (!kvm_vector_hashing_enabled()) { if (!lowest) lowest = vcpu;