public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] intel_txt: fix section warning messages from tboot when "allyesconfig" is set on i386
@ 2010-03-04  5:30 Wang, Shane
  2010-03-04  7:41 ` [PATCH v2] " Wang, Shane
  0 siblings, 1 reply; 3+ messages in thread
From: Wang, Shane @ 2010-03-04  5:30 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org; +Cc: H. Peter Anvin, Ingo Molnar, Cihula, Joseph

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

This patch is to fix the warning messages related to tboot when "allyesconfig" is set on i386.

Signed-off-by: Shane Wang <shane.wang@intel.com>

 arch/x86/kernel/tboot.c |   90 ++++++++++++++++----------------------
 1 file changed, 40 insertions(+), 50 deletions(-)

diff -r d5d64753146c arch/x86/kernel/tboot.c
--- a/arch/x86/kernel/tboot.c	Mon Mar 01 09:47:50 2010 -0500
+++ b/arch/x86/kernel/tboot.c	Tue Mar 02 05:23:32 2010 -0500
@@ -55,6 +55,44 @@ struct tboot *tboot __read_mostly;
 
 static u8 tboot_uuid[16] __initdata = TBOOT_UUID;
 
+#ifdef CONFIG_ACPI_SLEEP
+
+static void add_mac_region(phys_addr_t start, unsigned long size)
+{
+	struct tboot_mac_region *mr;
+	phys_addr_t end = start + size;
+
+	if (start && size) {
+		mr = &tboot->mac_regions[tboot->num_mac_regions++];
+		mr->start = round_down(start, PAGE_SIZE);
+		mr->size  = round_up(end, PAGE_SIZE) - mr->start;
+	}
+}
+
+static void __init tboot_setup_sleep(void)
+{
+	tboot->num_mac_regions = 0;
+
+	/* S3 resume code */
+	add_mac_region(acpi_wakeup_address, WAKEUP_SIZE);
+
+#ifdef CONFIG_X86_TRAMPOLINE
+	/* AP trampoline code */
+	add_mac_region(virt_to_phys(trampoline_base), TRAMPOLINE_SIZE);
+#endif
+
+	/* kernel code + data + bss */
+	add_mac_region(virt_to_phys(_text), _end - _text);
+
+	tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
+}
+
+#else /* no CONFIG_ACPI_SLEEP */
+
+static void tboot_setup_sleep(void)	{}
+
+#endif
+
 void __init tboot_probe(void)
 {
 	/* Look for valid page-aligned address for shared page. */
@@ -98,6 +136,8 @@ void __init tboot_probe(void)
 	pr_debug("shutdown_entry: 0x%x\n", tboot->shutdown_entry);
 	pr_debug("tboot_base: 0x%08x\n", tboot->tboot_base);
 	pr_debug("tboot_size: 0x%x\n", tboot->tboot_size);
+
+	tboot_setup_sleep();
 }
 
 static pgd_t *tboot_pg_dir;
@@ -168,51 +208,6 @@ static void tboot_create_trampoline(void
 		      map_base, map_size);
 }
 
-#ifdef CONFIG_ACPI_SLEEP
-
-static void add_mac_region(phys_addr_t start, unsigned long size)
-{
-	struct tboot_mac_region *mr;
-	phys_addr_t end = start + size;
-
-	if (start && size) {
-		mr = &tboot->mac_regions[tboot->num_mac_regions++];
-		mr->start = round_down(start, PAGE_SIZE);
-		mr->size  = round_up(end, PAGE_SIZE) - mr->start;
-	}
-}
-
-static int tboot_setup_sleep(void)
-{
-	tboot->num_mac_regions = 0;
-
-	/* S3 resume code */
-	add_mac_region(acpi_wakeup_address, WAKEUP_SIZE);
-
-#ifdef CONFIG_X86_TRAMPOLINE
-	/* AP trampoline code */
-	add_mac_region(virt_to_phys(trampoline_base), TRAMPOLINE_SIZE);
-#endif
-
-	/* kernel code + data + bss */
-	add_mac_region(virt_to_phys(_text), _end - _text);
-
-	tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
-
-	return 0;
-}
-
-#else /* no CONFIG_ACPI_SLEEP */
-
-static int tboot_setup_sleep(void)
-{
-	/* S3 shutdown requested, but S3 not supported by the kernel... */
-	BUG();
-	return -1;
-}
-
-#endif
-
 void tboot_shutdown(u32 shutdown_type)
 {
 	void (*shutdown)(void);
@@ -227,11 +222,6 @@ void tboot_shutdown(u32 shutdown_type)
 	 */
 	if (!tboot_pg_dir)
 		return;
-
-	/* if this is S3 then set regions to MAC */
-	if (shutdown_type == TB_SHUTDOWN_S3)
-		if (tboot_setup_sleep())
-			return;
 
 	tboot->shutdown_type = shutdown_type;
 

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

This patch is to fix the warning messages related to tboot when "allyesconfig" is set on i386.

Signed-off-by: Shane Wang <shane.wang@intel.com>

diff -r d5d64753146c arch/x86/kernel/tboot.c
--- a/arch/x86/kernel/tboot.c	Mon Mar 01 09:47:50 2010 -0500
+++ b/arch/x86/kernel/tboot.c	Tue Mar 02 05:23:32 2010 -0500
@@ -55,6 +55,44 @@ struct tboot *tboot __read_mostly;
 
 static u8 tboot_uuid[16] __initdata = TBOOT_UUID;
 
+#ifdef CONFIG_ACPI_SLEEP
+
+static void add_mac_region(phys_addr_t start, unsigned long size)
+{
+	struct tboot_mac_region *mr;
+	phys_addr_t end = start + size;
+
+	if (start && size) {
+		mr = &tboot->mac_regions[tboot->num_mac_regions++];
+		mr->start = round_down(start, PAGE_SIZE);
+		mr->size  = round_up(end, PAGE_SIZE) - mr->start;
+	}
+}
+
+static void __init tboot_setup_sleep(void)
+{
+	tboot->num_mac_regions = 0;
+
+	/* S3 resume code */
+	add_mac_region(acpi_wakeup_address, WAKEUP_SIZE);
+
+#ifdef CONFIG_X86_TRAMPOLINE
+	/* AP trampoline code */
+	add_mac_region(virt_to_phys(trampoline_base), TRAMPOLINE_SIZE);
+#endif
+
+	/* kernel code + data + bss */
+	add_mac_region(virt_to_phys(_text), _end - _text);
+
+	tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
+}
+
+#else /* no CONFIG_ACPI_SLEEP */
+
+static void tboot_setup_sleep(void)	{}
+
+#endif
+
 void __init tboot_probe(void)
 {
 	/* Look for valid page-aligned address for shared page. */
@@ -98,6 +136,8 @@ void __init tboot_probe(void)
 	pr_debug("shutdown_entry: 0x%x\n", tboot->shutdown_entry);
 	pr_debug("tboot_base: 0x%08x\n", tboot->tboot_base);
 	pr_debug("tboot_size: 0x%x\n", tboot->tboot_size);
+
+	tboot_setup_sleep();
 }
 
 static pgd_t *tboot_pg_dir;
@@ -168,51 +208,6 @@ static void tboot_create_trampoline(void
 		      map_base, map_size);
 }
 
-#ifdef CONFIG_ACPI_SLEEP
-
-static void add_mac_region(phys_addr_t start, unsigned long size)
-{
-	struct tboot_mac_region *mr;
-	phys_addr_t end = start + size;
-
-	if (start && size) {
-		mr = &tboot->mac_regions[tboot->num_mac_regions++];
-		mr->start = round_down(start, PAGE_SIZE);
-		mr->size  = round_up(end, PAGE_SIZE) - mr->start;
-	}
-}
-
-static int tboot_setup_sleep(void)
-{
-	tboot->num_mac_regions = 0;
-
-	/* S3 resume code */
-	add_mac_region(acpi_wakeup_address, WAKEUP_SIZE);
-
-#ifdef CONFIG_X86_TRAMPOLINE
-	/* AP trampoline code */
-	add_mac_region(virt_to_phys(trampoline_base), TRAMPOLINE_SIZE);
-#endif
-
-	/* kernel code + data + bss */
-	add_mac_region(virt_to_phys(_text), _end - _text);
-
-	tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
-
-	return 0;
-}
-
-#else /* no CONFIG_ACPI_SLEEP */
-
-static int tboot_setup_sleep(void)
-{
-	/* S3 shutdown requested, but S3 not supported by the kernel... */
-	BUG();
-	return -1;
-}
-
-#endif
-
 void tboot_shutdown(u32 shutdown_type)
 {
 	void (*shutdown)(void);
@@ -227,11 +222,6 @@ void tboot_shutdown(u32 shutdown_type)
 	 */
 	if (!tboot_pg_dir)
 		return;
-
-	/* if this is S3 then set regions to MAC */
-	if (shutdown_type == TB_SHUTDOWN_S3)
-		if (tboot_setup_sleep())
-			return;
 
 	tboot->shutdown_type = shutdown_type;
 

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

* [PATCH v2] intel_txt: fix section warning messages from tboot when "allyesconfig" is set on i386
  2010-03-04  5:30 [PATCH] intel_txt: fix section warning messages from tboot when "allyesconfig" is set on i386 Wang, Shane
@ 2010-03-04  7:41 ` Wang, Shane
  2010-03-15 19:59   ` H. Peter Anvin
  0 siblings, 1 reply; 3+ messages in thread
From: Wang, Shane @ 2010-03-04  7:41 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org; +Cc: H. Peter Anvin, Ingo Molnar, Cihula, Joseph

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

<Please use this one. 
I put tboot_probe() below tboot_setup_sleep() in this patch
instead of put tboot_setup_sleep() above tboot_probe() in the previous patch.
It looks like more reasonable.>

This patch is to fix the warning messages related to tboot when "allyesconfig" is set on i386.

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

 arch/x86/kernel/tboot.c |  108 +++++++++++++++++---------------------
 1 file changed, 49 insertions(+), 59 deletions(-)

diff -r d5d64753146c arch/x86/kernel/tboot.c
--- a/arch/x86/kernel/tboot.c	Mon Mar 01 09:47:50 2010 -0500
+++ b/arch/x86/kernel/tboot.c	Thu Mar 04 09:36:37 2010 -0500
@@ -54,51 +54,6 @@ struct tboot *tboot __read_mostly;
 #define pr_fmt(fmt)	"tboot: " fmt
 
 static u8 tboot_uuid[16] __initdata = TBOOT_UUID;
-
-void __init tboot_probe(void)
-{
-	/* Look for valid page-aligned address for shared page. */
-	if (!boot_params.tboot_addr)
-		return;
-	/*
-	 * also verify that it is mapped as we expect it before calling
-	 * set_fixmap(), to reduce chance of garbage value causing crash
-	 */
-	if (!e820_any_mapped(boot_params.tboot_addr,
-			     boot_params.tboot_addr, E820_RESERVED)) {
-		pr_warning("non-0 tboot_addr but it is not of type E820_RESERVED\n");
-		return;
-	}
-
-	/* only a natively booted kernel should be using TXT */
-	if (paravirt_enabled()) {
-		pr_warning("non-0 tboot_addr but pv_ops is enabled\n");
-		return;
-	}
-
-	/* Map and check for tboot UUID. */
-	set_fixmap(FIX_TBOOT_BASE, boot_params.tboot_addr);
-	tboot = (struct tboot *)fix_to_virt(FIX_TBOOT_BASE);
-	if (memcmp(&tboot_uuid, &tboot->uuid, sizeof(tboot->uuid))) {
-		pr_warning("tboot at 0x%llx is invalid\n",
-			   boot_params.tboot_addr);
-		tboot = NULL;
-		return;
-	}
-	if (tboot->version < 5) {
-		pr_warning("tboot version is invalid: %u\n", tboot->version);
-		tboot = NULL;
-		return;
-	}
-
-	pr_info("found shared page at phys addr 0x%llx:\n",
-		boot_params.tboot_addr);
-	pr_debug("version: %d\n", tboot->version);
-	pr_debug("log_addr: 0x%08x\n", tboot->log_addr);
-	pr_debug("shutdown_entry: 0x%x\n", tboot->shutdown_entry);
-	pr_debug("tboot_base: 0x%08x\n", tboot->tboot_base);
-	pr_debug("tboot_size: 0x%x\n", tboot->tboot_size);
-}
 
 static pgd_t *tboot_pg_dir;
 static struct mm_struct tboot_mm = {
@@ -182,7 +137,7 @@ static void add_mac_region(phys_addr_t s
 	}
 }
 
-static int tboot_setup_sleep(void)
+static void __init tboot_setup_sleep(void)
 {
 	tboot->num_mac_regions = 0;
 
@@ -198,20 +153,60 @@ static int tboot_setup_sleep(void)
 	add_mac_region(virt_to_phys(_text), _end - _text);
 
 	tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
-
-	return 0;
 }
 
 #else /* no CONFIG_ACPI_SLEEP */
 
-static int tboot_setup_sleep(void)
-{
-	/* S3 shutdown requested, but S3 not supported by the kernel... */
-	BUG();
-	return -1;
-}
+static void tboot_setup_sleep(void)     {}
 
 #endif
+
+void __init tboot_probe(void)
+{
+	/* Look for valid page-aligned address for shared page. */
+	if (!boot_params.tboot_addr)
+		return;
+	/*
+	 * also verify that it is mapped as we expect it before calling
+	 * set_fixmap(), to reduce chance of garbage value causing crash
+	 */
+	if (!e820_any_mapped(boot_params.tboot_addr,
+			boot_params.tboot_addr, E820_RESERVED)) {
+		pr_warning("non-0 tboot_addr but it is not of type E820_RESERVED\n");
+		return;
+	}
+
+	/* only a natively booted kernel should be using TXT */
+	if (paravirt_enabled()) {
+		pr_warning("non-0 tboot_addr but pv_ops is enabled\n");
+		return;
+	}
+
+	/* Map and check for tboot UUID. */
+	set_fixmap(FIX_TBOOT_BASE, boot_params.tboot_addr);
+	tboot = (struct tboot *)fix_to_virt(FIX_TBOOT_BASE);
+	if (memcmp(&tboot_uuid, &tboot->uuid, sizeof(tboot->uuid))) {
+		pr_warning("tboot at 0x%llx is invalid\n",
+			boot_params.tboot_addr);
+		tboot = NULL;
+		return;
+	}
+	if (tboot->version < 5) {
+		pr_warning("tboot version is invalid: %u\n", tboot->version);
+		tboot = NULL;
+		return;
+	}
+
+	pr_info("found shared page at phys addr 0x%llx:\n",
+		boot_params.tboot_addr);
+	pr_debug("version: %d\n", tboot->version);
+	pr_debug("log_addr: 0x%08x\n", tboot->log_addr);
+	pr_debug("shutdown_entry: 0x%x\n", tboot->shutdown_entry);
+	pr_debug("tboot_base: 0x%08x\n", tboot->tboot_base);
+	pr_debug("tboot_size: 0x%x\n", tboot->tboot_size);
+
+	tboot_setup_sleep();
+}
 
 void tboot_shutdown(u32 shutdown_type)
 {
@@ -227,11 +222,6 @@ void tboot_shutdown(u32 shutdown_type)
 	 */
 	if (!tboot_pg_dir)
 		return;
-
-	/* if this is S3 then set regions to MAC */
-	if (shutdown_type == TB_SHUTDOWN_S3)
-		if (tboot_setup_sleep())
-			return;
 
 	tboot->shutdown_type = shutdown_type;
 
Wang, Shane wrote:
> This patch is to fix the warning messages related to tboot when
> "allyesconfig" is set on i386. 
> 
> Signed-off-by: Shane Wang <shane.wang@intel.com>

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

This patch is to fix the warning messages related to tboot when "allyesconfig" is set on i386.

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

diff -r d5d64753146c arch/x86/kernel/tboot.c
--- a/arch/x86/kernel/tboot.c	Mon Mar 01 09:47:50 2010 -0500
+++ b/arch/x86/kernel/tboot.c	Thu Mar 04 09:36:37 2010 -0500
@@ -54,51 +54,6 @@ struct tboot *tboot __read_mostly;
 #define pr_fmt(fmt)	"tboot: " fmt
 
 static u8 tboot_uuid[16] __initdata = TBOOT_UUID;
-
-void __init tboot_probe(void)
-{
-	/* Look for valid page-aligned address for shared page. */
-	if (!boot_params.tboot_addr)
-		return;
-	/*
-	 * also verify that it is mapped as we expect it before calling
-	 * set_fixmap(), to reduce chance of garbage value causing crash
-	 */
-	if (!e820_any_mapped(boot_params.tboot_addr,
-			     boot_params.tboot_addr, E820_RESERVED)) {
-		pr_warning("non-0 tboot_addr but it is not of type E820_RESERVED\n");
-		return;
-	}
-
-	/* only a natively booted kernel should be using TXT */
-	if (paravirt_enabled()) {
-		pr_warning("non-0 tboot_addr but pv_ops is enabled\n");
-		return;
-	}
-
-	/* Map and check for tboot UUID. */
-	set_fixmap(FIX_TBOOT_BASE, boot_params.tboot_addr);
-	tboot = (struct tboot *)fix_to_virt(FIX_TBOOT_BASE);
-	if (memcmp(&tboot_uuid, &tboot->uuid, sizeof(tboot->uuid))) {
-		pr_warning("tboot at 0x%llx is invalid\n",
-			   boot_params.tboot_addr);
-		tboot = NULL;
-		return;
-	}
-	if (tboot->version < 5) {
-		pr_warning("tboot version is invalid: %u\n", tboot->version);
-		tboot = NULL;
-		return;
-	}
-
-	pr_info("found shared page at phys addr 0x%llx:\n",
-		boot_params.tboot_addr);
-	pr_debug("version: %d\n", tboot->version);
-	pr_debug("log_addr: 0x%08x\n", tboot->log_addr);
-	pr_debug("shutdown_entry: 0x%x\n", tboot->shutdown_entry);
-	pr_debug("tboot_base: 0x%08x\n", tboot->tboot_base);
-	pr_debug("tboot_size: 0x%x\n", tboot->tboot_size);
-}
 
 static pgd_t *tboot_pg_dir;
 static struct mm_struct tboot_mm = {
@@ -182,7 +137,7 @@ static void add_mac_region(phys_addr_t s
 	}
 }
 
-static int tboot_setup_sleep(void)
+static void __init tboot_setup_sleep(void)
 {
 	tboot->num_mac_regions = 0;
 
@@ -198,20 +153,60 @@ static int tboot_setup_sleep(void)
 	add_mac_region(virt_to_phys(_text), _end - _text);
 
 	tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
-
-	return 0;
 }
 
 #else /* no CONFIG_ACPI_SLEEP */
 
-static int tboot_setup_sleep(void)
-{
-	/* S3 shutdown requested, but S3 not supported by the kernel... */
-	BUG();
-	return -1;
-}
+static void tboot_setup_sleep(void)     {}
 
 #endif
+
+void __init tboot_probe(void)
+{
+	/* Look for valid page-aligned address for shared page. */
+	if (!boot_params.tboot_addr)
+		return;
+	/*
+	 * also verify that it is mapped as we expect it before calling
+	 * set_fixmap(), to reduce chance of garbage value causing crash
+	 */
+	if (!e820_any_mapped(boot_params.tboot_addr,
+			boot_params.tboot_addr, E820_RESERVED)) {
+		pr_warning("non-0 tboot_addr but it is not of type E820_RESERVED\n");
+		return;
+	}
+
+	/* only a natively booted kernel should be using TXT */
+	if (paravirt_enabled()) {
+		pr_warning("non-0 tboot_addr but pv_ops is enabled\n");
+		return;
+	}
+
+	/* Map and check for tboot UUID. */
+	set_fixmap(FIX_TBOOT_BASE, boot_params.tboot_addr);
+	tboot = (struct tboot *)fix_to_virt(FIX_TBOOT_BASE);
+	if (memcmp(&tboot_uuid, &tboot->uuid, sizeof(tboot->uuid))) {
+		pr_warning("tboot at 0x%llx is invalid\n",
+			boot_params.tboot_addr);
+		tboot = NULL;
+		return;
+	}
+	if (tboot->version < 5) {
+		pr_warning("tboot version is invalid: %u\n", tboot->version);
+		tboot = NULL;
+		return;
+	}
+
+	pr_info("found shared page at phys addr 0x%llx:\n",
+		boot_params.tboot_addr);
+	pr_debug("version: %d\n", tboot->version);
+	pr_debug("log_addr: 0x%08x\n", tboot->log_addr);
+	pr_debug("shutdown_entry: 0x%x\n", tboot->shutdown_entry);
+	pr_debug("tboot_base: 0x%08x\n", tboot->tboot_base);
+	pr_debug("tboot_size: 0x%x\n", tboot->tboot_size);
+
+	tboot_setup_sleep();
+}
 
 void tboot_shutdown(u32 shutdown_type)
 {
@@ -227,11 +222,6 @@ void tboot_shutdown(u32 shutdown_type)
 	 */
 	if (!tboot_pg_dir)
 		return;
-
-	/* if this is S3 then set regions to MAC */
-	if (shutdown_type == TB_SHUTDOWN_S3)
-		if (tboot_setup_sleep())
-			return;
 
 	tboot->shutdown_type = shutdown_type;
 

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

* Re: [PATCH v2] intel_txt: fix section warning messages from tboot when "allyesconfig" is set on i386
  2010-03-04  7:41 ` [PATCH v2] " Wang, Shane
@ 2010-03-15 19:59   ` H. Peter Anvin
  0 siblings, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2010-03-15 19:59 UTC (permalink / raw)
  To: Wang, Shane; +Cc: linux-kernel@vger.kernel.org, Ingo Molnar, Cihula, Joseph

Shane,

All your patches are sent in a form which is difficult for automation.
Could you please use "git send-email" instead of whatever method you are
currently using to send patches?

	-hpa


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

end of thread, other threads:[~2010-03-15 20:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04  5:30 [PATCH] intel_txt: fix section warning messages from tboot when "allyesconfig" is set on i386 Wang, Shane
2010-03-04  7:41 ` [PATCH v2] " Wang, Shane
2010-03-15 19:59   ` H. Peter Anvin

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