aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 21:37:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 21:37:42 -0400
commit804f18536984939622ddca60ab6b25743e0ec68d (patch)
tree82d96cd5f49876970afdd78b891875fd4c6df344
parent5a39837f76b7ded29afdf6ed2c2d5e56107179b7 (diff)
parentb3e96c0c756211e805c6941d4a6e5f6e1995cb6b (diff)
Merge branch 'stable/xen.pm.bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
* 'stable/xen.pm.bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen: use freeze/restore/thaw PM events for suspend/resume/chkpt xen: xenbus PM events support
-rw-r--r--drivers/xen/manage.c16
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c12
-rw-r--r--drivers/xen/xenbus/xenbus_probe.h3
-rw-r--r--drivers/xen/xenbus/xenbus_probe_frontend.c11
-rw-r--r--include/xen/xenbus.h2
5 files changed, 30 insertions, 14 deletions
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index ebb292859b59..95143dd6904d 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -61,7 +61,7 @@ static void xen_post_suspend(int cancelled)
61 xen_mm_unpin_all(); 61 xen_mm_unpin_all();
62} 62}
63 63
64#ifdef CONFIG_PM_SLEEP 64#ifdef CONFIG_HIBERNATION
65static int xen_suspend(void *data) 65static int xen_suspend(void *data)
66{ 66{
67 struct suspend_info *si = data; 67 struct suspend_info *si = data;
@@ -69,7 +69,7 @@ static int xen_suspend(void *data)
69 69
70 BUG_ON(!irqs_disabled()); 70 BUG_ON(!irqs_disabled());
71 71
72 err = sysdev_suspend(PMSG_SUSPEND); 72 err = sysdev_suspend(PMSG_FREEZE);
73 if (err) { 73 if (err) {
74 printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", 74 printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
75 err); 75 err);
@@ -118,7 +118,7 @@ static void do_suspend(void)
118 } 118 }
119#endif 119#endif
120 120
121 err = dpm_suspend_start(PMSG_SUSPEND); 121 err = dpm_suspend_start(PMSG_FREEZE);
122 if (err) { 122 if (err) {
123 printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); 123 printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err);
124 goto out_thaw; 124 goto out_thaw;
@@ -127,7 +127,7 @@ static void do_suspend(void)
127 printk(KERN_DEBUG "suspending xenstore...\n"); 127 printk(KERN_DEBUG "suspending xenstore...\n");
128 xs_suspend(); 128 xs_suspend();
129 129
130 err = dpm_suspend_noirq(PMSG_SUSPEND); 130 err = dpm_suspend_noirq(PMSG_FREEZE);
131 if (err) { 131 if (err) {
132 printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err); 132 printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err);
133 goto out_resume; 133 goto out_resume;
@@ -147,7 +147,7 @@ static void do_suspend(void)
147 147
148 err = stop_machine(xen_suspend, &si, cpumask_of(0)); 148 err = stop_machine(xen_suspend, &si, cpumask_of(0));
149 149
150 dpm_resume_noirq(PMSG_RESUME); 150 dpm_resume_noirq(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
151 151
152 if (err) { 152 if (err) {
153 printk(KERN_ERR "failed to start xen_suspend: %d\n", err); 153 printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
@@ -161,7 +161,7 @@ out_resume:
161 } else 161 } else
162 xs_suspend_cancel(); 162 xs_suspend_cancel();
163 163
164 dpm_resume_end(PMSG_RESUME); 164 dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
165 165
166 /* Make sure timer events get retriggered on all CPUs */ 166 /* Make sure timer events get retriggered on all CPUs */
167 clock_was_set(); 167 clock_was_set();
@@ -173,7 +173,7 @@ out:
173#endif 173#endif
174 shutting_down = SHUTDOWN_INVALID; 174 shutting_down = SHUTDOWN_INVALID;
175} 175}
176#endif /* CONFIG_PM_SLEEP */ 176#endif /* CONFIG_HIBERNATION */
177 177
178struct shutdown_handler { 178struct shutdown_handler {
179 const char *command; 179 const char *command;
@@ -202,7 +202,7 @@ static void shutdown_handler(struct xenbus_watch *watch,
202 { "poweroff", do_poweroff }, 202 { "poweroff", do_poweroff },
203 { "halt", do_poweroff }, 203 { "halt", do_poweroff },
204 { "reboot", do_reboot }, 204 { "reboot", do_reboot },
205#ifdef CONFIG_PM_SLEEP 205#ifdef CONFIG_HIBERNATION
206 { "suspend", do_suspend }, 206 { "suspend", do_suspend },
207#endif 207#endif
208 {NULL, NULL}, 208 {NULL, NULL},
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index baa65e7fbbc7..739769551e33 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -577,7 +577,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus)
577} 577}
578EXPORT_SYMBOL_GPL(xenbus_dev_changed); 578EXPORT_SYMBOL_GPL(xenbus_dev_changed);
579 579
580int xenbus_dev_suspend(struct device *dev, pm_message_t state) 580int xenbus_dev_suspend(struct device *dev)
581{ 581{
582 int err = 0; 582 int err = 0;
583 struct xenbus_driver *drv; 583 struct xenbus_driver *drv;
@@ -590,7 +590,7 @@ int xenbus_dev_suspend(struct device *dev, pm_message_t state)
590 return 0; 590 return 0;
591 drv = to_xenbus_driver(dev->driver); 591 drv = to_xenbus_driver(dev->driver);
592 if (drv->suspend) 592 if (drv->suspend)
593 err = drv->suspend(xdev, state); 593 err = drv->suspend(xdev);
594 if (err) 594 if (err)
595 printk(KERN_WARNING 595 printk(KERN_WARNING
596 "xenbus: suspend %s failed: %i\n", dev_name(dev), err); 596 "xenbus: suspend %s failed: %i\n", dev_name(dev), err);
@@ -642,6 +642,14 @@ int xenbus_dev_resume(struct device *dev)
642} 642}
643EXPORT_SYMBOL_GPL(xenbus_dev_resume); 643EXPORT_SYMBOL_GPL(xenbus_dev_resume);
644 644
645int xenbus_dev_cancel(struct device *dev)
646{
647 /* Do nothing */
648 DPRINTK("cancel");
649 return 0;
650}
651EXPORT_SYMBOL_GPL(xenbus_dev_cancel);
652
645/* A flag to determine if xenstored is 'ready' (i.e. has started) */ 653/* A flag to determine if xenstored is 'ready' (i.e. has started) */
646int xenstored_ready = 0; 654int xenstored_ready = 0;
647 655
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h
index 24665812316a..888b9900ca08 100644
--- a/drivers/xen/xenbus/xenbus_probe.h
+++ b/drivers/xen/xenbus/xenbus_probe.h
@@ -64,8 +64,9 @@ extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
64 64
65extern void xenbus_dev_shutdown(struct device *_dev); 65extern void xenbus_dev_shutdown(struct device *_dev);
66 66
67extern int xenbus_dev_suspend(struct device *dev, pm_message_t state); 67extern int xenbus_dev_suspend(struct device *dev);
68extern int xenbus_dev_resume(struct device *dev); 68extern int xenbus_dev_resume(struct device *dev);
69extern int xenbus_dev_cancel(struct device *dev);
69 70
70extern void xenbus_otherend_changed(struct xenbus_watch *watch, 71extern void xenbus_otherend_changed(struct xenbus_watch *watch,
71 const char **vec, unsigned int len, 72 const char **vec, unsigned int len,
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index 5bcc2d6cf129..b6a2690c9d49 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -85,6 +85,14 @@ static struct device_attribute xenbus_frontend_dev_attrs[] = {
85 __ATTR_NULL 85 __ATTR_NULL
86}; 86};
87 87
88static const struct dev_pm_ops xenbus_pm_ops = {
89 .suspend = xenbus_dev_suspend,
90 .resume = xenbus_dev_resume,
91 .freeze = xenbus_dev_suspend,
92 .thaw = xenbus_dev_cancel,
93 .restore = xenbus_dev_resume,
94};
95
88static struct xen_bus_type xenbus_frontend = { 96static struct xen_bus_type xenbus_frontend = {
89 .root = "device", 97 .root = "device",
90 .levels = 2, /* device/type/<id> */ 98 .levels = 2, /* device/type/<id> */
@@ -100,8 +108,7 @@ static struct xen_bus_type xenbus_frontend = {
100 .shutdown = xenbus_dev_shutdown, 108 .shutdown = xenbus_dev_shutdown,
101 .dev_attrs = xenbus_frontend_dev_attrs, 109 .dev_attrs = xenbus_frontend_dev_attrs,
102 110
103 .suspend = xenbus_dev_suspend, 111 .pm = &xenbus_pm_ops,
104 .resume = xenbus_dev_resume,
105 }, 112 },
106}; 113};
107 114
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 7a1d15ff19b7..5467369e0889 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -92,7 +92,7 @@ struct xenbus_driver {
92 void (*otherend_changed)(struct xenbus_device *dev, 92 void (*otherend_changed)(struct xenbus_device *dev,
93 enum xenbus_state backend_state); 93 enum xenbus_state backend_state);
94 int (*remove)(struct xenbus_device *dev); 94 int (*remove)(struct xenbus_device *dev);
95 int (*suspend)(struct xenbus_device *dev, pm_message_t state); 95 int (*suspend)(struct xenbus_device *dev);
96 int (*resume)(struct xenbus_device *dev); 96 int (*resume)(struct xenbus_device *dev);
97 int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); 97 int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *);
98 struct device_driver driver; 98 struct device_driver driver;