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

[Xen-devel] [PATCH RFC 10/16] Save/Restore Support: Add suspend/resume support for timers



Signed-off-by: Bruno Alvisio <bruno.alvisio@xxxxxxxxx>
---
 arch/x86/time.c | 13 +++++++++++++
 include/time.h  |  2 ++
 kernel.c        |  4 ++++
 3 files changed, 19 insertions(+)

diff --git a/arch/x86/time.c b/arch/x86/time.c
index 3658142..8f79d69 100644
--- a/arch/x86/time.c
+++ b/arch/x86/time.c
@@ -244,3 +244,16 @@ void fini_time(void)
     HYPERVISOR_set_timer_op(0);
     unbind_evtchn(port);
 }
+
+void suspend_time(void)
+{
+    /* Clear any pending timer */
+    HYPERVISOR_set_timer_op(0);
+    unbind_evtchn(port);
+}
+
+void resume_time(void)
+{
+    port = bind_virq(VIRQ_TIMER, &timer_handler, NULL);
+    unmask_evtchn(port);
+}
diff --git a/include/time.h b/include/time.h
index 5d6ed67..2e06d58 100644
--- a/include/time.h
+++ b/include/time.h
@@ -55,6 +55,8 @@ typedef long suseconds_t;
 /* prototypes */
 void     init_time(void);
 void     fini_time(void);
+void     suspend_time(void);
+void     resume_time(void);
 s_time_t get_s_time(void);
 s_time_t get_v_time(void);
 uint64_t monotonic_clock(void);
diff --git a/kernel.c b/kernel.c
index 782eb79..a16b1ba 100644
--- a/kernel.c
+++ b/kernel.c
@@ -120,10 +120,14 @@ void start_kernel(void* par)
 void pre_suspend(void)
 {
     local_irq_disable();
+
+    suspend_time();
 }
 
 void post_suspend(int canceled)
 {
+    resume_time();
+
     local_irq_enable();
 }
 
-- 
2.3.2 (Apple Git-55)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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