xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Alvisio <bruno.alvisio@gmail.com>
To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org
Cc: jgross@suse.com, samuel.thibault@ens-lyon.org,
	wei.liu2@citrix.com, Bruno Alvisio <bruno.alvisio@gmail.com>
Subject: [PATCH RFC 10/16] Save/Restore Support: Add suspend/resume support for timers
Date: Tue, 19 Dec 2017 15:42:05 -0800	[thread overview]
Message-ID: <1513726931-7516-11-git-send-email-bruno.alvisio@gmail.com> (raw)
In-Reply-To: <1513726931-7516-1-git-send-email-bruno.alvisio@gmail.com>

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
---
 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2017-12-19 23:42 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19 23:41 [PATCH RFC 00/16] Save/Restore Support for mini-OS PVH Bruno Alvisio
2017-12-19 23:41 ` [PATCH RFC 01/16] Save/Restore Support: Refactor HYPERVISOR_suspend hypercall Bruno Alvisio
2017-12-19 23:51   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:41 ` [PATCH RFC 02/16] Save/Restore Support: Refactor trap_init() and setup vector callbacks Bruno Alvisio
2017-12-19 23:51   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:41 ` [PATCH RFC 03/16] Save/Restore Support: Declare kernel and arch pre/post suspend functions Bruno Alvisio
2017-12-19 23:52   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:41 ` [PATCH RFC 04/16] Save/Restore Support: Add xenbus_release_wait_for_watch Bruno Alvisio
2017-12-20  0:14   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:42 ` [PATCH RFC 05/16] Save/Restore Support: Add kernel shutdown logic to shutdown.c Bruno Alvisio
2017-12-20  0:16   ` [Minios-devel] " Samuel Thibault
2017-12-21 22:49   ` Konrad Rzeszutek Wilk
2017-12-19 23:42 ` [PATCH RFC 06/16] Save/Restore Support: Moved shutdown thread " Bruno Alvisio
2017-12-19 23:42 ` [PATCH RFC 07/16] Save/Restore Support: Add unmap_shared_info Bruno Alvisio
2017-12-20  0:23   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:42 ` [PATCH RFC 08/16] Save/Restore Support: Add arch_mm_pre|post_suspend Bruno Alvisio
2017-12-20  0:24   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:42 ` [PATCH RFC 09/16] Save/Restore Support: Disable/enable IRQs during suspend/restore Bruno Alvisio
2017-12-20  0:25   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:42 ` Bruno Alvisio [this message]
2017-12-20  0:26   ` [Minios-devel] [PATCH RFC 10/16] Save/Restore Support: Add suspend/resume support for timers Samuel Thibault
2017-12-19 23:42 ` [PATCH RFC 11/16] Save/Restore Support: Add suspend/restore support for console Bruno Alvisio
2017-12-19 23:42 ` [PATCH RFC 12/16] Save/Restore Support: Add support for suspend/restore events Bruno Alvisio
2017-12-20  0:37   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:42 ` [PATCH RFC 13/16] Save/Restore Support: Add suspend/restore support for Grant Tables Bruno Alvisio
2017-12-20  0:40   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:42 ` [PATCH RFC 14/16] Save/Restore Support: Add suspend/restore support for xenbus Bruno Alvisio
2017-12-20  0:43   ` [Minios-devel] " Samuel Thibault
2017-12-19 23:42 ` [PATCH RFC 15/16] Save/Restore Support: Add suspend/restore support for netfront Bruno Alvisio
2017-12-19 23:42 ` [PATCH RFC 16/16] Save/Restore Support: Implement code for arch suspend/resume Bruno Alvisio
2017-12-20  0:19 ` [Minios-devel] [PATCH RFC 00/16] Save/Restore Support for mini-OS PVH Samuel Thibault
2017-12-20  0:37 ` Samuel Thibault
2017-12-20  0:57 ` Samuel Thibault
2017-12-20  1:01 ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513726931-7516-11-git-send-email-bruno.alvisio@gmail.com \
    --to=bruno.alvisio@gmail.com \
    --cc=jgross@suse.com \
    --cc=minios-devel@lists.xenproject.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).