aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/arm/arch_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/arm/arch_timer.c')
-rw-r--r--virt/kvm/arm/arch_timer.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 5261f98ae686..dbd0af19d27e 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -327,9 +327,11 @@ void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu)
327} 327}
328 328
329int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu, 329int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu,
330 const struct kvm_irq_level *irq) 330 const struct kvm_irq_level *virt_irq,
331 const struct kvm_irq_level *phys_irq)
331{ 332{
332 struct arch_timer_context *vtimer = vcpu_vtimer(vcpu); 333 struct arch_timer_context *vtimer = vcpu_vtimer(vcpu);
334 struct arch_timer_context *ptimer = vcpu_ptimer(vcpu);
333 335
334 /* 336 /*
335 * The vcpu timer irq number cannot be determined in 337 * The vcpu timer irq number cannot be determined in
@@ -337,7 +339,8 @@ int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu,
337 * kvm_vcpu_set_target(). To handle this, we determine 339 * kvm_vcpu_set_target(). To handle this, we determine
338 * vcpu timer irq number when the vcpu is reset. 340 * vcpu timer irq number when the vcpu is reset.
339 */ 341 */
340 vtimer->irq.irq = irq->irq; 342 vtimer->irq.irq = virt_irq->irq;
343 ptimer->irq.irq = phys_irq->irq;
341 344
342 /* 345 /*
343 * The bits in CNTV_CTL are architecturally reset to UNKNOWN for ARMv8 346 * The bits in CNTV_CTL are architecturally reset to UNKNOWN for ARMv8
@@ -346,6 +349,7 @@ int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu,
346 * the ARMv7 architecture. 349 * the ARMv7 architecture.
347 */ 350 */
348 vtimer->cnt_ctl = 0; 351 vtimer->cnt_ctl = 0;
352 ptimer->cnt_ctl = 0;
349 kvm_timer_update_state(vcpu); 353 kvm_timer_update_state(vcpu);
350 354
351 return 0; 355 return 0;
@@ -376,6 +380,7 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)
376 380
377 /* Synchronize cntvoff across all vtimers of a VM. */ 381 /* Synchronize cntvoff across all vtimers of a VM. */
378 update_vtimer_cntvoff(vcpu, kvm_phys_timer_read()); 382 update_vtimer_cntvoff(vcpu, kvm_phys_timer_read());
383 vcpu_ptimer(vcpu)->cntvoff = 0;
379 384
380 INIT_WORK(&timer->expired, kvm_timer_inject_irq_work); 385 INIT_WORK(&timer->expired, kvm_timer_inject_irq_work);
381 hrtimer_init(&timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 386 hrtimer_init(&timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);