public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joseph Cihula <joseph.cihula@intel.com>
To: linux-kernel@vger.kernel.org, mingo@elte.hu,
	arjan@linux.intel.com, hpa@zytor.com, andi@firstfloor.org
Cc: chrisw@sous-sol.org, jmorris@namei.org, jbeulich@novell.com,
	peterm@redhat.com, joseph.cihula@intel.com, gang.wei@intel.com,
	shane.wang@intel.com
Subject: [RFC v6][PATCH 2/4] intel_txt: Intel(R) TXT reboot/halt shutdown support
Date: Tue, 30 Jun 2009 19:31:02 -0700	[thread overview]
Message-ID: <4A4ACA66.2000706@intel.com> (raw)

Support for graceful handling of kernel reboots after an Intel(R) TXT launch.

Without this patch, attempting to reboot or halt the system will cause the
TXT hardware to lock memory upon system restart because the secrets-in-memory
flag that was set on launch was never cleared.  This will in turn cause BIOS
to execute a TXT Authenticated Code Module (ACM) that will scrub all of memory
and then unlock it.  Depending on the amount of memory in the system and its type,
this may take some time.

This patch creates a 1:1 address mapping to the tboot module and then calls back
into tboot so that it may properly and securely clean up system state and clear
the secrets-in-memory flag.  When it has completed these steps, the tboot module
will reboot or halt the system.


 arch/x86/kernel/reboot.c |    8 ++++++++
 init/main.c              |    3 +++
 2 files changed, 11 insertions(+)

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/reboot.c linus-2.6.git-0629-txt/arch/x86/kernel/reboot.c
--- linus-2.6.git-0629/arch/x86/kernel/reboot.c	2009-06-29 21:57:17.000000000 -0700
+++ linus-2.6.git-0629-txt/arch/x86/kernel/reboot.c	2009-06-30 16:00:28.000000000 -0700
@@ -24,6 +24,8 @@
 # include <asm/iommu.h>
 #endif
 
+#include <asm/tboot.h>
+
 /*
  * Power off function, if any
  */
@@ -460,6 +462,8 @@ static void native_machine_emergency_res
 	if (reboot_emergency)
 		emergency_vmx_disable_all();
 
+	tboot_shutdown(TB_SHUTDOWN_REBOOT);
+
 	/* Tell the BIOS if we want cold or warm reboot */
 	*((unsigned short *)__va(0x472)) = reboot_mode;
 
@@ -586,6 +590,8 @@ static void native_machine_halt(void)
 	/* stop other cpus and apics */
 	machine_shutdown();
 
+	tboot_shutdown(TB_SHUTDOWN_HALT);
+
 	/* stop this cpu */
 	stop_this_cpu(NULL);
 }
@@ -597,6 +603,8 @@ static void native_machine_power_off(voi
 			machine_shutdown();
 		pm_power_off();
 	}
+	/* a fallback in case there is no PM info available */
+	tboot_shutdown(TB_SHUTDOWN_HALT);
 }
 
 struct machine_ops machine_ops = {
diff -uprN -X linus-2.6.git-0629/Documentation/dontdiff linus-2.6.git-0629/init/main.c linus-2.6.git-0629-txt/init/main.c
--- linus-2.6.git-0629/init/main.c	2009-06-29 21:57:26.000000000 -0700
+++ linus-2.6.git-0629-txt/init/main.c	2009-06-29 22:23:07.000000000 -0700
@@ -73,6 +73,7 @@
 #include <asm/io.h>
 #include <asm/bugs.h>
 #include <asm/setup.h>
+#include <asm/tboot.h>
 #include <asm/sections.h>
 #include <asm/cacheflush.h>
 
@@ -715,6 +716,8 @@ asmlinkage void __init start_kernel(void
 
 	ftrace_init();
 
+	tboot_create_trampoline();
+
 	/* Do the rest non-__init'ed, we're now alive */
 	rest_init();
 }


             reply	other threads:[~2009-07-01  2:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01  2:31 Joseph Cihula [this message]
2009-08-17 15:40 ` [RFC v6][PATCH 2/4] intel_txt: Intel(R) TXT reboot/halt shutdown support Ingo Molnar
2009-08-17 15:53   ` Ingo Molnar
2009-08-20  9:33     ` Wang, Shane
2009-08-20 16:05       ` H. Peter Anvin
2009-08-20 16:10       ` Andi Kleen
2009-08-21 13:03         ` [PATCH] txt: fix the build errors on non-X86 platforms Shane Wang
2009-08-21 13:50           ` Ingo Molnar
2009-08-21 15:23             ` [PATCH] intel_txt: fix the build errors of intel_txt patch " Shane Wang
2009-08-21 16:12               ` Ingo Molnar
2009-08-21 17:23                 ` H. Peter Anvin
2009-08-24  8:20                   ` Wang, Shane
2009-08-24  8:48                     ` Ingo Molnar
2009-08-26  6:51                       ` Shane Wang

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=4A4ACA66.2000706@intel.com \
    --to=joseph.cihula@intel.com \
    --cc=andi@firstfloor.org \
    --cc=arjan@linux.intel.com \
    --cc=chrisw@sous-sol.org \
    --cc=gang.wei@intel.com \
    --cc=hpa@zytor.com \
    --cc=jbeulich@novell.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterm@redhat.com \
    --cc=shane.wang@intel.com \
    /path/to/YOUR_REPLY

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

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