xen: suspend and resume system devices when running PVHVM
authorIan Campbell <ian.campbell@citrix.com>
Thu, 17 Feb 2011 10:31:20 +0000 (10:31 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 17 Feb 2011 10:31:20 +0000 (10:31 +0000)
Otherwise we fail to properly suspend/resume all of the emulated devices.

Something between 2.6.38-rc2 and rc3 appears to have exposed this
issue, but it's always been wrong not to do this.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Jeremy Fitzhardinge <jeremy@goop.org>
drivers/xen/manage.c

index db8c4c4ac88086bf7c2e9d1dfa946da399e91b27..24177272bcb84aed3ec51cb82f91535f0c034fc0 100644 (file)
@@ -37,11 +37,19 @@ static enum shutdown_state shutting_down = SHUTDOWN_INVALID;
 #ifdef CONFIG_PM_SLEEP
 static int xen_hvm_suspend(void *data)
 {
+       int err;
        struct sched_shutdown r = { .reason = SHUTDOWN_suspend };
        int *cancelled = data;
 
        BUG_ON(!irqs_disabled());
 
+       err = sysdev_suspend(PMSG_SUSPEND);
+       if (err) {
+               printk(KERN_ERR "xen_hvm_suspend: sysdev_suspend failed: %d\n",
+                      err);
+               return err;
+       }
+
        *cancelled = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
 
        xen_hvm_post_suspend(*cancelled);
@@ -53,6 +61,8 @@ static int xen_hvm_suspend(void *data)
                xen_timer_resume();
        }
 
+       sysdev_resume();
+
        return 0;
 }