public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC v6][PATCH 3/4] intel_txt: Intel(R) TXT Sx shutdown support
@ 2009-07-01  2:31 Joseph Cihula
  2009-07-02 21:29 ` Pavel Machek
  2009-07-02 23:15 ` Rafael J. Wysocki
  0 siblings, 2 replies; 5+ messages in thread
From: Joseph Cihula @ 2009-07-01  2:31 UTC (permalink / raw)
  To: linux-kernel, mingo, arjan, hpa, andi
  Cc: chrisw, jmorris, jbeulich, peterm, joseph.cihula, gang.wei,
	shane.wang

Support for graceful handling of sleep states (S3/S4/S5) after an Intel(R) TXT launch.

Without this patch, attempting to place the system in one of the ACPI sleep
states (S3/S4/S5) will cause the TXT hardware to treat this as an attack and
will cause a system reset, with memory locked.  Not only may the subsequent
memory scrub take some time, but the platform will be unable to enter the
requested power state.

This patch calls back into the tboot so that it may properly and securely clean
up system state and clear the secrets-in-memory flag, after which it will place
the system into the requested sleep state using ACPI information passed by the kernel.


 arch/x86/kernel/smpboot.c     |    2 ++
 drivers/acpi/acpica/hwsleep.c |    3 +++
 kernel/cpu.c                  |    7 ++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Shane Wang <shane.wang@intel.com>

---

diff -uprN -X linus-2.6.git-0629/Documentation/dontdiff linus-2.6.git-0629/arch/x86/kernel/smpboot.c linus-2.6.git-0629-txt/arch/x86/kernel/smpboot.c
--- linus-2.6.git-0629/arch/x86/kernel/smpboot.c	2009-06-29 21:57:17.000000000 -0700
+++ linus-2.6.git-0629-txt/arch/x86/kernel/smpboot.c	2009-06-30 16:09:10.000000000 -0700
@@ -62,6 +62,7 @@
 #include <asm/vmi.h>
 #include <asm/apic.h>
 #include <asm/setup.h>
+#include <asm/tboot.h>
 #include <asm/uv/uv.h>
 #include <linux/mc146818rtc.h>
 
@@ -1317,6 +1318,7 @@ void play_dead_common(void)
 void native_play_dead(void)
 {
 	play_dead_common();
+	tboot_shutdown(TB_SHUTDOWN_WFS);
 	wbinvd_halt();
 }
 
diff -uprN -X linus-2.6.git-0629/Documentation/dontdiff linus-2.6.git-0629/drivers/acpi/acpica/hwsleep.c linus-2.6.git-0629-txt/drivers/acpi/acpica/hwsleep.c
--- linus-2.6.git-0629/drivers/acpi/acpica/hwsleep.c	2009-06-29 21:57:18.000000000 -0700
+++ linus-2.6.git-0629-txt/drivers/acpi/acpica/hwsleep.c	2009-06-30 16:07:51.000000000 -0700
@@ -45,6 +45,7 @@
 #include <acpi/acpi.h>
 #include "accommon.h"
 #include "actables.h"
+#include <asm/tboot.h>
 
 #define _COMPONENT          ACPI_HARDWARE
 ACPI_MODULE_NAME("hwsleep")
@@ -342,6 +343,8 @@ acpi_status asmlinkage acpi_enter_sleep_
 
 	ACPI_FLUSH_CPU_CACHE();
 
+	tboot_sleep(sleep_state, pm1a_control, pm1b_control);
+
 	/* Write #2: Write both SLP_TYP + SLP_EN */
 
 	status = acpi_hw_write_pm1_control(pm1a_control, pm1b_control);
diff -uprN -X linus-2.6.git-0629/Documentation/dontdiff linus-2.6.git-0629/kernel/cpu.c linus-2.6.git-0629-txt/kernel/cpu.c
--- linus-2.6.git-0629/kernel/cpu.c	2009-06-29 21:57:26.000000000 -0700
+++ linus-2.6.git-0629-txt/kernel/cpu.c	2009-06-30 16:01:58.000000000 -0700
@@ -14,6 +14,7 @@
 #include <linux/kthread.h>
 #include <linux/stop_machine.h>
 #include <linux/mutex.h>
+#include <asm/tboot.h>
 
 #ifdef CONFIG_SMP
 /* Serializes the updates to cpu_online_mask, cpu_present_mask */
@@ -376,7 +377,7 @@ static cpumask_var_t frozen_cpus;
 
 int disable_nonboot_cpus(void)
 {
-	int cpu, first_cpu, error;
+	int cpu, first_cpu, error, num_cpus = 0;
 
 	error = stop_machine_create();
 	if (error)
@@ -391,6 +392,7 @@ int disable_nonboot_cpus(void)
 	for_each_online_cpu(cpu) {
 		if (cpu == first_cpu)
 			continue;
+		num_cpus++;
 		error = _cpu_down(cpu, 1);
 		if (!error) {
 			cpumask_set_cpu(cpu, frozen_cpus);
@@ -401,6 +403,9 @@ int disable_nonboot_cpus(void)
 			break;
 		}
 	}
+	/* ensure all CPUs have gone into wait-for-SIPI */
+	error |= tboot_wait_for_aps(num_cpus);
+
 	if (!error) {
 		BUG_ON(num_online_cpus() > 1);
 		/* Make sure the CPUs won't be enabled by someone else */


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

* Re: [RFC v6][PATCH 3/4] intel_txt: Intel(R) TXT Sx shutdown support
  2009-07-01  2:31 [RFC v6][PATCH 3/4] intel_txt: Intel(R) TXT Sx shutdown support Joseph Cihula
@ 2009-07-02 21:29 ` Pavel Machek
  2009-07-02 23:15 ` Rafael J. Wysocki
  1 sibling, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2009-07-02 21:29 UTC (permalink / raw)
  To: Joseph Cihula
  Cc: linux-kernel, mingo, arjan, hpa, andi, chrisw, jmorris, jbeulich,
	peterm, gang.wei, shane.wang, Rafael J. Wysocki

On Tue 2009-06-30 19:31:07, Joseph Cihula wrote:
> Support for graceful handling of sleep states (S3/S4/S5) after an Intel(R) TXT launch.
> 
> Without this patch, attempting to place the system in one of the ACPI sleep
> states (S3/S4/S5) will cause the TXT hardware to treat this as an attack and
> will cause a system reset, with memory locked.  Not only may the subsequent
> memory scrub take some time, but the platform will be unable to enter the
> requested power state.

I believe I asked for Documentation how s3 works with txt before. As a
suspend maintainer, I believe I deserve to know. Now you are
resubmitting the patch without ccing me and without that explanation.

> Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
> Signed-off-by: Shane Wang <shane.wang@intel.com>

NAK.
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [RFC v6][PATCH 3/4] intel_txt: Intel(R) TXT Sx shutdown support
  2009-07-01  2:31 [RFC v6][PATCH 3/4] intel_txt: Intel(R) TXT Sx shutdown support Joseph Cihula
  2009-07-02 21:29 ` Pavel Machek
@ 2009-07-02 23:15 ` Rafael J. Wysocki
  2009-07-03  6:15   ` Andi Kleen
  1 sibling, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2009-07-02 23:15 UTC (permalink / raw)
  To: joseph.cihula
  Cc: linux-kernel, mingo, arjan, hpa, andi, chrisw, jmorris, jbeulich,
	peterm, gang.wei, shane.wang

On Wednesday 01 July 2009, Joseph Cihula wrote:
> Support for graceful handling of sleep states (S3/S4/S5) after an Intel(R) TXT launch.
> 
> Without this patch, attempting to place the system in one of the ACPI sleep
> states (S3/S4/S5)

To be precise, S5 is not a sleep state.

> will cause the TXT hardware to treat this as an attack and
> will cause a system reset, with memory locked.  Not only may the subsequent
> memory scrub take some time, but the platform will be unable to enter the
> requested power state.
> 
> This patch calls back into the tboot so that it may properly and securely clean
> up system state and clear the secrets-in-memory flag, after which it will place
> the system into the requested sleep state using ACPI information passed by the kernel.

Is there any documentation describing how ACPI sleeps states are supposed to
work with the TXT hardware?

Rafael

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

* Re: [RFC v6][PATCH 3/4] intel_txt: Intel(R) TXT Sx shutdown support
  2009-07-02 23:15 ` Rafael J. Wysocki
@ 2009-07-03  6:15   ` Andi Kleen
  2009-07-04  0:11     ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2009-07-03  6:15 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: joseph.cihula, linux-kernel, mingo, arjan, hpa, andi, chrisw,
	jmorris, jbeulich, peterm, gang.wei, shane.wang

On Fri, Jul 03, 2009 at 01:15:23AM +0200, Rafael J. Wysocki wrote:
> Is there any documentation describing how ACPI sleeps states are supposed to
> work with the TXT hardware?

2.4.8.4 in http://download.intel.com/technology/security/downloads/315168.pdf

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

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

* Re: [RFC v6][PATCH 3/4] intel_txt: Intel(R) TXT Sx shutdown support
  2009-07-03  6:15   ` Andi Kleen
@ 2009-07-04  0:11     ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2009-07-04  0:11 UTC (permalink / raw)
  To: Andi Kleen
  Cc: joseph.cihula, linux-kernel, mingo, arjan, hpa, chrisw, jmorris,
	jbeulich, peterm, gang.wei, shane.wang

On Friday 03 July 2009, Andi Kleen wrote:
> On Fri, Jul 03, 2009 at 01:15:23AM +0200, Rafael J. Wysocki wrote:
> > Is there any documentation describing how ACPI sleeps states are supposed to
> > work with the TXT hardware?
> 
> 2.4.8.4 in http://download.intel.com/technology/security/downloads/315168.pdf

Thanks!

Best,
Rafael

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

end of thread, other threads:[~2009-07-04  0:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-01  2:31 [RFC v6][PATCH 3/4] intel_txt: Intel(R) TXT Sx shutdown support Joseph Cihula
2009-07-02 21:29 ` Pavel Machek
2009-07-02 23:15 ` Rafael J. Wysocki
2009-07-03  6:15   ` Andi Kleen
2009-07-04  0:11     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox