All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems
@ 2013-06-28 13:46 ` Ben Guthro
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Richard L Maliszewski, Gang Wei, Shane Wang,
	Bob Moore, tboot-devel

In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Richard L Maliszewski <richard.l.maliszewski@intel.com>
Cc: Gang Wei <gang.wei@intel.com>
Cc: Shane Wang <shane.wang@intel.com>
Cc: Bob Moore <robert.moore@intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: linux-acpi@vger.kernel.org
Cc: tboot-devel@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
    Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
    Further patch split to break out acpica from OSL
    More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
    so intermediate builds of partial patch series will not fail.

Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi: Adjust linux acpi OS functions to new extended parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c          |    6 +++++-
 drivers/acpi/acpica/hwesleep.c   |    7 +++++++
 drivers/acpi/acpica/hwsleep.c    |    3 +--
 drivers/acpi/osl.c               |   16 ++++++++--------
 drivers/xen/acpi.c               |   26 +++++++++++++-------------
 include/acpi/acpiosxf.h          |    6 ++++++
 include/linux/acpi.h             |    9 +++------
 include/xen/acpi.h               |    4 ++--
 include/xen/interface/platform.h |    7 ++++---
 9 files changed, 49 insertions(+), 35 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH v5 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems
@ 2013-06-28 13:46 ` Ben Guthro
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Richard L Maliszewski, Gang Wei, Shane Wang,
	Bob Moore, tboot-devel

In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Richard L Maliszewski <richard.l.maliszewski@intel.com>
Cc: Gang Wei <gang.wei@intel.com>
Cc: Shane Wang <shane.wang@intel.com>
Cc: Bob Moore <robert.moore@intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: linux-acpi@vger.kernel.org
Cc: tboot-devel@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
    Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
    Further patch split to break out acpica from OSL
    More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
    so intermediate builds of partial patch series will not fail.

Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi: Adjust linux acpi OS functions to new extended parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c          |    6 +++++-
 drivers/acpi/acpica/hwesleep.c   |    7 +++++++
 drivers/acpi/acpica/hwsleep.c    |    3 +--
 drivers/acpi/osl.c               |   16 ++++++++--------
 drivers/xen/acpi.c               |   26 +++++++++++++-------------
 include/acpi/acpiosxf.h          |    6 ++++++
 include/linux/acpi.h             |    9 +++------
 include/xen/acpi.h               |    4 ++--
 include/xen/interface/platform.h |    7 ++++---
 9 files changed, 49 insertions(+), 35 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH v5 1/5] acpi: Remove need to include linux/acpi.h in common acpica code
  2013-06-28 13:46 ` Ben Guthro
@ 2013-06-28 13:46   ` Ben Guthro
  -1 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Bob Moore

Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Bob Moore <robert.moore@intel.com>
---
 drivers/acpi/acpica/hwsleep.c |    1 -
 include/acpi/acpiosxf.h       |    6 ++++++
 include/linux/acpi.h          |    3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include <acpi/acpi.h>
-#include <linux/acpi.h>
 #include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5b3d2bd..c68b779 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+				  u32 pm1a_control, u32 pm1b_control);
+
 #endif				/* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..709a2f2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device *dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
-				  u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 1/5] acpi: Remove need to include linux/acpi.h in common acpica code
@ 2013-06-28 13:46   ` Ben Guthro
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Bob Moore

Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Bob Moore <robert.moore@intel.com>
---
 drivers/acpi/acpica/hwsleep.c |    1 -
 include/acpi/acpiosxf.h       |    6 ++++++
 include/linux/acpi.h          |    3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include <acpi/acpi.h>
-#include <linux/acpi.h>
 #include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5b3d2bd..c68b779 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+				  u32 pm1a_control, u32 pm1b_control);
+
 #endif				/* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..709a2f2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device *dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
-				  u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 1/5] acpi: Remove need to include linux/acpi.h in common acpica code
  2013-06-28 13:46 ` Ben Guthro
  (?)
  (?)
@ 2013-06-28 13:46 ` Ben Guthro
  -1 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Bob Moore

Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Bob Moore <robert.moore@intel.com>
---
 drivers/acpi/acpica/hwsleep.c |    1 -
 include/acpi/acpiosxf.h       |    6 ++++++
 include/linux/acpi.h          |    3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include <acpi/acpi.h>
-#include <linux/acpi.h>
 #include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5b3d2bd..c68b779 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+				  u32 pm1a_control, u32 pm1b_control);
+
 #endif				/* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..709a2f2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device *dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
-				  u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  2013-06-28 13:46 ` Ben Guthro
@ 2013-06-28 13:46   ` Ben Guthro
  -1 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Bob Moore

In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Bob Moore <robert.moore@intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: linux-acpi@vger.kernel.org
---
 drivers/acpi/acpica/hwesleep.c |    7 +++++++
 drivers/acpi/acpica/hwsleep.c  |    2 +-
 include/acpi/acpiosxf.h        |    4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..69b3e15 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
 	ACPI_FLUSH_CPU_CACHE();
 
+	status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+				       acpi_gbl_sleep_type_b, TRUE);
+	if (ACPI_SKIP(status))
+		return_ACPI_STATUS(AE_OK);
+	if (ACPI_FAILURE(status))
+		return_ACPI_STATUS(status);
+
 	/*
 	 * Set the SLP_TYP and SLP_EN bits.
 	 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 867b947..cf78157 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
 	ACPI_FLUSH_CPU_CACHE();
 
 	status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-				       pm1b_control);
+				       pm1b_control, FALSE);
 	if (ACPI_SKIP(status))
 		return_ACPI_STATUS(AE_OK);
 	if (ACPI_FAILURE(status))
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index c68b779..51d0f78 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
 /*
  * ACPI sleep preparation
  */
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
-				  u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+				  u8 extended);
 
 #endif				/* __ACPIOSXF_H__ */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
@ 2013-06-28 13:46   ` Ben Guthro
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Bob Moore

In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Bob Moore <robert.moore@intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: linux-acpi@vger.kernel.org
---
 drivers/acpi/acpica/hwesleep.c |    7 +++++++
 drivers/acpi/acpica/hwsleep.c  |    2 +-
 include/acpi/acpiosxf.h        |    4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..69b3e15 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
 	ACPI_FLUSH_CPU_CACHE();
 
+	status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+				       acpi_gbl_sleep_type_b, TRUE);
+	if (ACPI_SKIP(status))
+		return_ACPI_STATUS(AE_OK);
+	if (ACPI_FAILURE(status))
+		return_ACPI_STATUS(status);
+
 	/*
 	 * Set the SLP_TYP and SLP_EN bits.
 	 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 867b947..cf78157 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
 	ACPI_FLUSH_CPU_CACHE();
 
 	status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-				       pm1b_control);
+				       pm1b_control, FALSE);
 	if (ACPI_SKIP(status))
 		return_ACPI_STATUS(AE_OK);
 	if (ACPI_FAILURE(status))
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index c68b779..51d0f78 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
 /*
  * ACPI sleep preparation
  */
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
-				  u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+				  u8 extended);
 
 #endif				/* __ACPIOSXF_H__ */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter
  2013-06-28 13:46 ` Ben Guthro
@ 2013-06-28 13:46   ` Ben Guthro
  -1 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Bob Moore

Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Bob Moore <robert.moore@intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: linux-acpi@vger.kernel.org
---
 arch/x86/kernel/tboot.c |    3 ++-
 drivers/acpi/osl.c      |   16 ++++++++--------
 drivers/xen/acpi.c      |    3 ++-
 include/linux/acpi.h    |    6 +++---
 include/xen/acpi.h      |    3 ++-
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..d578c9c 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt *fadt)
 		offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+		       bool extended)
 {
 	static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
 		/* S0,1,2: */ -1, -1, -1,
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..0251c9b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif				/*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
-				      u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+				      bool extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
 	return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
-				  u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+				  u8 extended)
 {
 	int rc = 0;
 	if (__acpi_os_prepare_sleep)
-		rc = __acpi_os_prepare_sleep(sleep_state,
-					     pm1a_control, pm1b_control);
+		rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+					     extended);
 	if (rc < 0)
 		return AE_ERROR;
 	else if (rc > 0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
 	return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-			       u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+			       u32 val_b, bool extended))
 {
 	__acpi_os_prepare_sleep = func;
 }
diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..36d2be1 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -36,7 +36,8 @@
 #include <asm/xen/hypervisor.h>
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-				     u32 pm1a_cnt, u32 pm1b_cnt)
+				     u32 pm1a_cnt, u32 pm1b_cnt,
+				     bool extended)
 {
 	struct xen_platform_op op = {
 		.cmd = XENPF_enter_acpi_sleep,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 709a2f2..26f9996 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device *dev,
 #endif	/* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+			       u32 val_b, bool extended));
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -488,7 +488,7 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..9f7e2e6 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -76,7 +76,8 @@ 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);
+				     u32 pm1a_cnt, u32 pm1b_cnd,
+				     bool extended);
 
 static inline void xen_acpi_sleep_register(void)
 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter
@ 2013-06-28 13:46   ` Ben Guthro
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, Bob Moore

Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Bob Moore <robert.moore@intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: linux-acpi@vger.kernel.org
---
 arch/x86/kernel/tboot.c |    3 ++-
 drivers/acpi/osl.c      |   16 ++++++++--------
 drivers/xen/acpi.c      |    3 ++-
 include/linux/acpi.h    |    6 +++---
 include/xen/acpi.h      |    3 ++-
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..d578c9c 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt *fadt)
 		offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+		       bool extended)
 {
 	static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
 		/* S0,1,2: */ -1, -1, -1,
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..0251c9b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif				/*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
-				      u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+				      bool extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
 	return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
-				  u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+				  u8 extended)
 {
 	int rc = 0;
 	if (__acpi_os_prepare_sleep)
-		rc = __acpi_os_prepare_sleep(sleep_state,
-					     pm1a_control, pm1b_control);
+		rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+					     extended);
 	if (rc < 0)
 		return AE_ERROR;
 	else if (rc > 0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
 	return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-			       u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+			       u32 val_b, bool extended))
 {
 	__acpi_os_prepare_sleep = func;
 }
diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..36d2be1 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -36,7 +36,8 @@
 #include <asm/xen/hypervisor.h>
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-				     u32 pm1a_cnt, u32 pm1b_cnt)
+				     u32 pm1a_cnt, u32 pm1b_cnt,
+				     bool extended)
 {
 	struct xen_platform_op op = {
 		.cmd = XENPF_enter_acpi_sleep,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 709a2f2..26f9996 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device *dev,
 #endif	/* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+			       u32 val_b, bool extended));
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -488,7 +488,7 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..9f7e2e6 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -76,7 +76,8 @@ 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);
+				     u32 pm1a_cnt, u32 pm1b_cnd,
+				     bool extended);
 
 static inline void xen_acpi_sleep_register(void)
 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep
  2013-06-28 13:46 ` Ben Guthro
@ 2013-06-28 13:46   ` Ben Guthro
  -1 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: tboot-devel, Ben Guthro

As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: tboot-devel@lists.sourceforge.net
Cc: Gang Wei <gang.wei@intel.com>
---
 arch/x86/kernel/tboot.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index d578c9c..57383b2 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -285,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
 	if (!tboot_enabled())
 		return 0;
 
+	if (extended)
+		return -1;
+
 	tboot_copy_fadt(&acpi_gbl_FADT);
 	tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
 	tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep
@ 2013-06-28 13:46   ` Ben Guthro
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro, tboot-devel, Gang Wei

As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: tboot-devel@lists.sourceforge.net
Cc: Gang Wei <gang.wei@intel.com>
---
 arch/x86/kernel/tboot.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index d578c9c..57383b2 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -285,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
 	if (!tboot_enabled())
 		return 0;
 
+	if (extended)
+		return -1;
+
 	tboot_copy_fadt(&acpi_gbl_FADT);
 	tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
 	tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep
  2013-06-28 13:46 ` Ben Guthro
                   ` (5 preceding siblings ...)
  (?)
@ 2013-06-28 13:46 ` Ben Guthro
  -1 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: tboot-devel, Ben Guthro, Gang Wei

As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: tboot-devel@lists.sourceforge.net
Cc: Gang Wei <gang.wei@intel.com>
---
 arch/x86/kernel/tboot.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index d578c9c..57383b2 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -285,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
 	if (!tboot_enabled())
 		return 0;
 
+	if (extended)
+		return -1;
+
 	tboot_copy_fadt(&acpi_gbl_FADT);
 	tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
 	tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 5/5] xen/acpi: notify xen when reduced hardware sleep is available
  2013-06-28 13:46 ` Ben Guthro
@ 2013-06-28 13:46   ` Ben Guthro
  -1 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro

Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Konrad Wilk <konrad.wilk@oracle.com>
---
 drivers/xen/acpi.c               |   25 ++++++++++++-------------
 include/xen/acpi.h               |    3 +--
 include/xen/interface/platform.h |    7 ++++---
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 36d2be1..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,27 @@
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-				     u32 pm1a_cnt, u32 pm1b_cnt,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 				     bool extended)
 {
+	unsigned int bits = extended ? 8 : 16;
+
 	struct xen_platform_op op = {
 		.cmd = XENPF_enter_acpi_sleep,
 		.interface_version = XENPF_INTERFACE_VERSION,
-		.u = {
-			.enter_acpi_sleep = {
-				.pm1a_cnt_val = (u16)pm1a_cnt,
-				.pm1b_cnt_val = (u16)pm1b_cnt,
-				.sleep_state = sleep_state,
-			},
+		.u.enter_acpi_sleep = {
+			.val_a = (u16)val_a,
+			.val_b = (u16)val_b,
+			.sleep_state = sleep_state,
+			.flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
 		},
 	};
 
-	if ((pm1a_cnt & 0xffff0000) || (pm1b_cnt & 0xffff0000)) {
-		WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-		     "Email xen-devel@lists.xensource.com  Thank you.\n", \
-		     pm1a_cnt, pm1b_cnt);
+	if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+		 "Using more than %u bits of sleep control values %#x/%#x!"
+		 "Email xen-devel@lists.xen.org - Thank you.\n", \
+		 bits, val_a, val_b))
 		return -1;
-	}
 
 	HYPERVISOR_dom0_op(&op);
 	return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 9f7e2e6..a2d5667 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 	return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-				     u32 pm1a_cnt, u32 pm1b_cnd,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 				     bool extended);
 
 static inline void xen_acpi_sleep_register(void)
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep    51
 struct xenpf_enter_acpi_sleep {
 	/* IN variables */
-	uint16_t pm1a_cnt_val;      /* PM1a control value. */
-	uint16_t pm1b_cnt_val;      /* PM1b control value. */
+	uint16_t val_a;             /* PM1a control / sleep type A. */
+	uint16_t val_b;             /* PM1b control / sleep type B. */
 	uint32_t sleep_state;       /* Which state to enter (Sn). */
-	uint32_t flags;             /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x00000001
+	uint32_t flags;             /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 5/5] xen/acpi: notify xen when reduced hardware sleep is available
@ 2013-06-28 13:46   ` Ben Guthro
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro

Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Konrad Wilk <konrad.wilk@oracle.com>
---
 drivers/xen/acpi.c               |   25 ++++++++++++-------------
 include/xen/acpi.h               |    3 +--
 include/xen/interface/platform.h |    7 ++++---
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 36d2be1..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,27 @@
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-				     u32 pm1a_cnt, u32 pm1b_cnt,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 				     bool extended)
 {
+	unsigned int bits = extended ? 8 : 16;
+
 	struct xen_platform_op op = {
 		.cmd = XENPF_enter_acpi_sleep,
 		.interface_version = XENPF_INTERFACE_VERSION,
-		.u = {
-			.enter_acpi_sleep = {
-				.pm1a_cnt_val = (u16)pm1a_cnt,
-				.pm1b_cnt_val = (u16)pm1b_cnt,
-				.sleep_state = sleep_state,
-			},
+		.u.enter_acpi_sleep = {
+			.val_a = (u16)val_a,
+			.val_b = (u16)val_b,
+			.sleep_state = sleep_state,
+			.flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
 		},
 	};
 
-	if ((pm1a_cnt & 0xffff0000) || (pm1b_cnt & 0xffff0000)) {
-		WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-		     "Email xen-devel@lists.xensource.com  Thank you.\n", \
-		     pm1a_cnt, pm1b_cnt);
+	if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+		 "Using more than %u bits of sleep control values %#x/%#x!"
+		 "Email xen-devel@lists.xen.org - Thank you.\n", \
+		 bits, val_a, val_b))
 		return -1;
-	}
 
 	HYPERVISOR_dom0_op(&op);
 	return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 9f7e2e6..a2d5667 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 	return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-				     u32 pm1a_cnt, u32 pm1b_cnd,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 				     bool extended);
 
 static inline void xen_acpi_sleep_register(void)
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep    51
 struct xenpf_enter_acpi_sleep {
 	/* IN variables */
-	uint16_t pm1a_cnt_val;      /* PM1a control value. */
-	uint16_t pm1b_cnt_val;      /* PM1b control value. */
+	uint16_t val_a;             /* PM1a control / sleep type A. */
+	uint16_t val_b;             /* PM1b control / sleep type B. */
 	uint32_t sleep_state;       /* Which state to enter (Sn). */
-	uint32_t flags;             /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x00000001
+	uint32_t flags;             /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH v5 5/5] xen/acpi: notify xen when reduced hardware sleep is available
  2013-06-28 13:46 ` Ben Guthro
                   ` (7 preceding siblings ...)
  (?)
@ 2013-06-28 13:46 ` Ben Guthro
  -1 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 13:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Jan Beulich, Rafael J . Wysocki,
	linux-kernel, linux-acpi, xen-devel
  Cc: Ben Guthro

Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Cc: Konrad Wilk <konrad.wilk@oracle.com>
---
 drivers/xen/acpi.c               |   25 ++++++++++++-------------
 include/xen/acpi.h               |    3 +--
 include/xen/interface/platform.h |    7 ++++---
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 36d2be1..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,27 @@
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-				     u32 pm1a_cnt, u32 pm1b_cnt,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 				     bool extended)
 {
+	unsigned int bits = extended ? 8 : 16;
+
 	struct xen_platform_op op = {
 		.cmd = XENPF_enter_acpi_sleep,
 		.interface_version = XENPF_INTERFACE_VERSION,
-		.u = {
-			.enter_acpi_sleep = {
-				.pm1a_cnt_val = (u16)pm1a_cnt,
-				.pm1b_cnt_val = (u16)pm1b_cnt,
-				.sleep_state = sleep_state,
-			},
+		.u.enter_acpi_sleep = {
+			.val_a = (u16)val_a,
+			.val_b = (u16)val_b,
+			.sleep_state = sleep_state,
+			.flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
 		},
 	};
 
-	if ((pm1a_cnt & 0xffff0000) || (pm1b_cnt & 0xffff0000)) {
-		WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-		     "Email xen-devel@lists.xensource.com  Thank you.\n", \
-		     pm1a_cnt, pm1b_cnt);
+	if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+		 "Using more than %u bits of sleep control values %#x/%#x!"
+		 "Email xen-devel@lists.xen.org - Thank you.\n", \
+		 bits, val_a, val_b))
 		return -1;
-	}
 
 	HYPERVISOR_dom0_op(&op);
 	return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 9f7e2e6..a2d5667 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 	return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-				     u32 pm1a_cnt, u32 pm1b_cnd,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 				     bool extended);
 
 static inline void xen_acpi_sleep_register(void)
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep    51
 struct xenpf_enter_acpi_sleep {
 	/* IN variables */
-	uint16_t pm1a_cnt_val;      /* PM1a control value. */
-	uint16_t pm1b_cnt_val;      /* PM1b control value. */
+	uint16_t val_a;             /* PM1a control / sleep type A. */
+	uint16_t val_b;             /* PM1b control / sleep type B. */
 	uint32_t sleep_state;       /* Which state to enter (Sn). */
-	uint32_t flags;             /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x00000001
+	uint32_t flags;             /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter
  2013-06-28 13:46   ` Ben Guthro
  (?)
  (?)
@ 2013-06-28 16:03   ` Konrad Rzeszutek Wilk
  2013-06-28 16:15     ` Ben Guthro
  2013-06-28 16:15       ` Ben Guthro
  -1 siblings, 2 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:03 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Jan Beulich, Rafael J . Wysocki, linux-kernel, linux-acpi,
	xen-devel, Bob Moore

On Fri, Jun 28, 2013 at 09:46:22AM -0400, Ben Guthro wrote:
> Change the function definitions of acpi_os_prepare_sleep() and
> acpi_os_set_prepare_sleep() to pass along the new extended sleep
> parameter.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Bob Moore <robert.moore@intel.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: linux-acpi@vger.kernel.org
> ---
>  arch/x86/kernel/tboot.c |    3 ++-
>  drivers/acpi/osl.c      |   16 ++++++++--------
>  drivers/xen/acpi.c      |    3 ++-
>  include/linux/acpi.h    |    6 +++---
>  include/xen/acpi.h      |    3 ++-

Since they touch the Xen files, please also include

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

thought you should rebase this on top of Rafael's linux-next
as it won't apply cleanly on top v3.10-rc7.


>  5 files changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
> index f84fe00..d578c9c 100644
> --- a/arch/x86/kernel/tboot.c
> +++ b/arch/x86/kernel/tboot.c
> @@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt *fadt)
>  		offsetof(struct acpi_table_facs, firmware_waking_vector);
>  }
>  
> -static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
> +static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
> +		       bool extended)
>  {
>  	static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
>  		/* S0,1,2: */ -1, -1, -1,
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index e721863..0251c9b 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
>  extern char line_buf[80];
>  #endif				/*ENABLE_DEBUGGER */
>  
> -static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
> -				      u32 pm1b_ctrl);
> +static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
> +				      bool extended);
>  
>  static acpi_osd_handler acpi_irq_handler;
>  static void *acpi_irq_context;
> @@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
>  	return AE_OK;
>  }
>  
> -acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
> -				  u32 pm1b_control)
> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
> +				  u8 extended)
>  {
>  	int rc = 0;
>  	if (__acpi_os_prepare_sleep)
> -		rc = __acpi_os_prepare_sleep(sleep_state,
> -					     pm1a_control, pm1b_control);
> +		rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
> +					     extended);
>  	if (rc < 0)
>  		return AE_ERROR;
>  	else if (rc > 0)
> @@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>  	return AE_OK;
>  }
>  
> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
> -			       u32 pm1a_ctrl, u32 pm1b_ctrl))
> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
> +			       u32 val_b, bool extended))
>  {
>  	__acpi_os_prepare_sleep = func;
>  }
> diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
> index 119d42a..36d2be1 100644
> --- a/drivers/xen/acpi.c
> +++ b/drivers/xen/acpi.c
> @@ -36,7 +36,8 @@
>  #include <asm/xen/hypervisor.h>
>  
>  int xen_acpi_notify_hypervisor_state(u8 sleep_state,
> -				     u32 pm1a_cnt, u32 pm1b_cnt)
> +				     u32 pm1a_cnt, u32 pm1b_cnt,
> +				     bool extended)
>  {
>  	struct xen_platform_op op = {
>  		.cmd = XENPF_enter_acpi_sleep,
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 709a2f2..26f9996 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device *dev,
>  #endif	/* !CONFIG_ACPI */
>  
>  #ifdef CONFIG_ACPI
> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
> -			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
> +			       u32 val_b, bool extended));
>  #ifdef CONFIG_X86
>  void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
>  #else
> @@ -488,7 +488,7 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
>  }
>  #endif /* CONFIG_X86 */
>  #else
> -#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
> +#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
>  #endif
>  
>  #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
> diff --git a/include/xen/acpi.h b/include/xen/acpi.h
> index 68d73d0..9f7e2e6 100644
> --- a/include/xen/acpi.h
> +++ b/include/xen/acpi.h
> @@ -76,7 +76,8 @@ 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);
> +				     u32 pm1a_cnt, u32 pm1b_cnd,
> +				     bool extended);
>  
>  static inline void xen_acpi_sleep_register(void)
>  {
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter
  2013-06-28 13:46   ` Ben Guthro
  (?)
@ 2013-06-28 16:03   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:03 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Bob Moore, linux-kernel, Rafael J . Wysocki, linux-acpi,
	Jan Beulich, xen-devel

On Fri, Jun 28, 2013 at 09:46:22AM -0400, Ben Guthro wrote:
> Change the function definitions of acpi_os_prepare_sleep() and
> acpi_os_set_prepare_sleep() to pass along the new extended sleep
> parameter.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Bob Moore <robert.moore@intel.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: linux-acpi@vger.kernel.org
> ---
>  arch/x86/kernel/tboot.c |    3 ++-
>  drivers/acpi/osl.c      |   16 ++++++++--------
>  drivers/xen/acpi.c      |    3 ++-
>  include/linux/acpi.h    |    6 +++---
>  include/xen/acpi.h      |    3 ++-

Since they touch the Xen files, please also include

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

thought you should rebase this on top of Rafael's linux-next
as it won't apply cleanly on top v3.10-rc7.


>  5 files changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
> index f84fe00..d578c9c 100644
> --- a/arch/x86/kernel/tboot.c
> +++ b/arch/x86/kernel/tboot.c
> @@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt *fadt)
>  		offsetof(struct acpi_table_facs, firmware_waking_vector);
>  }
>  
> -static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
> +static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
> +		       bool extended)
>  {
>  	static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
>  		/* S0,1,2: */ -1, -1, -1,
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index e721863..0251c9b 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
>  extern char line_buf[80];
>  #endif				/*ENABLE_DEBUGGER */
>  
> -static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
> -				      u32 pm1b_ctrl);
> +static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
> +				      bool extended);
>  
>  static acpi_osd_handler acpi_irq_handler;
>  static void *acpi_irq_context;
> @@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
>  	return AE_OK;
>  }
>  
> -acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
> -				  u32 pm1b_control)
> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
> +				  u8 extended)
>  {
>  	int rc = 0;
>  	if (__acpi_os_prepare_sleep)
> -		rc = __acpi_os_prepare_sleep(sleep_state,
> -					     pm1a_control, pm1b_control);
> +		rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
> +					     extended);
>  	if (rc < 0)
>  		return AE_ERROR;
>  	else if (rc > 0)
> @@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>  	return AE_OK;
>  }
>  
> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
> -			       u32 pm1a_ctrl, u32 pm1b_ctrl))
> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
> +			       u32 val_b, bool extended))
>  {
>  	__acpi_os_prepare_sleep = func;
>  }
> diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
> index 119d42a..36d2be1 100644
> --- a/drivers/xen/acpi.c
> +++ b/drivers/xen/acpi.c
> @@ -36,7 +36,8 @@
>  #include <asm/xen/hypervisor.h>
>  
>  int xen_acpi_notify_hypervisor_state(u8 sleep_state,
> -				     u32 pm1a_cnt, u32 pm1b_cnt)
> +				     u32 pm1a_cnt, u32 pm1b_cnt,
> +				     bool extended)
>  {
>  	struct xen_platform_op op = {
>  		.cmd = XENPF_enter_acpi_sleep,
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 709a2f2..26f9996 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device *dev,
>  #endif	/* !CONFIG_ACPI */
>  
>  #ifdef CONFIG_ACPI
> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
> -			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
> +			       u32 val_b, bool extended));
>  #ifdef CONFIG_X86
>  void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
>  #else
> @@ -488,7 +488,7 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
>  }
>  #endif /* CONFIG_X86 */
>  #else
> -#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
> +#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
>  #endif
>  
>  #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
> diff --git a/include/xen/acpi.h b/include/xen/acpi.h
> index 68d73d0..9f7e2e6 100644
> --- a/include/xen/acpi.h
> +++ b/include/xen/acpi.h
> @@ -76,7 +76,8 @@ 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);
> +				     u32 pm1a_cnt, u32 pm1b_cnd,
> +				     bool extended);
>  
>  static inline void xen_acpi_sleep_register(void)
>  {
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep
  2013-06-28 13:46   ` Ben Guthro
@ 2013-06-28 16:05     ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:05 UTC (permalink / raw)
  To: Ben Guthro
  Cc: linux-kernel, xen-devel, Rafael J . Wysocki, linux-acpi,
	tboot-devel, Jan Beulich

On Fri, Jun 28, 2013 at 09:46:23AM -0400, Ben Guthro wrote:
> As tboot currently does not support the reduced hardware sleep
> interface, fail this extended call.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: tboot-devel@lists.sourceforge.net
> Cc: Gang Wei <gang.wei@intel.com>
> ---
>  arch/x86/kernel/tboot.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
> index d578c9c..57383b2 100644
> --- a/arch/x86/kernel/tboot.c
> +++ b/arch/x86/kernel/tboot.c
> @@ -285,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
>  	if (!tboot_enabled())
>  		return 0;
>  
> +	if (extended)
> +		return -1;

I would add WARN_ON just so that the user is aware of.
Perhaps

	if (WARN(extended,"tboot is not able to suspend on ACPI extended platforms. Contact
tboot-something mailing list please."))
		return -1

Otherwise
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> +
>  	tboot_copy_fadt(&acpi_gbl_FADT);
>  	tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
>  	tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
> -- 
> 1.7.9.5
> 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep
@ 2013-06-28 16:05     ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:05 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Jan Beulich, Rafael J . Wysocki, linux-kernel, linux-acpi,
	xen-devel, tboot-devel, Gang Wei

On Fri, Jun 28, 2013 at 09:46:23AM -0400, Ben Guthro wrote:
> As tboot currently does not support the reduced hardware sleep
> interface, fail this extended call.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: tboot-devel@lists.sourceforge.net
> Cc: Gang Wei <gang.wei@intel.com>
> ---
>  arch/x86/kernel/tboot.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
> index d578c9c..57383b2 100644
> --- a/arch/x86/kernel/tboot.c
> +++ b/arch/x86/kernel/tboot.c
> @@ -285,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
>  	if (!tboot_enabled())
>  		return 0;
>  
> +	if (extended)
> +		return -1;

I would add WARN_ON just so that the user is aware of.
Perhaps

	if (WARN(extended,"tboot is not able to suspend on ACPI extended platforms. Contact
tboot-something mailing list please."))
		return -1

Otherwise
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> +
>  	tboot_copy_fadt(&acpi_gbl_FADT);
>  	tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
>  	tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep
  2013-06-28 13:46   ` Ben Guthro
  (?)
  (?)
@ 2013-06-28 16:05   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:05 UTC (permalink / raw)
  To: Ben Guthro
  Cc: linux-kernel, xen-devel, Rafael J . Wysocki, linux-acpi,
	tboot-devel, Jan Beulich, Gang Wei

On Fri, Jun 28, 2013 at 09:46:23AM -0400, Ben Guthro wrote:
> As tboot currently does not support the reduced hardware sleep
> interface, fail this extended call.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: tboot-devel@lists.sourceforge.net
> Cc: Gang Wei <gang.wei@intel.com>
> ---
>  arch/x86/kernel/tboot.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
> index d578c9c..57383b2 100644
> --- a/arch/x86/kernel/tboot.c
> +++ b/arch/x86/kernel/tboot.c
> @@ -285,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
>  	if (!tboot_enabled())
>  		return 0;
>  
> +	if (extended)
> +		return -1;

I would add WARN_ON just so that the user is aware of.
Perhaps

	if (WARN(extended,"tboot is not able to suspend on ACPI extended platforms. Contact
tboot-something mailing list please."))
		return -1

Otherwise
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> +
>  	tboot_copy_fadt(&acpi_gbl_FADT);
>  	tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
>  	tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 5/5] xen/acpi: notify xen when reduced hardware sleep is available
  2013-06-28 13:46   ` Ben Guthro
  (?)
@ 2013-06-28 16:05   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:05 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Jan Beulich, Rafael J . Wysocki, linux-kernel, linux-acpi, xen-devel

On Fri, Jun 28, 2013 at 09:46:24AM -0400, Ben Guthro wrote:
> Make use of acpi_os_prepare_sleep extended parameter to notify xen
> to make use of the reduced hardware sleep functionality
> 
> The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
> v5 (reduced HW) sleep interface") on the master branch of
> git://xenbits.xen.org/xen.git.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Konrad Wilk <konrad.wilk@oracle.com>

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/xen/acpi.c               |   25 ++++++++++++-------------
>  include/xen/acpi.h               |    3 +--
>  include/xen/interface/platform.h |    7 ++++---
>  3 files changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
> index 36d2be1..371dade 100644
> --- a/drivers/xen/acpi.c
> +++ b/drivers/xen/acpi.c
> @@ -35,28 +35,27 @@
>  #include <asm/xen/hypercall.h>
>  #include <asm/xen/hypervisor.h>
>  
> -int xen_acpi_notify_hypervisor_state(u8 sleep_state,
> -				     u32 pm1a_cnt, u32 pm1b_cnt,
> +int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
>  				     bool extended)
>  {
> +	unsigned int bits = extended ? 8 : 16;
> +
>  	struct xen_platform_op op = {
>  		.cmd = XENPF_enter_acpi_sleep,
>  		.interface_version = XENPF_INTERFACE_VERSION,
> -		.u = {
> -			.enter_acpi_sleep = {
> -				.pm1a_cnt_val = (u16)pm1a_cnt,
> -				.pm1b_cnt_val = (u16)pm1b_cnt,
> -				.sleep_state = sleep_state,
> -			},
> +		.u.enter_acpi_sleep = {
> +			.val_a = (u16)val_a,
> +			.val_b = (u16)val_b,
> +			.sleep_state = sleep_state,
> +			.flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
>  		},
>  	};
>  
> -	if ((pm1a_cnt & 0xffff0000) || (pm1b_cnt & 0xffff0000)) {
> -		WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
> -		     "Email xen-devel@lists.xensource.com  Thank you.\n", \
> -		     pm1a_cnt, pm1b_cnt);
> +	if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
> +		 "Using more than %u bits of sleep control values %#x/%#x!"
> +		 "Email xen-devel@lists.xen.org - Thank you.\n", \
> +		 bits, val_a, val_b))
>  		return -1;
> -	}
>  
>  	HYPERVISOR_dom0_op(&op);
>  	return 1;
> diff --git a/include/xen/acpi.h b/include/xen/acpi.h
> index 9f7e2e6..a2d5667 100644
> --- a/include/xen/acpi.h
> +++ b/include/xen/acpi.h
> @@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
>  	return -ENXIO;
>  }
>  
> -int xen_acpi_notify_hypervisor_state(u8 sleep_state,
> -				     u32 pm1a_cnt, u32 pm1b_cnd,
> +int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
>  				     bool extended);
>  
>  static inline void xen_acpi_sleep_register(void)
> diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
> index c57d5f6..f1331e3 100644
> --- a/include/xen/interface/platform.h
> +++ b/include/xen/interface/platform.h
> @@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
>  #define XENPF_enter_acpi_sleep    51
>  struct xenpf_enter_acpi_sleep {
>  	/* IN variables */
> -	uint16_t pm1a_cnt_val;      /* PM1a control value. */
> -	uint16_t pm1b_cnt_val;      /* PM1b control value. */
> +	uint16_t val_a;             /* PM1a control / sleep type A. */
> +	uint16_t val_b;             /* PM1b control / sleep type B. */
>  	uint32_t sleep_state;       /* Which state to enter (Sn). */
> -	uint32_t flags;             /* Must be zero. */
> +#define XENPF_ACPI_SLEEP_EXTENDED 0x00000001
> +	uint32_t flags;             /* XENPF_ACPI_SLEEP_*. */
>  };
>  DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
>  
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 5/5] xen/acpi: notify xen when reduced hardware sleep is available
  2013-06-28 13:46   ` Ben Guthro
  (?)
  (?)
@ 2013-06-28 16:05   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:05 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Rafael J . Wysocki, linux-acpi, linux-kernel, Jan Beulich, xen-devel

On Fri, Jun 28, 2013 at 09:46:24AM -0400, Ben Guthro wrote:
> Make use of acpi_os_prepare_sleep extended parameter to notify xen
> to make use of the reduced hardware sleep functionality
> 
> The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
> v5 (reduced HW) sleep interface") on the master branch of
> git://xenbits.xen.org/xen.git.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Konrad Wilk <konrad.wilk@oracle.com>

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/xen/acpi.c               |   25 ++++++++++++-------------
>  include/xen/acpi.h               |    3 +--
>  include/xen/interface/platform.h |    7 ++++---
>  3 files changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
> index 36d2be1..371dade 100644
> --- a/drivers/xen/acpi.c
> +++ b/drivers/xen/acpi.c
> @@ -35,28 +35,27 @@
>  #include <asm/xen/hypercall.h>
>  #include <asm/xen/hypervisor.h>
>  
> -int xen_acpi_notify_hypervisor_state(u8 sleep_state,
> -				     u32 pm1a_cnt, u32 pm1b_cnt,
> +int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
>  				     bool extended)
>  {
> +	unsigned int bits = extended ? 8 : 16;
> +
>  	struct xen_platform_op op = {
>  		.cmd = XENPF_enter_acpi_sleep,
>  		.interface_version = XENPF_INTERFACE_VERSION,
> -		.u = {
> -			.enter_acpi_sleep = {
> -				.pm1a_cnt_val = (u16)pm1a_cnt,
> -				.pm1b_cnt_val = (u16)pm1b_cnt,
> -				.sleep_state = sleep_state,
> -			},
> +		.u.enter_acpi_sleep = {
> +			.val_a = (u16)val_a,
> +			.val_b = (u16)val_b,
> +			.sleep_state = sleep_state,
> +			.flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
>  		},
>  	};
>  
> -	if ((pm1a_cnt & 0xffff0000) || (pm1b_cnt & 0xffff0000)) {
> -		WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
> -		     "Email xen-devel@lists.xensource.com  Thank you.\n", \
> -		     pm1a_cnt, pm1b_cnt);
> +	if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
> +		 "Using more than %u bits of sleep control values %#x/%#x!"
> +		 "Email xen-devel@lists.xen.org - Thank you.\n", \
> +		 bits, val_a, val_b))
>  		return -1;
> -	}
>  
>  	HYPERVISOR_dom0_op(&op);
>  	return 1;
> diff --git a/include/xen/acpi.h b/include/xen/acpi.h
> index 9f7e2e6..a2d5667 100644
> --- a/include/xen/acpi.h
> +++ b/include/xen/acpi.h
> @@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
>  	return -ENXIO;
>  }
>  
> -int xen_acpi_notify_hypervisor_state(u8 sleep_state,
> -				     u32 pm1a_cnt, u32 pm1b_cnd,
> +int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
>  				     bool extended);
>  
>  static inline void xen_acpi_sleep_register(void)
> diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
> index c57d5f6..f1331e3 100644
> --- a/include/xen/interface/platform.h
> +++ b/include/xen/interface/platform.h
> @@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
>  #define XENPF_enter_acpi_sleep    51
>  struct xenpf_enter_acpi_sleep {
>  	/* IN variables */
> -	uint16_t pm1a_cnt_val;      /* PM1a control value. */
> -	uint16_t pm1b_cnt_val;      /* PM1b control value. */
> +	uint16_t val_a;             /* PM1a control / sleep type A. */
> +	uint16_t val_b;             /* PM1b control / sleep type B. */
>  	uint32_t sleep_state;       /* Which state to enter (Sn). */
> -	uint32_t flags;             /* Must be zero. */
> +#define XENPF_ACPI_SLEEP_EXTENDED 0x00000001
> +	uint32_t flags;             /* XENPF_ACPI_SLEEP_*. */
>  };
>  DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
>  
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  2013-06-28 13:46   ` Ben Guthro
  (?)
  (?)
@ 2013-06-28 16:06   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:06 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Jan Beulich, Rafael J . Wysocki, linux-kernel, linux-acpi,
	xen-devel, Bob Moore

On Fri, Jun 28, 2013 at 09:46:21AM -0400, Ben Guthro wrote:
> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
> reduced hardware sleep support, and the two changes didn't get
> synchronized: The new code doesn't call the hook function (if so
> requested). Fix this, requiring a parameter to be added to the
> hook function to distinguish "extended" from "legacy" sleep.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Bob Moore <robert.moore@intel.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: linux-acpi@vger.kernel.org

You can also add
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> ---
>  drivers/acpi/acpica/hwesleep.c |    7 +++++++
>  drivers/acpi/acpica/hwsleep.c  |    2 +-
>  include/acpi/acpiosxf.h        |    4 ++--
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
> index 5e5f762..69b3e15 100644
> --- a/drivers/acpi/acpica/hwesleep.c
> +++ b/drivers/acpi/acpica/hwesleep.c
> @@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
>  
>  	ACPI_FLUSH_CPU_CACHE();
>  
> +	status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
> +				       acpi_gbl_sleep_type_b, TRUE);
> +	if (ACPI_SKIP(status))
> +		return_ACPI_STATUS(AE_OK);
> +	if (ACPI_FAILURE(status))
> +		return_ACPI_STATUS(status);
> +
>  	/*
>  	 * Set the SLP_TYP and SLP_EN bits.
>  	 *
> diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
> index 867b947..cf78157 100644
> --- a/drivers/acpi/acpica/hwsleep.c
> +++ b/drivers/acpi/acpica/hwsleep.c
> @@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
>  	ACPI_FLUSH_CPU_CACHE();
>  
>  	status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
> -				       pm1b_control);
> +				       pm1b_control, FALSE);
>  	if (ACPI_SKIP(status))
>  		return_ACPI_STATUS(AE_OK);
>  	if (ACPI_FAILURE(status))
> diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
> index c68b779..51d0f78 100644
> --- a/include/acpi/acpiosxf.h
> +++ b/include/acpi/acpiosxf.h
> @@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
>  /*
>   * ACPI sleep preparation
>   */
> -acpi_status acpi_os_prepare_sleep(u8 sleep_state,
> -				  u32 pm1a_control, u32 pm1b_control);
> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
> +				  u8 extended);
>  
>  #endif				/* __ACPIOSXF_H__ */
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  2013-06-28 13:46   ` Ben Guthro
  (?)
@ 2013-06-28 16:06   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:06 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Bob Moore, linux-kernel, Rafael J . Wysocki, linux-acpi,
	Jan Beulich, xen-devel

On Fri, Jun 28, 2013 at 09:46:21AM -0400, Ben Guthro wrote:
> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
> reduced hardware sleep support, and the two changes didn't get
> synchronized: The new code doesn't call the hook function (if so
> requested). Fix this, requiring a parameter to be added to the
> hook function to distinguish "extended" from "legacy" sleep.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Bob Moore <robert.moore@intel.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: linux-acpi@vger.kernel.org

You can also add
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> ---
>  drivers/acpi/acpica/hwesleep.c |    7 +++++++
>  drivers/acpi/acpica/hwsleep.c  |    2 +-
>  include/acpi/acpiosxf.h        |    4 ++--
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
> index 5e5f762..69b3e15 100644
> --- a/drivers/acpi/acpica/hwesleep.c
> +++ b/drivers/acpi/acpica/hwesleep.c
> @@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
>  
>  	ACPI_FLUSH_CPU_CACHE();
>  
> +	status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
> +				       acpi_gbl_sleep_type_b, TRUE);
> +	if (ACPI_SKIP(status))
> +		return_ACPI_STATUS(AE_OK);
> +	if (ACPI_FAILURE(status))
> +		return_ACPI_STATUS(status);
> +
>  	/*
>  	 * Set the SLP_TYP and SLP_EN bits.
>  	 *
> diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
> index 867b947..cf78157 100644
> --- a/drivers/acpi/acpica/hwsleep.c
> +++ b/drivers/acpi/acpica/hwsleep.c
> @@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
>  	ACPI_FLUSH_CPU_CACHE();
>  
>  	status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
> -				       pm1b_control);
> +				       pm1b_control, FALSE);
>  	if (ACPI_SKIP(status))
>  		return_ACPI_STATUS(AE_OK);
>  	if (ACPI_FAILURE(status))
> diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
> index c68b779..51d0f78 100644
> --- a/include/acpi/acpiosxf.h
> +++ b/include/acpi/acpiosxf.h
> @@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
>  /*
>   * ACPI sleep preparation
>   */
> -acpi_status acpi_os_prepare_sleep(u8 sleep_state,
> -				  u32 pm1a_control, u32 pm1b_control);
> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
> +				  u8 extended);
>  
>  #endif				/* __ACPIOSXF_H__ */
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 1/5] acpi: Remove need to include linux/acpi.h in common acpica code
  2013-06-28 13:46   ` Ben Guthro
  (?)
@ 2013-06-28 16:07   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:07 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Jan Beulich, Rafael J . Wysocki, linux-kernel, linux-acpi,
	xen-devel, Bob Moore

On Fri, Jun 28, 2013 at 09:46:20AM -0400, Ben Guthro wrote:
> Move the definition of acpi_os_prepare_sleep into the OS services layer header,
> and remove the include of linux/acpi.h from common acpica code.
> 

Thank you.

> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: Bob Moore <robert.moore@intel.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/acpi/acpica/hwsleep.c |    1 -
>  include/acpi/acpiosxf.h       |    6 ++++++
>  include/linux/acpi.h          |    3 ---
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
> index e3828cc..867b947 100644
> --- a/drivers/acpi/acpica/hwsleep.c
> +++ b/drivers/acpi/acpica/hwsleep.c
> @@ -43,7 +43,6 @@
>   */
>  
>  #include <acpi/acpi.h>
> -#include <linux/acpi.h>
>  #include "accommon.h"
>  
>  #define _COMPONENT          ACPI_HARDWARE
> diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
> index 5b3d2bd..c68b779 100644
> --- a/include/acpi/acpiosxf.h
> +++ b/include/acpi/acpiosxf.h
> @@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
>  
>  void acpi_os_close_directory(void *dir_handle);
>  
> +/*
> + * ACPI sleep preparation
> + */
> +acpi_status acpi_os_prepare_sleep(u8 sleep_state,
> +				  u32 pm1a_control, u32 pm1b_control);
> +
>  #endif				/* __ACPIOSXF_H__ */
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 17b5b59..709a2f2 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device *dev,
>  #ifdef CONFIG_ACPI
>  void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>  			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
> -
> -acpi_status acpi_os_prepare_sleep(u8 sleep_state,
> -				  u32 pm1a_control, u32 pm1b_control);
>  #ifdef CONFIG_X86
>  void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
>  #else
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 1/5] acpi: Remove need to include linux/acpi.h in common acpica code
  2013-06-28 13:46   ` Ben Guthro
  (?)
  (?)
@ 2013-06-28 16:07   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 31+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-06-28 16:07 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Bob Moore, linux-kernel, Rafael J . Wysocki, linux-acpi,
	Jan Beulich, xen-devel

On Fri, Jun 28, 2013 at 09:46:20AM -0400, Ben Guthro wrote:
> Move the definition of acpi_os_prepare_sleep into the OS services layer header,
> and remove the include of linux/acpi.h from common acpica code.
> 

Thank you.

> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: Bob Moore <robert.moore@intel.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/acpi/acpica/hwsleep.c |    1 -
>  include/acpi/acpiosxf.h       |    6 ++++++
>  include/linux/acpi.h          |    3 ---
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
> index e3828cc..867b947 100644
> --- a/drivers/acpi/acpica/hwsleep.c
> +++ b/drivers/acpi/acpica/hwsleep.c
> @@ -43,7 +43,6 @@
>   */
>  
>  #include <acpi/acpi.h>
> -#include <linux/acpi.h>
>  #include "accommon.h"
>  
>  #define _COMPONENT          ACPI_HARDWARE
> diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
> index 5b3d2bd..c68b779 100644
> --- a/include/acpi/acpiosxf.h
> +++ b/include/acpi/acpiosxf.h
> @@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
>  
>  void acpi_os_close_directory(void *dir_handle);
>  
> +/*
> + * ACPI sleep preparation
> + */
> +acpi_status acpi_os_prepare_sleep(u8 sleep_state,
> +				  u32 pm1a_control, u32 pm1b_control);
> +
>  #endif				/* __ACPIOSXF_H__ */
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 17b5b59..709a2f2 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device *dev,
>  #ifdef CONFIG_ACPI
>  void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>  			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
> -
> -acpi_status acpi_os_prepare_sleep(u8 sleep_state,
> -				  u32 pm1a_control, u32 pm1b_control);
>  #ifdef CONFIG_X86
>  void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
>  #else
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter
  2013-06-28 16:03   ` Konrad Rzeszutek Wilk
@ 2013-06-28 16:15       ` Ben Guthro
  2013-06-28 16:15       ` Ben Guthro
  1 sibling, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 16:15 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Jan Beulich, Rafael J . Wysocki, linux-kernel, linux-acpi,
	xen-devel, Bob Moore



On 06/28/2013 12:03 PM, Konrad Rzeszutek Wilk wrote:
> On Fri, Jun 28, 2013 at 09:46:22AM -0400, Ben Guthro wrote:
>> Change the function definitions of acpi_os_prepare_sleep() and
>> acpi_os_set_prepare_sleep() to pass along the new extended sleep
>> parameter.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
>> Cc: Bob Moore <robert.moore@intel.com>
>> Cc: Rafael J. Wysocki <rjw@sisk.pl>
>> Cc: linux-acpi@vger.kernel.org
>> ---
>>   arch/x86/kernel/tboot.c |    3 ++-
>>   drivers/acpi/osl.c      |   16 ++++++++--------
>>   drivers/xen/acpi.c      |    3 ++-
>>   include/linux/acpi.h    |    6 +++---
>>   include/xen/acpi.h      |    3 ++-
>
> Since they touch the Xen files, please also include
>
> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
> thought you should rebase this on top of Rafael's linux-next
> as it won't apply cleanly on top v3.10-rc7.

Actually, it does apply cleanly on top of v3.10-rc7.

However, I'll pull Rafael's linux-next, and rebase on that.

>
>
>>   5 files changed, 17 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
>> index f84fe00..d578c9c 100644
>> --- a/arch/x86/kernel/tboot.c
>> +++ b/arch/x86/kernel/tboot.c
>> @@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt *fadt)
>>   		offsetof(struct acpi_table_facs, firmware_waking_vector);
>>   }
>>
>> -static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
>> +static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
>> +		       bool extended)
>>   {
>>   	static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
>>   		/* S0,1,2: */ -1, -1, -1,
>> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
>> index e721863..0251c9b 100644
>> --- a/drivers/acpi/osl.c
>> +++ b/drivers/acpi/osl.c
>> @@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
>>   extern char line_buf[80];
>>   #endif				/*ENABLE_DEBUGGER */
>>
>> -static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
>> -				      u32 pm1b_ctrl);
>> +static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
>> +				      bool extended);
>>
>>   static acpi_osd_handler acpi_irq_handler;
>>   static void *acpi_irq_context;
>> @@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
>>   	return AE_OK;
>>   }
>>
>> -acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>> -				  u32 pm1b_control)
>> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
>> +				  u8 extended)
>>   {
>>   	int rc = 0;
>>   	if (__acpi_os_prepare_sleep)
>> -		rc = __acpi_os_prepare_sleep(sleep_state,
>> -					     pm1a_control, pm1b_control);
>> +		rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
>> +					     extended);
>>   	if (rc < 0)
>>   		return AE_ERROR;
>>   	else if (rc > 0)
>> @@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>>   	return AE_OK;
>>   }
>>
>> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>> -			       u32 pm1a_ctrl, u32 pm1b_ctrl))
>> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
>> +			       u32 val_b, bool extended))
>>   {
>>   	__acpi_os_prepare_sleep = func;
>>   }
>> diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
>> index 119d42a..36d2be1 100644
>> --- a/drivers/xen/acpi.c
>> +++ b/drivers/xen/acpi.c
>> @@ -36,7 +36,8 @@
>>   #include <asm/xen/hypervisor.h>
>>
>>   int xen_acpi_notify_hypervisor_state(u8 sleep_state,
>> -				     u32 pm1a_cnt, u32 pm1b_cnt)
>> +				     u32 pm1a_cnt, u32 pm1b_cnt,
>> +				     bool extended)
>>   {
>>   	struct xen_platform_op op = {
>>   		.cmd = XENPF_enter_acpi_sleep,
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index 709a2f2..26f9996 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device *dev,
>>   #endif	/* !CONFIG_ACPI */
>>
>>   #ifdef CONFIG_ACPI
>> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>> -			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
>> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
>> +			       u32 val_b, bool extended));
>>   #ifdef CONFIG_X86
>>   void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
>>   #else
>> @@ -488,7 +488,7 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
>>   }
>>   #endif /* CONFIG_X86 */
>>   #else
>> -#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
>> +#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
>>   #endif
>>
>>   #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
>> diff --git a/include/xen/acpi.h b/include/xen/acpi.h
>> index 68d73d0..9f7e2e6 100644
>> --- a/include/xen/acpi.h
>> +++ b/include/xen/acpi.h
>> @@ -76,7 +76,8 @@ 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);
>> +				     u32 pm1a_cnt, u32 pm1b_cnd,
>> +				     bool extended);
>>
>>   static inline void xen_acpi_sleep_register(void)
>>   {
>> --
>> 1.7.9.5
>>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter
@ 2013-06-28 16:15       ` Ben Guthro
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 16:15 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Jan Beulich, Rafael J . Wysocki, linux-kernel, linux-acpi,
	xen-devel, Bob Moore



On 06/28/2013 12:03 PM, Konrad Rzeszutek Wilk wrote:
> On Fri, Jun 28, 2013 at 09:46:22AM -0400, Ben Guthro wrote:
>> Change the function definitions of acpi_os_prepare_sleep() and
>> acpi_os_set_prepare_sleep() to pass along the new extended sleep
>> parameter.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
>> Cc: Bob Moore <robert.moore@intel.com>
>> Cc: Rafael J. Wysocki <rjw@sisk.pl>
>> Cc: linux-acpi@vger.kernel.org
>> ---
>>   arch/x86/kernel/tboot.c |    3 ++-
>>   drivers/acpi/osl.c      |   16 ++++++++--------
>>   drivers/xen/acpi.c      |    3 ++-
>>   include/linux/acpi.h    |    6 +++---
>>   include/xen/acpi.h      |    3 ++-
>
> Since they touch the Xen files, please also include
>
> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
> thought you should rebase this on top of Rafael's linux-next
> as it won't apply cleanly on top v3.10-rc7.

Actually, it does apply cleanly on top of v3.10-rc7.

However, I'll pull Rafael's linux-next, and rebase on that.

>
>
>>   5 files changed, 17 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
>> index f84fe00..d578c9c 100644
>> --- a/arch/x86/kernel/tboot.c
>> +++ b/arch/x86/kernel/tboot.c
>> @@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt *fadt)
>>   		offsetof(struct acpi_table_facs, firmware_waking_vector);
>>   }
>>
>> -static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
>> +static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
>> +		       bool extended)
>>   {
>>   	static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
>>   		/* S0,1,2: */ -1, -1, -1,
>> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
>> index e721863..0251c9b 100644
>> --- a/drivers/acpi/osl.c
>> +++ b/drivers/acpi/osl.c
>> @@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
>>   extern char line_buf[80];
>>   #endif				/*ENABLE_DEBUGGER */
>>
>> -static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
>> -				      u32 pm1b_ctrl);
>> +static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
>> +				      bool extended);
>>
>>   static acpi_osd_handler acpi_irq_handler;
>>   static void *acpi_irq_context;
>> @@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
>>   	return AE_OK;
>>   }
>>
>> -acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>> -				  u32 pm1b_control)
>> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
>> +				  u8 extended)
>>   {
>>   	int rc = 0;
>>   	if (__acpi_os_prepare_sleep)
>> -		rc = __acpi_os_prepare_sleep(sleep_state,
>> -					     pm1a_control, pm1b_control);
>> +		rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
>> +					     extended);
>>   	if (rc < 0)
>>   		return AE_ERROR;
>>   	else if (rc > 0)
>> @@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>>   	return AE_OK;
>>   }
>>
>> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>> -			       u32 pm1a_ctrl, u32 pm1b_ctrl))
>> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
>> +			       u32 val_b, bool extended))
>>   {
>>   	__acpi_os_prepare_sleep = func;
>>   }
>> diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
>> index 119d42a..36d2be1 100644
>> --- a/drivers/xen/acpi.c
>> +++ b/drivers/xen/acpi.c
>> @@ -36,7 +36,8 @@
>>   #include <asm/xen/hypervisor.h>
>>
>>   int xen_acpi_notify_hypervisor_state(u8 sleep_state,
>> -				     u32 pm1a_cnt, u32 pm1b_cnt)
>> +				     u32 pm1a_cnt, u32 pm1b_cnt,
>> +				     bool extended)
>>   {
>>   	struct xen_platform_op op = {
>>   		.cmd = XENPF_enter_acpi_sleep,
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index 709a2f2..26f9996 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device *dev,
>>   #endif	/* !CONFIG_ACPI */
>>
>>   #ifdef CONFIG_ACPI
>> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>> -			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
>> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
>> +			       u32 val_b, bool extended));
>>   #ifdef CONFIG_X86
>>   void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
>>   #else
>> @@ -488,7 +488,7 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
>>   }
>>   #endif /* CONFIG_X86 */
>>   #else
>> -#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
>> +#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
>>   #endif
>>
>>   #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
>> diff --git a/include/xen/acpi.h b/include/xen/acpi.h
>> index 68d73d0..9f7e2e6 100644
>> --- a/include/xen/acpi.h
>> +++ b/include/xen/acpi.h
>> @@ -76,7 +76,8 @@ 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);
>> +				     u32 pm1a_cnt, u32 pm1b_cnd,
>> +				     bool extended);
>>
>>   static inline void xen_acpi_sleep_register(void)
>>   {
>> --
>> 1.7.9.5
>>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter
  2013-06-28 16:03   ` Konrad Rzeszutek Wilk
@ 2013-06-28 16:15     ` Ben Guthro
  2013-06-28 16:15       ` Ben Guthro
  1 sibling, 0 replies; 31+ messages in thread
From: Ben Guthro @ 2013-06-28 16:15 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Bob Moore, linux-kernel, Rafael J . Wysocki, linux-acpi,
	Jan Beulich, xen-devel



On 06/28/2013 12:03 PM, Konrad Rzeszutek Wilk wrote:
> On Fri, Jun 28, 2013 at 09:46:22AM -0400, Ben Guthro wrote:
>> Change the function definitions of acpi_os_prepare_sleep() and
>> acpi_os_set_prepare_sleep() to pass along the new extended sleep
>> parameter.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
>> Cc: Bob Moore <robert.moore@intel.com>
>> Cc: Rafael J. Wysocki <rjw@sisk.pl>
>> Cc: linux-acpi@vger.kernel.org
>> ---
>>   arch/x86/kernel/tboot.c |    3 ++-
>>   drivers/acpi/osl.c      |   16 ++++++++--------
>>   drivers/xen/acpi.c      |    3 ++-
>>   include/linux/acpi.h    |    6 +++---
>>   include/xen/acpi.h      |    3 ++-
>
> Since they touch the Xen files, please also include
>
> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
> thought you should rebase this on top of Rafael's linux-next
> as it won't apply cleanly on top v3.10-rc7.

Actually, it does apply cleanly on top of v3.10-rc7.

However, I'll pull Rafael's linux-next, and rebase on that.

>
>
>>   5 files changed, 17 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
>> index f84fe00..d578c9c 100644
>> --- a/arch/x86/kernel/tboot.c
>> +++ b/arch/x86/kernel/tboot.c
>> @@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt *fadt)
>>   		offsetof(struct acpi_table_facs, firmware_waking_vector);
>>   }
>>
>> -static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
>> +static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
>> +		       bool extended)
>>   {
>>   	static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
>>   		/* S0,1,2: */ -1, -1, -1,
>> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
>> index e721863..0251c9b 100644
>> --- a/drivers/acpi/osl.c
>> +++ b/drivers/acpi/osl.c
>> @@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
>>   extern char line_buf[80];
>>   #endif				/*ENABLE_DEBUGGER */
>>
>> -static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
>> -				      u32 pm1b_ctrl);
>> +static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
>> +				      bool extended);
>>
>>   static acpi_osd_handler acpi_irq_handler;
>>   static void *acpi_irq_context;
>> @@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
>>   	return AE_OK;
>>   }
>>
>> -acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>> -				  u32 pm1b_control)
>> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
>> +				  u8 extended)
>>   {
>>   	int rc = 0;
>>   	if (__acpi_os_prepare_sleep)
>> -		rc = __acpi_os_prepare_sleep(sleep_state,
>> -					     pm1a_control, pm1b_control);
>> +		rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
>> +					     extended);
>>   	if (rc < 0)
>>   		return AE_ERROR;
>>   	else if (rc > 0)
>> @@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>>   	return AE_OK;
>>   }
>>
>> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>> -			       u32 pm1a_ctrl, u32 pm1b_ctrl))
>> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
>> +			       u32 val_b, bool extended))
>>   {
>>   	__acpi_os_prepare_sleep = func;
>>   }
>> diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
>> index 119d42a..36d2be1 100644
>> --- a/drivers/xen/acpi.c
>> +++ b/drivers/xen/acpi.c
>> @@ -36,7 +36,8 @@
>>   #include <asm/xen/hypervisor.h>
>>
>>   int xen_acpi_notify_hypervisor_state(u8 sleep_state,
>> -				     u32 pm1a_cnt, u32 pm1b_cnt)
>> +				     u32 pm1a_cnt, u32 pm1b_cnt,
>> +				     bool extended)
>>   {
>>   	struct xen_platform_op op = {
>>   		.cmd = XENPF_enter_acpi_sleep,
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index 709a2f2..26f9996 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device *dev,
>>   #endif	/* !CONFIG_ACPI */
>>
>>   #ifdef CONFIG_ACPI
>> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>> -			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
>> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
>> +			       u32 val_b, bool extended));
>>   #ifdef CONFIG_X86
>>   void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
>>   #else
>> @@ -488,7 +488,7 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
>>   }
>>   #endif /* CONFIG_X86 */
>>   #else
>> -#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
>> +#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
>>   #endif
>>
>>   #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
>> diff --git a/include/xen/acpi.h b/include/xen/acpi.h
>> index 68d73d0..9f7e2e6 100644
>> --- a/include/xen/acpi.h
>> +++ b/include/xen/acpi.h
>> @@ -76,7 +76,8 @@ 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);
>> +				     u32 pm1a_cnt, u32 pm1b_cnd,
>> +				     bool extended);
>>
>>   static inline void xen_acpi_sleep_register(void)
>>   {
>> --
>> 1.7.9.5
>>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems
  2013-06-28 13:46 ` Ben Guthro
                   ` (9 preceding siblings ...)
  (?)
@ 2013-07-27 14:05 ` Rafael J. Wysocki
  -1 siblings, 0 replies; 31+ messages in thread
From: Rafael J. Wysocki @ 2013-07-27 14:05 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Konrad Rzeszutek Wilk, Jan Beulich, linux-kernel, linux-acpi,
	xen-devel, Richard L Maliszewski, Gang Wei, Shane Wang,
	Bob Moore, tboot-devel

On Friday, June 28, 2013 09:46:19 AM Ben Guthro wrote:
> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
> reduced hardware sleep support, and the two changes didn't get
> synchronized: The new code doesn't call the hook function (if so
> requested). Fix this, requiring a boolean parameter to be added to the
> hook function to distinguish "extended" from "legacy" sleep.
> 
> This requires adjusting TXT, but the adjustments only go as far as
> failing the extended mode call (since, looking at the TXT interface,
> there doesn't even appear to be precautions to deal with that
> alternative interface).
> 
> The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
> v5 (reduced HW) sleep interface") on the master branch of
> git://xenbits.xen.org/xen.git.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Richard L Maliszewski <richard.l.maliszewski@intel.com>
> Cc: Gang Wei <gang.wei@intel.com>
> Cc: Shane Wang <shane.wang@intel.com>
> Cc: Bob Moore <robert.moore@intel.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: linux-acpi@vger.kernel.org
> Cc: tboot-devel@lists.sourceforge.net 
> 
> v2: Extend description to include reference to hypervisor side change
> v3: Split into multiple patches, separating subsystems
>     Remove bool parameters, in favor of u8
> v4: Remove linux/acpi.h dependencies
>     Further patch split to break out acpica from OSL
>     More bool vs u8 fixes
> v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
>     so intermediate builds of partial patch series will not fail.
> 
> Ben Guthro (5):
>   acpi: Remove need to include linux/acpi.h in common acpica code
>   acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
>   acpi: Adjust linux acpi OS functions to new extended parameter
>   x86/tboot: Fail extended mode reduced hardware sleep
>   xen/acpi: notify xen when reduced hardware sleep is available

I've just replied to [0/5] from the previous series, here:

http://marc.info/?l=linux-acpi&m=137493312722239&w=2

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v5 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems
  2013-06-28 13:46 ` Ben Guthro
                   ` (8 preceding siblings ...)
  (?)
@ 2013-07-27 14:05 ` Rafael J. Wysocki
  -1 siblings, 0 replies; 31+ messages in thread
From: Rafael J. Wysocki @ 2013-07-27 14:05 UTC (permalink / raw)
  To: Ben Guthro
  Cc: Shane Wang, Bob Moore, linux-kernel, xen-devel, linux-acpi,
	tboot-devel, Jan Beulich, Richard L Maliszewski, Gang Wei

On Friday, June 28, 2013 09:46:19 AM Ben Guthro wrote:
> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
> reduced hardware sleep support, and the two changes didn't get
> synchronized: The new code doesn't call the hook function (if so
> requested). Fix this, requiring a boolean parameter to be added to the
> hook function to distinguish "extended" from "legacy" sleep.
> 
> This requires adjusting TXT, but the adjustments only go as far as
> failing the extended mode call (since, looking at the TXT interface,
> there doesn't even appear to be precautions to deal with that
> alternative interface).
> 
> The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
> v5 (reduced HW) sleep interface") on the master branch of
> git://xenbits.xen.org/xen.git.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
> Cc: Richard L Maliszewski <richard.l.maliszewski@intel.com>
> Cc: Gang Wei <gang.wei@intel.com>
> Cc: Shane Wang <shane.wang@intel.com>
> Cc: Bob Moore <robert.moore@intel.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: linux-acpi@vger.kernel.org
> Cc: tboot-devel@lists.sourceforge.net 
> 
> v2: Extend description to include reference to hypervisor side change
> v3: Split into multiple patches, separating subsystems
>     Remove bool parameters, in favor of u8
> v4: Remove linux/acpi.h dependencies
>     Further patch split to break out acpica from OSL
>     More bool vs u8 fixes
> v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
>     so intermediate builds of partial patch series will not fail.
> 
> Ben Guthro (5):
>   acpi: Remove need to include linux/acpi.h in common acpica code
>   acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
>   acpi: Adjust linux acpi OS functions to new extended parameter
>   x86/tboot: Fail extended mode reduced hardware sleep
>   xen/acpi: notify xen when reduced hardware sleep is available

I've just replied to [0/5] from the previous series, here:

http://marc.info/?l=linux-acpi&m=137493312722239&w=2

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2013-07-27 14:05 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28 13:46 [PATCH v5 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems Ben Guthro
2013-06-28 13:46 ` Ben Guthro
2013-06-28 13:46 ` [PATCH v5 1/5] acpi: Remove need to include linux/acpi.h in common acpica code Ben Guthro
2013-06-28 13:46   ` Ben Guthro
2013-06-28 16:07   ` Konrad Rzeszutek Wilk
2013-06-28 16:07   ` Konrad Rzeszutek Wilk
2013-06-28 13:46 ` Ben Guthro
2013-06-28 13:46 ` [PATCH v5 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path Ben Guthro
2013-06-28 13:46   ` Ben Guthro
2013-06-28 16:06   ` Konrad Rzeszutek Wilk
2013-06-28 16:06   ` Konrad Rzeszutek Wilk
2013-06-28 13:46 ` [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter Ben Guthro
2013-06-28 13:46   ` Ben Guthro
2013-06-28 16:03   ` Konrad Rzeszutek Wilk
2013-06-28 16:03   ` Konrad Rzeszutek Wilk
2013-06-28 16:15     ` Ben Guthro
2013-06-28 16:15     ` Ben Guthro
2013-06-28 16:15       ` Ben Guthro
2013-06-28 13:46 ` [PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep Ben Guthro
2013-06-28 13:46   ` Ben Guthro
2013-06-28 16:05   ` Konrad Rzeszutek Wilk
2013-06-28 16:05     ` Konrad Rzeszutek Wilk
2013-06-28 16:05   ` Konrad Rzeszutek Wilk
2013-06-28 13:46 ` Ben Guthro
2013-06-28 13:46 ` [PATCH v5 5/5] xen/acpi: notify xen when reduced hardware sleep is available Ben Guthro
2013-06-28 13:46   ` Ben Guthro
2013-06-28 16:05   ` Konrad Rzeszutek Wilk
2013-06-28 16:05   ` Konrad Rzeszutek Wilk
2013-06-28 13:46 ` Ben Guthro
2013-07-27 14:05 ` [PATCH v5 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems Rafael J. Wysocki
2013-07-27 14:05 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.