]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen/acpi/sleep: Register to the acpi_suspend_lowlevel a callback.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 29 Sep 2011 02:16:50 +0000 (10:16 +0800)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 19 Oct 2011 17:08:36 +0000 (13:08 -0400)
We piggyback on "x86/acpi: Provide registration for acpi_suspend_lowlevel."
to register a Xen version of the callback. The callback does not
do anything special - except it omits the x86_acpi_suspend_lowlevel.
It does that b/c during suspend it tries to save cr8 values (which
the hypervisor does not support), and then on resume path the
cr3, cr8, idt, and gdt are all resumed which clashes with what
the hypervisor has set up for the guest.

Signed-off-by: Liang Tang <liang.tang@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
include/xen/acpi.h

index c98188718b47da4fe7c39de6508571460a8a1790..18025e0942a18cbff95a1e69df4ca3a3fa7022fb 100644 (file)
@@ -44,10 +44,22 @@ int xen_acpi_notify_hypervisor_state(u8 sleep_state,
                                     u32 pm1a_cnt, u32 pm1b_cnd,
                                     bool *skip_rest);
 
+static inline int xen_acpi_suspend_lowlevel(void)
+{
+       /*
+        * Xen will save and restore CPU context, so
+        * we can skip that and just go straight to
+        * the suspend.
+        */
+       acpi_enter_sleep_state(ACPI_STATE_S3);
+       return 0;
+}
 static inline void xen_acpi_sleep_register(void)
 {
-       if (xen_initial_domain())
+       if (xen_initial_domain()) {
+               acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
                __acpi_override_sleep = xen_acpi_notify_hypervisor_state;
+       }
 }
 #else
 static inline void xen_acpi_sleep_register(void)