summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorChristoffer Dall <cdall@linaro.org>2017-06-18 01:41:06 -0700
committerChristoffer Dall <christoffer.dall@linaro.org>2017-11-06 16:23:15 +0100
commitcda93b7aa4657f2a9df28d56df8259226be8b0e9 (patch)
tree4a58966cf04ec8360a2878b0ed23eac6cdcdb137 /virt
parentc1b135af8387bc6c6d43ed61a65647c68f231ea1 (diff)
downloadlinux-cda93b7aa4657f2a9df28d56df8259226be8b0e9.tar.bz2
KVM: arm/arm64: Move phys_timer_emulate function
We are about to call phys_timer_emulate() from kvm_timer_update_state() and modify phys_timer_emulate() at the same time. Moving the function and modifying it in a single patch makes the diff hard to read, so do this separately first. No functional change. Signed-off-by: Christoffer Dall <cdall@linaro.org> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/arch_timer.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index d1a6fb12121f..7f4f12d48a1a 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -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;