diff options
Diffstat (limited to 'arch/x86/kvm/lapic.c')
-rw-r--r-- | arch/x86/kvm/lapic.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0aa158657f20..e904ff06a83d 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -216,6 +216,9 @@ static void recalculate_apic_map(struct kvm *kvm) | |||
216 | if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id]) | 216 | if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id]) |
217 | new->phys_map[xapic_id] = apic; | 217 | new->phys_map[xapic_id] = apic; |
218 | 218 | ||
219 | if (!kvm_apic_sw_enabled(apic)) | ||
220 | continue; | ||
221 | |||
219 | ldr = kvm_lapic_get_reg(apic, APIC_LDR); | 222 | ldr = kvm_lapic_get_reg(apic, APIC_LDR); |
220 | 223 | ||
221 | if (apic_x2apic_mode(apic)) { | 224 | if (apic_x2apic_mode(apic)) { |
@@ -258,6 +261,8 @@ static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val) | |||
258 | static_key_slow_dec_deferred(&apic_sw_disabled); | 261 | static_key_slow_dec_deferred(&apic_sw_disabled); |
259 | else | 262 | else |
260 | static_key_slow_inc(&apic_sw_disabled.key); | 263 | static_key_slow_inc(&apic_sw_disabled.key); |
264 | |||
265 | recalculate_apic_map(apic->vcpu->kvm); | ||
261 | } | 266 | } |
262 | } | 267 | } |
263 | 268 | ||
@@ -1548,7 +1553,6 @@ static void kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic) | |||
1548 | static void apic_timer_expired(struct kvm_lapic *apic) | 1553 | static void apic_timer_expired(struct kvm_lapic *apic) |
1549 | { | 1554 | { |
1550 | struct kvm_vcpu *vcpu = apic->vcpu; | 1555 | struct kvm_vcpu *vcpu = apic->vcpu; |
1551 | struct swait_queue_head *q = &vcpu->wq; | ||
1552 | struct kvm_timer *ktimer = &apic->lapic_timer; | 1556 | struct kvm_timer *ktimer = &apic->lapic_timer; |
1553 | 1557 | ||
1554 | if (atomic_read(&apic->lapic_timer.pending)) | 1558 | if (atomic_read(&apic->lapic_timer.pending)) |
@@ -1566,13 +1570,6 @@ static void apic_timer_expired(struct kvm_lapic *apic) | |||
1566 | 1570 | ||
1567 | atomic_inc(&apic->lapic_timer.pending); | 1571 | atomic_inc(&apic->lapic_timer.pending); |
1568 | kvm_set_pending_timer(vcpu); | 1572 | kvm_set_pending_timer(vcpu); |
1569 | |||
1570 | /* | ||
1571 | * For x86, the atomic_inc() is serialized, thus | ||
1572 | * using swait_active() is safe. | ||
1573 | */ | ||
1574 | if (swait_active(q)) | ||
1575 | swake_up_one(q); | ||
1576 | } | 1573 | } |
1577 | 1574 | ||
1578 | static void start_sw_tscdeadline(struct kvm_lapic *apic) | 1575 | static void start_sw_tscdeadline(struct kvm_lapic *apic) |