aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2007-12-05 14:01:39 +0000
committerKeir Fraser <keir.fraser@citrix.com>2007-12-05 14:01:39 +0000
commitebd0979ead4c5d23073dc319b22a9f2bee6e23a4 (patch)
tree4440bb417ddd5d662860a1cdd9615fc92d084589
parentea4f3a408e5e9993a9292eed301abd0b41dab74d (diff)
downloadxen-ebd0979ead4c5d23073dc319b22a9f2bee6e23a4.tar.gz
xen-ebd0979ead4c5d23073dc319b22a9f2bee6e23a4.tar.bz2
xen-ebd0979ead4c5d23073dc319b22a9f2bee6e23a4.zip
hvm: Initialize vlapic->timer_last_update.
Without the fix, before the first vlapic timer interrupt is injected, the "vlapic->timer_last_update" in vlapic_get_tmcct() is always 0, causing a wrong value of counter_passed. Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
-rw-r--r--xen/arch/x86/hvm/vlapic.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 8bdb325369..3d27d46840 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -430,9 +430,9 @@ static uint32_t vlapic_get_tmcct(struct vlapic *vlapic)
uint32_t tmcct, tmict = vlapic_get_reg(vlapic, APIC_TMICT);
uint64_t counter_passed;
- counter_passed = (hvm_get_guest_time(v) - vlapic->timer_last_update) // TSC
- * 1000000000ULL / ticks_per_sec(v) // NS
- / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor;
+ counter_passed = ((hvm_get_guest_time(v) - vlapic->timer_last_update)
+ * 1000000000ULL / ticks_per_sec(v)
+ / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor);
tmcct = tmict - counter_passed;
HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
@@ -668,6 +668,7 @@ static void vlapic_write(struct vcpu *v, unsigned long address,
create_periodic_time(current, &vlapic->pt, period, vlapic->pt.irq,
!vlapic_lvtt_period(vlapic), vlapic_pt_cb,
&vlapic->timer_last_update);
+ vlapic->timer_last_update = vlapic->pt.last_plt_gtime;
HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
"bus cycle is %uns, "
@@ -831,6 +832,7 @@ static void lapic_rearm(struct vlapic *s)
create_periodic_time(vlapic_vcpu(s), &s->pt, period, s->pt.irq,
!vlapic_lvtt_period(s), vlapic_pt_cb,
&s->timer_last_update);
+ s->timer_last_update = s->pt.last_plt_gtime;
printk("lapic_load to rearm the actimer:"
"bus cycle is %uns, "