aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/Kconfig4
-rw-r--r--arch/x86/kernel/reboot.c3
-rw-r--r--arch/x86/kernel/setup.c3
-rw-r--r--arch/x86/kernel/smpboot.c2
-rw-r--r--arch/x86/kernel/tboot.c58
-rw-r--r--drivers/acpi/acpica/hwsleep.c2
-rw-r--r--drivers/pci/dmar.c2
-rw-r--r--drivers/pci/intel-iommu.c2
-rw-r--r--include/linux/tboot.h (renamed from arch/x86/include/asm/tboot.h)57
-rw-r--r--init/main.c3
-rw-r--r--kernel/cpu.c6
-rw-r--r--security/Kconfig2
12 files changed, 70 insertions, 74 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 738bdc6b0f8b..b66f2102c35d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -178,6 +178,10 @@ config ARCH_SUPPORTS_OPTIMIZED_INLINING
178config ARCH_SUPPORTS_DEBUG_PAGEALLOC 178config ARCH_SUPPORTS_DEBUG_PAGEALLOC
179 def_bool y 179 def_bool y
180 180
181config HAVE_INTEL_TXT
182 def_bool y
183 depends on EXPERIMENTAL && DMAR && ACPI
184
181# Use the generic interrupt handling code in kernel/irq/: 185# Use the generic interrupt handling code in kernel/irq/:
182config GENERIC_HARDIRQS 186config GENERIC_HARDIRQS
183 bool 187 bool
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 9de01c5d9794..18ce5c04242a 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -3,6 +3,7 @@
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/pm.h> 4#include <linux/pm.h>
5#include <linux/efi.h> 5#include <linux/efi.h>
6#include <linux/tboot.h>
6#include <acpi/reboot.h> 7#include <acpi/reboot.h>
7#include <asm/io.h> 8#include <asm/io.h>
8#include <asm/apic.h> 9#include <asm/apic.h>
@@ -24,8 +25,6 @@
24# include <asm/iommu.h> 25# include <asm/iommu.h>
25#endif 26#endif
26 27
27#include <asm/tboot.h>
28
29/* 28/*
30 * Power off function, if any 29 * Power off function, if any
31 */ 30 */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 80d6e9e32483..6ce0d6f38f7f 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -66,6 +66,7 @@
66 66
67#include <linux/percpu.h> 67#include <linux/percpu.h>
68#include <linux/crash_dump.h> 68#include <linux/crash_dump.h>
69#include <linux/tboot.h>
69 70
70#include <video/edid.h> 71#include <video/edid.h>
71 72
@@ -145,8 +146,6 @@ struct boot_params __initdata boot_params;
145struct boot_params boot_params; 146struct boot_params boot_params;
146#endif 147#endif
147 148
148#include <asm/tboot.h>
149
150/* 149/*
151 * Machine setup.. 150 * Machine setup..
152 */ 151 */
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 61cc40887c48..7d9d8eea20a0 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -47,6 +47,7 @@
47#include <linux/bootmem.h> 47#include <linux/bootmem.h>
48#include <linux/err.h> 48#include <linux/err.h>
49#include <linux/nmi.h> 49#include <linux/nmi.h>
50#include <linux/tboot.h>
50 51
51#include <asm/acpi.h> 52#include <asm/acpi.h>
52#include <asm/desc.h> 53#include <asm/desc.h>
@@ -62,7 +63,6 @@
62#include <asm/vmi.h> 63#include <asm/vmi.h>
63#include <asm/apic.h> 64#include <asm/apic.h>
64#include <asm/setup.h> 65#include <asm/setup.h>
65#include <asm/tboot.h>
66#include <asm/uv/uv.h> 66#include <asm/uv/uv.h>
67#include <linux/mc146818rtc.h> 67#include <linux/mc146818rtc.h>
68 68
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index c2e760ca7b01..86c9f91b48ae 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -22,11 +22,14 @@
22#include <linux/dma_remapping.h> 22#include <linux/dma_remapping.h>
23#include <linux/init_task.h> 23#include <linux/init_task.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/delay.h>
25#include <linux/sched.h> 26#include <linux/sched.h>
26#include <linux/init.h> 27#include <linux/init.h>
27#include <linux/dmar.h> 28#include <linux/dmar.h>
29#include <linux/cpu.h>
28#include <linux/pfn.h> 30#include <linux/pfn.h>
29#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/tboot.h>
30 33
31#include <asm/trampoline.h> 34#include <asm/trampoline.h>
32#include <asm/processor.h> 35#include <asm/processor.h>
@@ -36,7 +39,6 @@
36#include <asm/fixmap.h> 39#include <asm/fixmap.h>
37#include <asm/proto.h> 40#include <asm/proto.h>
38#include <asm/setup.h> 41#include <asm/setup.h>
39#include <asm/tboot.h>
40#include <asm/e820.h> 42#include <asm/e820.h>
41#include <asm/io.h> 43#include <asm/io.h>
42 44
@@ -154,13 +156,10 @@ static int map_tboot_pages(unsigned long vaddr, unsigned long start_pfn,
154 return 0; 156 return 0;
155} 157}
156 158
157void tboot_create_trampoline(void) 159static void tboot_create_trampoline(void)
158{ 160{
159 u32 map_base, map_size; 161 u32 map_base, map_size;
160 162
161 if (!tboot_enabled())
162 return;
163
164 /* Create identity map for tboot shutdown code. */ 163 /* Create identity map for tboot shutdown code. */
165 map_base = PFN_DOWN(tboot->tboot_base); 164 map_base = PFN_DOWN(tboot->tboot_base);
166 map_size = PFN_UP(tboot->tboot_size); 165 map_size = PFN_UP(tboot->tboot_size);
@@ -295,21 +294,58 @@ void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
295 tboot_shutdown(acpi_shutdown_map[sleep_state]); 294 tboot_shutdown(acpi_shutdown_map[sleep_state]);
296} 295}
297 296
298int tboot_wait_for_aps(int num_aps) 297static atomic_t ap_wfs_count;
298
299static int tboot_wait_for_aps(int num_aps)
299{ 300{
300 unsigned long timeout; 301 unsigned long timeout;
301 302
303 timeout = AP_WAIT_TIMEOUT*HZ;
304 while (atomic_read((atomic_t *)&tboot->num_in_wfs) != num_aps &&
305 timeout) {
306 mdelay(1);
307 timeout--;
308 }
309
310 if (timeout)
311 pr_warning("tboot wait for APs timeout\n");
312
313 return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps);
314}
315
316static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb,
317 unsigned long action, void *hcpu)
318{
319 switch (action) {
320 case CPU_DYING:
321 atomic_inc(&ap_wfs_count);
322 if (num_online_cpus() == 1)
323 if (tboot_wait_for_aps(atomic_read(&ap_wfs_count)))
324 return NOTIFY_BAD;
325 break;
326 }
327 return NOTIFY_OK;
328}
329
330static struct notifier_block tboot_cpu_notifier __cpuinitdata =
331{
332 .notifier_call = tboot_cpu_callback,
333};
334
335static __init int tboot_late_init(void)
336{
302 if (!tboot_enabled()) 337 if (!tboot_enabled())
303 return 0; 338 return 0;
304 339
305 timeout = jiffies + AP_WAIT_TIMEOUT*HZ; 340 tboot_create_trampoline();
306 while (atomic_read((atomic_t *)&tboot->num_in_wfs) != num_aps &&
307 time_before(jiffies, timeout))
308 cpu_relax();
309 341
310 return time_before(jiffies, timeout) ? 0 : 1; 342 atomic_set(&ap_wfs_count, 0);
343 register_hotcpu_notifier(&tboot_cpu_notifier);
344 return 0;
311} 345}
312 346
347late_initcall(tboot_late_init);
348
313/* 349/*
314 * TXT configuration registers (offsets from TXT_{PUB, PRIV}_CONFIG_REGS_BASE) 350 * TXT configuration registers (offsets from TXT_{PUB, PRIV}_CONFIG_REGS_BASE)
315 */ 351 */
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 8c01dd3724e0..cc22f9a585b0 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -45,7 +45,7 @@
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include "accommon.h" 46#include "accommon.h"
47#include "actables.h" 47#include "actables.h"
48#include <asm/tboot.h> 48#include <linux/tboot.h>
49 49
50#define _COMPONENT ACPI_HARDWARE 50#define _COMPONENT ACPI_HARDWARE
51ACPI_MODULE_NAME("hwsleep") 51ACPI_MODULE_NAME("hwsleep")
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index 0cbc5fd26c3c..ab99783dccec 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -33,7 +33,7 @@
33#include <linux/timer.h> 33#include <linux/timer.h>
34#include <linux/irq.h> 34#include <linux/irq.h>
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <asm/tboot.h> 36#include <linux/tboot.h>
37 37
38#undef PREFIX 38#undef PREFIX
39#define PREFIX "DMAR:" 39#define PREFIX "DMAR:"
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 2dc72a6d7412..833509b53527 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -37,8 +37,8 @@
37#include <linux/iommu.h> 37#include <linux/iommu.h>
38#include <linux/intel-iommu.h> 38#include <linux/intel-iommu.h>
39#include <linux/sysdev.h> 39#include <linux/sysdev.h>
40#include <linux/tboot.h>
40#include <asm/cacheflush.h> 41#include <asm/cacheflush.h>
41#include <asm/tboot.h>
42#include <asm/iommu.h> 42#include <asm/iommu.h>
43#include "pci.h" 43#include "pci.h"
44 44
diff --git a/arch/x86/include/asm/tboot.h b/include/linux/tboot.h
index b13929d4e5f4..bf2a0c748878 100644
--- a/arch/x86/include/asm/tboot.h
+++ b/include/linux/tboot.h
@@ -20,10 +20,8 @@
20 * 20 *
21 */ 21 */
22 22
23#ifndef _ASM_TBOOT_H 23#ifndef _LINUX_TBOOT_H
24#define _ASM_TBOOT_H 24#define _LINUX_TBOOT_H
25
26#include <acpi/acpi.h>
27 25
28/* these must have the values from 0-5 in this order */ 26/* these must have the values from 0-5 in this order */
29enum { 27enum {
@@ -36,7 +34,7 @@ enum {
36}; 34};
37 35
38#ifdef CONFIG_INTEL_TXT 36#ifdef CONFIG_INTEL_TXT
39 37#include <acpi/acpi.h>
40/* used to communicate between tboot and the launched kernel */ 38/* used to communicate between tboot and the launched kernel */
41 39
42#define TB_KEY_SIZE 64 /* 512 bits */ 40#define TB_KEY_SIZE 64 /* 512 bits */
@@ -144,54 +142,21 @@ static inline int tboot_enabled(void)
144} 142}
145 143
146extern void tboot_probe(void); 144extern void tboot_probe(void);
147extern void tboot_create_trampoline(void);
148extern void tboot_shutdown(u32 shutdown_type); 145extern void tboot_shutdown(u32 shutdown_type);
149extern void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control); 146extern void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control);
150extern int tboot_wait_for_aps(int num_aps);
151extern struct acpi_table_header *tboot_get_dmar_table( 147extern struct acpi_table_header *tboot_get_dmar_table(
152 struct acpi_table_header *dmar_tbl); 148 struct acpi_table_header *dmar_tbl);
153extern int tboot_force_iommu(void); 149extern int tboot_force_iommu(void);
154 150
155#else /* CONFIG_INTEL_TXT */ 151#else
156
157static inline int tboot_enabled(void)
158{
159 return 0;
160}
161
162static inline void tboot_probe(void)
163{
164}
165
166static inline void tboot_create_trampoline(void)
167{
168}
169
170static inline void tboot_shutdown(u32 shutdown_type)
171{
172}
173
174static inline void tboot_sleep(u8 sleep_state, u32 pm1a_control,
175 u32 pm1b_control)
176{
177}
178
179static inline int tboot_wait_for_aps(int num_aps)
180{
181 return 0;
182}
183 152
184static inline struct acpi_table_header *tboot_get_dmar_table( 153#define tboot_probe() do { } while (0)
185 struct acpi_table_header *dmar_tbl) 154#define tboot_shutdown(shutdown_type) do { } while (0)
186{ 155#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
187 return dmar_tbl; 156 do { } while (0)
188} 157#define tboot_get_dmar_table(dmar_tbl) (dmar_tbl)
189 158#define tboot_force_iommu() 0
190static inline int tboot_force_iommu(void)
191{
192 return 0;
193}
194 159
195#endif /* !CONFIG_INTEL_TXT */ 160#endif /* !CONFIG_INTEL_TXT */
196 161
197#endif /* _ASM_TBOOT_H */ 162#endif /* _LINUX_TBOOT_H */
diff --git a/init/main.c b/init/main.c
index 56ada27c4f47..2c5ade79eb81 100644
--- a/init/main.c
+++ b/init/main.c
@@ -73,7 +73,6 @@
73#include <asm/io.h> 73#include <asm/io.h>
74#include <asm/bugs.h> 74#include <asm/bugs.h>
75#include <asm/setup.h> 75#include <asm/setup.h>
76#include <asm/tboot.h>
77#include <asm/sections.h> 76#include <asm/sections.h>
78#include <asm/cacheflush.h> 77#include <asm/cacheflush.h>
79 78
@@ -716,8 +715,6 @@ asmlinkage void __init start_kernel(void)
716 715
717 ftrace_init(); 716 ftrace_init();
718 717
719 tboot_create_trampoline();
720
721 /* Do the rest non-__init'ed, we're now alive */ 718 /* Do the rest non-__init'ed, we're now alive */
722 rest_init(); 719 rest_init();
723} 720}
diff --git a/kernel/cpu.c b/kernel/cpu.c
index ff071e022a85..67a60076dd7e 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -14,7 +14,6 @@
14#include <linux/kthread.h> 14#include <linux/kthread.h>
15#include <linux/stop_machine.h> 15#include <linux/stop_machine.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <asm/tboot.h>
18 17
19#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
20/* Serializes the updates to cpu_online_mask, cpu_present_mask */ 19/* Serializes the updates to cpu_online_mask, cpu_present_mask */
@@ -377,7 +376,7 @@ static cpumask_var_t frozen_cpus;
377 376
378int disable_nonboot_cpus(void) 377int disable_nonboot_cpus(void)
379{ 378{
380 int cpu, first_cpu, error, num_cpus = 0; 379 int cpu, first_cpu, error;
381 380
382 error = stop_machine_create(); 381 error = stop_machine_create();
383 if (error) 382 if (error)
@@ -392,7 +391,6 @@ int disable_nonboot_cpus(void)
392 for_each_online_cpu(cpu) { 391 for_each_online_cpu(cpu) {
393 if (cpu == first_cpu) 392 if (cpu == first_cpu)
394 continue; 393 continue;
395 num_cpus++;
396 error = _cpu_down(cpu, 1); 394 error = _cpu_down(cpu, 1);
397 if (!error) { 395 if (!error) {
398 cpumask_set_cpu(cpu, frozen_cpus); 396 cpumask_set_cpu(cpu, frozen_cpus);
@@ -403,8 +401,6 @@ int disable_nonboot_cpus(void)
403 break; 401 break;
404 } 402 }
405 } 403 }
406 /* ensure all CPUs have gone into wait-for-SIPI */
407 error |= tboot_wait_for_aps(num_cpus);
408 404
409 if (!error) { 405 if (!error) {
410 BUG_ON(num_online_cpus() > 1); 406 BUG_ON(num_online_cpus() > 1);
diff --git a/security/Kconfig b/security/Kconfig
index 6631774672c1..5721847a7a62 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -115,7 +115,7 @@ config SECURITY_ROOTPLUG
115 115
116config INTEL_TXT 116config INTEL_TXT
117 bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)" 117 bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
118 depends on EXPERIMENTAL && X86 && DMAR && ACPI 118 depends on HAVE_INTEL_TXT
119 help 119 help
120 This option enables support for booting the kernel with the 120 This option enables support for booting the kernel with the
121 Trusted Boot (tboot) module. This will utilize 121 Trusted Boot (tboot) module. This will utilize