Commit 804f1853 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 5a39837f b3e96c0c
...@@ -61,7 +61,7 @@ static void xen_post_suspend(int cancelled) ...@@ -61,7 +61,7 @@ static void xen_post_suspend(int cancelled)
xen_mm_unpin_all(); xen_mm_unpin_all();
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_HIBERNATION
static int xen_suspend(void *data) static int xen_suspend(void *data)
{ {
struct suspend_info *si = data; struct suspend_info *si = data;
...@@ -69,7 +69,7 @@ static int xen_suspend(void *data) ...@@ -69,7 +69,7 @@ static int xen_suspend(void *data)
BUG_ON(!irqs_disabled()); BUG_ON(!irqs_disabled());
err = sysdev_suspend(PMSG_SUSPEND); err = sysdev_suspend(PMSG_FREEZE);
if (err) { if (err) {
printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
err); err);
...@@ -118,7 +118,7 @@ static void do_suspend(void) ...@@ -118,7 +118,7 @@ static void do_suspend(void)
} }
#endif #endif
err = dpm_suspend_start(PMSG_SUSPEND); err = dpm_suspend_start(PMSG_FREEZE);
if (err) { if (err) {
printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err);
goto out_thaw; goto out_thaw;
...@@ -127,7 +127,7 @@ static void do_suspend(void) ...@@ -127,7 +127,7 @@ static void do_suspend(void)
printk(KERN_DEBUG "suspending xenstore...\n"); printk(KERN_DEBUG "suspending xenstore...\n");
xs_suspend(); xs_suspend();
err = dpm_suspend_noirq(PMSG_SUSPEND); err = dpm_suspend_noirq(PMSG_FREEZE);
if (err) { if (err) {
printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err); printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err);
goto out_resume; goto out_resume;
...@@ -147,7 +147,7 @@ static void do_suspend(void) ...@@ -147,7 +147,7 @@ static void do_suspend(void)
err = stop_machine(xen_suspend, &si, cpumask_of(0)); err = stop_machine(xen_suspend, &si, cpumask_of(0));
dpm_resume_noirq(PMSG_RESUME); dpm_resume_noirq(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
if (err) { if (err) {
printk(KERN_ERR "failed to start xen_suspend: %d\n", err); printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
...@@ -161,7 +161,7 @@ static void do_suspend(void) ...@@ -161,7 +161,7 @@ static void do_suspend(void)
} else } else
xs_suspend_cancel(); xs_suspend_cancel();
dpm_resume_end(PMSG_RESUME); dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
/* Make sure timer events get retriggered on all CPUs */ /* Make sure timer events get retriggered on all CPUs */
clock_was_set(); clock_was_set();
...@@ -173,7 +173,7 @@ static void do_suspend(void) ...@@ -173,7 +173,7 @@ static void do_suspend(void)
#endif #endif
shutting_down = SHUTDOWN_INVALID; shutting_down = SHUTDOWN_INVALID;
} }
#endif /* CONFIG_PM_SLEEP */ #endif /* CONFIG_HIBERNATION */
struct shutdown_handler { struct shutdown_handler {
const char *command; const char *command;
...@@ -202,7 +202,7 @@ static void shutdown_handler(struct xenbus_watch *watch, ...@@ -202,7 +202,7 @@ static void shutdown_handler(struct xenbus_watch *watch,
{ "poweroff", do_poweroff }, { "poweroff", do_poweroff },
{ "halt", do_poweroff }, { "halt", do_poweroff },
{ "reboot", do_reboot }, { "reboot", do_reboot },
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_HIBERNATION
{ "suspend", do_suspend }, { "suspend", do_suspend },
#endif #endif
{NULL, NULL}, {NULL, NULL},
......
...@@ -577,7 +577,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) ...@@ -577,7 +577,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus)
} }
EXPORT_SYMBOL_GPL(xenbus_dev_changed); EXPORT_SYMBOL_GPL(xenbus_dev_changed);
int xenbus_dev_suspend(struct device *dev, pm_message_t state) int xenbus_dev_suspend(struct device *dev)
{ {
int err = 0; int err = 0;
struct xenbus_driver *drv; struct xenbus_driver *drv;
...@@ -590,7 +590,7 @@ int xenbus_dev_suspend(struct device *dev, pm_message_t state) ...@@ -590,7 +590,7 @@ int xenbus_dev_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
drv = to_xenbus_driver(dev->driver); drv = to_xenbus_driver(dev->driver);
if (drv->suspend) if (drv->suspend)
err = drv->suspend(xdev, state); err = drv->suspend(xdev);
if (err) if (err)
printk(KERN_WARNING printk(KERN_WARNING
"xenbus: suspend %s failed: %i\n", dev_name(dev), err); "xenbus: suspend %s failed: %i\n", dev_name(dev), err);
...@@ -642,6 +642,14 @@ int xenbus_dev_resume(struct device *dev) ...@@ -642,6 +642,14 @@ int xenbus_dev_resume(struct device *dev)
} }
EXPORT_SYMBOL_GPL(xenbus_dev_resume); EXPORT_SYMBOL_GPL(xenbus_dev_resume);
int xenbus_dev_cancel(struct device *dev)
{
/* Do nothing */
DPRINTK("cancel");
return 0;
}
EXPORT_SYMBOL_GPL(xenbus_dev_cancel);
/* A flag to determine if xenstored is 'ready' (i.e. has started) */ /* A flag to determine if xenstored is 'ready' (i.e. has started) */
int xenstored_ready = 0; int xenstored_ready = 0;
......
...@@ -64,8 +64,9 @@ extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); ...@@ -64,8 +64,9 @@ extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
extern void xenbus_dev_shutdown(struct device *_dev); extern void xenbus_dev_shutdown(struct device *_dev);
extern int xenbus_dev_suspend(struct device *dev, pm_message_t state); extern int xenbus_dev_suspend(struct device *dev);
extern int xenbus_dev_resume(struct device *dev); extern int xenbus_dev_resume(struct device *dev);
extern int xenbus_dev_cancel(struct device *dev);
extern void xenbus_otherend_changed(struct xenbus_watch *watch, extern void xenbus_otherend_changed(struct xenbus_watch *watch,
const char **vec, unsigned int len, const char **vec, unsigned int len,
......
...@@ -85,6 +85,14 @@ static struct device_attribute xenbus_frontend_dev_attrs[] = { ...@@ -85,6 +85,14 @@ static struct device_attribute xenbus_frontend_dev_attrs[] = {
__ATTR_NULL __ATTR_NULL
}; };
static const struct dev_pm_ops xenbus_pm_ops = {
.suspend = xenbus_dev_suspend,
.resume = xenbus_dev_resume,
.freeze = xenbus_dev_suspend,
.thaw = xenbus_dev_cancel,
.restore = xenbus_dev_resume,
};
static struct xen_bus_type xenbus_frontend = { static struct xen_bus_type xenbus_frontend = {
.root = "device", .root = "device",
.levels = 2, /* device/type/<id> */ .levels = 2, /* device/type/<id> */
...@@ -100,8 +108,7 @@ static struct xen_bus_type xenbus_frontend = { ...@@ -100,8 +108,7 @@ static struct xen_bus_type xenbus_frontend = {
.shutdown = xenbus_dev_shutdown, .shutdown = xenbus_dev_shutdown,
.dev_attrs = xenbus_frontend_dev_attrs, .dev_attrs = xenbus_frontend_dev_attrs,
.suspend = xenbus_dev_suspend, .pm = &xenbus_pm_ops,
.resume = xenbus_dev_resume,
}, },
}; };
......
...@@ -92,7 +92,7 @@ struct xenbus_driver { ...@@ -92,7 +92,7 @@ struct xenbus_driver {
void (*otherend_changed)(struct xenbus_device *dev, void (*otherend_changed)(struct xenbus_device *dev,
enum xenbus_state backend_state); enum xenbus_state backend_state);
int (*remove)(struct xenbus_device *dev); int (*remove)(struct xenbus_device *dev);
int (*suspend)(struct xenbus_device *dev, pm_message_t state); int (*suspend)(struct xenbus_device *dev);
int (*resume)(struct xenbus_device *dev); int (*resume)(struct xenbus_device *dev);
int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *);
struct device_driver driver; struct device_driver driver;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment