aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/xen/manage.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 4dd01865ad1..5c0184fb9d8 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -34,11 +34,15 @@ enum shutdown_state {
34/* Ignore multiple shutdown requests. */ 34/* Ignore multiple shutdown requests. */
35static enum shutdown_state shutting_down = SHUTDOWN_INVALID; 35static enum shutdown_state shutting_down = SHUTDOWN_INVALID;
36 36
37struct suspend_info {
38 int cancelled;
39};
40
37#ifdef CONFIG_PM_SLEEP 41#ifdef CONFIG_PM_SLEEP
38static int xen_hvm_suspend(void *data) 42static int xen_hvm_suspend(void *data)
39{ 43{
44 struct suspend_info *si = data;
40 int err; 45 int err;
41 int *cancelled = data;
42 46
43 BUG_ON(!irqs_disabled()); 47 BUG_ON(!irqs_disabled());
44 48
@@ -54,12 +58,12 @@ static int xen_hvm_suspend(void *data)
54 * or the domain was merely checkpointed, and 0 if it 58 * or the domain was merely checkpointed, and 0 if it
55 * is resuming in a new domain. 59 * is resuming in a new domain.
56 */ 60 */
57 *cancelled = HYPERVISOR_suspend(0UL); 61 si->cancelled = HYPERVISOR_suspend(0UL);
58 62
59 xen_hvm_post_suspend(*cancelled); 63 xen_hvm_post_suspend(si->cancelled);
60 gnttab_resume(); 64 gnttab_resume();
61 65
62 if (!*cancelled) { 66 if (!si->cancelled) {
63 xen_irq_resume(); 67 xen_irq_resume();
64 xen_console_resume(); 68 xen_console_resume();
65 xen_timer_resume(); 69 xen_timer_resume();
@@ -72,8 +76,8 @@ static int xen_hvm_suspend(void *data)
72 76
73static int xen_suspend(void *data) 77static int xen_suspend(void *data)
74{ 78{
79 struct suspend_info *si = data;
75 int err; 80 int err;
76 int *cancelled = data;
77 81
78 BUG_ON(!irqs_disabled()); 82 BUG_ON(!irqs_disabled());
79 83
@@ -93,13 +97,13 @@ static int xen_suspend(void *data)
93 * or the domain was merely checkpointed, and 0 if it 97 * or the domain was merely checkpointed, and 0 if it
94 * is resuming in a new domain. 98 * is resuming in a new domain.
95 */ 99 */
96 *cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info)); 100 si->cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
97 101
98 xen_post_suspend(*cancelled); 102 xen_post_suspend(si->cancelled);
99 gnttab_resume(); 103 gnttab_resume();
100 xen_mm_unpin_all(); 104 xen_mm_unpin_all();
101 105
102 if (!*cancelled) { 106 if (!si->cancelled) {
103 xen_irq_resume(); 107 xen_irq_resume();
104 xen_console_resume(); 108 xen_console_resume();
105 xen_timer_resume(); 109 xen_timer_resume();
@@ -113,7 +117,7 @@ static int xen_suspend(void *data)
113static void do_suspend(void) 117static void do_suspend(void)
114{ 118{
115 int err; 119 int err;
116 int cancelled = 1; 120 struct suspend_info si;
117 121
118 shutting_down = SHUTDOWN_SUSPEND; 122 shutting_down = SHUTDOWN_SUSPEND;
119 123
@@ -143,20 +147,22 @@ static void do_suspend(void)
143 goto out_resume; 147 goto out_resume;
144 } 148 }
145 149
150 si.cancelled = 1;
151
146 if (xen_hvm_domain()) 152 if (xen_hvm_domain())
147 err = stop_machine(xen_hvm_suspend, &cancelled, cpumask_of(0)); 153 err = stop_machine(xen_hvm_suspend, &si, cpumask_of(0));
148 else 154 else
149 err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); 155 err = stop_machine(xen_suspend, &si, cpumask_of(0));
150 156
151 dpm_resume_noirq(PMSG_RESUME); 157 dpm_resume_noirq(PMSG_RESUME);
152 158
153 if (err) { 159 if (err) {
154 printk(KERN_ERR "failed to start xen_suspend: %d\n", err); 160 printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
155 cancelled = 1; 161 si.cancelled = 1;
156 } 162 }
157 163
158out_resume: 164out_resume:
159 if (!cancelled) { 165 if (!si.cancelled) {
160 xen_arch_resume(); 166 xen_arch_resume();
161 xs_resume(); 167 xs_resume();
162 } else 168 } else