[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvm vlapic: Fix tmcct read logic when in periodic mode.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1291999745 0
# Node ID 3b3fce9050b9b14f3a11123f6943998413ea7e7e
# Parent  901c118b363e978566775f9d118b4f2f15598212
hvm vlapic: Fix tmcct read logic when in periodic mode.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/arch/x86/hvm/vlapic.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff -r 901c118b363e -r 3b3fce9050b9 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Fri Dec 10 16:40:05 2010 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Fri Dec 10 16:49:05 2010 +0000
@@ -435,12 +435,19 @@ static uint32_t vlapic_get_tmcct(struct 
 static uint32_t vlapic_get_tmcct(struct vlapic *vlapic)
 {
     struct vcpu *v = current;
-    uint32_t tmcct, tmict = vlapic_get_reg(vlapic, APIC_TMICT);
+    uint32_t tmcct = 0, tmict = vlapic_get_reg(vlapic, APIC_TMICT);
     uint64_t counter_passed;
 
     counter_passed = ((hvm_get_guest_time(v) - vlapic->timer_last_update)
-                      / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor);
-    tmcct = (counter_passed < tmict) ? tmict - counter_passed : 0;
+                      / (APIC_BUS_CYCLE_NS * vlapic->hw.timer_divisor));
+
+    if ( tmict != 0 )
+    {
+        if ( vlapic_lvtt_period(vlapic) )
+            counter_passed %= tmict;
+        if ( counter_passed < tmict )
+            tmcct = tmict - counter_passed;
+    }
 
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
                 "timer initial count %d, timer current count %d, "

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.