WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 10/11] xen: suspend: pull pre/post suspend hooks out

To: Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 10/11] xen: suspend: pull pre/post suspend hooks out into suspend_info
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 15 Feb 2011 14:13:24 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 15 Feb 2011 06:24:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1297779181.21980.3722.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1297779181.21980.3722.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 drivers/xen/manage.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 49a7458..5ccddab 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -37,6 +37,8 @@ static enum shutdown_state shutting_down = SHUTDOWN_INVALID;
 struct suspend_info {
        int cancelled;
        unsigned long arg; /* extra hypercall argument */
+       void (*pre)(void);
+       void (*post)(int cancelled);
 };
 
 static void xen_hvm_post_suspend(int cancelled)
@@ -74,6 +76,9 @@ static int xen_hvm_suspend(void *data)
                return err;
        }
 
+       if (si->pre)
+               si->pre();
+
        /*
         * This hypercall returns 1 if suspend was cancelled
         * or the domain was merely checkpointed, and 0 if it
@@ -81,7 +86,8 @@ static int xen_hvm_suspend(void *data)
         */
        si->cancelled = HYPERVISOR_suspend(si->arg);
 
-       xen_hvm_post_suspend(si->cancelled);
+       if (si->post)
+               si->post(si->cancelled);
 
        if (!si->cancelled) {
                xen_irq_resume();
@@ -108,7 +114,8 @@ static int xen_suspend(void *data)
                return err;
        }
 
-       xen_pre_suspend();
+       if (si->pre)
+               si->pre();
 
        /*
         * This hypercall returns 1 if suspend was cancelled
@@ -117,7 +124,8 @@ static int xen_suspend(void *data)
         */
        si->cancelled = HYPERVISOR_suspend(si->arg);
 
-       xen_post_suspend(si->cancelled);
+       if (si->post)
+               si->post(si->cancelled);
 
        if (!si->cancelled) {
                xen_irq_resume();
@@ -165,10 +173,15 @@ static void do_suspend(void)
 
        si.cancelled = 1;
 
-       if (xen_hvm_domain())
+       if (xen_hvm_domain()) {
                si.arg = 0UL;
-       else
+               si.pre = NULL;
+               si.post = &xen_hvm_post_suspend;
+       } else {
                si.arg = virt_to_mfn(xen_start_info);
+               si.pre = &xen_pre_suspend;
+               si.post = &xen_post_suspend;
+       }
 
        if (xen_hvm_domain())
                err = stop_machine(xen_hvm_suspend, &si, cpumask_of(0));
-- 
1.5.6.5


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

<Prev in Thread] Current Thread [Next in Thread>