Patches contributed by Eötvös Lorand University


commit 2544a873ab2a1ee9196bb2f4b12c3afd44ec8a06
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Apr 29 12:04:51 2008 +0200

    revert: "x86: ioremap(), extend check to all RAM pages"
    
    Vegard Nossum reported a large (150 seconds) boot delay during bootup,
    and bisected it to "x86: ioremap(), extend check to all RAM pages"
    (commit bdd3cee2e4b). Revert this commit for now.
    
    Bisected-by: Vegard Nossum <vegard.nossum@gmail.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 804de18abcc2..0be9f9c59aa6 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -148,8 +148,8 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
 	/*
 	 * Don't allow anybody to remap normal RAM that we're using..
 	 */
-	for (pfn = phys_addr >> PAGE_SHIFT;
-				(pfn << PAGE_SHIFT) < last_addr; pfn++) {
+	for (pfn = phys_addr >> PAGE_SHIFT; pfn < max_pfn_mapped &&
+		(pfn << PAGE_SHIFT) < last_addr; pfn++) {
 
 		int is_ram = page_is_ram(pfn);
 

commit 3e8f7e35f3fd17eadef44e4679abb39a3806cf01
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Apr 28 10:46:58 2008 +0200

    x86 VISWS: build fix
    
    the 'reboot_force' flag is a notion that non-PC subarchitectures do
    not have.
    
    also, unify the X86_BIOS_REBOOT option between 32-bit and 64-bit
    and get rid of a few unnecessary Kconfig and Makefile complications
    that way.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f70e3e3a9fa7..80303187b872 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -180,7 +180,7 @@ config X86_HT
 
 config X86_BIOS_REBOOT
 	bool
-	depends on X86_32 && !(X86_VISWS || X86_VOYAGER)
+	depends on !X86_VISWS && !X86_VOYAGER
 	default y
 
 config X86_TRAMPOLINE
@@ -1161,7 +1161,7 @@ source kernel/Kconfig.hz
 
 config KEXEC
 	bool "kexec system call"
-	depends on X86_64 || X86_BIOS_REBOOT
+	depends on X86_BIOS_REBOOT
 	help
 	  kexec is a system call that implements the ability to shutdown your
 	  current kernel, and to start another kernel.  It is like a reboot
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 30d54ed27e55..bbdacb398d48 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -40,7 +40,6 @@ obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-y				+= cpu/
 obj-y				+= acpi/
 obj-$(CONFIG_X86_BIOS_REBOOT)	+= reboot.o
-obj-$(CONFIG_X86_64)		+= reboot.o
 obj-$(CONFIG_MCA)		+= mca_32.o
 obj-$(CONFIG_X86_MSR)		+= msr.o
 obj-$(CONFIG_X86_CPUID)		+= cpuid.o
diff --git a/include/asm-x86/proto.h b/include/asm-x86/proto.h
index 1e17bcce450e..6c8b41b03f6d 100644
--- a/include/asm-x86/proto.h
+++ b/include/asm-x86/proto.h
@@ -20,7 +20,11 @@ extern void syscall32_cpu_init(void);
 
 extern void check_efer(void);
 
+#ifdef CONFIG_X86_BIOS_REBOOT
 extern int reboot_force;
+#else
+static const int reboot_force = 0;
+#endif
 
 long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
 

commit ed5e233284bc4aff965df7351da8426aa188c8f9
Author: Ingo Molnar <mingo@elte.hu>
Date:   Sun Apr 27 23:21:03 2008 +0200

    x86, voyager: fix ioremap_nocache()
    
    James Bottomley reported that the following commit:
    
    | commit 6371b495991debfd1417b17c2bc4f7d7bae05739
    | Author: Ingo Molnar <mingo@elte.hu>
    | Date:   Wed Jan 30 13:33:40 2008 +0100
    |
    |     x86: change ioremap() to default to uncached
    
    broke Voyager.
    
    James says:
    
    " it broke a class of voyager machines: those which
      rely on the quad interrupt controller (QIC).  The precis of why they
      broke is because the QIC does IPIs (or CPIs in its terminology) via
      cache line interference: you interrupt a processor by moving a
      designated memory area to write exclusive in the cache (by simply
      writing to the line) and the CPU acks the interrupt by moving it back to
      read shared (by reading from it).  That area, is, of course, mapped by
      ioremap, so reversing the ioremap semantics and adding the uncached bit
      completely breaks the QIC. "
    
    Sorry about that!
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/mach-voyager/voyager_cat.c b/arch/x86/mach-voyager/voyager_cat.c
index ecab9fff0fd1..2ad598c104af 100644
--- a/arch/x86/mach-voyager/voyager_cat.c
+++ b/arch/x86/mach-voyager/voyager_cat.c
@@ -877,7 +877,7 @@ void __init voyager_cat_init(void)
 			request_resource(&iomem_resource, res);
 		}
 
-		qic_addr = (unsigned long)ioremap(qic_addr, 0x400);
+		qic_addr = (unsigned long)ioremap_cache(qic_addr, 0x400);
 
 		for (j = 0; j < 4; j++) {
 			__u8 cpu;

commit fc3fbc45098e5aff59f06962dee79aba2e11430d
Author: Ingo Molnar <mingo@elte.hu>
Date:   Sun Apr 27 14:04:14 2008 +0200

    hpet: fix
    
    Al Viro pointed out that there's a missing readl() of timer->hpet_config,
    found by Sparse.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 9007f9ea64ee..9b5cfcdfc426 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -137,9 +137,10 @@ static void hpet_reserve_platform_timers(unsigned long id)
 	hd.hd_irq[0] = HPET_LEGACY_8254;
 	hd.hd_irq[1] = HPET_LEGACY_RTC;
 
-	for (i = 2; i < nrtimers; timer++, i++)
-		hd.hd_irq[i] = (timer->hpet_config & Tn_INT_ROUTE_CNF_MASK) >>
+	for (i = 2; i < nrtimers; timer++, i++) {
+		hd.hd_irq[i] = (readl(&timer->hpet_config) & Tn_INT_ROUTE_CNF_MASK) >>
 			Tn_INT_ROUTE_CNF_SHIFT;
+	}
 
 	hpet_alloc(&hd);
 

commit ae3a0064e6d69068b1c9fd075095da062430bda9
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Apr 30 00:15:31 2008 +0200

    inlining: do not allow gcc below version 4 to optimize inlining
    
    fix the condition to match intention: always use the old inlining
    behavior on all gcc versions below 4.
    
    this should solve the UML build problem.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index b2fd7547b58d..5c8351b859f0 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -29,10 +29,11 @@
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
 
 /*
- * Force always-inline if the user requests it so via the .config:
+ * Force always-inline if the user requests it so via the .config,
+ * or if gcc is too old:
  */
 #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
-    !defined(CONFIG_OPTIMIZE_INLINING) && (__GNUC__ >= 4)
+    !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
 # define inline		inline		__attribute__((always_inline))
 # define __inline__	__inline__	__attribute__((always_inline))
 # define __inline	__inline	__attribute__((always_inline))

commit ca72cddfcb6afd75a808da4f027325fa63a1b856
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Apr 30 11:50:11 2008 +0200

    fix drivers/media/common/tuners/ build bug
    
    x86.git randconfig testing found a build failure on latest -git:
    
     drivers/built-in.o: In function `set_type':
     tuner-core.c:(.text+0x2a9a26): undefined reference to `tea5761_attach'
     tuner-core.c:(.text+0x2a9d05): undefined reference to `tda9887_attach'
     tuner-core.c:(.text+0x2a9d51): undefined reference to `xc2028_attach'
     tuner-core.c:(.text+0x2a9e22): undefined reference to `tda829x_attach'
     tuner-core.c:(.text+0x2a9e3f): undefined reference to `microtune_attach'
     drivers/built-in.o: In function `tuner_probe':
     tuner-core.c:(.text+0x2aa18a): undefined reference to `tda829x_probe'
     tuner-core.c:(.text+0x2aa302): undefined reference to `tea5761_autodetection'
    
    with the following config:
    
     http://redhat.com/~mingo/misc/config-Wed_Apr_30_10_21_40_CEST_2008.bad
    
    the problem is caused by the drivers/media/common/tuners/ subdirectory
    not being part of the kbuild hierarchy anymore, due to commit
    7c91f0624 ("V4L/DVB(7767): Move tuners to common/tuners").
    
    this seems similar to the problem also reported by Mike Galbraith.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Acked-by: Sam Ravnborg <sam@ravnborg.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/drivers/media/common/Makefile b/drivers/media/common/Makefile
index 8e7448230643..351b98b9b302 100644
--- a/drivers/media/common/Makefile
+++ b/drivers/media/common/Makefile
@@ -2,6 +2,7 @@ saa7146-objs    := saa7146_i2c.o saa7146_core.o
 saa7146_vv-objs := saa7146_fops.o saa7146_video.o saa7146_hlp.o saa7146_vbi.o
 ir-common-objs  := ir-functions.o ir-keymaps.o
 
+obj-y += tuners/
 obj-$(CONFIG_VIDEO_SAA7146) += saa7146.o
 obj-$(CONFIG_VIDEO_SAA7146_VV) += saa7146_vv.o
 obj-$(CONFIG_VIDEO_IR) += ir-common.o

commit e7ae1e7ef9b4ef50444a49611dab92cb778eb97c
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Apr 29 10:21:20 2008 +0200

    ACER_WMI/ASUS_LAPTOP: fix build bug
    
    randconfig testing in x86.git found the following upstream build bug:
    
     drivers/built-in.o: In function `acer_led_exit':
     acer-wmi.c:(.text+0xdc76e): undefined reference to `led_classdev_unregister'
     drivers/built-in.o: In function `acer_platform_probe':
     acer-wmi.c:(.devinit.text+0x63e6): undefined reference to `led_classdev_register'
    
    which was due to acer-wmi.o only depending on CONFIG_LEDS_CLASS, while
    also using a symbol offered by CONFIG_NEW_LEDS. Also fix a similar bug
    in CONFIG_ASUS_LAPTOP.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Len Brown <len.brown@intel.com>

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 297a48f85446..38cce4d1e2fb 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -140,6 +140,7 @@ config ACER_WMI
 	depends on EXPERIMENTAL
 	depends on ACPI
 	depends on LEDS_CLASS
+	depends on NEW_LEDS
 	depends on BACKLIGHT_CLASS_DEVICE
 	depends on SERIO_I8042
 	select ACPI_WMI
@@ -160,6 +161,7 @@ config ASUS_LAPTOP
         depends on ACPI
 	depends on EXPERIMENTAL && !ACPI_ASUS
 	depends on LEDS_CLASS
+	depends on NEW_LEDS
 	depends on BACKLIGHT_CLASS_DEVICE
         ---help---
 	  This is the new Linux driver for Asus laptops. It may also support some

commit 781fe2ebc0f44b32418d203ac023a541afdd042f
Author: Ingo Molnar <mingo@elte.hu>
Date:   Sat Apr 26 23:14:36 2008 +0200

    bootprotocol: cleanup
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 645ee5e32a27..124480c0008d 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -100,7 +100,7 @@ void __init free_early(unsigned long start, unsigned long end)
 	for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++)
 		;
 
-	memcpy(&early_res[i], &early_res[i + 1],
+	memmove(&early_res[i], &early_res[i + 1],
 	       (j - 1 - i) * sizeof(struct early_res));
 
 	early_res[j - 1].end = 0;

commit 96fffeb4b413a4f8f65bb627d59b7dfc97ea0b39
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Apr 28 01:39:43 2008 +0200

    make CC_OPTIMIZE_FOR_SIZE non-experimental
    
    this option has been the default on a wide range of distributions
    for a long time - time to make it non-experimental.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/init/Kconfig b/init/Kconfig
index ba3a389fab94..183c9973be72 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -496,16 +496,12 @@ source "usr/Kconfig"
 endif
 
 config CC_OPTIMIZE_FOR_SIZE
-	bool "Optimize for size (Look out for broken compilers!)"
+	bool "Optimize for size"
 	default y
-	depends on ARM || H8300 || SUPERH || EXPERIMENTAL
 	help
 	  Enabling this option will pass "-Os" instead of "-O2" to gcc
 	  resulting in a smaller kernel.
 
-	  WARNING: some versions of gcc may generate incorrect code with this
-	  option.  If problems are observed, a gcc upgrade may be needed.
-
 	  If unsure, say N.
 
 config SYSCTL

commit f022bfd58253099102218db5249220a7f4787114
Author: Ingo Molnar <mingo@elte.hu>
Date:   Fri Mar 21 15:42:28 2008 +0100

    x86: PAT fix
    
    Adrian Bunk noticed the following Coverity report:
    
    > Commit e7f260a276f2c9184fe753732d834b1f6fbe9f17
    > (x86: PAT use reserve free memtype in mmap of /dev/mem)
    > added the following gem to arch/x86/mm/pat.c:
    >
    > <--  snip  -->
    >
    > ...
    > int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
    >                                 unsigned long size, pgprot_t *vma_prot)
    > {
    >         u64 offset = ((u64) pfn) << PAGE_SHIFT;
    >         unsigned long flags = _PAGE_CACHE_UC_MINUS;
    >         unsigned long ret_flags;
    > ...
    > ...  (nothing that touches ret_flags)
    > ...
    >         if (flags != _PAGE_CACHE_UC_MINUS) {
    >                 retval = reserve_memtype(offset, offset + size, flags, NULL);
    >         } else {
    >                 retval = reserve_memtype(offset, offset + size, -1, &ret_flags);
    >         }
    >
    >         if (retval < 0)
    >                 return 0;
    >
    >         flags = ret_flags;
    >
    >         if (pfn <= max_pfn_mapped &&
    >             ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) {
    >                 free_memtype(offset, offset + size);
    >                 printk(KERN_INFO
    >                 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n",
    >                         current->comm, current->pid,
    >                         cattr_name(flags),
    >                         offset, offset + size);
    >                 return 0;
    >         }
    >
    >         *vma_prot = __pgprot((pgprot_val(*vma_prot) & ~_PAGE_CACHE_MASK) |
    >                              flags);
    >         return 1;
    > }
    >
    > <--  snip  -->
    >
    > If (flags != _PAGE_CACHE_UC_MINUS) we pass garbage from the stack to
    > ioremap_change_attr() and/or __pgprot().
    >
    > Spotted by the Coverity checker.
    
    the fix simplifies the code as we get rid of the 'ret_flags'
    complication.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index b17cdf64e41e..277446cd30b6 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -510,7 +510,6 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
 {
 	u64 offset = ((u64) pfn) << PAGE_SHIFT;
 	unsigned long flags = _PAGE_CACHE_UC_MINUS;
-	unsigned long ret_flags;
 	int retval;
 
 	if (!range_is_allowed(pfn, size))
@@ -549,14 +548,12 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
 	if (flags != _PAGE_CACHE_UC_MINUS) {
 		retval = reserve_memtype(offset, offset + size, flags, NULL);
 	} else {
-		retval = reserve_memtype(offset, offset + size, -1, &ret_flags);
+		retval = reserve_memtype(offset, offset + size, -1, &flags);
 	}
 
 	if (retval < 0)
 		return 0;
 
-	flags = ret_flags;
-
 	if (pfn <= max_pfn_mapped &&
             ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) {
 		free_memtype(offset, offset + size);