|
@@ -255,6 +255,22 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/* Schedule the background timer for the emulated timer. */
|
|
|
+static void phys_timer_emulate(struct kvm_vcpu *vcpu,
|
|
|
+ struct arch_timer_context *timer_ctx)
|
|
|
+{
|
|
|
+ struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
|
|
|
+
|
|
|
+ if (kvm_timer_should_fire(timer_ctx))
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (!kvm_timer_irq_can_fire(timer_ctx))
|
|
|
+ return;
|
|
|
+
|
|
|
+ /* The timer has not yet expired, schedule a background timer */
|
|
|
+ soft_timer_start(&timer->phys_timer, kvm_timer_compute_delta(timer_ctx));
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Check if there was a change in the timer state (should we raise or lower
|
|
|
* the line level to the GIC).
|
|
@@ -281,22 +297,6 @@ static void kvm_timer_update_state(struct kvm_vcpu *vcpu)
|
|
|
kvm_timer_update_irq(vcpu, !ptimer->irq.level, ptimer);
|
|
|
}
|
|
|
|
|
|
-/* Schedule the background timer for the emulated timer. */
|
|
|
-static void phys_timer_emulate(struct kvm_vcpu *vcpu,
|
|
|
- struct arch_timer_context *timer_ctx)
|
|
|
-{
|
|
|
- struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
|
|
|
-
|
|
|
- if (kvm_timer_should_fire(timer_ctx))
|
|
|
- return;
|
|
|
-
|
|
|
- if (!kvm_timer_irq_can_fire(timer_ctx))
|
|
|
- return;
|
|
|
-
|
|
|
- /* The timer has not yet expired, schedule a background timer */
|
|
|
- soft_timer_start(&timer->phys_timer, kvm_timer_compute_delta(timer_ctx));
|
|
|
-}
|
|
|
-
|
|
|
static void vtimer_save_state(struct kvm_vcpu *vcpu)
|
|
|
{
|
|
|
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
|