RE: [RFC v6][PATCH 2/4] intel_txt: Intel(R) TXT reboot/halt shutdown support

Wang, Shane
2009-08-20T09:35:44Z

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

Hi Ingo & hpa,

I have made some change on the previous tboot patch to fix the build errors.
Please comment.

Thanks.
Shane

Ingo Molnar wrote:
> * Ingo Molnar <mingo@elte.hu> wrote:
>
>>> + tboot_create_trampoline();
>>> +
>>> /* Do the rest non-__init'ed, we're now alive */
>>> rest_init();
>>> }
>>
>> hm, this breaks the kernel build on every non-x86 architecture -
>> none of which has asm/tboot.h.
>
> also, tboot modifies kernel/cpu.c (and that too breaks the build) -
> why? I've excluded x86/txt from tip:master for now.
>
> Ingo

[-- Attachment #2: tboot_fix.patch --]
[-- Type: application/octet-stream, Size: 2319 bytes --]

diff -r 04f249f00303 drivers/acpi/acpica/hwsleep.c
--- a/drivers/acpi/acpica/hwsleep.c Tue Aug 18 12:06:57 2009 -0700
+++ b/drivers/acpi/acpica/hwsleep.c Wed Aug 19 15:23:44 2009 -0700
@@ -45,7 +45,12 @@
#include <acpi/acpi.h>
#include "accommon.h"
#include "actables.h"
+
+#ifdef CONFIG_X86
#include <asm/tboot.h>
+#else
+#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) do { } while (0)
+#endif

#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwsleep")
diff -r 04f249f00303 drivers/pci/dmar.c
--- a/drivers/pci/dmar.c Tue Aug 18 12:06:57 2009 -0700
+++ b/drivers/pci/dmar.c Wed Aug 19 15:23:44 2009 -0700
@@ -33,7 +33,12 @@
#include <linux/timer.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
+
+#ifdef CONFIG_X86
#include <asm/tboot.h>
+#else
+#define tboot_get_dmar_table(x) (x)
+#endif

#undef PREFIX
#define PREFIX "DMAR:"
diff -r 04f249f00303 drivers/pci/intel-iommu.c
--- a/drivers/pci/intel-iommu.c Tue Aug 18 12:06:57 2009 -0700
+++ b/drivers/pci/intel-iommu.c Wed Aug 19 15:23:44 2009 -0700
@@ -38,9 +38,14 @@
#include <linux/intel-iommu.h>
#include <linux/sysdev.h>
#include <asm/cacheflush.h>
-#include <asm/tboot.h>
#include <asm/iommu.h>
#include "pci.h"
+
+#ifdef CONFIG_X86
+#include <asm/tboot.h>
+#else
+#define tboot_force_iommu() 0
+#endif

#define ROOT_SIZE VTD_PAGE_SIZE
#define CONTEXT_SIZE VTD_PAGE_SIZE
diff -r 04f249f00303 init/main.c
--- a/init/main.c Tue Aug 18 12:06:57 2009 -0700
+++ b/init/main.c Wed Aug 19 15:23:44 2009 -0700
@@ -73,13 +73,19 @@
#include <asm/io.h>
#include <asm/bugs.h>
#include <asm/setup.h>
-#include <asm/tboot.h>
#include <asm/sections.h>
#include <asm/cacheflush.h>

#ifdef CONFIG_X86_LOCAL_APIC
#include <asm/smp.h>
#endif
+
+#ifdef CONFIG_X86
+#include <asm/tboot.h>
+#else
+#define tboot_create_trampoline() do { } while (0)
+#endif
+

static int kernel_init(void *);

diff -r 04f249f00303 kernel/cpu.c
--- a/kernel/cpu.c Tue Aug 18 12:06:57 2009 -0700
+++ b/kernel/cpu.c Wed Aug 19 15:23:44 2009 -0700
@@ -14,7 +14,12 @@
#include <linux/kthread.h>
#include <linux/stop_machine.h>
#include <linux/mutex.h>
+
+#ifdef CONFIG_X86
#include <asm/tboot.h>
+#else
+#define tboot_wait_for_aps(x) 0
+#endif

#ifdef CONFIG_SMP
/* Serializes the updates to cpu_online_mask, cpu_present_mask */