aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorAndrew Jones <drjones@redhat.com>2019-05-27 07:46:19 -0400
committerMarc Zyngier <marc.zyngier@arm.com>2019-06-19 10:47:52 -0400
commite4e5a865e9a9e8e47ac1959b629e9f3ae3b062f2 (patch)
treefaad5eee971b557bd98b020ae964a0a5735f81f1 /virt
parent4729ec8c1e1145234aeeebad5d96d77f4ccbb00a (diff)
KVM: arm/arm64: Fix emulated ptimer irq injection
The emulated ptimer needs to track the level changes, otherwise the the interrupt will never get deasserted, resulting in the guest getting stuck in an interrupt storm if it enables ptimer interrupts. This was found with kvm-unit-tests; the ptimer tests hung as soon as interrupts were enabled. Typical Linux guests don't have a problem as they prefer using the virtual timer. Fixes: bee038a674875 ("KVM: arm/arm64: Rework the timer code to use a timer_map") Signed-off-by: Andrew Jones <drjones@redhat.com> [Simplified the patch to res we only care about emulated timers here] Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/arch_timer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 7fc272ecae16..1b1c449ceaf4 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -321,14 +321,15 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level,
321 } 321 }
322} 322}
323 323
324/* Only called for a fully emulated timer */
324static void timer_emulate(struct arch_timer_context *ctx) 325static void timer_emulate(struct arch_timer_context *ctx)
325{ 326{
326 bool should_fire = kvm_timer_should_fire(ctx); 327 bool should_fire = kvm_timer_should_fire(ctx);
327 328
328 trace_kvm_timer_emulate(ctx, should_fire); 329 trace_kvm_timer_emulate(ctx, should_fire);
329 330
330 if (should_fire) { 331 if (should_fire != ctx->irq.level) {
331 kvm_timer_update_irq(ctx->vcpu, true, ctx); 332 kvm_timer_update_irq(ctx->vcpu, should_fire, ctx);
332 return; 333 return;
333 } 334 }
334 335