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

[Xen-changelog] [xen-unstable] x86: Re-initialise HPET on resume from S3



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1227023714 0
# Node ID ed8524f4a044efbd6d30f9340c6ddfb00f972407
# Parent  85fda344dba7cf9d22ff0a792d70e032ce6c1b40
x86: Re-initialise HPET on resume from S3

Signed-off-by: Guanqun Lu <guanqun.lu@xxxxxxxxx>
Signed-off-by: Kevin Tian <kevin.tian@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hpet.c |    7 +------
 xen/arch/x86/time.c |   20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 9 deletions(-)

diff -r 85fda344dba7 -r ed8524f4a044 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Tue Nov 18 15:39:31 2008 +0000
+++ b/xen/arch/x86/hpet.c       Tue Nov 18 15:55:14 2008 +0000
@@ -264,14 +264,9 @@ int hpet_legacy_irq_tick(void)
 
 u64 hpet_setup(void)
 {
-    static u64 hpet_rate;
-    static int initialised;
+    u64 hpet_rate;
     u32 hpet_id, hpet_period, cfg;
     int i;
-
-    if ( initialised )
-        return hpet_rate;
-    initialised = 1;
 
     if ( hpet_address == 0 )
         return 0;
diff -r 85fda344dba7 -r ed8524f4a044 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Tue Nov 18 15:39:31 2008 +0000
+++ b/xen/arch/x86/time.c       Tue Nov 18 15:55:14 2008 +0000
@@ -60,6 +60,7 @@ struct platform_timesource {
     u64 frequency;
     u64 (*read_counter)(void);
     int (*init)(struct platform_timesource *);
+    void (*resume)(struct platform_timesource *);
     int counter_bits;
 };
 
@@ -396,12 +397,21 @@ static int init_hpet(struct platform_tim
     return 1;
 }
 
+static void resume_hpet(struct platform_timesource *pts)
+{
+    u64 hpet_rate = hpet_setup();
+
+    BUG_ON(hpet_rate == 0);
+    pts->frequency = hpet_rate;
+}
+
 static struct platform_timesource plt_hpet =
 {
     .name = "HPET",
     .read_counter = read_hpet_count,
     .counter_bits = 32,
-    .init = init_hpet
+    .init = init_hpet,
+    .resume = resume_hpet
 };
 
 /************************************************************
@@ -566,6 +576,10 @@ static void platform_time_calibration(vo
 
 static void resume_platform_timer(void)
 {
+    /* Timer source can be reset when backing from S3 to S0 */
+    if ( plt_src.resume )
+        plt_src.resume(&plt_src);
+
     /* No change in platform_stime across suspend/resume. */
     platform_timer_stamp = plt_stamp64;
     plt_stamp = plt_src.read_counter();
@@ -1214,12 +1228,12 @@ int time_resume(void)
 {
     /*u64 tmp = */init_pit_and_calibrate_tsc();
 
-    disable_pit_irq();
-
     /* Disable this while calibrate_tsc_ap() also is skipped. */
     /*set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);*/
 
     resume_platform_timer();
+
+    disable_pit_irq();
 
     init_percpu_time();
 

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