aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-02-17 06:04:20 -0500
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2011-02-25 11:43:12 -0500
commit82043bb60d24d2897074905c94be5a53071e8913 (patch)
treec8a2f269465d03da6268e96c4f95ec5cd6d2b61a /drivers/xen
parent03c8142bd2fb3b87effa6ecb2f8957be588bc85f (diff)
xen: suspend: refactor non-arch specific pre/post suspend hooks
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/manage.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 134eb73ca59..33312c09829 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -39,6 +39,23 @@ struct suspend_info {
39 unsigned long arg; /* extra hypercall argument */ 39 unsigned long arg; /* extra hypercall argument */
40}; 40};
41 41
42static void xen_hvm_post_suspend(void)
43{
44 gnttab_resume();
45}
46
47static void xen_pre_suspend(void)
48{
49 xen_mm_pin_all();
50 gnttab_suspend();
51}
52
53static void xen_post_suspend(void)
54{
55 gnttab_resume();
56 xen_mm_unpin_all();
57}
58
42#ifdef CONFIG_PM_SLEEP 59#ifdef CONFIG_PM_SLEEP
43static int xen_hvm_suspend(void *data) 60static int xen_hvm_suspend(void *data)
44{ 61{
@@ -62,7 +79,7 @@ static int xen_hvm_suspend(void *data)
62 si->cancelled = HYPERVISOR_suspend(si->arg); 79 si->cancelled = HYPERVISOR_suspend(si->arg);
63 80
64 xen_arch_hvm_post_suspend(si->cancelled); 81 xen_arch_hvm_post_suspend(si->cancelled);
65 gnttab_resume(); 82 xen_hvm_post_suspend();
66 83
67 if (!si->cancelled) { 84 if (!si->cancelled) {
68 xen_irq_resume(); 85 xen_irq_resume();
@@ -89,8 +106,7 @@ static int xen_suspend(void *data)
89 return err; 106 return err;
90 } 107 }
91 108
92 xen_mm_pin_all(); 109 xen_pre_suspend();
93 gnttab_suspend();
94 xen_arch_pre_suspend(); 110 xen_arch_pre_suspend();
95 111
96 /* 112 /*
@@ -101,8 +117,7 @@ static int xen_suspend(void *data)
101 si->cancelled = HYPERVISOR_suspend(si->arg); 117 si->cancelled = HYPERVISOR_suspend(si->arg);
102 118
103 xen_arch_post_suspend(si->cancelled); 119 xen_arch_post_suspend(si->cancelled);
104 gnttab_resume(); 120 xen_post_suspend();
105 xen_mm_unpin_all();
106 121
107 if (!si->cancelled) { 122 if (!si->cancelled) {
108 xen_irq_resume(); 123 xen_irq_resume();