Skip to content

Commit cda93b7

Browse files
Christoffer Dallchazy
authored andcommitted
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>
1 parent c1b135a commit cda93b7

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

‎virt/kvm/arm/arch_timer.c‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,22 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level,
255255
}
256256
}
257257

258+
/* Schedule the background timer for the emulated timer. */
259+
static void phys_timer_emulate(struct kvm_vcpu *vcpu,
260+
struct arch_timer_context *timer_ctx)
261+
{
262+
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
263+
264+
if (kvm_timer_should_fire(timer_ctx))
265+
return;
266+
267+
if (!kvm_timer_irq_can_fire(timer_ctx))
268+
return;
269+
270+
/* The timer has not yet expired, schedule a background timer */
271+
soft_timer_start(&timer->phys_timer, kvm_timer_compute_delta(timer_ctx));
272+
}
273+
258274
/*
259275
* Check if there was a change in the timer state (should we raise or lower
260276
* the line level to the GIC).
@@ -281,22 +297,6 @@ static void kvm_timer_update_state(struct kvm_vcpu *vcpu)
281297
kvm_timer_update_irq(vcpu, !ptimer->irq.level, ptimer);
282298
}
283299

284-
/* Schedule the background timer for the emulated timer. */
285-
static void phys_timer_emulate(struct kvm_vcpu *vcpu,
286-
struct arch_timer_context *timer_ctx)
287-
{
288-
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
289-
290-
if (kvm_timer_should_fire(timer_ctx))
291-
return;
292-
293-
if (!kvm_timer_irq_can_fire(timer_ctx))
294-
return;
295-
296-
/* The timer has not yet expired, schedule a background timer */
297-
soft_timer_start(&timer->phys_timer, kvm_timer_compute_delta(timer_ctx));
298-
}
299-
300300
static void vtimer_save_state(struct kvm_vcpu *vcpu)
301301
{
302302
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;

0 commit comments

Comments
 (0)