lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1368553572-4966-2-git-send-email-benjamin.guthro@citrix.com>
Date:	Tue, 14 May 2013 13:46:12 -0400
From:	Ben Guthro <benjamin.guthro@...rix.com>
To:	<linux-kernel@...r.kernel.org>, <x86@...nel.org>,
	<linux-acpi@...r.kernel.org>, <xen-devel@...ts.xensource.com>
CC:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Liang Tang <liang.tang@...cle.com>
Subject: [PATCH] xen/acpi/sleep: Register to the acpi_suspend_lowlevel a callback.

From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>

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.

This is necessary b/c during suspend the generic code tries to write
cr3 values that clashes with what the hypervisor has set up for the guest.

Signed-off-by: Liang Tang <liang.tang@...cle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Tested-by: Ben Guthro <benjamin.guthro@...rix.com>
Acked-by: H. Peter Anvin <hpa@...ux.intel.com>
---
 include/xen/acpi.h |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..46aa3d1 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -78,11 +78,25 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
 				     u32 pm1a_cnt, u32 pm1b_cnd);
 
+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_os_set_prepare_sleep(
 			&xen_acpi_notify_hypervisor_state);
+
+		acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
+	}
 }
 #else
 static inline void xen_acpi_sleep_register(void)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ