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

[Xen-changelog] [xen-3.1-testing] hvm: hpet: Fix per-timer enable/disable.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1199965052 0
# Node ID 4eae9c351c5edc3e97aed2a6e41761d0dd0f37e7
# Parent  0e68233d9176c3a2b45822628f453682e1349747
hvm: hpet: Fix per-timer enable/disable.

The enable/disable per timer interrupt bit is wrongly used as per
timer enable/disable. According to spec, comparator value should
constantly increasing when HPET is globally enabled, no matter
whether the timer interrupt is enabled or not.

From: Haitao Shan <haitao.shan@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   16689:66db23ecd5628d87890abe0744ae3dc20b62bced
xen-unstable date:        Tue Jan 08 13:57:45 2008 +0000
---
 xen/arch/x86/hvm/hpet.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff -r 0e68233d9176 -r 4eae9c351c5e xen/arch/x86/hvm/hpet.c
--- a/xen/arch/x86/hvm/hpet.c   Thu Jan 10 11:35:34 2008 +0000
+++ b/xen/arch/x86/hvm/hpet.c   Thu Jan 10 11:37:32 2008 +0000
@@ -75,7 +75,6 @@
                                   (S_TO_NS*TSC_PER_HPET_TICK)/h->tsc_freq)
 
 #define timer_config(h, n)       (h->hpet.timers[n].config)
-#define timer_enabled(h, n)      (timer_config(h, n) & HPET_TN_ENABLE)
 #define timer_is_periodic(h, n)  (timer_config(h, n) & HPET_TN_PERIODIC)
 #define timer_is_32bit(h, n)     (timer_config(h, n) & HPET_TN_32BIT)
 #define hpet_enabled(h)          (h->hpet.config & HPET_CFG_ENABLE)
@@ -169,9 +168,6 @@ static void hpet_set_timer(HPETState *h,
 
     ASSERT(tn < HPET_TIMER_NUM);
     ASSERT(spin_is_locked(&h->lock));
-
-    if ( !hpet_enabled(h) || !timer_enabled(h, tn) )
-        return;
 
     if ( (tn == 0) && (h->hpet.config & HPET_CFG_LEGACY) )
     {
@@ -283,10 +279,6 @@ static void hpet_write(
         if ( new_val & HPET_TN_32BIT )
             h->hpet.timers[tn].cmp = (uint32_t)h->hpet.timers[tn].cmp;
 
-        if ( !(old_val & HPET_TN_ENABLE) && (new_val & HPET_TN_ENABLE) )
-            hpet_set_timer(h, tn);
-        else if ( (old_val & HPET_TN_ENABLE) && !(new_val & HPET_TN_ENABLE) )
-            hpet_stop_timer(h, tn);
         break;
 
     case HPET_T0_CMP:
@@ -301,7 +293,7 @@ static void hpet_write(
         else
             h->hpet.period[tn] = new_val;
         h->hpet.timers[tn].config &= ~HPET_TN_SETVAL;
-        if ( hpet_enabled(h) && timer_enabled(h, tn) )
+        if ( hpet_enabled(h) )
             hpet_set_timer(h, tn);
         break;
 
@@ -372,13 +364,14 @@ static void hpet_timer_fn(void *opaque)
 
     spin_lock(&h->lock);
 
-    if ( !hpet_enabled(h) || !timer_enabled(h, tn) )
+    if ( !hpet_enabled(h) )
     {
         spin_unlock(&h->lock);
         return;
     }
 
-    hpet_route_interrupt(h, tn);
+    if ( timer_config(h, tn) & HPET_TN_ENABLE )
+        hpet_route_interrupt(h, tn);
 
     if ( timer_is_periodic(h, tn) && (h->hpet.period[tn] != 0) )
     {
@@ -450,7 +443,8 @@ static int hpet_load(struct domain *d, h
                 
     /* Restart the timers */
     for ( i = 0; i < HPET_TIMER_NUM; i++ )
-        hpet_set_timer(hp, i);
+        if ( hpet_enabled(hp) )
+            hpet_set_timer(hp, i);
 
     spin_unlock(&hp->lock);
 

_______________________________________________
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®.