rpms/kernel/F-11 linux-2.6-e820-acpi3-bios-workaround.patch, NONE, 1.1 linux-2.6-e820-guard-against-pre-acpi3.patch, NONE, 1.1 linux-2.6-e820-mark-esi-clobbered.patch, NONE, 1.1 linux-2.6-e820-save-restore-edi-ebp.patch, NONE, 1.1 kernel.spec, 1.1509, 1.1510

Chuck Ebbert cebbert at fedoraproject.org
Fri Apr 3 18:48:01 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28955

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-e820-acpi3-bios-workaround.patch 
	linux-2.6-e820-guard-against-pre-acpi3.patch 
	linux-2.6-e820-mark-esi-clobbered.patch 
	linux-2.6-e820-save-restore-edi-ebp.patch 
Log Message:
x86 E820 fixes from 2.6.30

linux-2.6-e820-acpi3-bios-workaround.patch:

--- NEW FILE linux-2.6-e820-acpi3-bios-workaround.patch ---
From: H. Peter Anvin <hpa at zytor.com>
Date: Sat, 28 Mar 2009 20:53:26 +0000 (-0700)
Subject: x86, setup: ACPI 3, BIOS workaround for E820-probing code
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=c549e71d073a6e9a4847497344db28a784061455

x86, setup: ACPI 3, BIOS workaround for E820-probing code

Impact: ACPI 3 spec compliance, BIOS bug workaround

The ACPI 3 spec added another field to the E820 buffer -- which is
backwards incompatible, since it contains a validity bit.
Furthermore, there has been at least one report of a BIOS which
assumes that the buffer it is pointed at is the same buffer as for the
previous E820 call.  Therefore, read the data into a temporary buffer
and copy the standard part of it if and only if the valid bit is set.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---

diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c
index fcdb10a..d5d2360 100644
--- a/arch/x86/boot/memory.c
+++ b/arch/x86/boot/memory.c
@@ -2,6 +2,7 @@
  *
  *   Copyright (C) 1991, 1992 Linus Torvalds
  *   Copyright 2007 rPath, Inc. - All Rights Reserved
+ *   Copyright 2009 Intel Corporation; author H. Peter Anvin
  *
  *   This file is part of the Linux kernel, and is made available under
  *   the terms of the GNU General Public License version 2.
@@ -16,6 +17,11 @@
 
 #define SMAP	0x534d4150	/* ASCII "SMAP" */
 
+struct e820_ext_entry {
+	struct e820entry std;
+	u32 ext_flags;
+} __attribute__((packed));
+
 static int detect_memory_e820(void)
 {
 	int count = 0;
@@ -23,9 +29,10 @@ static int detect_memory_e820(void)
 	u32 size, id, edi;
 	u8 err;
 	struct e820entry *desc = boot_params.e820_map;
+	static struct e820_ext_entry buf; /* static so it is zeroed */
 
 	do {
-		size = sizeof(struct e820entry);
+		size = sizeof buf;
 
 		/* Important: %edx and %esi are clobbered by some BIOSes,
 		   so they must be either used for the error output
@@ -33,8 +40,8 @@ static int detect_memory_e820(void)
 		   is something out there clobbering %ebp and %edi, too. */
 		asm("pushl %%ebp; int $0x15; popl %%ebp; setc %0"
 		    : "=d" (err), "+b" (next), "=a" (id), "+c" (size),
-		      "=D" (edi), "=m" (*desc)
-		    : "D" (desc), "d" (SMAP), "a" (0xe820)
+		      "=D" (edi), "+m" (buf)
+		    : "D" (&buf), "d" (SMAP), "a" (0xe820)
 		    : "esi");
 
 		/* BIOSes which terminate the chain with CF = 1 as opposed
@@ -53,8 +60,14 @@ static int detect_memory_e820(void)
 			break;
 		}
 
+		/* ACPI 3.0 added the extended flags support.  If bit 0
+		   in the extended flags is zero, we're supposed to simply
+		   ignore the entry -- a backwards incompatible change! */
+		if (size > 20 && !(buf.ext_flags & 1))
+			continue;
+
+		*desc++ = buf.std;
 		count++;
-		desc++;
 	} while (next && count < ARRAY_SIZE(boot_params.e820_map));
 
 	return boot_params.e820_entries = count;

linux-2.6-e820-guard-against-pre-acpi3.patch:

--- NEW FILE linux-2.6-e820-guard-against-pre-acpi3.patch ---
From: H. Peter Anvin <hpa at zytor.com>
Date: Wed, 1 Apr 2009 18:35:00 +0000 (-0700)
Subject: x86, setup: guard against pre-ACPI 3 e820 code not updating %ecx
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=cd670599b7b00d9263f6f11a05c0edeb9cbedaf3

x86, setup: guard against pre-ACPI 3 e820 code not updating %ecx

Impact: BIOS bug safety

For pre-ACPI 3 BIOSes, pre-initialize the end of the e820 buffer just
in case the BIOS returns an unchanged %ecx but without actually
touching the ACPI 3 extended flags field.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---

diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c
index d5d2360..5054c2d 100644
--- a/arch/x86/boot/memory.c
+++ b/arch/x86/boot/memory.c
@@ -31,6 +31,12 @@ static int detect_memory_e820(void)
 	struct e820entry *desc = boot_params.e820_map;
 	static struct e820_ext_entry buf; /* static so it is zeroed */
 
+	/*
+	 * Set this here so that if the BIOS doesn't change this field
+	 * but still doesn't change %ecx, we're still okay...
+	 */
+	buf.ext_flags = 1;
+
 	do {
 		size = sizeof buf;
 

linux-2.6-e820-mark-esi-clobbered.patch:

--- NEW FILE linux-2.6-e820-mark-esi-clobbered.patch ---
From: Michael K. Johnson <johnsonm at rpath.com>
Date: Fri, 27 Mar 2009 17:14:41 +0000 (-0400)
Subject: x86, setup: mark %esi as clobbered in E820 BIOS call
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=01522df346f846906eaf6ca57148641476209909

x86, setup: mark %esi as clobbered in E820 BIOS call

Jordan Hargrave diagnosed a BIOS clobbering %esi in the E820 call.
That particular BIOS has been fixed, but there is a possibility that
this is responsible for other occasional reports of early boot
failure, and it does not hurt to add %esi to the clobbers.

-stable candidate patch.

Cc: Justin Forbes <jmforbes at linuxtx.org>
Signed-off-by: Michael K Johnson <johnsonm at rpath.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
Cc: stable at kernel.org
---

diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c
index 8c3c25f..a99dbbe 100644
--- a/arch/x86/boot/memory.c
+++ b/arch/x86/boot/memory.c
@@ -27,13 +27,14 @@ static int detect_memory_e820(void)
 	do {
 		size = sizeof(struct e820entry);
 
-		/* Important: %edx is clobbered by some BIOSes,
-		   so it must be either used for the error output
+		/* Important: %edx and %esi are clobbered by some BIOSes,
+		   so they must be either used for the error output
 		   or explicitly marked clobbered. */
 		asm("int $0x15; setc %0"
 		    : "=d" (err), "+b" (next), "=a" (id), "+c" (size),
 		      "=m" (*desc)
-		    : "D" (desc), "d" (SMAP), "a" (0xe820));
+		    : "D" (desc), "d" (SMAP), "a" (0xe820)
+		    : "esi");
 
 		/* BIOSes which terminate the chain with CF = 1 as opposed
 		   to %ebx = 0 don't always report the SMAP signature on

linux-2.6-e820-save-restore-edi-ebp.patch:

--- NEW FILE linux-2.6-e820-save-restore-edi-ebp.patch ---
From: H. Peter Anvin <hpa at zytor.com>
Date: Sat, 28 Mar 2009 20:53:26 +0000 (-0700)
Subject: x86, setup: preemptively save/restore edi and ebp around INT 15 E820
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=32ec7fd08b597586774b92ac1cd2678021ccac1b

x86, setup: preemptively save/restore edi and ebp around INT 15 E820

Impact: BIOS bugproofing

Since there are BIOSes known to clobber %ebx and %esi for INT 15 E820,
assume there is something out there clobbering %edi and/or %ebp too,
and don't wait for it to fail.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---

diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c
index a99dbbe..fcdb10a 100644
--- a/arch/x86/boot/memory.c
+++ b/arch/x86/boot/memory.c
@@ -20,7 +20,7 @@ static int detect_memory_e820(void)
 {
 	int count = 0;
 	u32 next = 0;
-	u32 size, id;
+	u32 size, id, edi;
 	u8 err;
 	struct e820entry *desc = boot_params.e820_map;
 
@@ -29,10 +29,11 @@ static int detect_memory_e820(void)
 
 		/* Important: %edx and %esi are clobbered by some BIOSes,
 		   so they must be either used for the error output
-		   or explicitly marked clobbered. */
-		asm("int $0x15; setc %0"
+		   or explicitly marked clobbered.  Given that, assume there
+		   is something out there clobbering %ebp and %edi, too. */
+		asm("pushl %%ebp; int $0x15; popl %%ebp; setc %0"
 		    : "=d" (err), "+b" (next), "=a" (id), "+c" (size),
-		      "=m" (*desc)
+		      "=D" (edi), "=m" (*desc)
 		    : "D" (desc), "d" (SMAP), "a" (0xe820)
 		    : "esi");
 


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1509
retrieving revision 1.1510
diff -u -r1.1509 -r1.1510
--- kernel.spec	3 Apr 2009 16:37:54 -0000	1.1509
+++ kernel.spec	3 Apr 2009 18:47:30 -0000	1.1510
@@ -596,6 +596,11 @@
 
 Patch41: linux-2.6-sysrq-c.patch
 
+Patch100: linux-2.6-e820-mark-esi-clobbered.patch
+Patch101: linux-2.6-e820-save-restore-edi-ebp.patch
+Patch102: linux-2.6-e820-acpi3-bios-workaround.patch
+Patch103: linux-2.6-e820-guard-against-pre-acpi3.patch
+
 Patch141: linux-2.6-ps3-storage-alias.patch
 Patch143: linux-2.6-g5-therm-shutdown.patch
 Patch144: linux-2.6-vio-modalias.patch
@@ -1101,6 +1106,10 @@
 
 # Architecture patches
 # x86(-64)
+ApplyPatch linux-2.6-e820-mark-esi-clobbered.patch
+ApplyPatch linux-2.6-e820-save-restore-edi-ebp.patch
+ApplyPatch linux-2.6-e820-acpi3-bios-workaround.patch
+ApplyPatch linux-2.6-e820-guard-against-pre-acpi3.patch
 
 #
 # PowerPC
@@ -1889,6 +1898,9 @@
 # and build.
 
 %changelog
+* Fri Apr 03 2009 Chuck Ebbert <cebbert at redhat.com>
+- x86 E820 fixes from 2.6.30
+
 * Fri Apr 03 2009 Dave Jones <davej at redhat.com>
 - x86/dma: unify definition of pci_unmap_addr* and pci_unmap_len macros
 




More information about the fedora-extras-commits mailing list