KVM: X86: Filter out the broadcast dest for IPI fastpath
authorWanpeng Li <wanpengli@tencent.com>
Thu, 2 Apr 2020 08:20:26 +0000 (16:20 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 7 Apr 2020 12:34:16 +0000 (08:34 -0400)
Except destination shorthand, a destination value 0xffffffff is used to
broadcast interrupts, let's also filter out this for single target IPI
fastpath.

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Message-Id: <1585815626-28370-1-git-send-email-wanpengli@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/lapic.h
arch/x86/kvm/x86.c

index ca80daf8f878311329c0403a77bb6dd6d67f45e1..9af25c97612a7488d6ec29f544aa9bc8c46cbaac 100644 (file)
@@ -59,9 +59,6 @@
 #define MAX_APIC_VECTOR                        256
 #define APIC_VECTORS_PER_REG           32
 
-#define APIC_BROADCAST                 0xFF
-#define X2APIC_BROADCAST               0xFFFFFFFFul
-
 static bool lapic_timer_advance_dynamic __read_mostly;
 #define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100     /* clock cycles */
 #define LAPIC_TIMER_ADVANCE_ADJUST_MAX 10000   /* clock cycles */
index 40ed6ed22751086a530d5596f65dabbdbfca6bd1..a0ffb43314183c3c79ee2475cf77dc825326078e 100644 (file)
@@ -17,6 +17,9 @@
 #define APIC_BUS_CYCLE_NS       1
 #define APIC_BUS_FREQUENCY      (1000000000ULL / APIC_BUS_CYCLE_NS)
 
+#define APIC_BROADCAST                 0xFF
+#define X2APIC_BROADCAST               0xFFFFFFFFul
+
 enum lapic_mode {
        LAPIC_MODE_DISABLED = 0,
        LAPIC_MODE_INVALID = X2APIC_ENABLE,
index b8124b562dea4937e4433cb1b35068f95a3700b3..027dfd278a973d4c62c41cd3fd5a2de2a0dc36c8 100644 (file)
@@ -1586,7 +1586,8 @@ static int handle_fastpath_set_x2apic_icr_irqoff(struct kvm_vcpu *vcpu, u64 data
 
        if (((data & APIC_SHORT_MASK) == APIC_DEST_NOSHORT) &&
                ((data & APIC_DEST_MASK) == APIC_DEST_PHYSICAL) &&
-               ((data & APIC_MODE_MASK) == APIC_DM_FIXED)) {
+               ((data & APIC_MODE_MASK) == APIC_DM_FIXED) &&
+               ((u32)(data >> 32) != X2APIC_BROADCAST)) {
 
                data &= ~(1 << 12);
                kvm_apic_send_ipi(vcpu->arch.apic, (u32)data, (u32)(data >> 32));