diff options
| -rw-r--r-- | arch/x86/kvm/lapic.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index d67206a7b99a..629af0f1c5c4 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
| @@ -683,8 +683,7 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src, | |||
| 683 | unsigned long bitmap = 1; | 683 | unsigned long bitmap = 1; |
| 684 | struct kvm_lapic **dst; | 684 | struct kvm_lapic **dst; |
| 685 | int i; | 685 | int i; |
| 686 | bool ret = false; | 686 | bool ret, x2apic_ipi; |
| 687 | bool x2apic_ipi = src && apic_x2apic_mode(src); | ||
| 688 | 687 | ||
| 689 | *r = -1; | 688 | *r = -1; |
| 690 | 689 | ||
| @@ -696,16 +695,18 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src, | |||
| 696 | if (irq->shorthand) | 695 | if (irq->shorthand) |
| 697 | return false; | 696 | return false; |
| 698 | 697 | ||
| 698 | x2apic_ipi = src && apic_x2apic_mode(src); | ||
| 699 | if (irq->dest_id == (x2apic_ipi ? X2APIC_BROADCAST : APIC_BROADCAST)) | 699 | if (irq->dest_id == (x2apic_ipi ? X2APIC_BROADCAST : APIC_BROADCAST)) |
| 700 | return false; | 700 | return false; |
| 701 | 701 | ||
| 702 | ret = true; | ||
| 702 | rcu_read_lock(); | 703 | rcu_read_lock(); |
| 703 | map = rcu_dereference(kvm->arch.apic_map); | 704 | map = rcu_dereference(kvm->arch.apic_map); |
| 704 | 705 | ||
| 705 | if (!map) | 706 | if (!map) { |
| 707 | ret = false; | ||
| 706 | goto out; | 708 | goto out; |
| 707 | 709 | } | |
| 708 | ret = true; | ||
| 709 | 710 | ||
| 710 | if (irq->dest_mode == APIC_DEST_PHYSICAL) { | 711 | if (irq->dest_mode == APIC_DEST_PHYSICAL) { |
| 711 | if (irq->dest_id >= ARRAY_SIZE(map->phys_map)) | 712 | if (irq->dest_id >= ARRAY_SIZE(map->phys_map)) |
