linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Guthro <benjamin.guthro@citrix.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-acpi@vger.kernel.org, xen-devel@lists.xensource.com
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Liang Tang <liang.tang@oracle.com>
Subject: [PATCH] xen/acpi/sleep: Register to the acpi_suspend_lowlevel a callback.
Date: Tue, 14 May 2013 13:46:12 -0400	[thread overview]
Message-ID: <1368553572-4966-2-git-send-email-benjamin.guthro@citrix.com> (raw)
In-Reply-To: <1368553572-4966-1-git-send-email-benjamin.guthro@citrix.com>

From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.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@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Ben Guthro <benjamin.guthro@citrix.com>
Acked-by: H. Peter Anvin <hpa@linux.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


      reply	other threads:[~2013-05-14 17:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14 17:09 [PATCH 0/2] Implement ACPI S3 for Xen dom0 Ben Guthro
2013-05-14 17:09 ` [PATCH 1/2] x86/acpi/sleep: Provide registration for acpi_suspend_lowlevel Ben Guthro
2013-05-14 17:09 ` [PATCH 2/2] xen/acpi/sleep: Register to the acpi_suspend_lowlevel a callback Ben Guthro
2013-05-14 17:46 ` Ben Guthro
2013-05-14 17:46   ` Ben Guthro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368553572-4966-2-git-send-email-benjamin.guthro@citrix.com \
    --to=benjamin.guthro@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=liang.tang@oracle.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).