aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-04-04 22:37:28 -0400
committerTejun Heo <tj@kernel.org>2010-04-04 22:37:28 -0400
commit336f5899d287f06d8329e208fc14ce50f7ec9698 (patch)
tree9b762d450d5eb248a6ff8317badb7e223d93ed58 /arch
parenta4ab2773205e8b94c18625455f85e3b6bb9d7ad6 (diff)
parentdb217dece3003df0841bacf9556b5c06aa097dae (diff)
Merge branch 'master' into export-slabh
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/cacheflush.h38
-rw-r--r--arch/arm/include/asm/clkdev.h1
-rw-r--r--arch/arm/include/asm/irq.h1
-rw-r--r--arch/arm/include/asm/outercache.h75
-rw-r--r--arch/arm/include/asm/system.h16
-rw-r--r--arch/arm/kernel/kprobes.c10
-rw-r--r--arch/arm/lib/memmove.S4
-rw-r--r--arch/arm/mm/Kconfig13
-rw-r--r--arch/arm/mm/cache-l2x0.c10
-rw-r--r--arch/arm/vfp/vfpmodule.c2
-rw-r--r--arch/microblaze/Kconfig3
-rw-r--r--arch/microblaze/Makefile4
-rw-r--r--arch/microblaze/boot/Makefile6
-rw-r--r--arch/microblaze/include/asm/processor.h1
-rw-r--r--arch/microblaze/include/asm/segment.h49
-rw-r--r--arch/microblaze/include/asm/thread_info.h5
-rw-r--r--arch/microblaze/include/asm/tlbflush.h3
-rw-r--r--arch/microblaze/include/asm/uaccess.h447
-rw-r--r--arch/microblaze/kernel/dma.c2
-rw-r--r--arch/microblaze/kernel/head.S12
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S112
-rw-r--r--arch/microblaze/kernel/misc.S15
-rw-r--r--arch/microblaze/kernel/process.c10
-rw-r--r--arch/microblaze/kernel/setup.c24
-rw-r--r--arch/microblaze/kernel/traps.c6
-rw-r--r--arch/microblaze/lib/Makefile3
-rw-r--r--arch/microblaze/lib/fastcopy.S6
-rw-r--r--arch/microblaze/lib/memcpy.c2
-rw-r--r--arch/microblaze/lib/memset.c15
-rw-r--r--arch/microblaze/lib/uaccess.c48
-rw-r--r--arch/microblaze/lib/uaccess_old.S45
-rw-r--r--arch/microblaze/mm/fault.c24
-rw-r--r--arch/microblaze/mm/init.c9
-rw-r--r--arch/microblaze/mm/pgtable.c2
-rw-r--r--arch/powerpc/kernel/misc.S2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c2
-rw-r--r--arch/sh/configs/ecovec24_defconfig236
-rw-r--r--arch/sh/include/asm/elf.h6
-rw-r--r--arch/sh/include/cpu-sh4/cpu/mmu_context.h2
-rw-r--r--arch/sh/kernel/cpufreq.c4
-rw-r--r--arch/sh/kernel/return_address.c3
-rw-r--r--arch/sh/kernel/smp.c1
-rw-r--r--arch/sh/mm/tlb-pteaex.c28
-rw-r--r--arch/sh/mm/tlb-sh3.c19
-rw-r--r--arch/sh/mm/tlb-sh4.c28
-rw-r--r--arch/sh/mm/tlb-urb.c22
-rw-r--r--arch/sh/mm/tlbflush_32.c28
-rw-r--r--arch/sparc/configs/sparc64_defconfig28
-rw-r--r--arch/sparc/kernel/helpers.S75
-rw-r--r--arch/sparc/kernel/ptrace_32.c4
-rw-r--r--arch/sparc/kernel/ptrace_64.c4
-rw-r--r--arch/sparc/mm/init_64.c2
-rw-r--r--arch/x86/kernel/cpu/perf_event.c54
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c80
-rw-r--r--arch/x86/kernel/dumpstack.h5
-rw-r--r--arch/x86/kernel/head32.c4
-rw-r--r--arch/x86/kernel/head64.c3
-rw-r--r--arch/x86/kernel/kgdb.c2
-rw-r--r--arch/x86/kernel/setup.c10
-rw-r--r--arch/x86/kernel/smpboot.c4
-rw-r--r--arch/x86/kernel/vmlinux.lds.S2
-rw-r--r--arch/x86/mm/init.c32
62 files changed, 1063 insertions, 650 deletions
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index 72da7e045c6b..0d08d4170b64 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -15,6 +15,7 @@
15#include <asm/glue.h> 15#include <asm/glue.h>
16#include <asm/shmparam.h> 16#include <asm/shmparam.h>
17#include <asm/cachetype.h> 17#include <asm/cachetype.h>
18#include <asm/outercache.h>
18 19
19#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT) 20#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT)
20 21
@@ -219,12 +220,6 @@ struct cpu_cache_fns {
219 void (*dma_flush_range)(const void *, const void *); 220 void (*dma_flush_range)(const void *, const void *);
220}; 221};
221 222
222struct outer_cache_fns {
223 void (*inv_range)(unsigned long, unsigned long);
224 void (*clean_range)(unsigned long, unsigned long);
225 void (*flush_range)(unsigned long, unsigned long);
226};
227
228/* 223/*
229 * Select the calling method 224 * Select the calling method
230 */ 225 */
@@ -281,37 +276,6 @@ extern void dmac_flush_range(const void *, const void *);
281 276
282#endif 277#endif
283 278
284#ifdef CONFIG_OUTER_CACHE
285
286extern struct outer_cache_fns outer_cache;
287
288static inline void outer_inv_range(unsigned long start, unsigned long end)
289{
290 if (outer_cache.inv_range)
291 outer_cache.inv_range(start, end);
292}
293static inline void outer_clean_range(unsigned long start, unsigned long end)
294{
295 if (outer_cache.clean_range)
296 outer_cache.clean_range(start, end);
297}
298static inline void outer_flush_range(unsigned long start, unsigned long end)
299{
300 if (outer_cache.flush_range)
301 outer_cache.flush_range(start, end);
302}
303
304#else
305
306static inline void outer_inv_range(unsigned long start, unsigned long end)
307{ }
308static inline void outer_clean_range(unsigned long start, unsigned long end)
309{ }
310static inline void outer_flush_range(unsigned long start, unsigned long end)
311{ }
312
313#endif
314
315/* 279/*
316 * Copy user data from/to a page which is mapped into a different 280 * Copy user data from/to a page which is mapped into a different
317 * processes address space. Really, we want to allow our "user 281 * processes address space. Really, we want to allow our "user
diff --git a/arch/arm/include/asm/clkdev.h b/arch/arm/include/asm/clkdev.h
index 7a0690da5e63..b56c1389b6fa 100644
--- a/arch/arm/include/asm/clkdev.h
+++ b/arch/arm/include/asm/clkdev.h
@@ -13,6 +13,7 @@
13#define __ASM_CLKDEV_H 13#define __ASM_CLKDEV_H
14 14
15struct clk; 15struct clk;
16struct device;
16 17
17struct clk_lookup { 18struct clk_lookup {
18 struct list_head node; 19 struct list_head node;
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index 328f14a8b790..237282f7c762 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -17,6 +17,7 @@
17 17
18#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
19struct irqaction; 19struct irqaction;
20struct pt_regs;
20extern void migrate_irqs(void); 21extern void migrate_irqs(void);
21 22
22extern void asm_do_IRQ(unsigned int, struct pt_regs *); 23extern void asm_do_IRQ(unsigned int, struct pt_regs *);
diff --git a/arch/arm/include/asm/outercache.h b/arch/arm/include/asm/outercache.h
new file mode 100644
index 000000000000..25f76bae57ab
--- /dev/null
+++ b/arch/arm/include/asm/outercache.h
@@ -0,0 +1,75 @@
1/*
2 * arch/arm/include/asm/outercache.h
3 *
4 * Copyright (C) 2010 ARM Ltd.
5 * Written by Catalin Marinas <catalin.marinas@arm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __ASM_OUTERCACHE_H
22#define __ASM_OUTERCACHE_H
23
24struct outer_cache_fns {
25 void (*inv_range)(unsigned long, unsigned long);
26 void (*clean_range)(unsigned long, unsigned long);
27 void (*flush_range)(unsigned long, unsigned long);
28#ifdef CONFIG_OUTER_CACHE_SYNC
29 void (*sync)(void);
30#endif
31};
32
33#ifdef CONFIG_OUTER_CACHE
34
35extern struct outer_cache_fns outer_cache;
36
37static inline void outer_inv_range(unsigned long start, unsigned long end)
38{
39 if (outer_cache.inv_range)
40 outer_cache.inv_range(start, end);
41}
42static inline void outer_clean_range(unsigned long start, unsigned long end)
43{
44 if (outer_cache.clean_range)
45 outer_cache.clean_range(start, end);
46}
47static inline void outer_flush_range(unsigned long start, unsigned long end)
48{
49 if (outer_cache.flush_range)
50 outer_cache.flush_range(start, end);
51}
52
53#else
54
55static inline void outer_inv_range(unsigned long start, unsigned long end)
56{ }
57static inline void outer_clean_range(unsigned long start, unsigned long end)
58{ }
59static inline void outer_flush_range(unsigned long start, unsigned long end)
60{ }
61
62#endif
63
64#ifdef CONFIG_OUTER_CACHE_SYNC
65static inline void outer_sync(void)
66{
67 if (outer_cache.sync)
68 outer_cache.sync();
69}
70#else
71static inline void outer_sync(void)
72{ }
73#endif
74
75#endif /* __ASM_OUTERCACHE_H */
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index ca88e6a84707..4ace45ec3ef8 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -60,6 +60,8 @@
60#include <linux/linkage.h> 60#include <linux/linkage.h>
61#include <linux/irqflags.h> 61#include <linux/irqflags.h>
62 62
63#include <asm/outercache.h>
64
63#define __exception __attribute__((section(".exception.text"))) 65#define __exception __attribute__((section(".exception.text")))
64 66
65struct thread_info; 67struct thread_info;
@@ -137,10 +139,12 @@ extern unsigned int user_debug;
137#define dmb() __asm__ __volatile__ ("" : : : "memory") 139#define dmb() __asm__ __volatile__ ("" : : : "memory")
138#endif 140#endif
139 141
140#if __LINUX_ARM_ARCH__ >= 7 || defined(CONFIG_SMP) 142#ifdef CONFIG_ARCH_HAS_BARRIERS
141#define mb() dmb() 143#include <mach/barriers.h>
144#elif __LINUX_ARM_ARCH__ >= 7 || defined(CONFIG_SMP)
145#define mb() do { dsb(); outer_sync(); } while (0)
142#define rmb() dmb() 146#define rmb() dmb()
143#define wmb() dmb() 147#define wmb() mb()
144#else 148#else
145#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) 149#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
146#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) 150#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
@@ -152,9 +156,9 @@ extern unsigned int user_debug;
152#define smp_rmb() barrier() 156#define smp_rmb() barrier()
153#define smp_wmb() barrier() 157#define smp_wmb() barrier()
154#else 158#else
155#define smp_mb() mb() 159#define smp_mb() dmb()
156#define smp_rmb() rmb() 160#define smp_rmb() dmb()
157#define smp_wmb() wmb() 161#define smp_wmb() dmb()
158#endif 162#endif
159 163
160#define read_barrier_depends() do { } while(0) 164#define read_barrier_depends() do { } while(0)
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 1fb932b4fece..2ba7deb3072e 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -394,6 +394,14 @@ void __kprobes jprobe_return(void)
394 /* 394 /*
395 * Setup an empty pt_regs. Fill SP and PC fields as 395 * Setup an empty pt_regs. Fill SP and PC fields as
396 * they're needed by longjmp_break_handler. 396 * they're needed by longjmp_break_handler.
397 *
398 * We allocate some slack between the original SP and start of
399 * our fabricated regs. To be precise we want to have worst case
400 * covered which is STMFD with all 16 regs so we allocate 2 *
401 * sizeof(struct_pt_regs)).
402 *
403 * This is to prevent any simulated instruction from writing
404 * over the regs when they are accessing the stack.
397 */ 405 */
398 "sub sp, %0, %1 \n\t" 406 "sub sp, %0, %1 \n\t"
399 "ldr r0, ="__stringify(JPROBE_MAGIC_ADDR)"\n\t" 407 "ldr r0, ="__stringify(JPROBE_MAGIC_ADDR)"\n\t"
@@ -411,7 +419,7 @@ void __kprobes jprobe_return(void)
411 "ldmia sp, {r0 - pc} \n\t" 419 "ldmia sp, {r0 - pc} \n\t"
412 : 420 :
413 : "r" (kcb->jprobe_saved_regs.ARM_sp), 421 : "r" (kcb->jprobe_saved_regs.ARM_sp),
414 "I" (sizeof(struct pt_regs)), 422 "I" (sizeof(struct pt_regs) * 2),
415 "J" (offsetof(struct pt_regs, ARM_sp)), 423 "J" (offsetof(struct pt_regs, ARM_sp)),
416 "J" (offsetof(struct pt_regs, ARM_pc)), 424 "J" (offsetof(struct pt_regs, ARM_pc)),
417 "J" (offsetof(struct pt_regs, ARM_cpsr)) 425 "J" (offsetof(struct pt_regs, ARM_cpsr))
diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
index 5025c863713d..938fc14f962d 100644
--- a/arch/arm/lib/memmove.S
+++ b/arch/arm/lib/memmove.S
@@ -74,7 +74,7 @@ ENTRY(memmove)
74 rsb ip, ip, #32 74 rsb ip, ip, #32
75 addne pc, pc, ip @ C is always clear here 75 addne pc, pc, ip @ C is always clear here
76 b 7f 76 b 7f
776: nop 776: W(nop)
78 W(ldr) r3, [r1, #-4]! 78 W(ldr) r3, [r1, #-4]!
79 W(ldr) r4, [r1, #-4]! 79 W(ldr) r4, [r1, #-4]!
80 W(ldr) r5, [r1, #-4]! 80 W(ldr) r5, [r1, #-4]!
@@ -85,7 +85,7 @@ ENTRY(memmove)
85 85
86 add pc, pc, ip 86 add pc, pc, ip
87 nop 87 nop
88 nop 88 W(nop)
89 W(str) r3, [r0, #-4]! 89 W(str) r3, [r0, #-4]!
90 W(str) r4, [r0, #-4]! 90 W(str) r4, [r0, #-4]!
91 W(str) r5, [r0, #-4]! 91 W(str) r5, [r0, #-4]!
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index c4ed9f93f646..5bd7c89a6045 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -736,6 +736,12 @@ config NEEDS_SYSCALL_FOR_CMPXCHG
736config OUTER_CACHE 736config OUTER_CACHE
737 bool 737 bool
738 738
739config OUTER_CACHE_SYNC
740 bool
741 help
742 The outer cache has a outer_cache_fns.sync function pointer
743 that can be used to drain the write buffer of the outer cache.
744
739config CACHE_FEROCEON_L2 745config CACHE_FEROCEON_L2
740 bool "Enable the Feroceon L2 cache controller" 746 bool "Enable the Feroceon L2 cache controller"
741 depends on ARCH_KIRKWOOD || ARCH_MV78XX0 747 depends on ARCH_KIRKWOOD || ARCH_MV78XX0
@@ -757,6 +763,7 @@ config CACHE_L2X0
757 REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || ARCH_NOMADIK || ARCH_OMAP4 763 REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || ARCH_NOMADIK || ARCH_OMAP4
758 default y 764 default y
759 select OUTER_CACHE 765 select OUTER_CACHE
766 select OUTER_CACHE_SYNC
760 help 767 help
761 This option enables the L2x0 PrimeCell. 768 This option enables the L2x0 PrimeCell.
762 769
@@ -781,3 +788,9 @@ config ARM_L1_CACHE_SHIFT
781 int 788 int
782 default 6 if ARM_L1_CACHE_SHIFT_6 789 default 6 if ARM_L1_CACHE_SHIFT_6
783 default 5 790 default 5
791
792config ARCH_HAS_BARRIERS
793 bool
794 help
795 This option allows the use of custom mandatory barriers
796 included via the mach/barriers.h file.
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 07334632d3e2..21ad68ba22ba 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -93,6 +93,15 @@ static inline void l2x0_flush_line(unsigned long addr)
93} 93}
94#endif 94#endif
95 95
96static void l2x0_cache_sync(void)
97{
98 unsigned long flags;
99
100 spin_lock_irqsave(&l2x0_lock, flags);
101 cache_sync();
102 spin_unlock_irqrestore(&l2x0_lock, flags);
103}
104
96static inline void l2x0_inv_all(void) 105static inline void l2x0_inv_all(void)
97{ 106{
98 unsigned long flags; 107 unsigned long flags;
@@ -225,6 +234,7 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
225 outer_cache.inv_range = l2x0_inv_range; 234 outer_cache.inv_range = l2x0_inv_range;
226 outer_cache.clean_range = l2x0_clean_range; 235 outer_cache.clean_range = l2x0_clean_range;
227 outer_cache.flush_range = l2x0_flush_range; 236 outer_cache.flush_range = l2x0_flush_range;
237 outer_cache.sync = l2x0_cache_sync;
228 238
229 printk(KERN_INFO "L2X0 cache controller enabled\n"); 239 printk(KERN_INFO "L2X0 cache controller enabled\n");
230} 240}
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 7f3f59fcaa21..a420cb949328 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -545,7 +545,7 @@ static int __init vfp_init(void)
545 */ 545 */
546 elf_hwcap |= HWCAP_VFP; 546 elf_hwcap |= HWCAP_VFP;
547#ifdef CONFIG_VFPv3 547#ifdef CONFIG_VFPv3
548 if (VFP_arch >= 3) { 548 if (VFP_arch >= 2) {
549 elf_hwcap |= HWCAP_VFPv3; 549 elf_hwcap |= HWCAP_VFPv3;
550 550
551 /* 551 /*
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 203ec61c6d4c..76818f926539 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -75,9 +75,6 @@ config LOCKDEP_SUPPORT
75config HAVE_LATENCYTOP_SUPPORT 75config HAVE_LATENCYTOP_SUPPORT
76 def_bool y 76 def_bool y
77 77
78config PCI
79 def_bool n
80
81config DTC 78config DTC
82 def_bool y 79 def_bool y
83 80
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 836832dd9b26..72f6e8583746 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -84,7 +84,7 @@ define archhelp
84 echo '* linux.bin - Create raw binary' 84 echo '* linux.bin - Create raw binary'
85 echo ' linux.bin.gz - Create compressed raw binary' 85 echo ' linux.bin.gz - Create compressed raw binary'
86 echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in' 86 echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in'
87 echo ' - stripped elf with fdt blob 87 echo ' - stripped elf with fdt blob'
88 echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob' 88 echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob'
89 echo ' *_defconfig - Select default config from arch/microblaze/configs' 89 echo ' *_defconfig - Select default config from arch/microblaze/configs'
90 echo '' 90 echo ''
@@ -94,3 +94,5 @@ define archhelp
94 echo ' name of a dts file from the arch/microblaze/boot/dts/ directory' 94 echo ' name of a dts file from the arch/microblaze/boot/dts/ directory'
95 echo ' (minus the .dts extension).' 95 echo ' (minus the .dts extension).'
96endef 96endef
97
98MRPROPER_FILES += $(boot)/simpleImage.*
diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
index 902cf9846c3c..57f50c2371c6 100644
--- a/arch/microblaze/boot/Makefile
+++ b/arch/microblaze/boot/Makefile
@@ -23,8 +23,6 @@ $(obj)/system.dtb: $(obj)/$(DTB).dtb
23endif 23endif
24 24
25$(obj)/linux.bin: vmlinux FORCE 25$(obj)/linux.bin: vmlinux FORCE
26 [ -n $(CONFIG_INITRAMFS_SOURCE) ] && [ ! -e $(CONFIG_INITRAMFS_SOURCE) ] && \
27 touch $(CONFIG_INITRAMFS_SOURCE) || echo "No CPIO image"
28 $(call if_changed,objcopy) 26 $(call if_changed,objcopy)
29 $(call if_changed,uimage) 27 $(call if_changed,uimage)
30 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' 28 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
@@ -62,6 +60,4 @@ quiet_cmd_dtc = DTC $@
62$(obj)/%.dtb: $(dtstree)/%.dts FORCE 60$(obj)/%.dtb: $(dtstree)/%.dts FORCE
63 $(call if_changed,dtc) 61 $(call if_changed,dtc)
64 62
65clean-kernel += linux.bin linux.bin.gz simpleImage.* 63clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub
66
67clean-files += *.dtb simpleImage.*.unstrip
diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h
index 563c6b9453f0..8eeb09211ece 100644
--- a/arch/microblaze/include/asm/processor.h
+++ b/arch/microblaze/include/asm/processor.h
@@ -14,7 +14,6 @@
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <asm/setup.h> 15#include <asm/setup.h>
16#include <asm/registers.h> 16#include <asm/registers.h>
17#include <asm/segment.h>
18#include <asm/entry.h> 17#include <asm/entry.h>
19#include <asm/current.h> 18#include <asm/current.h>
20 19
diff --git a/arch/microblaze/include/asm/segment.h b/arch/microblaze/include/asm/segment.h
deleted file mode 100644
index 0e7102c3fb11..000000000000
--- a/arch/microblaze/include/asm/segment.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2008-2009 PetaLogix
4 * Copyright (C) 2006 Atmark Techno, Inc.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _ASM_MICROBLAZE_SEGMENT_H
12#define _ASM_MICROBLAZE_SEGMENT_H
13
14# ifndef __ASSEMBLY__
15
16typedef struct {
17 unsigned long seg;
18} mm_segment_t;
19
20/*
21 * On Microblaze the fs value is actually the top of the corresponding
22 * address space.
23 *
24 * The fs value determines whether argument validity checking should be
25 * performed or not. If get_fs() == USER_DS, checking is performed, with
26 * get_fs() == KERNEL_DS, checking is bypassed.
27 *
28 * For historical reasons, these macros are grossly misnamed.
29 *
30 * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal.
31 */
32# define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
33
34# ifndef CONFIG_MMU
35# define KERNEL_DS MAKE_MM_SEG(0)
36# define USER_DS KERNEL_DS
37# else
38# define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
39# define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
40# endif
41
42# define get_ds() (KERNEL_DS)
43# define get_fs() (current_thread_info()->addr_limit)
44# define set_fs(val) (current_thread_info()->addr_limit = (val))
45
46# define segment_eq(a, b) ((a).seg == (b).seg)
47
48# endif /* __ASSEMBLY__ */
49#endif /* _ASM_MICROBLAZE_SEGMENT_H */
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h
index 6e92885d381a..b2ca80f64640 100644
--- a/arch/microblaze/include/asm/thread_info.h
+++ b/arch/microblaze/include/asm/thread_info.h
@@ -19,7 +19,6 @@
19#ifndef __ASSEMBLY__ 19#ifndef __ASSEMBLY__
20# include <linux/types.h> 20# include <linux/types.h>
21# include <asm/processor.h> 21# include <asm/processor.h>
22# include <asm/segment.h>
23 22
24/* 23/*
25 * low level task data that entry.S needs immediate access to 24 * low level task data that entry.S needs immediate access to
@@ -60,6 +59,10 @@ struct cpu_context {
60 __u32 fsr; 59 __u32 fsr;
61}; 60};
62 61
62typedef struct {
63 unsigned long seg;
64} mm_segment_t;
65
63struct thread_info { 66struct thread_info {
64 struct task_struct *task; /* main task structure */ 67 struct task_struct *task; /* main task structure */
65 struct exec_domain *exec_domain; /* execution domain */ 68 struct exec_domain *exec_domain; /* execution domain */
diff --git a/arch/microblaze/include/asm/tlbflush.h b/arch/microblaze/include/asm/tlbflush.h
index bcb8b41d55af..2e1353c2d18d 100644
--- a/arch/microblaze/include/asm/tlbflush.h
+++ b/arch/microblaze/include/asm/tlbflush.h
@@ -24,6 +24,7 @@ extern void _tlbie(unsigned long address);
24extern void _tlbia(void); 24extern void _tlbia(void);
25 25
26#define __tlbia() { preempt_disable(); _tlbia(); preempt_enable(); } 26#define __tlbia() { preempt_disable(); _tlbia(); preempt_enable(); }
27#define __tlbie(x) { _tlbie(x); }
27 28
28static inline void local_flush_tlb_all(void) 29static inline void local_flush_tlb_all(void)
29 { __tlbia(); } 30 { __tlbia(); }
@@ -31,7 +32,7 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
31 { __tlbia(); } 32 { __tlbia(); }
32static inline void local_flush_tlb_page(struct vm_area_struct *vma, 33static inline void local_flush_tlb_page(struct vm_area_struct *vma,
33 unsigned long vmaddr) 34 unsigned long vmaddr)
34 { _tlbie(vmaddr); } 35 { __tlbie(vmaddr); }
35static inline void local_flush_tlb_range(struct vm_area_struct *vma, 36static inline void local_flush_tlb_range(struct vm_area_struct *vma,
36 unsigned long start, unsigned long end) 37 unsigned long start, unsigned long end)
37 { __tlbia(); } 38 { __tlbia(); }
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 371bd6e56d9a..446bec29b142 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -22,101 +22,73 @@
22#include <asm/mmu.h> 22#include <asm/mmu.h>
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25#include <asm/segment.h>
26#include <linux/string.h> 25#include <linux/string.h>
27 26
28#define VERIFY_READ 0 27#define VERIFY_READ 0
29#define VERIFY_WRITE 1 28#define VERIFY_WRITE 1
30 29
31#define __clear_user(addr, n) (memset((void *)(addr), 0, (n)), 0) 30/*
32 31 * On Microblaze the fs value is actually the top of the corresponding
33#ifndef CONFIG_MMU 32 * address space.
34 33 *
35extern int ___range_ok(unsigned long addr, unsigned long size); 34 * The fs value determines whether argument validity checking should be
36 35 * performed or not. If get_fs() == USER_DS, checking is performed, with
37#define __range_ok(addr, size) \ 36 * get_fs() == KERNEL_DS, checking is bypassed.
38 ___range_ok((unsigned long)(addr), (unsigned long)(size)) 37 *
39 38 * For historical reasons, these macros are grossly misnamed.
40#define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0) 39 *
41#define __access_ok(add, size) (__range_ok((addr), (size)) == 0) 40 * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal.
42 41 */
43/* Undefined function to trigger linker error */ 42# define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
44extern int bad_user_access_length(void);
45
46/* FIXME this is function for optimalization -> memcpy */
47#define __get_user(var, ptr) \
48({ \
49 int __gu_err = 0; \
50 switch (sizeof(*(ptr))) { \
51 case 1: \
52 case 2: \
53 case 4: \
54 (var) = *(ptr); \
55 break; \
56 case 8: \
57 memcpy((void *) &(var), (ptr), 8); \
58 break; \
59 default: \
60 (var) = 0; \
61 __gu_err = __get_user_bad(); \
62 break; \
63 } \
64 __gu_err; \
65})
66 43
67#define __get_user_bad() (bad_user_access_length(), (-EFAULT)) 44# ifndef CONFIG_MMU
45# define KERNEL_DS MAKE_MM_SEG(0)
46# define USER_DS KERNEL_DS
47# else
48# define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
49# define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
50# endif
68 51
69/* FIXME is not there defined __pu_val */ 52# define get_ds() (KERNEL_DS)
70#define __put_user(var, ptr) \ 53# define get_fs() (current_thread_info()->addr_limit)
71({ \ 54# define set_fs(val) (current_thread_info()->addr_limit = (val))
72 int __pu_err = 0; \
73 switch (sizeof(*(ptr))) { \
74 case 1: \
75 case 2: \
76 case 4: \
77 *(ptr) = (var); \
78 break; \
79 case 8: { \
80 typeof(*(ptr)) __pu_val = (var); \
81 memcpy(ptr, &__pu_val, sizeof(__pu_val)); \
82 } \
83 break; \
84 default: \
85 __pu_err = __put_user_bad(); \
86 break; \
87 } \
88 __pu_err; \
89})
90 55
91#define __put_user_bad() (bad_user_access_length(), (-EFAULT)) 56# define segment_eq(a, b) ((a).seg == (b).seg)
92 57
93#define put_user(x, ptr) __put_user((x), (ptr)) 58/*
94#define get_user(x, ptr) __get_user((x), (ptr)) 59 * The exception table consists of pairs of addresses: the first is the
60 * address of an instruction that is allowed to fault, and the second is
61 * the address at which the program should continue. No registers are
62 * modified, so it is entirely up to the continuation code to figure out
63 * what to do.
64 *
65 * All the routines below use bits of fixup code that are out of line
66 * with the main instruction path. This means when everything is well,
67 * we don't even have to jump over them. Further, they do not intrude
68 * on our cache or tlb entries.
69 */
70struct exception_table_entry {
71 unsigned long insn, fixup;
72};
95 73
96#define copy_to_user(to, from, n) (memcpy((to), (from), (n)), 0) 74/* Returns 0 if exception not found and fixup otherwise. */
97#define copy_from_user(to, from, n) (memcpy((to), (from), (n)), 0) 75extern unsigned long search_exception_table(unsigned long);
98 76
99#define __copy_to_user(to, from, n) (copy_to_user((to), (from), (n))) 77#ifndef CONFIG_MMU
100#define __copy_from_user(to, from, n) (copy_from_user((to), (from), (n)))
101#define __copy_to_user_inatomic(to, from, n) \
102 (__copy_to_user((to), (from), (n)))
103#define __copy_from_user_inatomic(to, from, n) \
104 (__copy_from_user((to), (from), (n)))
105 78
106static inline unsigned long clear_user(void *addr, unsigned long size) 79/* Check against bounds of physical memory */
80static inline int ___range_ok(unsigned long addr, unsigned long size)
107{ 81{
108 if (access_ok(VERIFY_WRITE, addr, size)) 82 return ((addr < memory_start) ||
109 size = __clear_user(addr, size); 83 ((addr + size) > memory_end));
110 return size;
111} 84}
112 85
113/* Returns 0 if exception not found and fixup otherwise. */ 86#define __range_ok(addr, size) \
114extern unsigned long search_exception_table(unsigned long); 87 ___range_ok((unsigned long)(addr), (unsigned long)(size))
115 88
116extern long strncpy_from_user(char *dst, const char *src, long count); 89#define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0)
117extern long strnlen_user(const char *src, long count);
118 90
119#else /* CONFIG_MMU */ 91#else
120 92
121/* 93/*
122 * Address is valid if: 94 * Address is valid if:
@@ -129,24 +101,88 @@ extern long strnlen_user(const char *src, long count);
129/* || printk("access_ok failed for %s at 0x%08lx (size %d), seg 0x%08x\n", 101/* || printk("access_ok failed for %s at 0x%08lx (size %d), seg 0x%08x\n",
130 type?"WRITE":"READ",addr,size,get_fs().seg)) */ 102 type?"WRITE":"READ",addr,size,get_fs().seg)) */
131 103
132/* 104#endif
133 * All the __XXX versions macros/functions below do not perform
134 * access checking. It is assumed that the necessary checks have been
135 * already performed before the finction (macro) is called.
136 */
137 105
138#define get_user(x, ptr) \ 106#ifdef CONFIG_MMU
139({ \ 107# define __FIXUP_SECTION ".section .fixup,\"ax\"\n"
140 access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \ 108# define __EX_TABLE_SECTION ".section __ex_table,\"a\"\n"
141 ? __get_user((x), (ptr)) : -EFAULT; \ 109#else
142}) 110# define __FIXUP_SECTION ".section .discard,\"ax\"\n"
111# define __EX_TABLE_SECTION ".section .discard,\"a\"\n"
112#endif
143 113
144#define put_user(x, ptr) \ 114extern unsigned long __copy_tofrom_user(void __user *to,
145({ \ 115 const void __user *from, unsigned long size);
146 access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \ 116
147 ? __put_user((x), (ptr)) : -EFAULT; \ 117/* Return: number of not copied bytes, i.e. 0 if OK or non-zero if fail. */
118static inline unsigned long __must_check __clear_user(void __user *to,
119 unsigned long n)
120{
121 /* normal memset with two words to __ex_table */
122 __asm__ __volatile__ ( \
123 "1: sb r0, %2, r0;" \
124 " addik %0, %0, -1;" \
125 " bneid %0, 1b;" \
126 " addik %2, %2, 1;" \
127 "2: " \
128 __EX_TABLE_SECTION \
129 ".word 1b,2b;" \
130 ".previous;" \
131 : "=r"(n) \
132 : "0"(n), "r"(to)
133 );
134 return n;
135}
136
137static inline unsigned long __must_check clear_user(void __user *to,
138 unsigned long n)
139{
140 might_sleep();
141 if (unlikely(!access_ok(VERIFY_WRITE, to, n)))
142 return n;
143
144 return __clear_user(to, n);
145}
146
147/* put_user and get_user macros */
148extern long __user_bad(void);
149
150#define __get_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \
151({ \
152 __asm__ __volatile__ ( \
153 "1:" insn " %1, %2, r0;" \
154 " addk %0, r0, r0;" \
155 "2: " \
156 __FIXUP_SECTION \
157 "3: brid 2b;" \
158 " addik %0, r0, %3;" \
159 ".previous;" \
160 __EX_TABLE_SECTION \
161 ".word 1b,3b;" \
162 ".previous;" \
163 : "=&r"(__gu_err), "=r"(__gu_val) \
164 : "r"(__gu_ptr), "i"(-EFAULT) \
165 ); \
148}) 166})
149 167
168/**
169 * get_user: - Get a simple variable from user space.
170 * @x: Variable to store result.
171 * @ptr: Source address, in user space.
172 *
173 * Context: User context only. This function may sleep.
174 *
175 * This macro copies a single simple variable from user space to kernel
176 * space. It supports simple types like char and int, but not larger
177 * data types like structures or arrays.
178 *
179 * @ptr must have pointer-to-simple-variable type, and the result of
180 * dereferencing @ptr must be assignable to @x without a cast.
181 *
182 * Returns zero on success, or -EFAULT on error.
183 * On error, the variable @x is set to zero.
184 */
185
150#define __get_user(x, ptr) \ 186#define __get_user(x, ptr) \
151({ \ 187({ \
152 unsigned long __gu_val; \ 188 unsigned long __gu_val; \
@@ -163,30 +199,74 @@ extern long strnlen_user(const char *src, long count);
163 __get_user_asm("lw", (ptr), __gu_val, __gu_err); \ 199 __get_user_asm("lw", (ptr), __gu_val, __gu_err); \
164 break; \ 200 break; \
165 default: \ 201 default: \
166 __gu_val = 0; __gu_err = -EINVAL; \ 202 /* __gu_val = 0; __gu_err = -EINVAL;*/ __gu_err = __user_bad();\
167 } \ 203 } \
168 x = (__typeof__(*(ptr))) __gu_val; \ 204 x = (__typeof__(*(ptr))) __gu_val; \
169 __gu_err; \ 205 __gu_err; \
170}) 206})
171 207
172#define __get_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ 208
209#define get_user(x, ptr) \
173({ \ 210({ \
174 __asm__ __volatile__ ( \ 211 access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \
175 "1:" insn " %1, %2, r0; \ 212 ? __get_user((x), (ptr)) : -EFAULT; \
176 addk %0, r0, r0; \ 213})
177 2: \ 214
178 .section .fixup,\"ax\"; \ 215#define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \
179 3: brid 2b; \ 216({ \
180 addik %0, r0, %3; \ 217 __asm__ __volatile__ ( \
181 .previous; \ 218 "1:" insn " %1, %2, r0;" \
182 .section __ex_table,\"a\"; \ 219 " addk %0, r0, r0;" \
183 .word 1b,3b; \ 220 "2: " \
184 .previous;" \ 221 __FIXUP_SECTION \
185 : "=r"(__gu_err), "=r"(__gu_val) \ 222 "3: brid 2b;" \
186 : "r"(__gu_ptr), "i"(-EFAULT) \ 223 " addik %0, r0, %3;" \
187 ); \ 224 ".previous;" \
225 __EX_TABLE_SECTION \
226 ".word 1b,3b;" \
227 ".previous;" \
228 : "=&r"(__gu_err) \
229 : "r"(__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \
230 ); \
188}) 231})
189 232
233#define __put_user_asm_8(__gu_ptr, __gu_val, __gu_err) \
234({ \
235 __asm__ __volatile__ (" lwi %0, %1, 0;" \
236 "1: swi %0, %2, 0;" \
237 " lwi %0, %1, 4;" \
238 "2: swi %0, %2, 4;" \
239 " addk %0, r0, r0;" \
240 "3: " \
241 __FIXUP_SECTION \
242 "4: brid 3b;" \
243 " addik %0, r0, %3;" \
244 ".previous;" \
245 __EX_TABLE_SECTION \
246 ".word 1b,4b,2b,4b;" \
247 ".previous;" \
248 : "=&r"(__gu_err) \
249 : "r"(&__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \
250 ); \
251})
252
253/**
254 * put_user: - Write a simple value into user space.
255 * @x: Value to copy to user space.
256 * @ptr: Destination address, in user space.
257 *
258 * Context: User context only. This function may sleep.
259 *
260 * This macro copies a single simple value from kernel space to user
261 * space. It supports simple types like char and int, but not larger
262 * data types like structures or arrays.
263 *
264 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
265 * to the result of dereferencing @ptr.
266 *
267 * Returns zero on success, or -EFAULT on error.
268 */
269
190#define __put_user(x, ptr) \ 270#define __put_user(x, ptr) \
191({ \ 271({ \
192 __typeof__(*(ptr)) volatile __gu_val = (x); \ 272 __typeof__(*(ptr)) volatile __gu_val = (x); \
@@ -195,7 +275,7 @@ extern long strnlen_user(const char *src, long count);
195 case 1: \ 275 case 1: \
196 __put_user_asm("sb", (ptr), __gu_val, __gu_err); \ 276 __put_user_asm("sb", (ptr), __gu_val, __gu_err); \
197 break; \ 277 break; \
198 case 2: \ 278 case 2: \
199 __put_user_asm("sh", (ptr), __gu_val, __gu_err); \ 279 __put_user_asm("sh", (ptr), __gu_val, __gu_err); \
200 break; \ 280 break; \
201 case 4: \ 281 case 4: \
@@ -205,121 +285,82 @@ extern long strnlen_user(const char *src, long count);
205 __put_user_asm_8((ptr), __gu_val, __gu_err); \ 285 __put_user_asm_8((ptr), __gu_val, __gu_err); \
206 break; \ 286 break; \
207 default: \ 287 default: \
208 __gu_err = -EINVAL; \ 288 /*__gu_err = -EINVAL;*/ __gu_err = __user_bad(); \
209 } \ 289 } \
210 __gu_err; \ 290 __gu_err; \
211}) 291})
212 292
213#define __put_user_asm_8(__gu_ptr, __gu_val, __gu_err) \ 293#ifndef CONFIG_MMU
214({ \
215__asm__ __volatile__ (" lwi %0, %1, 0; \
216 1: swi %0, %2, 0; \
217 lwi %0, %1, 4; \
218 2: swi %0, %2, 4; \
219 addk %0,r0,r0; \
220 3: \
221 .section .fixup,\"ax\"; \
222 4: brid 3b; \
223 addik %0, r0, %3; \
224 .previous; \
225 .section __ex_table,\"a\"; \
226 .word 1b,4b,2b,4b; \
227 .previous;" \
228 : "=&r"(__gu_err) \
229 : "r"(&__gu_val), \
230 "r"(__gu_ptr), "i"(-EFAULT) \
231 ); \
232})
233 294
234#define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ 295#define put_user(x, ptr) __put_user((x), (ptr))
235({ \
236 __asm__ __volatile__ ( \
237 "1:" insn " %1, %2, r0; \
238 addk %0, r0, r0; \
239 2: \
240 .section .fixup,\"ax\"; \
241 3: brid 2b; \
242 addik %0, r0, %3; \
243 .previous; \
244 .section __ex_table,\"a\"; \
245 .word 1b,3b; \
246 .previous;" \
247 : "=r"(__gu_err) \
248 : "r"(__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \
249 ); \
250})
251 296
252/* 297#else /* CONFIG_MMU */
253 * Return: number of not copied bytes, i.e. 0 if OK or non-zero if fail.
254 */
255static inline int clear_user(char *to, int size)
256{
257 if (size && access_ok(VERIFY_WRITE, to, size)) {
258 __asm__ __volatile__ (" \
259 1: \
260 sb r0, %2, r0; \
261 addik %0, %0, -1; \
262 bneid %0, 1b; \
263 addik %2, %2, 1; \
264 2: \
265 .section __ex_table,\"a\"; \
266 .word 1b,2b; \
267 .section .text;" \
268 : "=r"(size) \
269 : "0"(size), "r"(to)
270 );
271 }
272 return size;
273}
274 298
275#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n)) 299#define put_user(x, ptr) \
300({ \
301 access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \
302 ? __put_user((x), (ptr)) : -EFAULT; \
303})
304#endif /* CONFIG_MMU */
305
306/* copy_to_from_user */
307#define __copy_from_user(to, from, n) \
308 __copy_tofrom_user((__force void __user *)(to), \
309 (void __user *)(from), (n))
276#define __copy_from_user_inatomic(to, from, n) \ 310#define __copy_from_user_inatomic(to, from, n) \
277 copy_from_user((to), (from), (n)) 311 copy_from_user((to), (from), (n))
278 312
279#define copy_to_user(to, from, n) \ 313static inline long copy_from_user(void *to,
280 (access_ok(VERIFY_WRITE, (to), (n)) ? \ 314 const void __user *from, unsigned long n)
281 __copy_tofrom_user((void __user *)(to), \ 315{
282 (__force const void __user *)(from), (n)) \ 316 might_sleep();
283 : -EFAULT) 317 if (access_ok(VERIFY_READ, from, n))
318 return __copy_from_user(to, from, n);
319 return n;
320}
284 321
285#define __copy_to_user(to, from, n) copy_to_user((to), (from), (n)) 322#define __copy_to_user(to, from, n) \
323 __copy_tofrom_user((void __user *)(to), \
324 (__force const void __user *)(from), (n))
286#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n)) 325#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n))
287 326
288#define copy_from_user(to, from, n) \ 327static inline long copy_to_user(void __user *to,
289 (access_ok(VERIFY_READ, (from), (n)) ? \ 328 const void *from, unsigned long n)
290 __copy_tofrom_user((__force void __user *)(to), \ 329{
291 (void __user *)(from), (n)) \ 330 might_sleep();
292 : -EFAULT) 331 if (access_ok(VERIFY_WRITE, to, n))
332 return __copy_to_user(to, from, n);
333 return n;
334}
293 335
336/*
337 * Copy a null terminated string from userspace.
338 */
294extern int __strncpy_user(char *to, const char __user *from, int len); 339extern int __strncpy_user(char *to, const char __user *from, int len);
295extern int __strnlen_user(const char __user *sstr, int len);
296 340
297#define strncpy_from_user(to, from, len) \ 341#define __strncpy_from_user __strncpy_user
298 (access_ok(VERIFY_READ, from, 1) ? \
299 __strncpy_user(to, from, len) : -EFAULT)
300#define strnlen_user(str, len) \
301 (access_ok(VERIFY_READ, str, 1) ? __strnlen_user(str, len) : 0)
302 342
303#endif /* CONFIG_MMU */ 343static inline long
304 344strncpy_from_user(char *dst, const char __user *src, long count)
305extern unsigned long __copy_tofrom_user(void __user *to, 345{
306 const void __user *from, unsigned long size); 346 if (!access_ok(VERIFY_READ, src, 1))
347 return -EFAULT;
348 return __strncpy_from_user(dst, src, count);
349}
307 350
308/* 351/*
309 * The exception table consists of pairs of addresses: the first is the 352 * Return the size of a string (including the ending 0)
310 * address of an instruction that is allowed to fault, and the second is
311 * the address at which the program should continue. No registers are
312 * modified, so it is entirely up to the continuation code to figure out
313 * what to do.
314 * 353 *
315 * All the routines below use bits of fixup code that are out of line 354 * Return 0 on exception, a value greater than N if too long
316 * with the main instruction path. This means when everything is well,
317 * we don't even have to jump over them. Further, they do not intrude
318 * on our cache or tlb entries.
319 */ 355 */
320struct exception_table_entry { 356extern int __strnlen_user(const char __user *sstr, int len);
321 unsigned long insn, fixup; 357
322}; 358static inline long strnlen_user(const char __user *src, long n)
359{
360 if (!access_ok(VERIFY_READ, src, 1))
361 return 0;
362 return __strnlen_user(src, n);
363}
323 364
324#endif /* __ASSEMBLY__ */ 365#endif /* __ASSEMBLY__ */
325#endif /* __KERNEL__ */ 366#endif /* __KERNEL__ */
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 9d69ca4b9635..ce72dd4967cf 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -38,7 +38,7 @@ static inline void __dma_sync_page(unsigned long paddr, unsigned long offset,
38 38
39static unsigned long get_dma_direct_offset(struct device *dev) 39static unsigned long get_dma_direct_offset(struct device *dev)
40{ 40{
41 if (dev) 41 if (likely(dev))
42 return (unsigned long)dev->archdata.dma_data; 42 return (unsigned long)dev->archdata.dma_data;
43 43
44 return PCI_DRAM_OFFSET; /* FIXME Not sure if is correct */ 44 return PCI_DRAM_OFFSET; /* FIXME Not sure if is correct */
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index cb7815cfe5ab..da6a5f5dc766 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -51,6 +51,12 @@ swapper_pg_dir:
51 51
52 .text 52 .text
53ENTRY(_start) 53ENTRY(_start)
54#if CONFIG_KERNEL_BASE_ADDR == 0
55 brai TOPHYS(real_start)
56 .org 0x100
57real_start:
58#endif
59
54 mfs r1, rmsr 60 mfs r1, rmsr
55 andi r1, r1, ~2 61 andi r1, r1, ~2
56 mts rmsr, r1 62 mts rmsr, r1
@@ -99,8 +105,8 @@ no_fdt_arg:
99 tophys(r4,r4) /* convert to phys address */ 105 tophys(r4,r4) /* convert to phys address */
100 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */ 106 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */
101_copy_command_line: 107_copy_command_line:
102 lbu r2, r5, r6 /* r7=r5+r6 - r5 contain pointer to command line */ 108 lbu r2, r5, r6 /* r2=r5+r6 - r5 contain pointer to command line */
103 sb r2, r4, r6 /* addr[r4+r6]= r7*/ 109 sb r2, r4, r6 /* addr[r4+r6]= r2*/
104 addik r6, r6, 1 /* increment counting */ 110 addik r6, r6, 1 /* increment counting */
105 bgtid r3, _copy_command_line /* loop for all entries */ 111 bgtid r3, _copy_command_line /* loop for all entries */
106 addik r3, r3, -1 /* descrement loop */ 112 addik r3, r3, -1 /* descrement loop */
@@ -128,7 +134,7 @@ _copy_bram:
128 * virtual to physical. 134 * virtual to physical.
129 */ 135 */
130 nop 136 nop
131 addik r3, r0, 63 /* Invalidate all TLB entries */ 137 addik r3, r0, MICROBLAZE_TLB_SIZE -1 /* Invalidate all TLB entries */
132_invalidate: 138_invalidate:
133 mts rtlbx, r3 139 mts rtlbx, r3
134 mts rtlbhi, r0 /* flush: ensure V is clear */ 140 mts rtlbhi, r0 /* flush: ensure V is clear */
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index 2b86c03aa841..995a2123635b 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -313,13 +313,13 @@ _hw_exception_handler:
313 mfs r5, rmsr; 313 mfs r5, rmsr;
314 nop 314 nop
315 swi r5, r1, 0; 315 swi r5, r1, 0;
316 mfs r3, resr 316 mfs r4, resr
317 nop 317 nop
318 mfs r4, rear; 318 mfs r3, rear;
319 nop 319 nop
320 320
321#ifndef CONFIG_MMU 321#ifndef CONFIG_MMU
322 andi r5, r3, 0x1000; /* Check ESR[DS] */ 322 andi r5, r4, 0x1000; /* Check ESR[DS] */
323 beqi r5, not_in_delay_slot; /* Branch if ESR[DS] not set */ 323 beqi r5, not_in_delay_slot; /* Branch if ESR[DS] not set */
324 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */ 324 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */
325 nop 325 nop
@@ -327,13 +327,14 @@ not_in_delay_slot:
327 swi r17, r1, PT_R17 327 swi r17, r1, PT_R17
328#endif 328#endif
329 329
330 andi r5, r3, 0x1F; /* Extract ESR[EXC] */ 330 andi r5, r4, 0x1F; /* Extract ESR[EXC] */
331 331
332#ifdef CONFIG_MMU 332#ifdef CONFIG_MMU
333 /* Calculate exception vector offset = r5 << 2 */ 333 /* Calculate exception vector offset = r5 << 2 */
334 addk r6, r5, r5; /* << 1 */ 334 addk r6, r5, r5; /* << 1 */
335 addk r6, r6, r6; /* << 2 */ 335 addk r6, r6, r6; /* << 2 */
336 336
337#ifdef DEBUG
337/* counting which exception happen */ 338/* counting which exception happen */
338 lwi r5, r0, 0x200 + TOPHYS(r0_ram) 339 lwi r5, r0, 0x200 + TOPHYS(r0_ram)
339 addi r5, r5, 1 340 addi r5, r5, 1
@@ -341,6 +342,7 @@ not_in_delay_slot:
341 lwi r5, r6, 0x200 + TOPHYS(r0_ram) 342 lwi r5, r6, 0x200 + TOPHYS(r0_ram)
342 addi r5, r5, 1 343 addi r5, r5, 1
343 swi r5, r6, 0x200 + TOPHYS(r0_ram) 344 swi r5, r6, 0x200 + TOPHYS(r0_ram)
345#endif
344/* end */ 346/* end */
345 /* Load the HW Exception vector */ 347 /* Load the HW Exception vector */
346 lwi r6, r6, TOPHYS(_MB_HW_ExceptionVectorTable) 348 lwi r6, r6, TOPHYS(_MB_HW_ExceptionVectorTable)
@@ -376,7 +378,7 @@ handle_other_ex: /* Handle Other exceptions here */
376 swi r18, r1, PT_R18 378 swi r18, r1, PT_R18
377 379
378 or r5, r1, r0 380 or r5, r1, r0
379 andi r6, r3, 0x1F; /* Load ESR[EC] */ 381 andi r6, r4, 0x1F; /* Load ESR[EC] */
380 lwi r7, r0, PER_CPU(KM) /* MS: saving current kernel mode to regs */ 382 lwi r7, r0, PER_CPU(KM) /* MS: saving current kernel mode to regs */
381 swi r7, r1, PT_MODE 383 swi r7, r1, PT_MODE
382 mfs r7, rfsr 384 mfs r7, rfsr
@@ -426,11 +428,11 @@ handle_other_ex: /* Handle Other exceptions here */
426 */ 428 */
427handle_unaligned_ex: 429handle_unaligned_ex:
428 /* Working registers already saved: R3, R4, R5, R6 430 /* Working registers already saved: R3, R4, R5, R6
429 * R3 = ESR 431 * R4 = ESR
430 * R4 = EAR 432 * R3 = EAR
431 */ 433 */
432#ifdef CONFIG_MMU 434#ifdef CONFIG_MMU
433 andi r6, r3, 0x1000 /* Check ESR[DS] */ 435 andi r6, r4, 0x1000 /* Check ESR[DS] */
434 beqi r6, _no_delayslot /* Branch if ESR[DS] not set */ 436 beqi r6, _no_delayslot /* Branch if ESR[DS] not set */
435 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */ 437 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */
436 nop 438 nop
@@ -439,7 +441,7 @@ _no_delayslot:
439 RESTORE_STATE; 441 RESTORE_STATE;
440 bri unaligned_data_trap 442 bri unaligned_data_trap
441#endif 443#endif
442 andi r6, r3, 0x3E0; /* Mask and extract the register operand */ 444 andi r6, r4, 0x3E0; /* Mask and extract the register operand */
443 srl r6, r6; /* r6 >> 5 */ 445 srl r6, r6; /* r6 >> 5 */
444 srl r6, r6; 446 srl r6, r6;
445 srl r6, r6; 447 srl r6, r6;
@@ -448,33 +450,33 @@ _no_delayslot:
448 /* Store the register operand in a temporary location */ 450 /* Store the register operand in a temporary location */
449 sbi r6, r0, TOPHYS(ex_reg_op); 451 sbi r6, r0, TOPHYS(ex_reg_op);
450 452
451 andi r6, r3, 0x400; /* Extract ESR[S] */ 453 andi r6, r4, 0x400; /* Extract ESR[S] */
452 bnei r6, ex_sw; 454 bnei r6, ex_sw;
453ex_lw: 455ex_lw:
454 andi r6, r3, 0x800; /* Extract ESR[W] */ 456 andi r6, r4, 0x800; /* Extract ESR[W] */
455 beqi r6, ex_lhw; 457 beqi r6, ex_lhw;
456 lbui r5, r4, 0; /* Exception address in r4 */ 458 lbui r5, r3, 0; /* Exception address in r3 */
457 /* Load a word, byte-by-byte from destination address 459 /* Load a word, byte-by-byte from destination address
458 and save it in tmp space */ 460 and save it in tmp space */
459 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0); 461 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);
460 lbui r5, r4, 1; 462 lbui r5, r3, 1;
461 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1); 463 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
462 lbui r5, r4, 2; 464 lbui r5, r3, 2;
463 sbi r5, r0, TOPHYS(ex_tmp_data_loc_2); 465 sbi r5, r0, TOPHYS(ex_tmp_data_loc_2);
464 lbui r5, r4, 3; 466 lbui r5, r3, 3;
465 sbi r5, r0, TOPHYS(ex_tmp_data_loc_3); 467 sbi r5, r0, TOPHYS(ex_tmp_data_loc_3);
466 /* Get the destination register value into r3 */ 468 /* Get the destination register value into r4 */
467 lwi r3, r0, TOPHYS(ex_tmp_data_loc_0); 469 lwi r4, r0, TOPHYS(ex_tmp_data_loc_0);
468 bri ex_lw_tail; 470 bri ex_lw_tail;
469ex_lhw: 471ex_lhw:
470 lbui r5, r4, 0; /* Exception address in r4 */ 472 lbui r5, r3, 0; /* Exception address in r3 */
471 /* Load a half-word, byte-by-byte from destination 473 /* Load a half-word, byte-by-byte from destination
472 address and save it in tmp space */ 474 address and save it in tmp space */
473 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0); 475 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);
474 lbui r5, r4, 1; 476 lbui r5, r3, 1;
475 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1); 477 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
476 /* Get the destination register value into r3 */ 478 /* Get the destination register value into r4 */
477 lhui r3, r0, TOPHYS(ex_tmp_data_loc_0); 479 lhui r4, r0, TOPHYS(ex_tmp_data_loc_0);
478ex_lw_tail: 480ex_lw_tail:
479 /* Get the destination register number into r5 */ 481 /* Get the destination register number into r5 */
480 lbui r5, r0, TOPHYS(ex_reg_op); 482 lbui r5, r0, TOPHYS(ex_reg_op);
@@ -502,25 +504,25 @@ ex_sw_tail:
502 andi r6, r6, 0x800; /* Extract ESR[W] */ 504 andi r6, r6, 0x800; /* Extract ESR[W] */
503 beqi r6, ex_shw; 505 beqi r6, ex_shw;
504 /* Get the word - delay slot */ 506 /* Get the word - delay slot */
505 swi r3, r0, TOPHYS(ex_tmp_data_loc_0); 507 swi r4, r0, TOPHYS(ex_tmp_data_loc_0);
506 /* Store the word, byte-by-byte into destination address */ 508 /* Store the word, byte-by-byte into destination address */
507 lbui r3, r0, TOPHYS(ex_tmp_data_loc_0); 509 lbui r4, r0, TOPHYS(ex_tmp_data_loc_0);
508 sbi r3, r4, 0; 510 sbi r4, r3, 0;
509 lbui r3, r0, TOPHYS(ex_tmp_data_loc_1); 511 lbui r4, r0, TOPHYS(ex_tmp_data_loc_1);
510 sbi r3, r4, 1; 512 sbi r4, r3, 1;
511 lbui r3, r0, TOPHYS(ex_tmp_data_loc_2); 513 lbui r4, r0, TOPHYS(ex_tmp_data_loc_2);
512 sbi r3, r4, 2; 514 sbi r4, r3, 2;
513 lbui r3, r0, TOPHYS(ex_tmp_data_loc_3); 515 lbui r4, r0, TOPHYS(ex_tmp_data_loc_3);
514 sbi r3, r4, 3; 516 sbi r4, r3, 3;
515 bri ex_handler_done; 517 bri ex_handler_done;
516 518
517ex_shw: 519ex_shw:
518 /* Store the lower half-word, byte-by-byte into destination address */ 520 /* Store the lower half-word, byte-by-byte into destination address */
519 swi r3, r0, TOPHYS(ex_tmp_data_loc_0); 521 swi r4, r0, TOPHYS(ex_tmp_data_loc_0);
520 lbui r3, r0, TOPHYS(ex_tmp_data_loc_2); 522 lbui r4, r0, TOPHYS(ex_tmp_data_loc_2);
521 sbi r3, r4, 0; 523 sbi r4, r3, 0;
522 lbui r3, r0, TOPHYS(ex_tmp_data_loc_3); 524 lbui r4, r0, TOPHYS(ex_tmp_data_loc_3);
523 sbi r3, r4, 1; 525 sbi r4, r3, 1;
524ex_sw_end: /* Exception handling of store word, ends. */ 526ex_sw_end: /* Exception handling of store word, ends. */
525 527
526ex_handler_done: 528ex_handler_done:
@@ -560,21 +562,16 @@ ex_handler_done:
560 */ 562 */
561 mfs r11, rpid 563 mfs r11, rpid
562 nop 564 nop
563 bri 4
564 mfs r3, rear /* Get faulting address */
565 nop
566 /* If we are faulting a kernel address, we have to use the 565 /* If we are faulting a kernel address, we have to use the
567 * kernel page tables. 566 * kernel page tables.
568 */ 567 */
569 ori r4, r0, CONFIG_KERNEL_START 568 ori r5, r0, CONFIG_KERNEL_START
570 cmpu r4, r3, r4 569 cmpu r5, r3, r5
571 bgti r4, ex3 570 bgti r5, ex3
572 /* First, check if it was a zone fault (which means a user 571 /* First, check if it was a zone fault (which means a user
573 * tried to access a kernel or read-protected page - always 572 * tried to access a kernel or read-protected page - always
574 * a SEGV). All other faults here must be stores, so no 573 * a SEGV). All other faults here must be stores, so no
575 * need to check ESR_S as well. */ 574 * need to check ESR_S as well. */
576 mfs r4, resr
577 nop
578 andi r4, r4, 0x800 /* ESR_Z - zone protection */ 575 andi r4, r4, 0x800 /* ESR_Z - zone protection */
579 bnei r4, ex2 576 bnei r4, ex2
580 577
@@ -589,8 +586,6 @@ ex_handler_done:
589 * tried to access a kernel or read-protected page - always 586 * tried to access a kernel or read-protected page - always
590 * a SEGV). All other faults here must be stores, so no 587 * a SEGV). All other faults here must be stores, so no
591 * need to check ESR_S as well. */ 588 * need to check ESR_S as well. */
592 mfs r4, resr
593 nop
594 andi r4, r4, 0x800 /* ESR_Z */ 589 andi r4, r4, 0x800 /* ESR_Z */
595 bnei r4, ex2 590 bnei r4, ex2
596 /* get current task address */ 591 /* get current task address */
@@ -665,8 +660,6 @@ ex_handler_done:
665 * R3 = ESR 660 * R3 = ESR
666 */ 661 */
667 662
668 mfs r3, rear /* Get faulting address */
669 nop
670 RESTORE_STATE; 663 RESTORE_STATE;
671 bri page_fault_instr_trap 664 bri page_fault_instr_trap
672 665
@@ -677,18 +670,15 @@ ex_handler_done:
677 */ 670 */
678 handle_data_tlb_miss_exception: 671 handle_data_tlb_miss_exception:
679 /* Working registers already saved: R3, R4, R5, R6 672 /* Working registers already saved: R3, R4, R5, R6
680 * R3 = ESR 673 * R3 = EAR, R4 = ESR
681 */ 674 */
682 mfs r11, rpid 675 mfs r11, rpid
683 nop 676 nop
684 bri 4
685 mfs r3, rear /* Get faulting address */
686 nop
687 677
688 /* If we are faulting a kernel address, we have to use the 678 /* If we are faulting a kernel address, we have to use the
689 * kernel page tables. */ 679 * kernel page tables. */
690 ori r4, r0, CONFIG_KERNEL_START 680 ori r6, r0, CONFIG_KERNEL_START
691 cmpu r4, r3, r4 681 cmpu r4, r3, r6
692 bgti r4, ex5 682 bgti r4, ex5
693 ori r4, r0, swapper_pg_dir 683 ori r4, r0, swapper_pg_dir
694 mts rpid, r0 /* TLB will have 0 TID */ 684 mts rpid, r0 /* TLB will have 0 TID */
@@ -731,9 +721,8 @@ ex_handler_done:
731 * Many of these bits are software only. Bits we don't set 721 * Many of these bits are software only. Bits we don't set
732 * here we (properly should) assume have the appropriate value. 722 * here we (properly should) assume have the appropriate value.
733 */ 723 */
724 brid finish_tlb_load
734 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 725 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
735
736 bri finish_tlb_load
737 ex7: 726 ex7:
738 /* The bailout. Restore registers to pre-exception conditions 727 /* The bailout. Restore registers to pre-exception conditions
739 * and call the heavyweights to help us out. 728 * and call the heavyweights to help us out.
@@ -754,9 +743,6 @@ ex_handler_done:
754 */ 743 */
755 mfs r11, rpid 744 mfs r11, rpid
756 nop 745 nop
757 bri 4
758 mfs r3, rear /* Get faulting address */
759 nop
760 746
761 /* If we are faulting a kernel address, we have to use the 747 /* If we are faulting a kernel address, we have to use the
762 * kernel page tables. 748 * kernel page tables.
@@ -792,7 +778,7 @@ ex_handler_done:
792 lwi r4, r5, 0 /* Get Linux PTE */ 778 lwi r4, r5, 0 /* Get Linux PTE */
793 779
794 andi r6, r4, _PAGE_PRESENT 780 andi r6, r4, _PAGE_PRESENT
795 beqi r6, ex7 781 beqi r6, ex10
796 782
797 ori r4, r4, _PAGE_ACCESSED 783 ori r4, r4, _PAGE_ACCESSED
798 swi r4, r5, 0 784 swi r4, r5, 0
@@ -805,9 +791,8 @@ ex_handler_done:
805 * Many of these bits are software only. Bits we don't set 791 * Many of these bits are software only. Bits we don't set
806 * here we (properly should) assume have the appropriate value. 792 * here we (properly should) assume have the appropriate value.
807 */ 793 */
794 brid finish_tlb_load
808 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 795 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
809
810 bri finish_tlb_load
811 ex10: 796 ex10:
812 /* The bailout. Restore registers to pre-exception conditions 797 /* The bailout. Restore registers to pre-exception conditions
813 * and call the heavyweights to help us out. 798 * and call the heavyweights to help us out.
@@ -837,9 +822,9 @@ ex_handler_done:
837 andi r5, r5, (MICROBLAZE_TLB_SIZE-1) 822 andi r5, r5, (MICROBLAZE_TLB_SIZE-1)
838 ori r6, r0, 1 823 ori r6, r0, 1
839 cmp r31, r5, r6 824 cmp r31, r5, r6
840 blti r31, sem 825 blti r31, ex12
841 addik r5, r6, 1 826 addik r5, r6, 1
842 sem: 827 ex12:
843 /* MS: save back current TLB index */ 828 /* MS: save back current TLB index */
844 swi r5, r0, TOPHYS(tlb_index) 829 swi r5, r0, TOPHYS(tlb_index)
845 830
@@ -859,7 +844,6 @@ ex_handler_done:
859 nop 844 nop
860 845
861 /* Done...restore registers and get out of here. */ 846 /* Done...restore registers and get out of here. */
862 ex12:
863 mts rpid, r11 847 mts rpid, r11
864 nop 848 nop
865 bri 4 849 bri 4
diff --git a/arch/microblaze/kernel/misc.S b/arch/microblaze/kernel/misc.S
index df16c6287a8e..7cf86498326c 100644
--- a/arch/microblaze/kernel/misc.S
+++ b/arch/microblaze/kernel/misc.S
@@ -26,9 +26,10 @@
26 * We avoid flushing the pinned 0, 1 and possibly 2 entries. 26 * We avoid flushing the pinned 0, 1 and possibly 2 entries.
27 */ 27 */
28.globl _tlbia; 28.globl _tlbia;
29.type _tlbia, @function
29.align 4; 30.align 4;
30_tlbia: 31_tlbia:
31 addik r12, r0, 63 /* flush all entries (63 - 3) */ 32 addik r12, r0, MICROBLAZE_TLB_SIZE - 1 /* flush all entries (63 - 3) */
32 /* isync */ 33 /* isync */
33_tlbia_1: 34_tlbia_1:
34 mts rtlbx, r12 35 mts rtlbx, r12
@@ -41,11 +42,13 @@ _tlbia_1:
41 /* sync */ 42 /* sync */
42 rtsd r15, 8 43 rtsd r15, 8
43 nop 44 nop
45 .size _tlbia, . - _tlbia
44 46
45/* 47/*
46 * Flush MMU TLB for a particular address (in r5) 48 * Flush MMU TLB for a particular address (in r5)
47 */ 49 */
48.globl _tlbie; 50.globl _tlbie;
51.type _tlbie, @function
49.align 4; 52.align 4;
50_tlbie: 53_tlbie:
51 mts rtlbsx, r5 /* look up the address in TLB */ 54 mts rtlbsx, r5 /* look up the address in TLB */
@@ -59,17 +62,20 @@ _tlbie_1:
59 rtsd r15, 8 62 rtsd r15, 8
60 nop 63 nop
61 64
65 .size _tlbie, . - _tlbie
66
62/* 67/*
63 * Allocate TLB entry for early console 68 * Allocate TLB entry for early console
64 */ 69 */
65.globl early_console_reg_tlb_alloc; 70.globl early_console_reg_tlb_alloc;
71.type early_console_reg_tlb_alloc, @function
66.align 4; 72.align 4;
67early_console_reg_tlb_alloc: 73early_console_reg_tlb_alloc:
68 /* 74 /*
69 * Load a TLB entry for the UART, so that microblaze_progress() can use 75 * Load a TLB entry for the UART, so that microblaze_progress() can use
70 * the UARTs nice and early. We use a 4k real==virtual mapping. 76 * the UARTs nice and early. We use a 4k real==virtual mapping.
71 */ 77 */
72 ori r4, r0, 63 78 ori r4, r0, MICROBLAZE_TLB_SIZE - 1
73 mts rtlbx, r4 /* TLB slot 2 */ 79 mts rtlbx, r4 /* TLB slot 2 */
74 80
75 or r4,r5,r0 81 or r4,r5,r0
@@ -86,6 +92,8 @@ early_console_reg_tlb_alloc:
86 rtsd r15, 8 92 rtsd r15, 8
87 nop 93 nop
88 94
95 .size early_console_reg_tlb_alloc, . - early_console_reg_tlb_alloc
96
89/* 97/*
90 * Copy a whole page (4096 bytes). 98 * Copy a whole page (4096 bytes).
91 */ 99 */
@@ -104,6 +112,7 @@ early_console_reg_tlb_alloc:
104#define DCACHE_LINE_BYTES (4 * 4) 112#define DCACHE_LINE_BYTES (4 * 4)
105 113
106.globl copy_page; 114.globl copy_page;
115.type copy_page, @function
107.align 4; 116.align 4;
108copy_page: 117copy_page:
109 ori r11, r0, (PAGE_SIZE/DCACHE_LINE_BYTES) - 1 118 ori r11, r0, (PAGE_SIZE/DCACHE_LINE_BYTES) - 1
@@ -118,3 +127,5 @@ _copy_page_loop:
118 addik r11, r11, -1 127 addik r11, r11, -1
119 rtsd r15, 8 128 rtsd r15, 8
120 nop 129 nop
130
131 .size copy_page, . - copy_page
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index 812f1bf06c9e..09bed44dfcd3 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -15,6 +15,7 @@
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
18#include <asm/uaccess.h> /* for USER_DS macros */
18#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
19 20
20void show_regs(struct pt_regs *regs) 21void show_regs(struct pt_regs *regs)
@@ -74,7 +75,10 @@ __setup("hlt", hlt_setup);
74 75
75void default_idle(void) 76void default_idle(void)
76{ 77{
77 if (!hlt_counter) { 78 if (likely(hlt_counter)) {
79 while (!need_resched())
80 cpu_relax();
81 } else {
78 clear_thread_flag(TIF_POLLING_NRFLAG); 82 clear_thread_flag(TIF_POLLING_NRFLAG);
79 smp_mb__after_clear_bit(); 83 smp_mb__after_clear_bit();
80 local_irq_disable(); 84 local_irq_disable();
@@ -82,9 +86,7 @@ void default_idle(void)
82 cpu_sleep(); 86 cpu_sleep();
83 local_irq_enable(); 87 local_irq_enable();
84 set_thread_flag(TIF_POLLING_NRFLAG); 88 set_thread_flag(TIF_POLLING_NRFLAG);
85 } else 89 }
86 while (!need_resched())
87 cpu_relax();
88} 90}
89 91
90void cpu_idle(void) 92void cpu_idle(void)
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index f974ec7aa357..17c98dbcec88 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -92,6 +92,12 @@ inline unsigned get_romfs_len(unsigned *addr)
92} 92}
93#endif /* CONFIG_MTD_UCLINUX_EBSS */ 93#endif /* CONFIG_MTD_UCLINUX_EBSS */
94 94
95#if defined(CONFIG_EARLY_PRINTK) && defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
96#define eprintk early_printk
97#else
98#define eprintk printk
99#endif
100
95void __init machine_early_init(const char *cmdline, unsigned int ram, 101void __init machine_early_init(const char *cmdline, unsigned int ram,
96 unsigned int fdt, unsigned int msr) 102 unsigned int fdt, unsigned int msr)
97{ 103{
@@ -139,32 +145,32 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
139 setup_early_printk(NULL); 145 setup_early_printk(NULL);
140#endif 146#endif
141 147
142 early_printk("Ramdisk addr 0x%08x, ", ram); 148 eprintk("Ramdisk addr 0x%08x, ", ram);
143 if (fdt) 149 if (fdt)
144 early_printk("FDT at 0x%08x\n", fdt); 150 eprintk("FDT at 0x%08x\n", fdt);
145 else 151 else
146 early_printk("Compiled-in FDT at 0x%08x\n", 152 eprintk("Compiled-in FDT at 0x%08x\n",
147 (unsigned int)_fdt_start); 153 (unsigned int)_fdt_start);
148 154
149#ifdef CONFIG_MTD_UCLINUX 155#ifdef CONFIG_MTD_UCLINUX
150 early_printk("Found romfs @ 0x%08x (0x%08x)\n", 156 eprintk("Found romfs @ 0x%08x (0x%08x)\n",
151 romfs_base, romfs_size); 157 romfs_base, romfs_size);
152 early_printk("#### klimit %p ####\n", old_klimit); 158 eprintk("#### klimit %p ####\n", old_klimit);
153 BUG_ON(romfs_size < 0); /* What else can we do? */ 159 BUG_ON(romfs_size < 0); /* What else can we do? */
154 160
155 early_printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", 161 eprintk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n",
156 romfs_size, romfs_base, (unsigned)&_ebss); 162 romfs_size, romfs_base, (unsigned)&_ebss);
157 163
158 early_printk("New klimit: 0x%08x\n", (unsigned)klimit); 164 eprintk("New klimit: 0x%08x\n", (unsigned)klimit);
159#endif 165#endif
160 166
161#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 167#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
162 if (msr) 168 if (msr)
163 early_printk("!!!Your kernel has setup MSR instruction but " 169 eprintk("!!!Your kernel has setup MSR instruction but "
164 "CPU don't have it %d\n", msr); 170 "CPU don't have it %d\n", msr);
165#else 171#else
166 if (!msr) 172 if (!msr)
167 early_printk("!!!Your kernel not setup MSR instruction but " 173 eprintk("!!!Your kernel not setup MSR instruction but "
168 "CPU have it %d\n", msr); 174 "CPU have it %d\n", msr);
169#endif 175#endif
170 176
diff --git a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c
index eaaaf805f31b..5e4570ef515c 100644
--- a/arch/microblaze/kernel/traps.c
+++ b/arch/microblaze/kernel/traps.c
@@ -22,13 +22,11 @@ void trap_init(void)
22 __enable_hw_exceptions(); 22 __enable_hw_exceptions();
23} 23}
24 24
25static int kstack_depth_to_print = 24; 25static unsigned long kstack_depth_to_print = 24;
26 26
27static int __init kstack_setup(char *s) 27static int __init kstack_setup(char *s)
28{ 28{
29 kstack_depth_to_print = strict_strtoul(s, 0, NULL); 29 return !strict_strtoul(s, 0, &kstack_depth_to_print);
30
31 return 1;
32} 30}
33__setup("kstack=", kstack_setup); 31__setup("kstack=", kstack_setup);
34 32
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
index b579db068c06..4dfe47d3cd91 100644
--- a/arch/microblaze/lib/Makefile
+++ b/arch/microblaze/lib/Makefile
@@ -10,5 +10,4 @@ else
10lib-y += memcpy.o memmove.o 10lib-y += memcpy.o memmove.o
11endif 11endif
12 12
13lib-$(CONFIG_NO_MMU) += uaccess.o 13lib-y += uaccess_old.o
14lib-$(CONFIG_MMU) += uaccess_old.o
diff --git a/arch/microblaze/lib/fastcopy.S b/arch/microblaze/lib/fastcopy.S
index 02e3ab4eddf3..fdc48bb065d8 100644
--- a/arch/microblaze/lib/fastcopy.S
+++ b/arch/microblaze/lib/fastcopy.S
@@ -30,8 +30,9 @@
30 */ 30 */
31 31
32#include <linux/linkage.h> 32#include <linux/linkage.h>
33 33 .text
34 .globl memcpy 34 .globl memcpy
35 .type memcpy, @function
35 .ent memcpy 36 .ent memcpy
36 37
37memcpy: 38memcpy:
@@ -345,9 +346,11 @@ a_done:
345 rtsd r15, 8 346 rtsd r15, 8
346 nop 347 nop
347 348
349.size memcpy, . - memcpy
348.end memcpy 350.end memcpy
349/*----------------------------------------------------------------------------*/ 351/*----------------------------------------------------------------------------*/
350 .globl memmove 352 .globl memmove
353 .type memmove, @function
351 .ent memmove 354 .ent memmove
352 355
353memmove: 356memmove:
@@ -659,4 +662,5 @@ d_done:
659 rtsd r15, 8 662 rtsd r15, 8
660 nop 663 nop
661 664
665.size memmove, . - memmove
662.end memmove 666.end memmove
diff --git a/arch/microblaze/lib/memcpy.c b/arch/microblaze/lib/memcpy.c
index cc2108b6b260..014bac92bdff 100644
--- a/arch/microblaze/lib/memcpy.c
+++ b/arch/microblaze/lib/memcpy.c
@@ -53,7 +53,7 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
53 const uint32_t *i_src; 53 const uint32_t *i_src;
54 uint32_t *i_dst; 54 uint32_t *i_dst;
55 55
56 if (c >= 4) { 56 if (likely(c >= 4)) {
57 unsigned value, buf_hold; 57 unsigned value, buf_hold;
58 58
59 /* Align the dstination to a word boundry. */ 59 /* Align the dstination to a word boundry. */
diff --git a/arch/microblaze/lib/memset.c b/arch/microblaze/lib/memset.c
index 4df851d41a29..ecfb663e1fc1 100644
--- a/arch/microblaze/lib/memset.c
+++ b/arch/microblaze/lib/memset.c
@@ -33,22 +33,23 @@
33#ifdef __HAVE_ARCH_MEMSET 33#ifdef __HAVE_ARCH_MEMSET
34void *memset(void *v_src, int c, __kernel_size_t n) 34void *memset(void *v_src, int c, __kernel_size_t n)
35{ 35{
36
37 char *src = v_src; 36 char *src = v_src;
38#ifdef CONFIG_OPT_LIB_FUNCTION 37#ifdef CONFIG_OPT_LIB_FUNCTION
39 uint32_t *i_src; 38 uint32_t *i_src;
40 uint32_t w32; 39 uint32_t w32 = 0;
41#endif 40#endif
42 /* Truncate c to 8 bits */ 41 /* Truncate c to 8 bits */
43 c = (c & 0xFF); 42 c = (c & 0xFF);
44 43
45#ifdef CONFIG_OPT_LIB_FUNCTION 44#ifdef CONFIG_OPT_LIB_FUNCTION
46 /* Make a repeating word out of it */ 45 if (unlikely(c)) {
47 w32 = c; 46 /* Make a repeating word out of it */
48 w32 |= w32 << 8; 47 w32 = c;
49 w32 |= w32 << 16; 48 w32 |= w32 << 8;
49 w32 |= w32 << 16;
50 }
50 51
51 if (n >= 4) { 52 if (likely(n >= 4)) {
52 /* Align the destination to a word boundary */ 53 /* Align the destination to a word boundary */
53 /* This is done in an endian independant manner */ 54 /* This is done in an endian independant manner */
54 switch ((unsigned) src & 3) { 55 switch ((unsigned) src & 3) {
diff --git a/arch/microblaze/lib/uaccess.c b/arch/microblaze/lib/uaccess.c
deleted file mode 100644
index a853fe089c44..000000000000
--- a/arch/microblaze/lib/uaccess.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Copyright (C) 2006 Atmark Techno, Inc.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8
9#include <linux/string.h>
10#include <asm/uaccess.h>
11
12#include <asm/bug.h>
13
14long strnlen_user(const char __user *src, long count)
15{
16 return strlen(src) + 1;
17}
18
19#define __do_strncpy_from_user(dst, src, count, res) \
20 do { \
21 char *tmp; \
22 strncpy(dst, src, count); \
23 for (tmp = dst; *tmp && count > 0; tmp++, count--) \
24 ; \
25 res = (tmp - dst); \
26 } while (0)
27
28long __strncpy_from_user(char *dst, const char __user *src, long count)
29{
30 long res;
31 __do_strncpy_from_user(dst, src, count, res);
32 return res;
33}
34
35long strncpy_from_user(char *dst, const char __user *src, long count)
36{
37 long res = -EFAULT;
38 if (access_ok(VERIFY_READ, src, 1))
39 __do_strncpy_from_user(dst, src, count, res);
40 return res;
41}
42
43unsigned long __copy_tofrom_user(void __user *to,
44 const void __user *from, unsigned long size)
45{
46 memcpy(to, from, size);
47 return 0;
48}
diff --git a/arch/microblaze/lib/uaccess_old.S b/arch/microblaze/lib/uaccess_old.S
index 67f991c14b8a..5810cec54a7a 100644
--- a/arch/microblaze/lib/uaccess_old.S
+++ b/arch/microblaze/lib/uaccess_old.S
@@ -22,6 +22,7 @@
22 22
23 .text 23 .text
24.globl __strncpy_user; 24.globl __strncpy_user;
25.type __strncpy_user, @function
25.align 4; 26.align 4;
26__strncpy_user: 27__strncpy_user:
27 28
@@ -50,7 +51,7 @@ __strncpy_user:
503: 513:
51 rtsd r15,8 52 rtsd r15,8
52 nop 53 nop
53 54 .size __strncpy_user, . - __strncpy_user
54 55
55 .section .fixup, "ax" 56 .section .fixup, "ax"
56 .align 2 57 .align 2
@@ -72,6 +73,7 @@ __strncpy_user:
72 73
73 .text 74 .text
74.globl __strnlen_user; 75.globl __strnlen_user;
76.type __strnlen_user, @function
75.align 4; 77.align 4;
76__strnlen_user: 78__strnlen_user:
77 addik r3,r6,0 79 addik r3,r6,0
@@ -90,7 +92,7 @@ __strnlen_user:
903: 923:
91 rtsd r15,8 93 rtsd r15,8
92 nop 94 nop
93 95 .size __strnlen_user, . - __strnlen_user
94 96
95 .section .fixup,"ax" 97 .section .fixup,"ax"
964: 984:
@@ -108,6 +110,7 @@ __strnlen_user:
108 */ 110 */
109 .text 111 .text
110.globl __copy_tofrom_user; 112.globl __copy_tofrom_user;
113.type __copy_tofrom_user, @function
111.align 4; 114.align 4;
112__copy_tofrom_user: 115__copy_tofrom_user:
113 /* 116 /*
@@ -116,20 +119,34 @@ __copy_tofrom_user:
116 * r7, r3 - count 119 * r7, r3 - count
117 * r4 - tempval 120 * r4 - tempval
118 */ 121 */
119 addik r3,r7,0 122 beqid r7, 3f /* zero size is not likely */
120 beqi r3,3f 123 andi r3, r7, 0x3 /* filter add count */
1211: 124 bneid r3, 4f /* if is odd value then byte copying */
122 lbu r4,r6,r0 125 or r3, r5, r6 /* find if is any to/from unaligned */
123 addik r6,r6,1 126 andi r3, r3, 0x3 /* mask unaligned */
1242: 127 bneid r3, 1f /* it is unaligned -> then jump */
125 sb r4,r5,r0 128 or r3, r0, r0
126 addik r3,r3,-1 129
127 bneid r3,1b 130/* at least one 4 byte copy */
128 addik r5,r5,1 /* delay slot */ 1315: lw r4, r6, r3
1326: sw r4, r5, r3
133 addik r7, r7, -4
134 bneid r7, 5b
135 addik r3, r3, 4
136 addik r3, r7, 0
137 rtsd r15, 8
138 nop
1394: or r3, r0, r0
1401: lbu r4,r6,r3
1412: sb r4,r5,r3
142 addik r7,r7,-1
143 bneid r7,1b
144 addik r3,r3,1 /* delay slot */
1293: 1453:
146 addik r3,r7,0
130 rtsd r15,8 147 rtsd r15,8
131 nop 148 nop
132 149 .size __copy_tofrom_user, . - __copy_tofrom_user
133 150
134 .section __ex_table,"a" 151 .section __ex_table,"a"
135 .word 1b,3b,2b,3b 152 .word 1b,3b,2b,3b,5b,3b,6b,3b
diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c
index d9d249a66ff2..7af87f4b2c2c 100644
--- a/arch/microblaze/mm/fault.c
+++ b/arch/microblaze/mm/fault.c
@@ -106,7 +106,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
106 regs->esr = error_code; 106 regs->esr = error_code;
107 107
108 /* On a kernel SLB miss we can only check for a valid exception entry */ 108 /* On a kernel SLB miss we can only check for a valid exception entry */
109 if (kernel_mode(regs) && (address >= TASK_SIZE)) { 109 if (unlikely(kernel_mode(regs) && (address >= TASK_SIZE))) {
110 printk(KERN_WARNING "kernel task_size exceed"); 110 printk(KERN_WARNING "kernel task_size exceed");
111 _exception(SIGSEGV, regs, code, address); 111 _exception(SIGSEGV, regs, code, address);
112 } 112 }
@@ -122,7 +122,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
122 } 122 }
123#endif /* CONFIG_KGDB */ 123#endif /* CONFIG_KGDB */
124 124
125 if (in_atomic() || !mm) { 125 if (unlikely(in_atomic() || !mm)) {
126 if (kernel_mode(regs)) 126 if (kernel_mode(regs))
127 goto bad_area_nosemaphore; 127 goto bad_area_nosemaphore;
128 128
@@ -150,7 +150,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
150 * source. If this is invalid we can skip the address space check, 150 * source. If this is invalid we can skip the address space check,
151 * thus avoiding the deadlock. 151 * thus avoiding the deadlock.
152 */ 152 */
153 if (!down_read_trylock(&mm->mmap_sem)) { 153 if (unlikely(!down_read_trylock(&mm->mmap_sem))) {
154 if (kernel_mode(regs) && !search_exception_tables(regs->pc)) 154 if (kernel_mode(regs) && !search_exception_tables(regs->pc))
155 goto bad_area_nosemaphore; 155 goto bad_area_nosemaphore;
156 156
@@ -158,16 +158,16 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
158 } 158 }
159 159
160 vma = find_vma(mm, address); 160 vma = find_vma(mm, address);
161 if (!vma) 161 if (unlikely(!vma))
162 goto bad_area; 162 goto bad_area;
163 163
164 if (vma->vm_start <= address) 164 if (vma->vm_start <= address)
165 goto good_area; 165 goto good_area;
166 166
167 if (!(vma->vm_flags & VM_GROWSDOWN)) 167 if (unlikely(!(vma->vm_flags & VM_GROWSDOWN)))
168 goto bad_area; 168 goto bad_area;
169 169
170 if (!is_write) 170 if (unlikely(!is_write))
171 goto bad_area; 171 goto bad_area;
172 172
173 /* 173 /*
@@ -179,7 +179,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
179 * before setting the user r1. Thus we allow the stack to 179 * before setting the user r1. Thus we allow the stack to
180 * expand to 1MB without further checks. 180 * expand to 1MB without further checks.
181 */ 181 */
182 if (address + 0x100000 < vma->vm_end) { 182 if (unlikely(address + 0x100000 < vma->vm_end)) {
183 183
184 /* get user regs even if this fault is in kernel mode */ 184 /* get user regs even if this fault is in kernel mode */
185 struct pt_regs *uregs = current->thread.regs; 185 struct pt_regs *uregs = current->thread.regs;
@@ -209,15 +209,15 @@ good_area:
209 code = SEGV_ACCERR; 209 code = SEGV_ACCERR;
210 210
211 /* a write */ 211 /* a write */
212 if (is_write) { 212 if (unlikely(is_write)) {
213 if (!(vma->vm_flags & VM_WRITE)) 213 if (unlikely(!(vma->vm_flags & VM_WRITE)))
214 goto bad_area; 214 goto bad_area;
215 /* a read */ 215 /* a read */
216 } else { 216 } else {
217 /* protection fault */ 217 /* protection fault */
218 if (error_code & 0x08000000) 218 if (unlikely(error_code & 0x08000000))
219 goto bad_area; 219 goto bad_area;
220 if (!(vma->vm_flags & (VM_READ | VM_EXEC))) 220 if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC))))
221 goto bad_area; 221 goto bad_area;
222 } 222 }
223 223
@@ -235,7 +235,7 @@ survive:
235 goto do_sigbus; 235 goto do_sigbus;
236 BUG(); 236 BUG();
237 } 237 }
238 if (fault & VM_FAULT_MAJOR) 238 if (unlikely(fault & VM_FAULT_MAJOR))
239 current->maj_flt++; 239 current->maj_flt++;
240 else 240 else
241 current->min_flt++; 241 current->min_flt++;
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 77c9e3033e71..f42c2dde8b1c 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -166,7 +166,6 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
166 for (addr = begin; addr < end; addr += PAGE_SIZE) { 166 for (addr = begin; addr < end; addr += PAGE_SIZE) {
167 ClearPageReserved(virt_to_page(addr)); 167 ClearPageReserved(virt_to_page(addr));
168 init_page_count(virt_to_page(addr)); 168 init_page_count(virt_to_page(addr));
169 memset((void *)addr, 0xcc, PAGE_SIZE);
170 free_page(addr); 169 free_page(addr);
171 totalram_pages++; 170 totalram_pages++;
172 } 171 }
@@ -209,14 +208,6 @@ void __init mem_init(void)
209} 208}
210 209
211#ifndef CONFIG_MMU 210#ifndef CONFIG_MMU
212/* Check against bounds of physical memory */
213int ___range_ok(unsigned long addr, unsigned long size)
214{
215 return ((addr < memory_start) ||
216 ((addr + size) > memory_end));
217}
218EXPORT_SYMBOL(___range_ok);
219
220int page_is_ram(unsigned long pfn) 211int page_is_ram(unsigned long pfn)
221{ 212{
222 return __range_ok(pfn, 0); 213 return __range_ok(pfn, 0);
diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c
index 63a6fd07c48f..d31312cde6ea 100644
--- a/arch/microblaze/mm/pgtable.c
+++ b/arch/microblaze/mm/pgtable.c
@@ -154,7 +154,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
154 err = 0; 154 err = 0;
155 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, 155 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT,
156 __pgprot(flags))); 156 __pgprot(flags)));
157 if (mem_init_done) 157 if (unlikely(mem_init_done))
158 flush_HPTE(0, va, pmd_val(*pd)); 158 flush_HPTE(0, va, pmd_val(*pd));
159 /* flush_HPTE(0, va, pg); */ 159 /* flush_HPTE(0, va, pg); */
160 } 160 }
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
index b485a87c94e1..22e507c8a556 100644
--- a/arch/powerpc/kernel/misc.S
+++ b/arch/powerpc/kernel/misc.S
@@ -128,7 +128,6 @@ _GLOBAL(__restore_cpu_power7)
128 /* place holder */ 128 /* place holder */
129 blr 129 blr
130 130
131#ifdef CONFIG_EVENT_TRACING
132/* 131/*
133 * Get a minimal set of registers for our caller's nth caller. 132 * Get a minimal set of registers for our caller's nth caller.
134 * r3 = regs pointer, r5 = n. 133 * r3 = regs pointer, r5 = n.
@@ -154,4 +153,3 @@ _GLOBAL(perf_arch_fetch_caller_regs)
154 PPC_STL r4,_NIP-STACK_FRAME_OVERHEAD(r3) 153 PPC_STL r4,_NIP-STACK_FRAME_OVERHEAD(r3)
155 PPC_STL r7,_LINK-STACK_FRAME_OVERHEAD(r3) 154 PPC_STL r7,_LINK-STACK_FRAME_OVERHEAD(r3)
156 blr 155 blr
157#endif /* CONFIG_EVENT_TRACING */
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index 929d017535a3..d4f8be307cd5 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -481,6 +481,8 @@ mpc52xx_lpbfifo_probe(struct of_device *op, const struct of_device_id *match)
481 if (rc) 481 if (rc)
482 goto err_bcom_rx_irq; 482 goto err_bcom_rx_irq;
483 483
484 lpbfifo.dma_irqs_enabled = 1;
485
484 /* Request the Bestcomm transmit (memory --> fifo) task and IRQ */ 486 /* Request the Bestcomm transmit (memory --> fifo) task and IRQ */
485 lpbfifo.bcom_tx_task = 487 lpbfifo.bcom_tx_task =
486 bcom_gen_bd_tx_init(2, res.start + LPBFIFO_REG_FIFO_DATA, 488 bcom_gen_bd_tx_init(2, res.start + LPBFIFO_REG_FIFO_DATA,
diff --git a/arch/sh/configs/ecovec24_defconfig b/arch/sh/configs/ecovec24_defconfig
index 18e3356406f3..6041c66dd10e 100644
--- a/arch/sh/configs/ecovec24_defconfig
+++ b/arch/sh/configs/ecovec24_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.33-rc2 3# Linux kernel version: 2.6.34-rc2
4# Mon Jan 4 11:20:36 2010 4# Mon Mar 29 02:21:58 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -13,8 +13,8 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
16CONFIG_GENERIC_IRQ_PROBE=y
17CONFIG_IRQ_PER_CPU=y 16CONFIG_IRQ_PER_CPU=y
17CONFIG_SPARSE_IRQ=y
18CONFIG_GENERIC_GPIO=y 18CONFIG_GENERIC_GPIO=y
19CONFIG_GENERIC_TIME=y 19CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
@@ -32,6 +32,7 @@ CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y 34CONFIG_DMA_NONCOHERENT=y
35CONFIG_NEED_DMA_MAP_STATE=y
35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
36CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
37 38
@@ -47,9 +48,11 @@ CONFIG_LOCALVERSION=""
47CONFIG_HAVE_KERNEL_GZIP=y 48CONFIG_HAVE_KERNEL_GZIP=y
48CONFIG_HAVE_KERNEL_BZIP2=y 49CONFIG_HAVE_KERNEL_BZIP2=y
49CONFIG_HAVE_KERNEL_LZMA=y 50CONFIG_HAVE_KERNEL_LZMA=y
51CONFIG_HAVE_KERNEL_LZO=y
50CONFIG_KERNEL_GZIP=y 52CONFIG_KERNEL_GZIP=y
51# CONFIG_KERNEL_BZIP2 is not set 53# CONFIG_KERNEL_BZIP2 is not set
52# CONFIG_KERNEL_LZMA is not set 54# CONFIG_KERNEL_LZMA is not set
55# CONFIG_KERNEL_LZO is not set
53CONFIG_SWAP=y 56CONFIG_SWAP=y
54CONFIG_SYSVIPC=y 57CONFIG_SYSVIPC=y
55CONFIG_SYSVIPC_SYSCTL=y 58CONFIG_SYSVIPC_SYSCTL=y
@@ -71,14 +74,8 @@ CONFIG_RCU_FANOUT=32
71# CONFIG_TREE_RCU_TRACE is not set 74# CONFIG_TREE_RCU_TRACE is not set
72# CONFIG_IKCONFIG is not set 75# CONFIG_IKCONFIG is not set
73CONFIG_LOG_BUF_SHIFT=14 76CONFIG_LOG_BUF_SHIFT=14
74CONFIG_GROUP_SCHED=y
75CONFIG_FAIR_GROUP_SCHED=y
76# CONFIG_RT_GROUP_SCHED is not set
77CONFIG_USER_SCHED=y
78# CONFIG_CGROUP_SCHED is not set
79# CONFIG_CGROUPS is not set 77# CONFIG_CGROUPS is not set
80CONFIG_SYSFS_DEPRECATED=y 78# CONFIG_SYSFS_DEPRECATED_V2 is not set
81CONFIG_SYSFS_DEPRECATED_V2=y
82# CONFIG_RELAY is not set 79# CONFIG_RELAY is not set
83# CONFIG_NAMESPACES is not set 80# CONFIG_NAMESPACES is not set
84# CONFIG_BLK_DEV_INITRD is not set 81# CONFIG_BLK_DEV_INITRD is not set
@@ -107,7 +104,7 @@ CONFIG_PERF_USE_VMALLOC=y
107# 104#
108# Kernel Performance Events And Counters 105# Kernel Performance Events And Counters
109# 106#
110# CONFIG_PERF_EVENTS is not set 107CONFIG_PERF_EVENTS=y
111# CONFIG_PERF_COUNTERS is not set 108# CONFIG_PERF_COUNTERS is not set
112CONFIG_VM_EVENT_COUNTERS=y 109CONFIG_VM_EVENT_COUNTERS=y
113CONFIG_COMPAT_BRK=y 110CONFIG_COMPAT_BRK=y
@@ -116,13 +113,13 @@ CONFIG_SLAB=y
116# CONFIG_SLOB is not set 113# CONFIG_SLOB is not set
117# CONFIG_PROFILING is not set 114# CONFIG_PROFILING is not set
118CONFIG_HAVE_OPROFILE=y 115CONFIG_HAVE_OPROFILE=y
119CONFIG_HAVE_IOREMAP_PROT=y
120CONFIG_HAVE_KPROBES=y 116CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y 117CONFIG_HAVE_KRETPROBES=y
122CONFIG_HAVE_ARCH_TRACEHOOK=y 118CONFIG_HAVE_ARCH_TRACEHOOK=y
123CONFIG_HAVE_DMA_ATTRS=y 119CONFIG_HAVE_DMA_ATTRS=y
124CONFIG_HAVE_CLK=y 120CONFIG_HAVE_CLK=y
125CONFIG_HAVE_DMA_API_DEBUG=y 121CONFIG_HAVE_DMA_API_DEBUG=y
122CONFIG_HAVE_HW_BREAKPOINT=y
126 123
127# 124#
128# GCOV-based kernel profiling 125# GCOV-based kernel profiling
@@ -234,12 +231,12 @@ CONFIG_CPU_SUBTYPE_SH7724=y
234CONFIG_QUICKLIST=y 231CONFIG_QUICKLIST=y
235CONFIG_MMU=y 232CONFIG_MMU=y
236CONFIG_PAGE_OFFSET=0x80000000 233CONFIG_PAGE_OFFSET=0x80000000
237CONFIG_FORCE_MAX_ZONEORDER=11 234CONFIG_FORCE_MAX_ZONEORDER=12
238CONFIG_MEMORY_START=0x08000000 235CONFIG_MEMORY_START=0x08000000
239CONFIG_MEMORY_SIZE=0x10000000 236CONFIG_MEMORY_SIZE=0x10000000
240CONFIG_29BIT=y 237CONFIG_29BIT=y
241# CONFIG_PMB_ENABLE is not set 238# CONFIG_PMB is not set
242# CONFIG_X2TLB is not set 239CONFIG_X2TLB=y
243CONFIG_VSYSCALL=y 240CONFIG_VSYSCALL=y
244CONFIG_ARCH_FLATMEM_ENABLE=y 241CONFIG_ARCH_FLATMEM_ENABLE=y
245CONFIG_ARCH_SPARSEMEM_ENABLE=y 242CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -247,6 +244,8 @@ CONFIG_ARCH_SPARSEMEM_DEFAULT=y
247CONFIG_MAX_ACTIVE_REGIONS=1 244CONFIG_MAX_ACTIVE_REGIONS=1
248CONFIG_ARCH_POPULATES_NODE_MAP=y 245CONFIG_ARCH_POPULATES_NODE_MAP=y
249CONFIG_ARCH_SELECT_MEMORY_MODEL=y 246CONFIG_ARCH_SELECT_MEMORY_MODEL=y
247CONFIG_IOREMAP_FIXED=y
248CONFIG_UNCACHED_MAPPING=y
250CONFIG_PAGE_SIZE_4KB=y 249CONFIG_PAGE_SIZE_4KB=y
251# CONFIG_PAGE_SIZE_8KB is not set 250# CONFIG_PAGE_SIZE_8KB is not set
252# CONFIG_PAGE_SIZE_16KB is not set 251# CONFIG_PAGE_SIZE_16KB is not set
@@ -262,7 +261,7 @@ CONFIG_PAGEFLAGS_EXTENDED=y
262CONFIG_SPLIT_PTLOCK_CPUS=4 261CONFIG_SPLIT_PTLOCK_CPUS=4
263# CONFIG_PHYS_ADDR_T_64BIT is not set 262# CONFIG_PHYS_ADDR_T_64BIT is not set
264CONFIG_ZONE_DMA_FLAG=0 263CONFIG_ZONE_DMA_FLAG=0
265CONFIG_NR_QUICK=2 264CONFIG_NR_QUICK=1
266# CONFIG_KSM is not set 265# CONFIG_KSM is not set
267CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 266CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
268 267
@@ -337,7 +336,6 @@ CONFIG_SECCOMP=y
337# CONFIG_PREEMPT_VOLUNTARY is not set 336# CONFIG_PREEMPT_VOLUNTARY is not set
338CONFIG_PREEMPT=y 337CONFIG_PREEMPT=y
339CONFIG_GUSA=y 338CONFIG_GUSA=y
340# CONFIG_SPARSE_IRQ is not set
341 339
342# 340#
343# Boot options 341# Boot options
@@ -347,7 +345,7 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
347CONFIG_ENTRY_OFFSET=0x00001000 345CONFIG_ENTRY_OFFSET=0x00001000
348CONFIG_CMDLINE_OVERWRITE=y 346CONFIG_CMDLINE_OVERWRITE=y
349# CONFIG_CMDLINE_EXTEND is not set 347# CONFIG_CMDLINE_EXTEND is not set
350CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=120M memchunk.vpu=4m" 348CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=248M memchunk.vpu=8m memchunk.veu0=4m"
351 349
352# 350#
353# Bus options 351# Bus options
@@ -373,6 +371,7 @@ CONFIG_SUSPEND=y
373CONFIG_SUSPEND_FREEZER=y 371CONFIG_SUSPEND_FREEZER=y
374# CONFIG_HIBERNATION is not set 372# CONFIG_HIBERNATION is not set
375CONFIG_PM_RUNTIME=y 373CONFIG_PM_RUNTIME=y
374CONFIG_PM_OPS=y
376# CONFIG_CPU_IDLE is not set 375# CONFIG_CPU_IDLE is not set
377CONFIG_NET=y 376CONFIG_NET=y
378 377
@@ -380,7 +379,6 @@ CONFIG_NET=y
380# Networking options 379# Networking options
381# 380#
382CONFIG_PACKET=y 381CONFIG_PACKET=y
383# CONFIG_PACKET_MMAP is not set
384CONFIG_UNIX=y 382CONFIG_UNIX=y
385# CONFIG_NET_KEY is not set 383# CONFIG_NET_KEY is not set
386CONFIG_INET=y 384CONFIG_INET=y
@@ -445,7 +443,45 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
445# CONFIG_NET_PKTGEN is not set 443# CONFIG_NET_PKTGEN is not set
446# CONFIG_HAMRADIO is not set 444# CONFIG_HAMRADIO is not set
447# CONFIG_CAN is not set 445# CONFIG_CAN is not set
448# CONFIG_IRDA is not set 446CONFIG_IRDA=y
447
448#
449# IrDA protocols
450#
451# CONFIG_IRLAN is not set
452# CONFIG_IRCOMM is not set
453# CONFIG_IRDA_ULTRA is not set
454
455#
456# IrDA options
457#
458# CONFIG_IRDA_CACHE_LAST_LSAP is not set
459# CONFIG_IRDA_FAST_RR is not set
460# CONFIG_IRDA_DEBUG is not set
461
462#
463# Infrared-port device drivers
464#
465
466#
467# SIR device drivers
468#
469# CONFIG_IRTTY_SIR is not set
470
471#
472# Dongle support
473#
474CONFIG_SH_SIR=y
475# CONFIG_KINGSUN_DONGLE is not set
476# CONFIG_KSDAZZLE_DONGLE is not set
477# CONFIG_KS959_DONGLE is not set
478
479#
480# FIR device drivers
481#
482# CONFIG_USB_IRDA is not set
483# CONFIG_SIGMATEL_FIR is not set
484# CONFIG_MCS_FIR is not set
449# CONFIG_BT is not set 485# CONFIG_BT is not set
450# CONFIG_AF_RXRPC is not set 486# CONFIG_AF_RXRPC is not set
451CONFIG_WIRELESS=y 487CONFIG_WIRELESS=y
@@ -556,6 +592,7 @@ CONFIG_MTD_NAND_IDS=y
556# CONFIG_MTD_NAND_NANDSIM is not set 592# CONFIG_MTD_NAND_NANDSIM is not set
557# CONFIG_MTD_NAND_PLATFORM is not set 593# CONFIG_MTD_NAND_PLATFORM is not set
558# CONFIG_MTD_ALAUDA is not set 594# CONFIG_MTD_ALAUDA is not set
595# CONFIG_MTD_NAND_SH_FLCTL is not set
559# CONFIG_MTD_ONENAND is not set 596# CONFIG_MTD_ONENAND is not set
560 597
561# 598#
@@ -597,6 +634,7 @@ CONFIG_MISC_DEVICES=y
597# CONFIG_ICS932S401 is not set 634# CONFIG_ICS932S401 is not set
598# CONFIG_ENCLOSURE_SERVICES is not set 635# CONFIG_ENCLOSURE_SERVICES is not set
599# CONFIG_ISL29003 is not set 636# CONFIG_ISL29003 is not set
637# CONFIG_SENSORS_TSL2550 is not set
600# CONFIG_DS1682 is not set 638# CONFIG_DS1682 is not set
601# CONFIG_TI_DAC7512 is not set 639# CONFIG_TI_DAC7512 is not set
602# CONFIG_C2PORT is not set 640# CONFIG_C2PORT is not set
@@ -616,6 +654,7 @@ CONFIG_HAVE_IDE=y
616# 654#
617# SCSI device support 655# SCSI device support
618# 656#
657CONFIG_SCSI_MOD=y
619# CONFIG_RAID_ATTRS is not set 658# CONFIG_RAID_ATTRS is not set
620CONFIG_SCSI=y 659CONFIG_SCSI=y
621CONFIG_SCSI_DMA=y 660CONFIG_SCSI_DMA=y
@@ -768,7 +807,29 @@ CONFIG_KEYBOARD_SH_KEYSC=y
768# CONFIG_INPUT_MOUSE is not set 807# CONFIG_INPUT_MOUSE is not set
769# CONFIG_INPUT_JOYSTICK is not set 808# CONFIG_INPUT_JOYSTICK is not set
770# CONFIG_INPUT_TABLET is not set 809# CONFIG_INPUT_TABLET is not set
771# CONFIG_INPUT_TOUCHSCREEN is not set 810CONFIG_INPUT_TOUCHSCREEN=y
811# CONFIG_TOUCHSCREEN_ADS7846 is not set
812# CONFIG_TOUCHSCREEN_AD7877 is not set
813# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
814# CONFIG_TOUCHSCREEN_AD7879_SPI is not set
815# CONFIG_TOUCHSCREEN_AD7879 is not set
816# CONFIG_TOUCHSCREEN_DYNAPRO is not set
817# CONFIG_TOUCHSCREEN_EETI is not set
818# CONFIG_TOUCHSCREEN_FUJITSU is not set
819# CONFIG_TOUCHSCREEN_GUNZE is not set
820# CONFIG_TOUCHSCREEN_ELO is not set
821# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
822# CONFIG_TOUCHSCREEN_MCS5000 is not set
823# CONFIG_TOUCHSCREEN_MTOUCH is not set
824# CONFIG_TOUCHSCREEN_INEXIO is not set
825# CONFIG_TOUCHSCREEN_MK712 is not set
826# CONFIG_TOUCHSCREEN_PENMOUNT is not set
827# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
828# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
829# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
830# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
831CONFIG_TOUCHSCREEN_TSC2007=y
832# CONFIG_TOUCHSCREEN_W90X900 is not set
772# CONFIG_INPUT_MISC is not set 833# CONFIG_INPUT_MISC is not set
773 834
774# 835#
@@ -802,10 +863,10 @@ CONFIG_SERIAL_SH_SCI_NR_UARTS=6
802CONFIG_SERIAL_SH_SCI_CONSOLE=y 863CONFIG_SERIAL_SH_SCI_CONSOLE=y
803CONFIG_SERIAL_CORE=y 864CONFIG_SERIAL_CORE=y
804CONFIG_SERIAL_CORE_CONSOLE=y 865CONFIG_SERIAL_CORE_CONSOLE=y
866# CONFIG_SERIAL_TIMBERDALE is not set
805CONFIG_UNIX98_PTYS=y 867CONFIG_UNIX98_PTYS=y
806# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 868# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
807CONFIG_LEGACY_PTYS=y 869# CONFIG_LEGACY_PTYS is not set
808CONFIG_LEGACY_PTY_COUNT=256
809# CONFIG_IPMI_HANDLER is not set 870# CONFIG_IPMI_HANDLER is not set
810CONFIG_HW_RANDOM=y 871CONFIG_HW_RANDOM=y
811# CONFIG_HW_RANDOM_TIMERIOMEM is not set 872# CONFIG_HW_RANDOM_TIMERIOMEM is not set
@@ -830,6 +891,7 @@ CONFIG_I2C_HELPER_AUTO=y
830# CONFIG_I2C_OCORES is not set 891# CONFIG_I2C_OCORES is not set
831CONFIG_I2C_SH_MOBILE=y 892CONFIG_I2C_SH_MOBILE=y
832# CONFIG_I2C_SIMTEC is not set 893# CONFIG_I2C_SIMTEC is not set
894# CONFIG_I2C_XILINX is not set
833 895
834# 896#
835# External I2C/SMBus adapter drivers 897# External I2C/SMBus adapter drivers
@@ -843,15 +905,9 @@ CONFIG_I2C_SH_MOBILE=y
843# 905#
844# CONFIG_I2C_PCA_PLATFORM is not set 906# CONFIG_I2C_PCA_PLATFORM is not set
845# CONFIG_I2C_STUB is not set 907# CONFIG_I2C_STUB is not set
846
847#
848# Miscellaneous I2C Chip support
849#
850# CONFIG_SENSORS_TSL2550 is not set
851# CONFIG_I2C_DEBUG_CORE is not set 908# CONFIG_I2C_DEBUG_CORE is not set
852# CONFIG_I2C_DEBUG_ALGO is not set 909# CONFIG_I2C_DEBUG_ALGO is not set
853# CONFIG_I2C_DEBUG_BUS is not set 910# CONFIG_I2C_DEBUG_BUS is not set
854# CONFIG_I2C_DEBUG_CHIP is not set
855CONFIG_SPI=y 911CONFIG_SPI=y
856CONFIG_SPI_MASTER=y 912CONFIG_SPI_MASTER=y
857 913
@@ -882,13 +938,16 @@ CONFIG_GPIOLIB=y
882# 938#
883# Memory mapped GPIO expanders: 939# Memory mapped GPIO expanders:
884# 940#
941# CONFIG_GPIO_IT8761E is not set
885 942
886# 943#
887# I2C GPIO expanders: 944# I2C GPIO expanders:
888# 945#
946# CONFIG_GPIO_MAX7300 is not set
889# CONFIG_GPIO_MAX732X is not set 947# CONFIG_GPIO_MAX732X is not set
890# CONFIG_GPIO_PCA953X is not set 948# CONFIG_GPIO_PCA953X is not set
891# CONFIG_GPIO_PCF857X is not set 949# CONFIG_GPIO_PCF857X is not set
950# CONFIG_GPIO_ADP5588 is not set
892 951
893# 952#
894# PCI GPIO expanders: 953# PCI GPIO expanders:
@@ -919,23 +978,26 @@ CONFIG_SSB_POSSIBLE=y
919# 978#
920# Multifunction device drivers 979# Multifunction device drivers
921# 980#
922# CONFIG_MFD_CORE is not set 981CONFIG_MFD_CORE=y
982# CONFIG_MFD_88PM860X is not set
923# CONFIG_MFD_SM501 is not set 983# CONFIG_MFD_SM501 is not set
924# CONFIG_MFD_SH_MOBILE_SDHI is not set 984CONFIG_MFD_SH_MOBILE_SDHI=y
925# CONFIG_HTC_PASIC3 is not set 985# CONFIG_HTC_PASIC3 is not set
986# CONFIG_HTC_I2CPLD is not set
926# CONFIG_TPS65010 is not set 987# CONFIG_TPS65010 is not set
927# CONFIG_TWL4030_CORE is not set 988# CONFIG_TWL4030_CORE is not set
928# CONFIG_MFD_TMIO is not set 989# CONFIG_MFD_TMIO is not set
929# CONFIG_PMIC_DA903X is not set 990# CONFIG_PMIC_DA903X is not set
930# CONFIG_PMIC_ADP5520 is not set 991# CONFIG_PMIC_ADP5520 is not set
992# CONFIG_MFD_MAX8925 is not set
931# CONFIG_MFD_WM8400 is not set 993# CONFIG_MFD_WM8400 is not set
932# CONFIG_MFD_WM831X is not set 994# CONFIG_MFD_WM831X is not set
933# CONFIG_MFD_WM8350_I2C is not set 995# CONFIG_MFD_WM8350_I2C is not set
996# CONFIG_MFD_WM8994 is not set
934# CONFIG_MFD_PCF50633 is not set 997# CONFIG_MFD_PCF50633 is not set
935# CONFIG_MFD_MC13783 is not set 998# CONFIG_MFD_MC13783 is not set
936# CONFIG_AB3100_CORE is not set 999# CONFIG_AB3100_CORE is not set
937# CONFIG_EZX_PCAP is not set 1000# CONFIG_EZX_PCAP is not set
938# CONFIG_MFD_88PM8607 is not set
939# CONFIG_AB4500_CORE is not set 1001# CONFIG_AB4500_CORE is not set
940# CONFIG_REGULATOR is not set 1002# CONFIG_REGULATOR is not set
941CONFIG_MEDIA_SUPPORT=y 1003CONFIG_MEDIA_SUPPORT=y
@@ -985,10 +1047,10 @@ CONFIG_SOC_CAMERA=y
985# CONFIG_SOC_CAMERA_MT9M001 is not set 1047# CONFIG_SOC_CAMERA_MT9M001 is not set
986# CONFIG_SOC_CAMERA_MT9M111 is not set 1048# CONFIG_SOC_CAMERA_MT9M111 is not set
987# CONFIG_SOC_CAMERA_MT9T031 is not set 1049# CONFIG_SOC_CAMERA_MT9T031 is not set
988# CONFIG_SOC_CAMERA_MT9T112 is not set 1050CONFIG_SOC_CAMERA_MT9T112=y
989# CONFIG_SOC_CAMERA_MT9V022 is not set 1051# CONFIG_SOC_CAMERA_MT9V022 is not set
990# CONFIG_SOC_CAMERA_RJ54N1 is not set 1052# CONFIG_SOC_CAMERA_RJ54N1 is not set
991# CONFIG_SOC_CAMERA_TW9910 is not set 1053CONFIG_SOC_CAMERA_TW9910=y
992# CONFIG_SOC_CAMERA_PLATFORM is not set 1054# CONFIG_SOC_CAMERA_PLATFORM is not set
993# CONFIG_SOC_CAMERA_OV772X is not set 1055# CONFIG_SOC_CAMERA_OV772X is not set
994# CONFIG_SOC_CAMERA_OV9640 is not set 1056# CONFIG_SOC_CAMERA_OV9640 is not set
@@ -1001,6 +1063,7 @@ CONFIG_RADIO_ADAPTERS=y
1001# CONFIG_RADIO_SI470X is not set 1063# CONFIG_RADIO_SI470X is not set
1002# CONFIG_USB_MR800 is not set 1064# CONFIG_USB_MR800 is not set
1003# CONFIG_RADIO_TEA5764 is not set 1065# CONFIG_RADIO_TEA5764 is not set
1066# CONFIG_RADIO_SAA7706H is not set
1004# CONFIG_RADIO_TEF6862 is not set 1067# CONFIG_RADIO_TEF6862 is not set
1005# CONFIG_DAB is not set 1068# CONFIG_DAB is not set
1006 1069
@@ -1034,6 +1097,7 @@ CONFIG_FB_DEFERRED_IO=y
1034# 1097#
1035# CONFIG_FB_S1D13XXX is not set 1098# CONFIG_FB_S1D13XXX is not set
1036CONFIG_FB_SH_MOBILE_LCDC=y 1099CONFIG_FB_SH_MOBILE_LCDC=y
1100# CONFIG_FB_TMIO is not set
1037# CONFIG_FB_VIRTUAL is not set 1101# CONFIG_FB_VIRTUAL is not set
1038# CONFIG_FB_METRONOME is not set 1102# CONFIG_FB_METRONOME is not set
1039# CONFIG_FB_MB862XX is not set 1103# CONFIG_FB_MB862XX is not set
@@ -1062,7 +1126,46 @@ CONFIG_LOGO=y
1062# CONFIG_LOGO_SUPERH_MONO is not set 1126# CONFIG_LOGO_SUPERH_MONO is not set
1063# CONFIG_LOGO_SUPERH_VGA16 is not set 1127# CONFIG_LOGO_SUPERH_VGA16 is not set
1064CONFIG_LOGO_SUPERH_CLUT224=y 1128CONFIG_LOGO_SUPERH_CLUT224=y
1065# CONFIG_SOUND is not set 1129CONFIG_SOUND=y
1130CONFIG_SOUND_OSS_CORE=y
1131CONFIG_SOUND_OSS_CORE_PRECLAIM=y
1132CONFIG_SND=y
1133CONFIG_SND_TIMER=y
1134CONFIG_SND_PCM=y
1135CONFIG_SND_JACK=y
1136CONFIG_SND_SEQUENCER=y
1137CONFIG_SND_SEQ_DUMMY=y
1138CONFIG_SND_OSSEMUL=y
1139CONFIG_SND_MIXER_OSS=y
1140CONFIG_SND_PCM_OSS=y
1141CONFIG_SND_PCM_OSS_PLUGINS=y
1142# CONFIG_SND_SEQUENCER_OSS is not set
1143# CONFIG_SND_DYNAMIC_MINORS is not set
1144CONFIG_SND_SUPPORT_OLD_API=y
1145CONFIG_SND_VERBOSE_PROCFS=y
1146# CONFIG_SND_VERBOSE_PRINTK is not set
1147# CONFIG_SND_DEBUG is not set
1148# CONFIG_SND_RAWMIDI_SEQ is not set
1149# CONFIG_SND_OPL3_LIB_SEQ is not set
1150# CONFIG_SND_OPL4_LIB_SEQ is not set
1151# CONFIG_SND_SBAWE_SEQ is not set
1152# CONFIG_SND_EMU10K1_SEQ is not set
1153# CONFIG_SND_DRIVERS is not set
1154# CONFIG_SND_SPI is not set
1155CONFIG_SND_SUPERH=y
1156# CONFIG_SND_USB is not set
1157CONFIG_SND_SOC=y
1158
1159#
1160# SoC Audio support for SuperH
1161#
1162CONFIG_SND_SOC_SH4_FSI=y
1163# CONFIG_SND_FSI_AK4642 is not set
1164CONFIG_SND_FSI_DA7210=y
1165CONFIG_SND_SOC_I2C_AND_SPI=y
1166# CONFIG_SND_SOC_ALL_CODECS is not set
1167CONFIG_SND_SOC_DA7210=y
1168# CONFIG_SOUND_PRIME is not set
1066CONFIG_HID_SUPPORT=y 1169CONFIG_HID_SUPPORT=y
1067CONFIG_HID=y 1170CONFIG_HID=y
1068# CONFIG_HIDRAW is not set 1171# CONFIG_HIDRAW is not set
@@ -1077,6 +1180,7 @@ CONFIG_USB_HID=y
1077# 1180#
1078# Special HID drivers 1181# Special HID drivers
1079# 1182#
1183# CONFIG_HID_3M_PCT is not set
1080# CONFIG_HID_A4TECH is not set 1184# CONFIG_HID_A4TECH is not set
1081# CONFIG_HID_APPLE is not set 1185# CONFIG_HID_APPLE is not set
1082# CONFIG_HID_BELKIN is not set 1186# CONFIG_HID_BELKIN is not set
@@ -1091,12 +1195,16 @@ CONFIG_USB_HID=y
1091# CONFIG_HID_KENSINGTON is not set 1195# CONFIG_HID_KENSINGTON is not set
1092# CONFIG_HID_LOGITECH is not set 1196# CONFIG_HID_LOGITECH is not set
1093# CONFIG_HID_MICROSOFT is not set 1197# CONFIG_HID_MICROSOFT is not set
1198# CONFIG_HID_MOSART is not set
1094# CONFIG_HID_MONTEREY is not set 1199# CONFIG_HID_MONTEREY is not set
1095# CONFIG_HID_NTRIG is not set 1200# CONFIG_HID_NTRIG is not set
1201# CONFIG_HID_ORTEK is not set
1096# CONFIG_HID_PANTHERLORD is not set 1202# CONFIG_HID_PANTHERLORD is not set
1097# CONFIG_HID_PETALYNX is not set 1203# CONFIG_HID_PETALYNX is not set
1204# CONFIG_HID_QUANTA is not set
1098# CONFIG_HID_SAMSUNG is not set 1205# CONFIG_HID_SAMSUNG is not set
1099# CONFIG_HID_SONY is not set 1206# CONFIG_HID_SONY is not set
1207# CONFIG_HID_STANTUM is not set
1100# CONFIG_HID_SUNPLUS is not set 1208# CONFIG_HID_SUNPLUS is not set
1101# CONFIG_HID_GREENASIA is not set 1209# CONFIG_HID_GREENASIA is not set
1102# CONFIG_HID_SMARTJOYPLUS is not set 1210# CONFIG_HID_SMARTJOYPLUS is not set
@@ -1136,6 +1244,7 @@ CONFIG_USB_MON=y
1136# CONFIG_USB_SL811_HCD is not set 1244# CONFIG_USB_SL811_HCD is not set
1137CONFIG_USB_R8A66597_HCD=y 1245CONFIG_USB_R8A66597_HCD=y
1138# CONFIG_USB_HWA_HCD is not set 1246# CONFIG_USB_HWA_HCD is not set
1247# CONFIG_USB_GADGET_MUSB_HDRC is not set
1139 1248
1140# 1249#
1141# USB Device Class drivers 1250# USB Device Class drivers
@@ -1188,7 +1297,6 @@ CONFIG_USB_STORAGE=y
1188# CONFIG_USB_RIO500 is not set 1297# CONFIG_USB_RIO500 is not set
1189# CONFIG_USB_LEGOTOWER is not set 1298# CONFIG_USB_LEGOTOWER is not set
1190# CONFIG_USB_LCD is not set 1299# CONFIG_USB_LCD is not set
1191# CONFIG_USB_BERRY_CHARGE is not set
1192# CONFIG_USB_LED is not set 1300# CONFIG_USB_LED is not set
1193# CONFIG_USB_CYPRESS_CY7C63 is not set 1301# CONFIG_USB_CYPRESS_CY7C63 is not set
1194# CONFIG_USB_CYTHERM is not set 1302# CONFIG_USB_CYTHERM is not set
@@ -1200,8 +1308,45 @@ CONFIG_USB_STORAGE=y
1200# CONFIG_USB_IOWARRIOR is not set 1308# CONFIG_USB_IOWARRIOR is not set
1201# CONFIG_USB_TEST is not set 1309# CONFIG_USB_TEST is not set
1202# CONFIG_USB_ISIGHTFW is not set 1310# CONFIG_USB_ISIGHTFW is not set
1203# CONFIG_USB_VST is not set 1311CONFIG_USB_GADGET=y
1204# CONFIG_USB_GADGET is not set 1312# CONFIG_USB_GADGET_DEBUG_FILES is not set
1313# CONFIG_USB_GADGET_DEBUG_FS is not set
1314CONFIG_USB_GADGET_VBUS_DRAW=2
1315CONFIG_USB_GADGET_SELECTED=y
1316# CONFIG_USB_GADGET_AT91 is not set
1317# CONFIG_USB_GADGET_ATMEL_USBA is not set
1318# CONFIG_USB_GADGET_FSL_USB2 is not set
1319# CONFIG_USB_GADGET_LH7A40X is not set
1320# CONFIG_USB_GADGET_OMAP is not set
1321# CONFIG_USB_GADGET_PXA25X is not set
1322CONFIG_USB_GADGET_R8A66597=y
1323CONFIG_USB_R8A66597=y
1324# CONFIG_USB_GADGET_PXA27X is not set
1325# CONFIG_USB_GADGET_S3C_HSOTG is not set
1326# CONFIG_USB_GADGET_IMX is not set
1327# CONFIG_USB_GADGET_S3C2410 is not set
1328# CONFIG_USB_GADGET_M66592 is not set
1329# CONFIG_USB_GADGET_AMD5536UDC is not set
1330# CONFIG_USB_GADGET_FSL_QE is not set
1331# CONFIG_USB_GADGET_CI13XXX is not set
1332# CONFIG_USB_GADGET_NET2280 is not set
1333# CONFIG_USB_GADGET_GOKU is not set
1334# CONFIG_USB_GADGET_LANGWELL is not set
1335# CONFIG_USB_GADGET_DUMMY_HCD is not set
1336CONFIG_USB_GADGET_DUALSPEED=y
1337# CONFIG_USB_ZERO is not set
1338# CONFIG_USB_AUDIO is not set
1339# CONFIG_USB_ETH is not set
1340# CONFIG_USB_GADGETFS is not set
1341CONFIG_USB_FILE_STORAGE=m
1342# CONFIG_USB_FILE_STORAGE_TEST is not set
1343# CONFIG_USB_MASS_STORAGE is not set
1344# CONFIG_USB_G_SERIAL is not set
1345# CONFIG_USB_MIDI_GADGET is not set
1346# CONFIG_USB_G_PRINTER is not set
1347# CONFIG_USB_CDC_COMPOSITE is not set
1348# CONFIG_USB_G_NOKIA is not set
1349# CONFIG_USB_G_MULTI is not set
1205 1350
1206# 1351#
1207# OTG and related infrastructure 1352# OTG and related infrastructure
@@ -1224,10 +1369,8 @@ CONFIG_MMC_BLOCK_BOUNCE=y
1224# MMC/SD/SDIO Host Controller Drivers 1369# MMC/SD/SDIO Host Controller Drivers
1225# 1370#
1226# CONFIG_MMC_SDHCI is not set 1371# CONFIG_MMC_SDHCI is not set
1227# CONFIG_MMC_AT91 is not set
1228# CONFIG_MMC_ATMELMCI is not set
1229CONFIG_MMC_SPI=y 1372CONFIG_MMC_SPI=y
1230# CONFIG_MMC_TMIO is not set 1373CONFIG_MMC_TMIO=y
1231# CONFIG_MEMSTICK is not set 1374# CONFIG_MEMSTICK is not set
1232# CONFIG_NEW_LEDS is not set 1375# CONFIG_NEW_LEDS is not set
1233# CONFIG_ACCESSIBILITY is not set 1376# CONFIG_ACCESSIBILITY is not set
@@ -1253,10 +1396,10 @@ CONFIG_RTC_INTF_DEV=y
1253# CONFIG_RTC_DRV_DS1374 is not set 1396# CONFIG_RTC_DRV_DS1374 is not set
1254# CONFIG_RTC_DRV_DS1672 is not set 1397# CONFIG_RTC_DRV_DS1672 is not set
1255# CONFIG_RTC_DRV_MAX6900 is not set 1398# CONFIG_RTC_DRV_MAX6900 is not set
1256# CONFIG_RTC_DRV_RS5C372 is not set 1399CONFIG_RTC_DRV_RS5C372=y
1257# CONFIG_RTC_DRV_ISL1208 is not set 1400# CONFIG_RTC_DRV_ISL1208 is not set
1258# CONFIG_RTC_DRV_X1205 is not set 1401# CONFIG_RTC_DRV_X1205 is not set
1259CONFIG_RTC_DRV_PCF8563=y 1402# CONFIG_RTC_DRV_PCF8563 is not set
1260# CONFIG_RTC_DRV_PCF8583 is not set 1403# CONFIG_RTC_DRV_PCF8583 is not set
1261# CONFIG_RTC_DRV_M41T80 is not set 1404# CONFIG_RTC_DRV_M41T80 is not set
1262# CONFIG_RTC_DRV_BQ32K is not set 1405# CONFIG_RTC_DRV_BQ32K is not set
@@ -1303,8 +1446,6 @@ CONFIG_RTC_DRV_PCF8563=y
1303CONFIG_UIO=y 1446CONFIG_UIO=y
1304# CONFIG_UIO_PDRV is not set 1447# CONFIG_UIO_PDRV is not set
1305CONFIG_UIO_PDRV_GENIRQ=y 1448CONFIG_UIO_PDRV_GENIRQ=y
1306# CONFIG_UIO_SMX is not set
1307# CONFIG_UIO_SERCOS3 is not set
1308 1449
1309# 1450#
1310# TI VLYNQ 1451# TI VLYNQ
@@ -1390,6 +1531,7 @@ CONFIG_MISC_FILESYSTEMS=y
1390# CONFIG_EFS_FS is not set 1531# CONFIG_EFS_FS is not set
1391# CONFIG_JFFS2_FS is not set 1532# CONFIG_JFFS2_FS is not set
1392# CONFIG_UBIFS_FS is not set 1533# CONFIG_UBIFS_FS is not set
1534# CONFIG_LOGFS is not set
1393# CONFIG_CRAMFS is not set 1535# CONFIG_CRAMFS is not set
1394# CONFIG_SQUASHFS is not set 1536# CONFIG_SQUASHFS is not set
1395# CONFIG_VXFS_FS is not set 1537# CONFIG_VXFS_FS is not set
@@ -1418,6 +1560,7 @@ CONFIG_SUNRPC=y
1418# CONFIG_RPCSEC_GSS_KRB5 is not set 1560# CONFIG_RPCSEC_GSS_KRB5 is not set
1419# CONFIG_RPCSEC_GSS_SPKM3 is not set 1561# CONFIG_RPCSEC_GSS_SPKM3 is not set
1420# CONFIG_SMB_FS is not set 1562# CONFIG_SMB_FS is not set
1563# CONFIG_CEPH_FS is not set
1421# CONFIG_CIFS is not set 1564# CONFIG_CIFS is not set
1422# CONFIG_NCP_FS is not set 1565# CONFIG_NCP_FS is not set
1423# CONFIG_CODA_FS is not set 1566# CONFIG_CODA_FS is not set
@@ -1487,6 +1630,7 @@ CONFIG_DEBUG_FS=y
1487CONFIG_DEBUG_BUGVERBOSE=y 1630CONFIG_DEBUG_BUGVERBOSE=y
1488# CONFIG_DEBUG_MEMORY_INIT is not set 1631# CONFIG_DEBUG_MEMORY_INIT is not set
1489# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1632# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1633# CONFIG_LKDTM is not set
1490# CONFIG_LATENCYTOP is not set 1634# CONFIG_LATENCYTOP is not set
1491CONFIG_SYSCTL_SYSCALL_CHECK=y 1635CONFIG_SYSCTL_SYSCALL_CHECK=y
1492CONFIG_HAVE_FUNCTION_TRACER=y 1636CONFIG_HAVE_FUNCTION_TRACER=y
@@ -1618,7 +1762,7 @@ CONFIG_CRYPTO_HW=y
1618# 1762#
1619CONFIG_BITREVERSE=y 1763CONFIG_BITREVERSE=y
1620CONFIG_GENERIC_FIND_LAST_BIT=y 1764CONFIG_GENERIC_FIND_LAST_BIT=y
1621# CONFIG_CRC_CCITT is not set 1765CONFIG_CRC_CCITT=y
1622# CONFIG_CRC16 is not set 1766# CONFIG_CRC16 is not set
1623CONFIG_CRC_T10DIF=y 1767CONFIG_CRC_T10DIF=y
1624CONFIG_CRC_ITU_T=y 1768CONFIG_CRC_ITU_T=y
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index ac04255022b6..ce830faeebbf 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -211,7 +211,9 @@ extern void __kernel_vsyscall;
211 211
212#define VSYSCALL_AUX_ENT \ 212#define VSYSCALL_AUX_ENT \
213 if (vdso_enabled) \ 213 if (vdso_enabled) \
214 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); 214 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
215 else \
216 NEW_AUX_ENT(AT_IGNORE, 0);
215#else 217#else
216#define VSYSCALL_AUX_ENT 218#define VSYSCALL_AUX_ENT
217#endif /* CONFIG_VSYSCALL */ 219#endif /* CONFIG_VSYSCALL */
@@ -219,7 +221,7 @@ extern void __kernel_vsyscall;
219#ifdef CONFIG_SH_FPU 221#ifdef CONFIG_SH_FPU
220#define FPU_AUX_ENT NEW_AUX_ENT(AT_FPUCW, FPSCR_INIT) 222#define FPU_AUX_ENT NEW_AUX_ENT(AT_FPUCW, FPSCR_INIT)
221#else 223#else
222#define FPU_AUX_ENT 224#define FPU_AUX_ENT NEW_AUX_ENT(AT_IGNORE, 0)
223#endif 225#endif
224 226
225extern int l1i_cache_shape, l1d_cache_shape, l2_cache_shape; 227extern int l1i_cache_shape, l1d_cache_shape, l2_cache_shape;
diff --git a/arch/sh/include/cpu-sh4/cpu/mmu_context.h b/arch/sh/include/cpu-sh4/cpu/mmu_context.h
index 310ec92f2759..5963124c1d4a 100644
--- a/arch/sh/include/cpu-sh4/cpu/mmu_context.h
+++ b/arch/sh/include/cpu-sh4/cpu/mmu_context.h
@@ -30,6 +30,8 @@
30#define MMUCR_URB 0x00FC0000 30#define MMUCR_URB 0x00FC0000
31#define MMUCR_URB_SHIFT 18 31#define MMUCR_URB_SHIFT 18
32#define MMUCR_URB_NENTRIES 64 32#define MMUCR_URB_NENTRIES 64
33#define MMUCR_URC 0x0000FC00
34#define MMUCR_URC_SHIFT 10
33 35
34#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_SUBTYPE_ST40) 36#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_SUBTYPE_ST40)
35#define MMUCR_SE (1 << 4) 37#define MMUCR_SE (1 << 4)
diff --git a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c
index dce4f3ff0932..0fffacea6ed9 100644
--- a/arch/sh/kernel/cpufreq.c
+++ b/arch/sh/kernel/cpufreq.c
@@ -48,7 +48,7 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
48 return -ENODEV; 48 return -ENODEV;
49 49
50 cpus_allowed = current->cpus_allowed; 50 cpus_allowed = current->cpus_allowed;
51 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 51 set_cpus_allowed_ptr(current, cpumask_of(cpu));
52 52
53 BUG_ON(smp_processor_id() != cpu); 53 BUG_ON(smp_processor_id() != cpu);
54 54
@@ -66,7 +66,7 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
66 freqs.flags = 0; 66 freqs.flags = 0;
67 67
68 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 68 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
69 set_cpus_allowed(current, cpus_allowed); 69 set_cpus_allowed_ptr(current, &cpus_allowed);
70 clk_set_rate(cpuclk, freq); 70 clk_set_rate(cpuclk, freq);
71 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 71 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
72 72
diff --git a/arch/sh/kernel/return_address.c b/arch/sh/kernel/return_address.c
index df3ab5811074..cbf1dd5372b2 100644
--- a/arch/sh/kernel/return_address.c
+++ b/arch/sh/kernel/return_address.c
@@ -9,6 +9,7 @@
9 * for more details. 9 * for more details.
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h>
12#include <asm/dwarf.h> 13#include <asm/dwarf.h>
13 14
14#ifdef CONFIG_DWARF_UNWINDER 15#ifdef CONFIG_DWARF_UNWINDER
@@ -52,3 +53,5 @@ void *return_address(unsigned int depth)
52} 53}
53 54
54#endif 55#endif
56
57EXPORT_SYMBOL_GPL(return_address);
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index e124cf7008df..002cc612deef 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -69,6 +69,7 @@ asmlinkage void __cpuinit start_secondary(void)
69 unsigned int cpu; 69 unsigned int cpu;
70 struct mm_struct *mm = &init_mm; 70 struct mm_struct *mm = &init_mm;
71 71
72 enable_mmu();
72 atomic_inc(&mm->mm_count); 73 atomic_inc(&mm->mm_count);
73 atomic_inc(&mm->mm_users); 74 atomic_inc(&mm->mm_users);
74 current->active_mm = mm; 75 current->active_mm = mm;
diff --git a/arch/sh/mm/tlb-pteaex.c b/arch/sh/mm/tlb-pteaex.c
index bdd0982b56ee..b71db6af8060 100644
--- a/arch/sh/mm/tlb-pteaex.c
+++ b/arch/sh/mm/tlb-pteaex.c
@@ -77,3 +77,31 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
77 __raw_writel(asid, MMU_ITLB_ADDRESS_ARRAY2 | MMU_PAGE_ASSOC_BIT); 77 __raw_writel(asid, MMU_ITLB_ADDRESS_ARRAY2 | MMU_PAGE_ASSOC_BIT);
78 back_to_cached(); 78 back_to_cached();
79} 79}
80
81void local_flush_tlb_all(void)
82{
83 unsigned long flags, status;
84 int i;
85
86 /*
87 * Flush all the TLB.
88 */
89 local_irq_save(flags);
90 jump_to_uncached();
91
92 status = __raw_readl(MMUCR);
93 status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT);
94
95 if (status == 0)
96 status = MMUCR_URB_NENTRIES;
97
98 for (i = 0; i < status; i++)
99 __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8));
100
101 for (i = 0; i < 4; i++)
102 __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8));
103
104 back_to_cached();
105 ctrl_barrier();
106 local_irq_restore(flags);
107}
diff --git a/arch/sh/mm/tlb-sh3.c b/arch/sh/mm/tlb-sh3.c
index 4f5f7cbdd508..7a940dbfc2e9 100644
--- a/arch/sh/mm/tlb-sh3.c
+++ b/arch/sh/mm/tlb-sh3.c
@@ -77,3 +77,22 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
77 for (i = 0; i < ways; i++) 77 for (i = 0; i < ways; i++)
78 __raw_writel(data, addr + (i << 8)); 78 __raw_writel(data, addr + (i << 8));
79} 79}
80
81void local_flush_tlb_all(void)
82{
83 unsigned long flags, status;
84
85 /*
86 * Flush all the TLB.
87 *
88 * Write to the MMU control register's bit:
89 * TF-bit for SH-3, TI-bit for SH-4.
90 * It's same position, bit #2.
91 */
92 local_irq_save(flags);
93 status = __raw_readl(MMUCR);
94 status |= 0x04;
95 __raw_writel(status, MMUCR);
96 ctrl_barrier();
97 local_irq_restore(flags);
98}
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c
index ccac77f504a8..cfdf7930d294 100644
--- a/arch/sh/mm/tlb-sh4.c
+++ b/arch/sh/mm/tlb-sh4.c
@@ -80,3 +80,31 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
80 __raw_writel(data, addr); 80 __raw_writel(data, addr);
81 back_to_cached(); 81 back_to_cached();
82} 82}
83
84void local_flush_tlb_all(void)
85{
86 unsigned long flags, status;
87 int i;
88
89 /*
90 * Flush all the TLB.
91 */
92 local_irq_save(flags);
93 jump_to_uncached();
94
95 status = __raw_readl(MMUCR);
96 status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT);
97
98 if (status == 0)
99 status = MMUCR_URB_NENTRIES;
100
101 for (i = 0; i < status; i++)
102 __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8));
103
104 for (i = 0; i < 4; i++)
105 __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8));
106
107 back_to_cached();
108 ctrl_barrier();
109 local_irq_restore(flags);
110}
diff --git a/arch/sh/mm/tlb-urb.c b/arch/sh/mm/tlb-urb.c
index bb5b9098956d..c92ce20db39b 100644
--- a/arch/sh/mm/tlb-urb.c
+++ b/arch/sh/mm/tlb-urb.c
@@ -24,13 +24,9 @@ void tlb_wire_entry(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
24 24
25 local_irq_save(flags); 25 local_irq_save(flags);
26 26
27 /* Load the entry into the TLB */
28 __update_tlb(vma, addr, pte);
29
30 /* ... and wire it up. */
31 status = __raw_readl(MMUCR); 27 status = __raw_readl(MMUCR);
32 urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT; 28 urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT;
33 status &= ~MMUCR_URB; 29 status &= ~MMUCR_URC;
34 30
35 /* 31 /*
36 * Make sure we're not trying to wire the last TLB entry slot. 32 * Make sure we're not trying to wire the last TLB entry slot.
@@ -39,7 +35,23 @@ void tlb_wire_entry(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
39 35
40 urb = urb % MMUCR_URB_NENTRIES; 36 urb = urb % MMUCR_URB_NENTRIES;
41 37
38 /*
39 * Insert this entry into the highest non-wired TLB slot (via
40 * the URC field).
41 */
42 status |= (urb << MMUCR_URC_SHIFT);
43 __raw_writel(status, MMUCR);
44 ctrl_barrier();
45
46 /* Load the entry into the TLB */
47 __update_tlb(vma, addr, pte);
48
49 /* ... and wire it up. */
50 status = __raw_readl(MMUCR);
51
52 status &= ~MMUCR_URB;
42 status |= (urb << MMUCR_URB_SHIFT); 53 status |= (urb << MMUCR_URB_SHIFT);
54
43 __raw_writel(status, MMUCR); 55 __raw_writel(status, MMUCR);
44 ctrl_barrier(); 56 ctrl_barrier();
45 57
diff --git a/arch/sh/mm/tlbflush_32.c b/arch/sh/mm/tlbflush_32.c
index 77dc5efa7127..3fbe03ce8fe3 100644
--- a/arch/sh/mm/tlbflush_32.c
+++ b/arch/sh/mm/tlbflush_32.c
@@ -119,31 +119,3 @@ void local_flush_tlb_mm(struct mm_struct *mm)
119 local_irq_restore(flags); 119 local_irq_restore(flags);
120 } 120 }
121} 121}
122
123void local_flush_tlb_all(void)
124{
125 unsigned long flags, status;
126 int i;
127
128 /*
129 * Flush all the TLB.
130 */
131 local_irq_save(flags);
132 jump_to_uncached();
133
134 status = __raw_readl(MMUCR);
135 status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT);
136
137 if (status == 0)
138 status = MMUCR_URB_NENTRIES;
139
140 for (i = 0; i < status; i++)
141 __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8));
142
143 for (i = 0; i < 4; i++)
144 __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8));
145
146 back_to_cached();
147 ctrl_barrier();
148 local_irq_restore(flags);
149}
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index 56e3163673e3..259e3fd50993 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.33 3# Linux kernel version: 2.6.34-rc3
4# Wed Mar 3 02:54:29 2010 4# Sat Apr 3 15:49:56 2010
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_SPARC=y 7CONFIG_SPARC=y
@@ -23,6 +23,7 @@ CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
23CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y 23CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
25CONFIG_MMU=y 25CONFIG_MMU=y
26CONFIG_NEED_DMA_MAP_STATE=y
26CONFIG_ARCH_NO_VIRT_TO_BUS=y 27CONFIG_ARCH_NO_VIRT_TO_BUS=y
27CONFIG_OF=y 28CONFIG_OF=y
28CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 29CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -439,6 +440,7 @@ CONFIG_MISC_DEVICES=y
439# CONFIG_ENCLOSURE_SERVICES is not set 440# CONFIG_ENCLOSURE_SERVICES is not set
440# CONFIG_HP_ILO is not set 441# CONFIG_HP_ILO is not set
441# CONFIG_ISL29003 is not set 442# CONFIG_ISL29003 is not set
443# CONFIG_SENSORS_TSL2550 is not set
442# CONFIG_DS1682 is not set 444# CONFIG_DS1682 is not set
443# CONFIG_C2PORT is not set 445# CONFIG_C2PORT is not set
444 446
@@ -511,6 +513,7 @@ CONFIG_BLK_DEV_IDEDMA=y
511# 513#
512# SCSI device support 514# SCSI device support
513# 515#
516CONFIG_SCSI_MOD=y
514CONFIG_RAID_ATTRS=m 517CONFIG_RAID_ATTRS=m
515CONFIG_SCSI=y 518CONFIG_SCSI=y
516CONFIG_SCSI_DMA=y 519CONFIG_SCSI_DMA=y
@@ -888,6 +891,7 @@ CONFIG_SERIAL_SUNHV=y
888CONFIG_SERIAL_CORE=y 891CONFIG_SERIAL_CORE=y
889CONFIG_SERIAL_CORE_CONSOLE=y 892CONFIG_SERIAL_CORE_CONSOLE=y
890# CONFIG_SERIAL_JSM is not set 893# CONFIG_SERIAL_JSM is not set
894# CONFIG_SERIAL_TIMBERDALE is not set
891# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set 895# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
892CONFIG_UNIX98_PTYS=y 896CONFIG_UNIX98_PTYS=y
893# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 897# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
@@ -935,6 +939,7 @@ CONFIG_I2C_ALGOBIT=y
935# 939#
936# CONFIG_I2C_OCORES is not set 940# CONFIG_I2C_OCORES is not set
937# CONFIG_I2C_SIMTEC is not set 941# CONFIG_I2C_SIMTEC is not set
942# CONFIG_I2C_XILINX is not set
938 943
939# 944#
940# External I2C/SMBus adapter drivers 945# External I2C/SMBus adapter drivers
@@ -948,15 +953,9 @@ CONFIG_I2C_ALGOBIT=y
948# 953#
949# CONFIG_I2C_PCA_PLATFORM is not set 954# CONFIG_I2C_PCA_PLATFORM is not set
950# CONFIG_I2C_STUB is not set 955# CONFIG_I2C_STUB is not set
951
952#
953# Miscellaneous I2C Chip support
954#
955# CONFIG_SENSORS_TSL2550 is not set
956# CONFIG_I2C_DEBUG_CORE is not set 956# CONFIG_I2C_DEBUG_CORE is not set
957# CONFIG_I2C_DEBUG_ALGO is not set 957# CONFIG_I2C_DEBUG_ALGO is not set
958# CONFIG_I2C_DEBUG_BUS is not set 958# CONFIG_I2C_DEBUG_BUS is not set
959# CONFIG_I2C_DEBUG_CHIP is not set
960# CONFIG_SPI is not set 959# CONFIG_SPI is not set
961 960
962# 961#
@@ -982,10 +981,11 @@ CONFIG_HWMON=y
982# CONFIG_SENSORS_ADM1029 is not set 981# CONFIG_SENSORS_ADM1029 is not set
983# CONFIG_SENSORS_ADM1031 is not set 982# CONFIG_SENSORS_ADM1031 is not set
984# CONFIG_SENSORS_ADM9240 is not set 983# CONFIG_SENSORS_ADM9240 is not set
984# CONFIG_SENSORS_ADT7411 is not set
985# CONFIG_SENSORS_ADT7462 is not set 985# CONFIG_SENSORS_ADT7462 is not set
986# CONFIG_SENSORS_ADT7470 is not set 986# CONFIG_SENSORS_ADT7470 is not set
987# CONFIG_SENSORS_ADT7473 is not set
988# CONFIG_SENSORS_ADT7475 is not set 987# CONFIG_SENSORS_ADT7475 is not set
988# CONFIG_SENSORS_ASC7621 is not set
989# CONFIG_SENSORS_ATXP1 is not set 989# CONFIG_SENSORS_ATXP1 is not set
990# CONFIG_SENSORS_DS1621 is not set 990# CONFIG_SENSORS_DS1621 is not set
991# CONFIG_SENSORS_I5K_AMB is not set 991# CONFIG_SENSORS_I5K_AMB is not set
@@ -1052,18 +1052,21 @@ CONFIG_SSB_POSSIBLE=y
1052# Multifunction device drivers 1052# Multifunction device drivers
1053# 1053#
1054# CONFIG_MFD_CORE is not set 1054# CONFIG_MFD_CORE is not set
1055# CONFIG_MFD_88PM860X is not set
1055# CONFIG_MFD_SM501 is not set 1056# CONFIG_MFD_SM501 is not set
1056# CONFIG_HTC_PASIC3 is not set 1057# CONFIG_HTC_PASIC3 is not set
1057# CONFIG_TWL4030_CORE is not set 1058# CONFIG_TWL4030_CORE is not set
1058# CONFIG_MFD_TMIO is not set 1059# CONFIG_MFD_TMIO is not set
1059# CONFIG_PMIC_DA903X is not set 1060# CONFIG_PMIC_DA903X is not set
1060# CONFIG_PMIC_ADP5520 is not set 1061# CONFIG_PMIC_ADP5520 is not set
1062# CONFIG_MFD_MAX8925 is not set
1061# CONFIG_MFD_WM8400 is not set 1063# CONFIG_MFD_WM8400 is not set
1062# CONFIG_MFD_WM831X is not set 1064# CONFIG_MFD_WM831X is not set
1063# CONFIG_MFD_WM8350_I2C is not set 1065# CONFIG_MFD_WM8350_I2C is not set
1066# CONFIG_MFD_WM8994 is not set
1064# CONFIG_MFD_PCF50633 is not set 1067# CONFIG_MFD_PCF50633 is not set
1065# CONFIG_AB3100_CORE is not set 1068# CONFIG_AB3100_CORE is not set
1066# CONFIG_MFD_88PM8607 is not set 1069# CONFIG_LPC_SCH is not set
1067# CONFIG_REGULATOR is not set 1070# CONFIG_REGULATOR is not set
1068# CONFIG_MEDIA_SUPPORT is not set 1071# CONFIG_MEDIA_SUPPORT is not set
1069 1072
@@ -1113,6 +1116,7 @@ CONFIG_FB_FFB=y
1113# CONFIG_FB_LEO is not set 1116# CONFIG_FB_LEO is not set
1114CONFIG_FB_XVR500=y 1117CONFIG_FB_XVR500=y
1115CONFIG_FB_XVR2500=y 1118CONFIG_FB_XVR2500=y
1119CONFIG_FB_XVR1000=y
1116# CONFIG_FB_S1D13XXX is not set 1120# CONFIG_FB_S1D13XXX is not set
1117# CONFIG_FB_NVIDIA is not set 1121# CONFIG_FB_NVIDIA is not set
1118# CONFIG_FB_RIVA is not set 1122# CONFIG_FB_RIVA is not set
@@ -1430,7 +1434,6 @@ CONFIG_USB_STORAGE=m
1430# CONFIG_USB_RIO500 is not set 1434# CONFIG_USB_RIO500 is not set
1431# CONFIG_USB_LEGOTOWER is not set 1435# CONFIG_USB_LEGOTOWER is not set
1432# CONFIG_USB_LCD is not set 1436# CONFIG_USB_LCD is not set
1433# CONFIG_USB_BERRY_CHARGE is not set
1434# CONFIG_USB_LED is not set 1437# CONFIG_USB_LED is not set
1435# CONFIG_USB_CYPRESS_CY7C63 is not set 1438# CONFIG_USB_CYPRESS_CY7C63 is not set
1436# CONFIG_USB_CYTHERM is not set 1439# CONFIG_USB_CYTHERM is not set
@@ -1443,7 +1446,6 @@ CONFIG_USB_STORAGE=m
1443# CONFIG_USB_IOWARRIOR is not set 1446# CONFIG_USB_IOWARRIOR is not set
1444# CONFIG_USB_TEST is not set 1447# CONFIG_USB_TEST is not set
1445# CONFIG_USB_ISIGHTFW is not set 1448# CONFIG_USB_ISIGHTFW is not set
1446# CONFIG_USB_VST is not set
1447# CONFIG_USB_GADGET is not set 1449# CONFIG_USB_GADGET is not set
1448 1450
1449# 1451#
@@ -1610,6 +1612,7 @@ CONFIG_MISC_FILESYSTEMS=y
1610# CONFIG_BEFS_FS is not set 1612# CONFIG_BEFS_FS is not set
1611# CONFIG_BFS_FS is not set 1613# CONFIG_BFS_FS is not set
1612# CONFIG_EFS_FS is not set 1614# CONFIG_EFS_FS is not set
1615# CONFIG_LOGFS is not set
1613# CONFIG_CRAMFS is not set 1616# CONFIG_CRAMFS is not set
1614# CONFIG_SQUASHFS is not set 1617# CONFIG_SQUASHFS is not set
1615# CONFIG_VXFS_FS is not set 1618# CONFIG_VXFS_FS is not set
@@ -1624,6 +1627,7 @@ CONFIG_NETWORK_FILESYSTEMS=y
1624# CONFIG_NFS_FS is not set 1627# CONFIG_NFS_FS is not set
1625# CONFIG_NFSD is not set 1628# CONFIG_NFSD is not set
1626# CONFIG_SMB_FS is not set 1629# CONFIG_SMB_FS is not set
1630# CONFIG_CEPH_FS is not set
1627# CONFIG_CIFS is not set 1631# CONFIG_CIFS is not set
1628# CONFIG_NCP_FS is not set 1632# CONFIG_NCP_FS is not set
1629# CONFIG_CODA_FS is not set 1633# CONFIG_CODA_FS is not set
diff --git a/arch/sparc/kernel/helpers.S b/arch/sparc/kernel/helpers.S
index 314dd0c9fc5b..92090cc9e829 100644
--- a/arch/sparc/kernel/helpers.S
+++ b/arch/sparc/kernel/helpers.S
@@ -46,6 +46,81 @@ stack_trace_flush:
46 nop 46 nop
47 .size stack_trace_flush,.-stack_trace_flush 47 .size stack_trace_flush,.-stack_trace_flush
48 48
49#ifdef CONFIG_PERF_EVENTS
50 .globl perf_arch_fetch_caller_regs
51 .type perf_arch_fetch_caller_regs,#function
52perf_arch_fetch_caller_regs:
53 /* We always read the %pstate into %o5 since we will use
54 * that to construct a fake %tstate to store into the regs.
55 */
56 rdpr %pstate, %o5
57 brz,pn %o2, 50f
58 mov %o2, %g7
59
60 /* Turn off interrupts while we walk around the register
61 * window by hand.
62 */
63 wrpr %o5, PSTATE_IE, %pstate
64
65 /* The %canrestore tells us how many register windows are
66 * still live in the chip above us, past that we have to
67 * walk the frame as saved on the stack. We stash away
68 * the %cwp in %g1 so we can return back to the original
69 * register window.
70 */
71 rdpr %cwp, %g1
72 rdpr %canrestore, %g2
73 sub %g1, 1, %g3
74
75 /* We have the skip count in %g7, if it hits zero then
76 * %fp/%i7 are the registers we need. Otherwise if our
77 * %canrestore count maintained in %g2 hits zero we have
78 * to start traversing the stack.
79 */
8010: brz,pn %g2, 4f
81 sub %g2, 1, %g2
82 wrpr %g3, %cwp
83 subcc %g7, 1, %g7
84 bne,pt %xcc, 10b
85 sub %g3, 1, %g3
86
87 /* We found the values we need in the cpu's register
88 * windows.
89 */
90 mov %fp, %g3
91 ba,pt %xcc, 3f
92 mov %i7, %g2
93
9450: mov %fp, %g3
95 ba,pt %xcc, 2f
96 mov %i7, %g2
97
98 /* We hit the end of the valid register windows in the
99 * cpu, start traversing the stack frame.
100 */
1014: mov %fp, %g3
102
10320: ldx [%g3 + STACK_BIAS + RW_V9_I7], %g2
104 subcc %g7, 1, %g7
105 bne,pn %xcc, 20b
106 ldx [%g3 + STACK_BIAS + RW_V9_I6], %g3
107
108 /* Restore the current register window position and
109 * re-enable interrupts.
110 */
1113: wrpr %g1, %cwp
112 wrpr %o5, %pstate
113
1142: stx %g3, [%o0 + PT_V9_FP]
115 sllx %o5, 8, %o5
116 stx %o5, [%o0 + PT_V9_TSTATE]
117 stx %g2, [%o0 + PT_V9_TPC]
118 add %g2, 4, %g2
119 retl
120 stx %g2, [%o0 + PT_V9_TNPC]
121 .size perf_arch_fetch_caller_regs,.-perf_arch_fetch_caller_regs
122#endif /* CONFIG_PERF_EVENTS */
123
49#ifdef CONFIG_SMP 124#ifdef CONFIG_SMP
50 .globl hard_smp_processor_id 125 .globl hard_smp_processor_id
51 .type hard_smp_processor_id,#function 126 .type hard_smp_processor_id,#function
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index 7e3dfd9bb97e..e608f397e11f 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -65,6 +65,7 @@ static int genregs32_get(struct task_struct *target,
65 *k++ = regs->u_regs[pos++]; 65 *k++ = regs->u_regs[pos++];
66 66
67 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 67 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
68 reg_window -= 16;
68 for (; count > 0 && pos < 32; count--) { 69 for (; count > 0 && pos < 32; count--) {
69 if (get_user(*k++, &reg_window[pos++])) 70 if (get_user(*k++, &reg_window[pos++]))
70 return -EFAULT; 71 return -EFAULT;
@@ -76,6 +77,7 @@ static int genregs32_get(struct task_struct *target,
76 } 77 }
77 78
78 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 79 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
80 reg_window -= 16;
79 for (; count > 0 && pos < 32; count--) { 81 for (; count > 0 && pos < 32; count--) {
80 if (get_user(reg, &reg_window[pos++]) || 82 if (get_user(reg, &reg_window[pos++]) ||
81 put_user(reg, u++)) 83 put_user(reg, u++))
@@ -141,6 +143,7 @@ static int genregs32_set(struct task_struct *target,
141 regs->u_regs[pos++] = *k++; 143 regs->u_regs[pos++] = *k++;
142 144
143 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 145 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
146 reg_window -= 16;
144 for (; count > 0 && pos < 32; count--) { 147 for (; count > 0 && pos < 32; count--) {
145 if (put_user(*k++, &reg_window[pos++])) 148 if (put_user(*k++, &reg_window[pos++]))
146 return -EFAULT; 149 return -EFAULT;
@@ -153,6 +156,7 @@ static int genregs32_set(struct task_struct *target,
153 } 156 }
154 157
155 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 158 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
159 reg_window -= 16;
156 for (; count > 0 && pos < 32; count--) { 160 for (; count > 0 && pos < 32; count--) {
157 if (get_user(reg, u++) || 161 if (get_user(reg, u++) ||
158 put_user(reg, &reg_window[pos++])) 162 put_user(reg, &reg_window[pos++]))
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index 2f6524d1a817..aa90da08bf61 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -492,6 +492,7 @@ static int genregs32_get(struct task_struct *target,
492 *k++ = regs->u_regs[pos++]; 492 *k++ = regs->u_regs[pos++];
493 493
494 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 494 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
495 reg_window -= 16;
495 if (target == current) { 496 if (target == current) {
496 for (; count > 0 && pos < 32; count--) { 497 for (; count > 0 && pos < 32; count--) {
497 if (get_user(*k++, &reg_window[pos++])) 498 if (get_user(*k++, &reg_window[pos++]))
@@ -516,6 +517,7 @@ static int genregs32_get(struct task_struct *target,
516 } 517 }
517 518
518 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 519 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
520 reg_window -= 16;
519 if (target == current) { 521 if (target == current) {
520 for (; count > 0 && pos < 32; count--) { 522 for (; count > 0 && pos < 32; count--) {
521 if (get_user(reg, &reg_window[pos++]) || 523 if (get_user(reg, &reg_window[pos++]) ||
@@ -599,6 +601,7 @@ static int genregs32_set(struct task_struct *target,
599 regs->u_regs[pos++] = *k++; 601 regs->u_regs[pos++] = *k++;
600 602
601 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 603 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
604 reg_window -= 16;
602 if (target == current) { 605 if (target == current) {
603 for (; count > 0 && pos < 32; count--) { 606 for (; count > 0 && pos < 32; count--) {
604 if (put_user(*k++, &reg_window[pos++])) 607 if (put_user(*k++, &reg_window[pos++]))
@@ -625,6 +628,7 @@ static int genregs32_set(struct task_struct *target,
625 } 628 }
626 629
627 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 630 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
631 reg_window -= 16;
628 if (target == current) { 632 if (target == current) {
629 for (; count > 0 && pos < 32; count--) { 633 for (; count > 0 && pos < 32; count--) {
630 if (get_user(reg, u++) || 634 if (get_user(reg, u++) ||
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index aaebc4815044..b2831dc3c121 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2117,7 +2117,7 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
2117 "node=%d entry=%lu/%lu\n", start, block, nr, 2117 "node=%d entry=%lu/%lu\n", start, block, nr,
2118 node, 2118 node,
2119 addr >> VMEMMAP_CHUNK_SHIFT, 2119 addr >> VMEMMAP_CHUNK_SHIFT,
2120 VMEMMAP_SIZE >> VMEMMAP_CHUNK_SHIFT); 2120 VMEMMAP_SIZE);
2121 } 2121 }
2122 } 2122 }
2123 return 0; 2123 return 0;
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 0316ffe851bd..db5bdc8addf8 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -29,6 +29,7 @@
29#include <asm/apic.h> 29#include <asm/apic.h>
30#include <asm/stacktrace.h> 30#include <asm/stacktrace.h>
31#include <asm/nmi.h> 31#include <asm/nmi.h>
32#include <asm/compat.h>
32 33
33static u64 perf_event_mask __read_mostly; 34static u64 perf_event_mask __read_mostly;
34 35
@@ -159,7 +160,7 @@ struct x86_pmu {
159 struct perf_event *event); 160 struct perf_event *event);
160 struct event_constraint *event_constraints; 161 struct event_constraint *event_constraints;
161 162
162 void (*cpu_prepare)(int cpu); 163 int (*cpu_prepare)(int cpu);
163 void (*cpu_starting)(int cpu); 164 void (*cpu_starting)(int cpu);
164 void (*cpu_dying)(int cpu); 165 void (*cpu_dying)(int cpu);
165 void (*cpu_dead)(int cpu); 166 void (*cpu_dead)(int cpu);
@@ -1334,11 +1335,12 @@ static int __cpuinit
1334x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 1335x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1335{ 1336{
1336 unsigned int cpu = (long)hcpu; 1337 unsigned int cpu = (long)hcpu;
1338 int ret = NOTIFY_OK;
1337 1339
1338 switch (action & ~CPU_TASKS_FROZEN) { 1340 switch (action & ~CPU_TASKS_FROZEN) {
1339 case CPU_UP_PREPARE: 1341 case CPU_UP_PREPARE:
1340 if (x86_pmu.cpu_prepare) 1342 if (x86_pmu.cpu_prepare)
1341 x86_pmu.cpu_prepare(cpu); 1343 ret = x86_pmu.cpu_prepare(cpu);
1342 break; 1344 break;
1343 1345
1344 case CPU_STARTING: 1346 case CPU_STARTING:
@@ -1351,6 +1353,7 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1351 x86_pmu.cpu_dying(cpu); 1353 x86_pmu.cpu_dying(cpu);
1352 break; 1354 break;
1353 1355
1356 case CPU_UP_CANCELED:
1354 case CPU_DEAD: 1357 case CPU_DEAD:
1355 if (x86_pmu.cpu_dead) 1358 if (x86_pmu.cpu_dead)
1356 x86_pmu.cpu_dead(cpu); 1359 x86_pmu.cpu_dead(cpu);
@@ -1360,7 +1363,7 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1360 break; 1363 break;
1361 } 1364 }
1362 1365
1363 return NOTIFY_OK; 1366 return ret;
1364} 1367}
1365 1368
1366static void __init pmu_check_apic(void) 1369static void __init pmu_check_apic(void)
@@ -1629,14 +1632,42 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
1629 return len; 1632 return len;
1630} 1633}
1631 1634
1632static int copy_stack_frame(const void __user *fp, struct stack_frame *frame) 1635#ifdef CONFIG_COMPAT
1636static inline int
1637perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
1633{ 1638{
1634 unsigned long bytes; 1639 /* 32-bit process in 64-bit kernel. */
1640 struct stack_frame_ia32 frame;
1641 const void __user *fp;
1635 1642
1636 bytes = copy_from_user_nmi(frame, fp, sizeof(*frame)); 1643 if (!test_thread_flag(TIF_IA32))
1644 return 0;
1645
1646 fp = compat_ptr(regs->bp);
1647 while (entry->nr < PERF_MAX_STACK_DEPTH) {
1648 unsigned long bytes;
1649 frame.next_frame = 0;
1650 frame.return_address = 0;
1651
1652 bytes = copy_from_user_nmi(&frame, fp, sizeof(frame));
1653 if (bytes != sizeof(frame))
1654 break;
1655
1656 if (fp < compat_ptr(regs->sp))
1657 break;
1637 1658
1638 return bytes == sizeof(*frame); 1659 callchain_store(entry, frame.return_address);
1660 fp = compat_ptr(frame.next_frame);
1661 }
1662 return 1;
1663}
1664#else
1665static inline int
1666perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
1667{
1668 return 0;
1639} 1669}
1670#endif
1640 1671
1641static void 1672static void
1642perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry) 1673perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
@@ -1652,11 +1683,16 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
1652 callchain_store(entry, PERF_CONTEXT_USER); 1683 callchain_store(entry, PERF_CONTEXT_USER);
1653 callchain_store(entry, regs->ip); 1684 callchain_store(entry, regs->ip);
1654 1685
1686 if (perf_callchain_user32(regs, entry))
1687 return;
1688
1655 while (entry->nr < PERF_MAX_STACK_DEPTH) { 1689 while (entry->nr < PERF_MAX_STACK_DEPTH) {
1690 unsigned long bytes;
1656 frame.next_frame = NULL; 1691 frame.next_frame = NULL;
1657 frame.return_address = 0; 1692 frame.return_address = 0;
1658 1693
1659 if (!copy_stack_frame(fp, &frame)) 1694 bytes = copy_from_user_nmi(&frame, fp, sizeof(frame));
1695 if (bytes != sizeof(frame))
1660 break; 1696 break;
1661 1697
1662 if ((unsigned long)fp < regs->sp) 1698 if ((unsigned long)fp < regs->sp)
@@ -1703,7 +1739,6 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
1703 return entry; 1739 return entry;
1704} 1740}
1705 1741
1706#ifdef CONFIG_EVENT_TRACING
1707void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip) 1742void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip)
1708{ 1743{
1709 regs->ip = ip; 1744 regs->ip = ip;
@@ -1715,4 +1750,3 @@ void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int ski
1715 regs->cs = __KERNEL_CS; 1750 regs->cs = __KERNEL_CS;
1716 local_save_flags(regs->flags); 1751 local_save_flags(regs->flags);
1717} 1752}
1718#endif
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index b87e0b6970cb..db6f7d4056e1 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -137,6 +137,13 @@ static inline int amd_is_nb_event(struct hw_perf_event *hwc)
137 return (hwc->config & 0xe0) == 0xe0; 137 return (hwc->config & 0xe0) == 0xe0;
138} 138}
139 139
140static inline int amd_has_nb(struct cpu_hw_events *cpuc)
141{
142 struct amd_nb *nb = cpuc->amd_nb;
143
144 return nb && nb->nb_id != -1;
145}
146
140static void amd_put_event_constraints(struct cpu_hw_events *cpuc, 147static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
141 struct perf_event *event) 148 struct perf_event *event)
142{ 149{
@@ -147,7 +154,7 @@ static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
147 /* 154 /*
148 * only care about NB events 155 * only care about NB events
149 */ 156 */
150 if (!(nb && amd_is_nb_event(hwc))) 157 if (!(amd_has_nb(cpuc) && amd_is_nb_event(hwc)))
151 return; 158 return;
152 159
153 /* 160 /*
@@ -214,7 +221,7 @@ amd_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
214 /* 221 /*
215 * if not NB event or no NB, then no constraints 222 * if not NB event or no NB, then no constraints
216 */ 223 */
217 if (!(nb && amd_is_nb_event(hwc))) 224 if (!(amd_has_nb(cpuc) && amd_is_nb_event(hwc)))
218 return &unconstrained; 225 return &unconstrained;
219 226
220 /* 227 /*
@@ -293,51 +300,55 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
293 return nb; 300 return nb;
294} 301}
295 302
296static void amd_pmu_cpu_online(int cpu) 303static int amd_pmu_cpu_prepare(int cpu)
304{
305 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
306
307 WARN_ON_ONCE(cpuc->amd_nb);
308
309 if (boot_cpu_data.x86_max_cores < 2)
310 return NOTIFY_OK;
311
312 cpuc->amd_nb = amd_alloc_nb(cpu, -1);
313 if (!cpuc->amd_nb)
314 return NOTIFY_BAD;
315
316 return NOTIFY_OK;
317}
318
319static void amd_pmu_cpu_starting(int cpu)
297{ 320{
298 struct cpu_hw_events *cpu1, *cpu2; 321 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
299 struct amd_nb *nb = NULL; 322 struct amd_nb *nb;
300 int i, nb_id; 323 int i, nb_id;
301 324
302 if (boot_cpu_data.x86_max_cores < 2) 325 if (boot_cpu_data.x86_max_cores < 2)
303 return; 326 return;
304 327
305 /*
306 * function may be called too early in the
307 * boot process, in which case nb_id is bogus
308 */
309 nb_id = amd_get_nb_id(cpu); 328 nb_id = amd_get_nb_id(cpu);
310 if (nb_id == BAD_APICID) 329 WARN_ON_ONCE(nb_id == BAD_APICID);
311 return;
312
313 cpu1 = &per_cpu(cpu_hw_events, cpu);
314 cpu1->amd_nb = NULL;
315 330
316 raw_spin_lock(&amd_nb_lock); 331 raw_spin_lock(&amd_nb_lock);
317 332
318 for_each_online_cpu(i) { 333 for_each_online_cpu(i) {
319 cpu2 = &per_cpu(cpu_hw_events, i); 334 nb = per_cpu(cpu_hw_events, i).amd_nb;
320 nb = cpu2->amd_nb; 335 if (WARN_ON_ONCE(!nb))
321 if (!nb)
322 continue; 336 continue;
323 if (nb->nb_id == nb_id)
324 goto found;
325 }
326 337
327 nb = amd_alloc_nb(cpu, nb_id); 338 if (nb->nb_id == nb_id) {
328 if (!nb) { 339 kfree(cpuc->amd_nb);
329 pr_err("perf_events: failed NB allocation for CPU%d\n", cpu); 340 cpuc->amd_nb = nb;
330 raw_spin_unlock(&amd_nb_lock); 341 break;
331 return; 342 }
332 } 343 }
333found: 344
334 nb->refcnt++; 345 cpuc->amd_nb->nb_id = nb_id;
335 cpu1->amd_nb = nb; 346 cpuc->amd_nb->refcnt++;
336 347
337 raw_spin_unlock(&amd_nb_lock); 348 raw_spin_unlock(&amd_nb_lock);
338} 349}
339 350
340static void amd_pmu_cpu_offline(int cpu) 351static void amd_pmu_cpu_dead(int cpu)
341{ 352{
342 struct cpu_hw_events *cpuhw; 353 struct cpu_hw_events *cpuhw;
343 354
@@ -349,8 +360,10 @@ static void amd_pmu_cpu_offline(int cpu)
349 raw_spin_lock(&amd_nb_lock); 360 raw_spin_lock(&amd_nb_lock);
350 361
351 if (cpuhw->amd_nb) { 362 if (cpuhw->amd_nb) {
352 if (--cpuhw->amd_nb->refcnt == 0) 363 struct amd_nb *nb = cpuhw->amd_nb;
353 kfree(cpuhw->amd_nb); 364
365 if (nb->nb_id == -1 || --nb->refcnt == 0)
366 kfree(nb);
354 367
355 cpuhw->amd_nb = NULL; 368 cpuhw->amd_nb = NULL;
356 } 369 }
@@ -379,8 +392,9 @@ static __initconst struct x86_pmu amd_pmu = {
379 .get_event_constraints = amd_get_event_constraints, 392 .get_event_constraints = amd_get_event_constraints,
380 .put_event_constraints = amd_put_event_constraints, 393 .put_event_constraints = amd_put_event_constraints,
381 394
382 .cpu_prepare = amd_pmu_cpu_online, 395 .cpu_prepare = amd_pmu_cpu_prepare,
383 .cpu_dead = amd_pmu_cpu_offline, 396 .cpu_starting = amd_pmu_cpu_starting,
397 .cpu_dead = amd_pmu_cpu_dead,
384}; 398};
385 399
386static __init int amd_pmu_init(void) 400static __init int amd_pmu_init(void)
diff --git a/arch/x86/kernel/dumpstack.h b/arch/x86/kernel/dumpstack.h
index 29e5f7c845b2..e39e77168a37 100644
--- a/arch/x86/kernel/dumpstack.h
+++ b/arch/x86/kernel/dumpstack.h
@@ -30,6 +30,11 @@ struct stack_frame {
30 unsigned long return_address; 30 unsigned long return_address;
31}; 31};
32 32
33struct stack_frame_ia32 {
34 u32 next_frame;
35 u32 return_address;
36};
37
33static inline unsigned long rewind_frame_pointer(int n) 38static inline unsigned long rewind_frame_pointer(int n)
34{ 39{
35 struct stack_frame *frame; 40 struct stack_frame *frame;
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index adedeef1dedc..b2e246037392 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/start_kernel.h> 9#include <linux/start_kernel.h>
10#include <linux/mm.h>
10 11
11#include <asm/setup.h> 12#include <asm/setup.h>
12#include <asm/sections.h> 13#include <asm/sections.h>
@@ -44,9 +45,10 @@ void __init i386_start_kernel(void)
44#ifdef CONFIG_BLK_DEV_INITRD 45#ifdef CONFIG_BLK_DEV_INITRD
45 /* Reserve INITRD */ 46 /* Reserve INITRD */
46 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { 47 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
48 /* Assume only end is not page aligned */
47 u64 ramdisk_image = boot_params.hdr.ramdisk_image; 49 u64 ramdisk_image = boot_params.hdr.ramdisk_image;
48 u64 ramdisk_size = boot_params.hdr.ramdisk_size; 50 u64 ramdisk_size = boot_params.hdr.ramdisk_size;
49 u64 ramdisk_end = ramdisk_image + ramdisk_size; 51 u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size);
50 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK"); 52 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
51 } 53 }
52#endif 54#endif
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index b5a9896ca1e7..7147143fd614 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -103,9 +103,10 @@ void __init x86_64_start_reservations(char *real_mode_data)
103#ifdef CONFIG_BLK_DEV_INITRD 103#ifdef CONFIG_BLK_DEV_INITRD
104 /* Reserve INITRD */ 104 /* Reserve INITRD */
105 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { 105 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
106 /* Assume only end is not page aligned */
106 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; 107 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
107 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; 108 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
108 unsigned long ramdisk_end = ramdisk_image + ramdisk_size; 109 unsigned long ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size);
109 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK"); 110 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
110 } 111 }
111#endif 112#endif
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index bfba6019d762..b2258ca91003 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -618,8 +618,8 @@ int kgdb_arch_init(void)
618 * portion of kgdb because this operation requires mutexs to 618 * portion of kgdb because this operation requires mutexs to
619 * complete. 619 * complete.
620 */ 620 */
621 hw_breakpoint_init(&attr);
621 attr.bp_addr = (unsigned long)kgdb_arch_init; 622 attr.bp_addr = (unsigned long)kgdb_arch_init;
622 attr.type = PERF_TYPE_BREAKPOINT;
623 attr.bp_len = HW_BREAKPOINT_LEN_1; 623 attr.bp_len = HW_BREAKPOINT_LEN_1;
624 attr.bp_type = HW_BREAKPOINT_W; 624 attr.bp_type = HW_BREAKPOINT_W;
625 attr.disabled = 1; 625 attr.disabled = 1;
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c08d1e3261a8..9570541caf7c 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -313,16 +313,17 @@ static void __init reserve_brk(void)
313#define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) 313#define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)
314static void __init relocate_initrd(void) 314static void __init relocate_initrd(void)
315{ 315{
316 316 /* Assume only end is not page aligned */
317 u64 ramdisk_image = boot_params.hdr.ramdisk_image; 317 u64 ramdisk_image = boot_params.hdr.ramdisk_image;
318 u64 ramdisk_size = boot_params.hdr.ramdisk_size; 318 u64 ramdisk_size = boot_params.hdr.ramdisk_size;
319 u64 area_size = PAGE_ALIGN(ramdisk_size);
319 u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; 320 u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT;
320 u64 ramdisk_here; 321 u64 ramdisk_here;
321 unsigned long slop, clen, mapaddr; 322 unsigned long slop, clen, mapaddr;
322 char *p, *q; 323 char *p, *q;
323 324
324 /* We need to move the initrd down into lowmem */ 325 /* We need to move the initrd down into lowmem */
325 ramdisk_here = find_e820_area(0, end_of_lowmem, ramdisk_size, 326 ramdisk_here = find_e820_area(0, end_of_lowmem, area_size,
326 PAGE_SIZE); 327 PAGE_SIZE);
327 328
328 if (ramdisk_here == -1ULL) 329 if (ramdisk_here == -1ULL)
@@ -331,7 +332,7 @@ static void __init relocate_initrd(void)
331 332
332 /* Note: this includes all the lowmem currently occupied by 333 /* Note: this includes all the lowmem currently occupied by
333 the initrd, we rely on that fact to keep the data intact. */ 334 the initrd, we rely on that fact to keep the data intact. */
334 reserve_early(ramdisk_here, ramdisk_here + ramdisk_size, 335 reserve_early(ramdisk_here, ramdisk_here + area_size,
335 "NEW RAMDISK"); 336 "NEW RAMDISK");
336 initrd_start = ramdisk_here + PAGE_OFFSET; 337 initrd_start = ramdisk_here + PAGE_OFFSET;
337 initrd_end = initrd_start + ramdisk_size; 338 initrd_end = initrd_start + ramdisk_size;
@@ -375,9 +376,10 @@ static void __init relocate_initrd(void)
375 376
376static void __init reserve_initrd(void) 377static void __init reserve_initrd(void)
377{ 378{
379 /* Assume only end is not page aligned */
378 u64 ramdisk_image = boot_params.hdr.ramdisk_image; 380 u64 ramdisk_image = boot_params.hdr.ramdisk_image;
379 u64 ramdisk_size = boot_params.hdr.ramdisk_size; 381 u64 ramdisk_size = boot_params.hdr.ramdisk_size;
380 u64 ramdisk_end = ramdisk_image + ramdisk_size; 382 u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size);
381 u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; 383 u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT;
382 384
383 if (!boot_params.hdr.type_of_loader || 385 if (!boot_params.hdr.type_of_loader ||
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index be40f82b09af..763d815e27a0 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -243,8 +243,6 @@ static void __cpuinit smp_callin(void)
243 end_local_APIC_setup(); 243 end_local_APIC_setup();
244 map_cpu_to_logical_apicid(); 244 map_cpu_to_logical_apicid();
245 245
246 notify_cpu_starting(cpuid);
247
248 /* 246 /*
249 * Need to setup vector mappings before we enable interrupts. 247 * Need to setup vector mappings before we enable interrupts.
250 */ 248 */
@@ -265,6 +263,8 @@ static void __cpuinit smp_callin(void)
265 */ 263 */
266 smp_store_cpu_info(cpuid); 264 smp_store_cpu_info(cpuid);
267 265
266 notify_cpu_starting(cpuid);
267
268 /* 268 /*
269 * Allow the master to continue. 269 * Allow the master to continue.
270 */ 270 */
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 44879df55696..2cc249718c46 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -291,8 +291,8 @@ SECTIONS
291 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 291 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
292 __smp_locks = .; 292 __smp_locks = .;
293 *(.smp_locks) 293 *(.smp_locks)
294 __smp_locks_end = .;
295 . = ALIGN(PAGE_SIZE); 294 . = ALIGN(PAGE_SIZE);
295 __smp_locks_end = .;
296 } 296 }
297 297
298#ifdef CONFIG_X86_64 298#ifdef CONFIG_X86_64
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index a4a7d7dc8aa4..b278535b14aa 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -332,11 +332,23 @@ int devmem_is_allowed(unsigned long pagenr)
332 332
333void free_init_pages(char *what, unsigned long begin, unsigned long end) 333void free_init_pages(char *what, unsigned long begin, unsigned long end)
334{ 334{
335 unsigned long addr = begin; 335 unsigned long addr;
336 unsigned long begin_aligned, end_aligned;
336 337
337 if (addr >= end) 338 /* Make sure boundaries are page aligned */
339 begin_aligned = PAGE_ALIGN(begin);
340 end_aligned = end & PAGE_MASK;
341
342 if (WARN_ON(begin_aligned != begin || end_aligned != end)) {
343 begin = begin_aligned;
344 end = end_aligned;
345 }
346
347 if (begin >= end)
338 return; 348 return;
339 349
350 addr = begin;
351
340 /* 352 /*
341 * If debugging page accesses then do not free this memory but 353 * If debugging page accesses then do not free this memory but
342 * mark them not present - any buggy init-section access will 354 * mark them not present - any buggy init-section access will
@@ -344,7 +356,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
344 */ 356 */
345#ifdef CONFIG_DEBUG_PAGEALLOC 357#ifdef CONFIG_DEBUG_PAGEALLOC
346 printk(KERN_INFO "debug: unmapping init memory %08lx..%08lx\n", 358 printk(KERN_INFO "debug: unmapping init memory %08lx..%08lx\n",
347 begin, PAGE_ALIGN(end)); 359 begin, end);
348 set_memory_np(begin, (end - begin) >> PAGE_SHIFT); 360 set_memory_np(begin, (end - begin) >> PAGE_SHIFT);
349#else 361#else
350 /* 362 /*
@@ -359,8 +371,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
359 for (; addr < end; addr += PAGE_SIZE) { 371 for (; addr < end; addr += PAGE_SIZE) {
360 ClearPageReserved(virt_to_page(addr)); 372 ClearPageReserved(virt_to_page(addr));
361 init_page_count(virt_to_page(addr)); 373 init_page_count(virt_to_page(addr));
362 memset((void *)(addr & ~(PAGE_SIZE-1)), 374 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
363 POISON_FREE_INITMEM, PAGE_SIZE);
364 free_page(addr); 375 free_page(addr);
365 totalram_pages++; 376 totalram_pages++;
366 } 377 }
@@ -377,6 +388,15 @@ void free_initmem(void)
377#ifdef CONFIG_BLK_DEV_INITRD 388#ifdef CONFIG_BLK_DEV_INITRD
378void free_initrd_mem(unsigned long start, unsigned long end) 389void free_initrd_mem(unsigned long start, unsigned long end)
379{ 390{
380 free_init_pages("initrd memory", start, end); 391 /*
392 * end could be not aligned, and We can not align that,
393 * decompresser could be confused by aligned initrd_end
394 * We already reserve the end partial page before in
395 * - i386_start_kernel()
396 * - x86_64_start_kernel()
397 * - relocate_initrd()
398 * So here We can do PAGE_ALIGN() safely to get partial page to be freed
399 */
400 free_init_pages("initrd memory", start, PAGE_ALIGN(end));
381} 401}
382#endif 402#endif