Skip to contentSkip to conversation

Xen/ACPI: support sleep state entering on hardware reduced systems

PATCH Superseded Ben Guthro 2 participants 15 messages Jul 29, 2013

Subsystems (5)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Ben Guthro

author
#0 lore raw

v7 cover Xen/ACPI: support sleep state entering on hardware reduced systems

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 new callback to be added to acpica to be called back during this reduced hardware 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 xen 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.

Cc Richard L Maliszewski <[email protected]>
Cc Gang Wei <[email protected]>
Cc Shane Wang <[email protected]>
Cc Bob Moore <[email protected]>
Cc Rafael J. Wysocki <[email protected]>

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.
v6: Rebased to linux-pm linux-next branch
Added warning in tboot early return code
Added Reviewed-by lines
v7: Add separate acpi_os_prepare_extended_sleep() interface
Remove OSL acpica changes introduced in v4

Ben Guthro (3):
x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for
extended sleep path
x86/tboot: Fail extended mode reduced hardware sleep xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c          |   12 +++++++++++
 drivers/acpi/acpica/hwesleep.c   |    9 +++++++++
 drivers/acpi/osl.c               |   24 ++++++++++++++++++++++
 drivers/xen/acpi.c               |   41 ++++++++++++++++++++++++++------------
 include/linux/acpi.h             |    7 +++++++
 include/xen/acpi.h               |    8 ++++++--
 include/xen/interface/platform.h |    7 ++++---
 7 files changed, 90 insertions(+), 18 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v7 1/3 x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for extended sleep path

Like acpi_os_prepare_sleep, register a callback for use in systems like tboot, and xen, which have system specific requirements outside of acpica. This mirrors the functionality in acpi_os_prepare_sleep(), called from acpi_hw_sleep()

---
 drivers/acpi/acpica/hwesleep.c |    9 +++++++++
 drivers/acpi/osl.c             |   24 ++++++++++++++++++++++++
 include/linux/acpi.h           |    7 +++++++
 3 files changed, 40 insertions(+)
drivers/acpi/acpica/hwesleep.c +9 -0
index 5e5f762..4140768 100644
@@ -43,6 +43,7 @@
  */
 
 #include <acpi/acpi.h>
+#include <linux/acpi.h>
 #include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
@@ -128,6 +129,14 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
 	ACPI_FLUSH_CPU_CACHE();
 
+	status = acpi_os_prepare_extended_sleep(sleep_state,
+						acpi_gbl_sleep_type_a,
+						acpi_gbl_sleep_type_b);
+	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.
 	 *
drivers/acpi/osl.c +24 -0
index 6ab2c35..a934950 100644
@@ -79,6 +79,8 @@ extern char line_buf[80];
 
 static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
 				      u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_extended_sleep)(u8 sleep_state, u32 val_a,
+				      u32 val_b);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1779,6 +1781,28 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 	__acpi_os_prepare_sleep = func;
 }
 
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
+				  u32 val_b)
+{
+	int rc = 0;
+	if (__acpi_os_prepare_extended_sleep)
+		rc = __acpi_os_prepare_extended_sleep(sleep_state,
+					     val_a, val_b);
+	if (rc < 0)
+		return AE_ERROR;
+	else if (rc > 0)
+		return AE_CTRL_SKIP;
+
+	return AE_OK;
+}
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+			       u32 val_a, u32 val_b))
+{
+	__acpi_os_prepare_extended_sleep = func;
+}
+
+
 void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context,
 			void (*func)(struct work_struct *work))
 {
include/linux/acpi.h +7 -0
index 353ba25..a5db4ae 100644
@@ -481,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 
 acpi_status acpi_os_prepare_sleep(u8 sleep_state,
 				  u32 pm1a_control, u32 pm1b_control);
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+				        u32 val_a,  u32 val_b));
+
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
+					   u32 val_a, u32 val_b);
+
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v7 1/3 x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for extended sleep path

In reply to Ben Guthro

Like acpi_os_prepare_sleep, register a callback for use in systems like tboot, and xen, which have system specific requirements outside of acpica. This mirrors the functionality in acpi_os_prepare_sleep(), called from acpi_hw_sleep()

---
 drivers/acpi/acpica/hwesleep.c |    9 +++++++++
 drivers/acpi/osl.c             |   24 ++++++++++++++++++++++++
 include/linux/acpi.h           |    7 +++++++
 3 files changed, 40 insertions(+)
drivers/acpi/acpica/hwesleep.c +9 -0
index 5e5f762..4140768 100644
@@ -43,6 +43,7 @@
  */
 
 #include <acpi/acpi.h>
+#include <linux/acpi.h>
 #include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
@@ -128,6 +129,14 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
 	ACPI_FLUSH_CPU_CACHE();
 
+	status = acpi_os_prepare_extended_sleep(sleep_state,
+						acpi_gbl_sleep_type_a,
+						acpi_gbl_sleep_type_b);
+	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.
 	 *
drivers/acpi/osl.c +24 -0
index 6ab2c35..a934950 100644
@@ -79,6 +79,8 @@ extern char line_buf[80];
 
 static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
 				      u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_extended_sleep)(u8 sleep_state, u32 val_a,
+				      u32 val_b);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1779,6 +1781,28 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 	__acpi_os_prepare_sleep = func;
 }
 
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
+				  u32 val_b)
+{
+	int rc = 0;
+	if (__acpi_os_prepare_extended_sleep)
+		rc = __acpi_os_prepare_extended_sleep(sleep_state,
+					     val_a, val_b);
+	if (rc < 0)
+		return AE_ERROR;
+	else if (rc > 0)
+		return AE_CTRL_SKIP;
+
+	return AE_OK;
+}
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+			       u32 val_a, u32 val_b))
+{
+	__acpi_os_prepare_extended_sleep = func;
+}
+
+
 void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context,
 			void (*func)(struct work_struct *work))
 {
include/linux/acpi.h +7 -0
index 353ba25..a5db4ae 100644
@@ -481,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 
 acpi_status acpi_os_prepare_sleep(u8 sleep_state,
 				  u32 pm1a_control, u32 pm1b_control);
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+				        u32 val_a,  u32 val_b));
+
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
+					   u32 val_a, u32 val_b);
+
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v7 2/3 x86/tboot: Fail extended mode reduced hardware sleep

In reply to Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/x86/kernel/tboot.c +12 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 	return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+	if (!tboot_enabled())
+		return 0;
+
+	pr_warning("tboot is not able to suspend on platforms with"
+		   " reduced hardware sleep (ACPIv5). Please contact"
+		   " [email protected] mailing list.");
+	return -1;
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
 	acpi_os_set_prepare_sleep(&tboot_sleep);
+	acpi_os_set_prepare_extended_sleep(&tboot_extended_sleep);
 	return 0;
 }
 
Signature · 9 lines
1.7.9.5


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
#4 lore raw

Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

Quoted 20 lines · Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/x86/kernel/tboot.c +0 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 	return 0;
 }

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control) · line 312

Quoted 10 lines
arch/x86/kernel/tboot.c +9 -0
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+	if (!tboot_enabled())
+		return 0;
+
+	pr_warning("tboot is not able to suspend on platforms with"
+		   " reduced hardware sleep (ACPIv5). Please contact"
+		   " [email protected] mailing list.");
+	return -1;

Please use a meaningful error code here. For example -ENODEV.

arch/x86/kernel/tboot.c static __init int tboot_late_init(void) · line 438

Quoted 12 lines
arch/x86/kernel/tboot.c +3 -0
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
 	acpi_os_set_prepare_sleep(&tboot_sleep);
+	acpi_os_set_prepare_extended_sleep(&tboot_extended_sleep);
 	return 0;
 }

Thanks,
Rafael

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author
#5 lore raw

Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

Quoted 22 lines · Rafael J. Wysocki
Quoted 21 lines · Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/x86/kernel/tboot.c +0 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 	return 0;
 }
 
Quoted 11 lines

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control) · line 312

Quoted 9 lines
arch/x86/kernel/tboot.c +9 -0
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+	if (!tboot_enabled())
+		return 0;
+
+	pr_warning("tboot is not able to suspend on platforms with"
+		   " reduced hardware sleep (ACPIv5). Please contact"
+		   " [email protected] mailing list.");
+	return -1;

Please use a meaningful error code here. For example -ENODEV.

Would AE_NOT_IMPLEMENTED be more appropriate?

include/acpi/acexcep.h:
#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)

Quoted 18 lines

arch/x86/kernel/tboot.c static __init int tboot_late_init(void) · line 438

Quoted 13 lines
arch/x86/kernel/tboot.c +3 -0
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
 	acpi_os_set_prepare_sleep(&tboot_sleep);
+	acpi_os_set_prepare_extended_sleep(&tboot_extended_sleep);
 	return 0;
 }

Thanks,
Rafael

author
#6 lore raw

Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

In reply to Rafael J. Wysocki
Quoted 22 lines · Rafael J. Wysocki
Quoted 21 lines · Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/x86/kernel/tboot.c +0 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 	return 0;
 }
 
Quoted 11 lines

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control) · line 312

Quoted 9 lines
arch/x86/kernel/tboot.c +9 -0
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+	if (!tboot_enabled())
+		return 0;
+
+	pr_warning("tboot is not able to suspend on platforms with"
+		   " reduced hardware sleep (ACPIv5). Please contact"
+		   " [email protected] mailing list.");
+	return -1;

Please use a meaningful error code here. For example -ENODEV.

Would AE_NOT_IMPLEMENTED be more appropriate?

include/acpi/acexcep.h:
#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)

Quoted 18 lines

arch/x86/kernel/tboot.c static __init int tboot_late_init(void) · line 438

Quoted 13 lines
arch/x86/kernel/tboot.c +3 -0
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
 	acpi_os_set_prepare_sleep(&tboot_sleep);
+	acpi_os_set_prepare_extended_sleep(&tboot_extended_sleep);
 	return 0;
 }

Thanks,
Rafael

#7 lore raw

Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

Quoted 36 lines · Ben Guthro
Quoted 22 lines · Rafael J. Wysocki
Quoted 21 lines · Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/x86/kernel/tboot.c +0 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 	return 0;
 }
 
Quoted 11 lines

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control) · line 312

Quoted 9 lines
arch/x86/kernel/tboot.c +9 -0
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+	if (!tboot_enabled())
+		return 0;
+
+	pr_warning("tboot is not able to suspend on platforms with"
+		   " reduced hardware sleep (ACPIv5). Please contact"
+		   " [email protected] mailing list.");
+	return -1;

Please use a meaningful error code here. For example -ENODEV.

Quoted 4 lines

Would AE_NOT_IMPLEMENTED be more appropriate?

include/acpi/acexcep.h:
#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)

This is not an ACPI error. :-)

Rafael

author
#8 lore raw

Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

Quoted 38 lines · Rafael J. Wysocki
Quoted 16 lines · Ben Guthro
Quoted 14 lines · Rafael J. Wysocki
Quoted 13 lines · Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 5 lines
Quoted 5 lines

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32

Quoted 5 lines
arch/x86/kernel/tboot.c +0 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32

pm1a_control, u32 pm1b_control)

Quoted 15 lines
Quoted 14 lines

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control) · line 312

Quoted 12 lines
arch/x86/kernel/tboot.c +9 -0
   return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+  if (!tboot_enabled())
+          return 0;
+
+  pr_warning("tboot is not able to suspend on platforms with"
+             " reduced hardware sleep (ACPIv5). Please contact"
+             " [email protected] mailing list.");
+  return -1;

Please use a meaningful error code here. For example -ENODEV.

Quoted 7 lines
Quoted 4 lines

Would AE_NOT_IMPLEMENTED be more appropriate?

include/acpi/acexcep.h:
#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)

This is not an ACPI error. :-)

Good point.
-ENODEV it is, then.

I'll respin tomorrow morning, to allow for anyone else who wishes to comment on the series.

Thanks for the review

Ben

Quoted 5 lines

Rafael

Quoted 11 lines

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
tboot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tboot-devel

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

_______________________________________________
tboot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tboot-devel

author
#9 lore raw

Re: [tboot-devel] [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

In reply to Rafael J. Wysocki
Quoted 38 lines · Rafael J. Wysocki
Quoted 16 lines · Ben Guthro
Quoted 14 lines · Rafael J. Wysocki
Quoted 13 lines · Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 5 lines
Quoted 5 lines

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32

Quoted 5 lines
arch/x86/kernel/tboot.c +0 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32

pm1a_control, u32 pm1b_control)

Quoted 15 lines
Quoted 14 lines

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control) · line 312

Quoted 12 lines
arch/x86/kernel/tboot.c +9 -0
   return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+  if (!tboot_enabled())
+          return 0;
+
+  pr_warning("tboot is not able to suspend on platforms with"
+             " reduced hardware sleep (ACPIv5). Please contact"
+             " [email protected] mailing list.");
+  return -1;

Please use a meaningful error code here. For example -ENODEV.

Quoted 7 lines
Quoted 4 lines

Would AE_NOT_IMPLEMENTED be more appropriate?

include/acpi/acexcep.h:
#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)

This is not an ACPI error. :-)

Good point.
-ENODEV it is, then.

I'll respin tomorrow morning, to allow for anyone else who wishes to comment on the series.

Thanks for the review

Ben

Quoted 5 lines

Rafael

Quoted 11 lines

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
tboot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tboot-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#10 lore raw

Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

In reply to Ben Guthro
Quoted 36 lines · Ben Guthro
Quoted 22 lines · Rafael J. Wysocki
Quoted 21 lines · Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/x86/kernel/tboot.c +0 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 	return 0;
 }
 
Quoted 11 lines

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control) · line 312

Quoted 9 lines
arch/x86/kernel/tboot.c +9 -0
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+	if (!tboot_enabled())
+		return 0;
+
+	pr_warning("tboot is not able to suspend on platforms with"
+		   " reduced hardware sleep (ACPIv5). Please contact"
+		   " [email protected] mailing list.");
+	return -1;

Please use a meaningful error code here. For example -ENODEV.

Quoted 4 lines

Would AE_NOT_IMPLEMENTED be more appropriate?

include/acpi/acexcep.h:
#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)

This is not an ACPI error. :-)

Rafael

#11 lore raw

Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

In reply to Ben Guthro
Quoted 20 lines · Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/x86/kernel/tboot.c +0 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 	return 0;
 }

arch/x86/kernel/tboot.c static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control) · line 312

Quoted 10 lines
arch/x86/kernel/tboot.c +9 -0
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+	if (!tboot_enabled())
+		return 0;
+
+	pr_warning("tboot is not able to suspend on platforms with"
+		   " reduced hardware sleep (ACPIv5). Please contact"
+		   " [email protected] mailing list.");
+	return -1;

Please use a meaningful error code here. For example -ENODEV.

arch/x86/kernel/tboot.c static __init int tboot_late_init(void) · line 438

Quoted 12 lines
arch/x86/kernel/tboot.c +3 -0
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
 	acpi_os_set_prepare_sleep(&tboot_sleep);
+	acpi_os_set_prepare_extended_sleep(&tboot_extended_sleep);
 	return 0;
 }

Thanks,
Rafael

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author
#12 lore raw

PATCH v7 2/3 x86/tboot: Fail extended mode reduced hardware sleep

In reply to Ben Guthro

Register for the extended sleep callback from acpi. As tboot currently does not support the reduced hardware sleep interface, fail this extended call.

---
 arch/x86/kernel/tboot.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/x86/kernel/tboot.c +12 -0
index addf7b5..760f431 100644
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 	return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+	if (!tboot_enabled())
+		return 0;
+
+	pr_warning("tboot is not able to suspend on platforms with"
+		   " reduced hardware sleep (ACPIv5). Please contact"
+		   " [email protected] mailing list.");
+	return -1;
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
 	acpi_os_set_prepare_sleep(&tboot_sleep);
+	acpi_os_set_prepare_extended_sleep(&tboot_extended_sleep);
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
author
#13 lore raw

PATCH v7 3/3 xen/acpi: notify xen when reduced hardware sleep is available

In reply to Ben Guthro

Make use of acpi_os_prepare_extended_sleep callback to notify xen to make use of the reduced hardware sleep functionality

The xen 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.

---
 drivers/xen/acpi.c               |   41 ++++++++++++++++++++++++++------------
 include/xen/acpi.h               |    8 ++++++--
 include/xen/interface/platform.h |    7 ++++---
 3 files changed, 38 insertions(+), 18 deletions(-)
drivers/xen/acpi.c +28 -13
index 119d42a..90307c0 100644
@@ -35,28 +35,43 @@
 #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)
+static 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 [email protected]  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 [email protected] - Thank you.\n", \
+		 bits, val_a, val_b))
 		return -1;
-	}
 
 	HYPERVISOR_dom0_op(&op);
 	return 1;
 }
+
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
+				     u32 pm1a_cnt, u32 pm1b_cnt)
+{
+	return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt,
+						pm1b_cnt, false);
+}
+
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+				     u32 val_a, u32 val_b)
+{
+	return xen_acpi_notify_hypervisor_state(sleep_state, val_a,
+						val_b, true);
+}
include/xen/acpi.h +6 -2
index 46aa3d1..4ddd7dc 100644
@@ -75,8 +75,10 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 	return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
 				     u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+				     u32 val_a, u32 val_b);
 
 static inline int xen_acpi_suspend_lowlevel(void)
 {
@@ -93,7 +95,9 @@ static inline void xen_acpi_sleep_register(void)
 {
 	if (xen_initial_domain()) {
 		acpi_os_set_prepare_sleep(
-			&xen_acpi_notify_hypervisor_state);
+			&xen_acpi_notify_hypervisor_sleep);
+		acpi_os_set_prepare_extended_sleep(
+			&xen_acpi_notify_hypervisor_extended_sleep);
 
 		acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
 	}
include/xen/interface/platform.h +4 -3
index c57d5f6..f1331e3 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
author
#14 lore raw

PATCH v7 3/3 xen/acpi: notify xen when reduced hardware sleep is available

In reply to Ben Guthro

Make use of acpi_os_prepare_extended_sleep callback to notify xen to make use of the reduced hardware sleep functionality

The xen 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.

---
 drivers/xen/acpi.c               |   41 ++++++++++++++++++++++++++------------
 include/xen/acpi.h               |    8 ++++++--
 include/xen/interface/platform.h |    7 ++++---
 3 files changed, 38 insertions(+), 18 deletions(-)
drivers/xen/acpi.c +28 -13
index 119d42a..90307c0 100644
@@ -35,28 +35,43 @@
 #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)
+static 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 [email protected]  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 [email protected] - Thank you.\n", \
+		 bits, val_a, val_b))
 		return -1;
-	}
 
 	HYPERVISOR_dom0_op(&op);
 	return 1;
 }
+
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
+				     u32 pm1a_cnt, u32 pm1b_cnt)
+{
+	return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt,
+						pm1b_cnt, false);
+}
+
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+				     u32 val_a, u32 val_b)
+{
+	return xen_acpi_notify_hypervisor_state(sleep_state, val_a,
+						val_b, true);
+}
include/xen/acpi.h +6 -2
index 46aa3d1..4ddd7dc 100644
@@ -75,8 +75,10 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 	return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
 				     u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+				     u32 val_a, u32 val_b);
 
 static inline int xen_acpi_suspend_lowlevel(void)
 {
@@ -93,7 +95,9 @@ static inline void xen_acpi_sleep_register(void)
 {
 	if (xen_initial_domain()) {
 		acpi_os_set_prepare_sleep(
-			&xen_acpi_notify_hypervisor_state);
+			&xen_acpi_notify_hypervisor_sleep);
+		acpi_os_set_prepare_extended_sleep(
+			&xen_acpi_notify_hypervisor_extended_sleep);
 
 		acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
 	}
include/xen/interface/platform.h +4 -3
index c57d5f6..f1331e3 100644
@@ -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);
 
Signature · 1 line
1.7.9.5