aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig9
-rw-r--r--arch/powerpc/kernel/kprobes.c33
-rw-r--r--arch/powerpc/kernel/misc_32.S2
-rw-r--r--arch/powerpc/kernel/misc_64.S2
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/setup_32.c4
-rw-r--r--arch/powerpc/kernel/setup_64.c7
-rw-r--r--arch/powerpc/kernel/swsusp_32.S4
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c17
-rw-r--r--arch/powerpc/kernel/syscalls.c14
-rw-r--r--arch/powerpc/kernel/time.c9
-rw-r--r--arch/powerpc/mm/fault.c4
-rw-r--r--arch/powerpc/mm/mem.c51
-rw-r--r--arch/powerpc/mm/numa.c159
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c3
-rw-r--r--arch/powerpc/platforms/iseries/mf.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c2
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c4
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c2
-rw-r--r--arch/powerpc/platforms/pseries/ras.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c2
-rw-r--r--arch/powerpc/sysdev/mpic.c2
22 files changed, 96 insertions, 240 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index de1ef2fa1a20..032e6ab5d3c4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -731,11 +731,10 @@ config ARCH_SPARSEMEM_DEFAULT
731 def_bool y 731 def_bool y
732 depends on SMP && PPC_PSERIES 732 depends on SMP && PPC_PSERIES
733 733
734source "mm/Kconfig" 734config ARCH_POPULATES_NODE_MAP
735
736config HAVE_ARCH_EARLY_PFN_TO_NID
737 def_bool y 735 def_bool y
738 depends on NEED_MULTIPLE_NODES 736
737source "mm/Kconfig"
739 738
740config ARCH_MEMORY_PROBE 739config ARCH_MEMORY_PROBE
741 def_bool y 740 def_bool y
@@ -1070,7 +1069,7 @@ source "arch/powerpc/oprofile/Kconfig"
1070 1069
1071config KPROBES 1070config KPROBES
1072 bool "Kprobes (EXPERIMENTAL)" 1071 bool "Kprobes (EXPERIMENTAL)"
1073 depends on PPC64 && EXPERIMENTAL && MODULES 1072 depends on PPC64 && KALLSYMS && EXPERIMENTAL && MODULES
1074 help 1073 help
1075 Kprobes allows you to trap at almost any kernel address and 1074 Kprobes allows you to trap at almost any kernel address and
1076 execute a callback function. register_kprobe() establishes 1075 execute a callback function. register_kprobe() establishes
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index cd65c367b8b6..7b8d12b9026c 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -259,14 +259,15 @@ void kretprobe_trampoline_holder(void)
259 */ 259 */
260int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 260int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
261{ 261{
262 struct kretprobe_instance *ri = NULL; 262 struct kretprobe_instance *ri = NULL;
263 struct hlist_head *head; 263 struct hlist_head *head, empty_rp;
264 struct hlist_node *node, *tmp; 264 struct hlist_node *node, *tmp;
265 unsigned long flags, orig_ret_address = 0; 265 unsigned long flags, orig_ret_address = 0;
266 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; 266 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
267 267
268 INIT_HLIST_HEAD(&empty_rp);
268 spin_lock_irqsave(&kretprobe_lock, flags); 269 spin_lock_irqsave(&kretprobe_lock, flags);
269 head = kretprobe_inst_table_head(current); 270 head = kretprobe_inst_table_head(current);
270 271
271 /* 272 /*
272 * It is possible to have multiple instances associated with a given 273 * It is possible to have multiple instances associated with a given
@@ -277,20 +278,20 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
277 * We can handle this because: 278 * We can handle this because:
278 * - instances are always inserted at the head of the list 279 * - instances are always inserted at the head of the list
279 * - when multiple return probes are registered for the same 280 * - when multiple return probes are registered for the same
280 * function, the first instance's ret_addr will point to the 281 * function, the first instance's ret_addr will point to the
281 * real return address, and all the rest will point to 282 * real return address, and all the rest will point to
282 * kretprobe_trampoline 283 * kretprobe_trampoline
283 */ 284 */
284 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { 285 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
285 if (ri->task != current) 286 if (ri->task != current)
286 /* another task is sharing our hash bucket */ 287 /* another task is sharing our hash bucket */
287 continue; 288 continue;
288 289
289 if (ri->rp && ri->rp->handler) 290 if (ri->rp && ri->rp->handler)
290 ri->rp->handler(ri, regs); 291 ri->rp->handler(ri, regs);
291 292
292 orig_ret_address = (unsigned long)ri->ret_addr; 293 orig_ret_address = (unsigned long)ri->ret_addr;
293 recycle_rp_inst(ri); 294 recycle_rp_inst(ri, &empty_rp);
294 295
295 if (orig_ret_address != trampoline_address) 296 if (orig_ret_address != trampoline_address)
296 /* 297 /*
@@ -308,12 +309,16 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
308 spin_unlock_irqrestore(&kretprobe_lock, flags); 309 spin_unlock_irqrestore(&kretprobe_lock, flags);
309 preempt_enable_no_resched(); 310 preempt_enable_no_resched();
310 311
311 /* 312 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
312 * By returning a non-zero value, we are telling 313 hlist_del(&ri->hlist);
313 * kprobe_handler() that we don't want the post_handler 314 kfree(ri);
314 * to run (and have re-enabled preemption) 315 }
315 */ 316 /*
316 return 1; 317 * By returning a non-zero value, we are telling
318 * kprobe_handler() that we don't want the post_handler
319 * to run (and have re-enabled preemption)
320 */
321 return 1;
317} 322}
318 323
319/* 324/*
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 58758d883361..88fd73fdf048 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -843,7 +843,7 @@ _GLOBAL(kernel_thread)
843 addi r1,r1,16 843 addi r1,r1,16
844 blr 844 blr
845 845
846_GLOBAL(execve) 846_GLOBAL(kernel_execve)
847 li r0,__NR_execve 847 li r0,__NR_execve
848 sc 848 sc
849 bnslr 849 bnslr
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index e3ed21cd3d94..9c54eccad993 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -556,7 +556,7 @@ _GLOBAL(giveup_altivec)
556 556
557#endif /* CONFIG_ALTIVEC */ 557#endif /* CONFIG_ALTIVEC */
558 558
559_GLOBAL(execve) 559_GLOBAL(kernel_execve)
560 li r0,__NR_execve 560 li r0,__NR_execve
561 sc 561 sc
562 bnslr 562 bnslr
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index a127a1e3c097..7b2f6452ba72 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -424,7 +424,7 @@ void show_regs(struct pt_regs * regs)
424 printk("NIP: "REG" LR: "REG" CTR: "REG"\n", 424 printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
425 regs->nip, regs->link, regs->ctr); 425 regs->nip, regs->link, regs->ctr);
426 printk("REGS: %p TRAP: %04lx %s (%s)\n", 426 printk("REGS: %p TRAP: %04lx %s (%s)\n",
427 regs, regs->trap, print_tainted(), system_utsname.release); 427 regs, regs->trap, print_tainted(), init_utsname()->release);
428 printk("MSR: "REG" ", regs->msr); 428 printk("MSR: "REG" ", regs->msr);
429 printbits(regs->msr, msr_bits); 429 printbits(regs->msr, msr_bits);
430 printk(" CR: %08lX XER: %08lX\n", regs->ccr, regs->xer); 430 printk(" CR: %08lX XER: %08lX\n", regs->ccr, regs->xer);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index e0df2ba1ab9f..79a17795d17b 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -67,10 +67,6 @@ int have_of = 1;
67dev_t boot_dev; 67dev_t boot_dev;
68#endif /* CONFIG_PPC_MULTIPLATFORM */ 68#endif /* CONFIG_PPC_MULTIPLATFORM */
69 69
70#ifdef CONFIG_MAGIC_SYSRQ
71unsigned long SYSRQ_KEY = 0x54;
72#endif /* CONFIG_MAGIC_SYSRQ */
73
74#ifdef CONFIG_VGA_CONSOLE 70#ifdef CONFIG_VGA_CONSOLE
75unsigned long vgacon_remap_base; 71unsigned long vgacon_remap_base;
76#endif 72#endif
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 00d6b8addd78..cda2dbe70a76 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -93,11 +93,6 @@ int dcache_bsize;
93int icache_bsize; 93int icache_bsize;
94int ucache_bsize; 94int ucache_bsize;
95 95
96#ifdef CONFIG_MAGIC_SYSRQ
97unsigned long SYSRQ_KEY;
98#endif /* CONFIG_MAGIC_SYSRQ */
99
100
101#ifdef CONFIG_SMP 96#ifdef CONFIG_SMP
102 97
103static int smt_enabled_cmdline; 98static int smt_enabled_cmdline;
@@ -419,7 +414,7 @@ void __init setup_system(void)
419 smp_release_cpus(); 414 smp_release_cpus();
420#endif 415#endif
421 416
422 printk("Starting Linux PPC64 %s\n", system_utsname.version); 417 printk("Starting Linux PPC64 %s\n", init_utsname()->version);
423 418
424 printk("-----------------------------------------------------\n"); 419 printk("-----------------------------------------------------\n");
425 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 420 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
diff --git a/arch/powerpc/kernel/swsusp_32.S b/arch/powerpc/kernel/swsusp_32.S
index 7369f9a6ad25..69e8f86aa4f8 100644
--- a/arch/powerpc/kernel/swsusp_32.S
+++ b/arch/powerpc/kernel/swsusp_32.S
@@ -159,8 +159,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
159 isync 159 isync
160 160
161 /* Load ptr the list of pages to copy in r3 */ 161 /* Load ptr the list of pages to copy in r3 */
162 lis r11,(pagedir_nosave - KERNELBASE)@h 162 lis r11,(restore_pblist - KERNELBASE)@h
163 ori r11,r11,pagedir_nosave@l 163 ori r11,r11,restore_pblist@l
164 lwz r10,0(r11) 164 lwz r10,0(r11)
165 165
166 /* Copy the pages. This is a very basic implementation, to 166 /* Copy the pages. This is a very basic implementation, to
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 2e292863e982..d15c33e95959 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -69,16 +69,20 @@ struct readdir_callback32 {
69}; 69};
70 70
71static int fillonedir(void * __buf, const char * name, int namlen, 71static int fillonedir(void * __buf, const char * name, int namlen,
72 off_t offset, ino_t ino, unsigned int d_type) 72 off_t offset, u64 ino, unsigned int d_type)
73{ 73{
74 struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf; 74 struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
75 struct old_linux_dirent32 __user * dirent; 75 struct old_linux_dirent32 __user * dirent;
76 ino_t d_ino;
76 77
77 if (buf->count) 78 if (buf->count)
78 return -EINVAL; 79 return -EINVAL;
80 d_ino = ino;
81 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
82 return -EOVERFLOW;
79 buf->count++; 83 buf->count++;
80 dirent = buf->dirent; 84 dirent = buf->dirent;
81 put_user(ino, &dirent->d_ino); 85 put_user(d_ino, &dirent->d_ino);
82 put_user(offset, &dirent->d_offset); 86 put_user(offset, &dirent->d_offset);
83 put_user(namlen, &dirent->d_namlen); 87 put_user(namlen, &dirent->d_namlen);
84 copy_to_user(dirent->d_name, name, namlen); 88 copy_to_user(dirent->d_name, name, namlen);
@@ -120,15 +124,20 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
120 124
121int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) 125int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
122{ 126{
127 compat_ino_t ino;
123 long err; 128 long err;
124 129
125 if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) || 130 if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) ||
126 !new_valid_dev(stat->rdev)) 131 !new_valid_dev(stat->rdev))
127 return -EOVERFLOW; 132 return -EOVERFLOW;
128 133
134 ino = stat->ino;
135 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
136 return -EOVERFLOW;
137
129 err = access_ok(VERIFY_WRITE, statbuf, sizeof(*statbuf)) ? 0 : -EFAULT; 138 err = access_ok(VERIFY_WRITE, statbuf, sizeof(*statbuf)) ? 0 : -EFAULT;
130 err |= __put_user(new_encode_dev(stat->dev), &statbuf->st_dev); 139 err |= __put_user(new_encode_dev(stat->dev), &statbuf->st_dev);
131 err |= __put_user(stat->ino, &statbuf->st_ino); 140 err |= __put_user(ino, &statbuf->st_ino);
132 err |= __put_user(stat->mode, &statbuf->st_mode); 141 err |= __put_user(stat->mode, &statbuf->st_mode);
133 err |= __put_user(stat->nlink, &statbuf->st_nlink); 142 err |= __put_user(stat->nlink, &statbuf->st_nlink);
134 err |= __put_user(stat->uid, &statbuf->st_uid); 143 err |= __put_user(stat->uid, &statbuf->st_uid);
@@ -740,7 +749,7 @@ asmlinkage long compat_sys_umask(u32 mask)
740 return sys_umask((int)mask); 749 return sys_umask((int)mask);
741} 750}
742 751
743#ifdef CONFIG_SYSCTL 752#ifdef CONFIG_SYSCTL_SYSCALL
744struct __sysctl_args32 { 753struct __sysctl_args32 {
745 u32 name; 754 u32 name;
746 int nlen; 755 int nlen;
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 9b69d99a9103..d358866b880f 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -260,7 +260,7 @@ long ppc_newuname(struct new_utsname __user * name)
260 int err = 0; 260 int err = 0;
261 261
262 down_read(&uts_sem); 262 down_read(&uts_sem);
263 if (copy_to_user(name, &system_utsname, sizeof(*name))) 263 if (copy_to_user(name, utsname(), sizeof(*name)))
264 err = -EFAULT; 264 err = -EFAULT;
265 up_read(&uts_sem); 265 up_read(&uts_sem);
266 if (!err) 266 if (!err)
@@ -273,7 +273,7 @@ int sys_uname(struct old_utsname __user *name)
273 int err = 0; 273 int err = 0;
274 274
275 down_read(&uts_sem); 275 down_read(&uts_sem);
276 if (copy_to_user(name, &system_utsname, sizeof(*name))) 276 if (copy_to_user(name, utsname(), sizeof(*name)))
277 err = -EFAULT; 277 err = -EFAULT;
278 up_read(&uts_sem); 278 up_read(&uts_sem);
279 if (!err) 279 if (!err)
@@ -289,19 +289,19 @@ int sys_olduname(struct oldold_utsname __user *name)
289 return -EFAULT; 289 return -EFAULT;
290 290
291 down_read(&uts_sem); 291 down_read(&uts_sem);
292 error = __copy_to_user(&name->sysname, &system_utsname.sysname, 292 error = __copy_to_user(&name->sysname, &utsname()->sysname,
293 __OLD_UTS_LEN); 293 __OLD_UTS_LEN);
294 error |= __put_user(0, name->sysname + __OLD_UTS_LEN); 294 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
295 error |= __copy_to_user(&name->nodename, &system_utsname.nodename, 295 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
296 __OLD_UTS_LEN); 296 __OLD_UTS_LEN);
297 error |= __put_user(0, name->nodename + __OLD_UTS_LEN); 297 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
298 error |= __copy_to_user(&name->release, &system_utsname.release, 298 error |= __copy_to_user(&name->release, &utsname()->release,
299 __OLD_UTS_LEN); 299 __OLD_UTS_LEN);
300 error |= __put_user(0, name->release + __OLD_UTS_LEN); 300 error |= __put_user(0, name->release + __OLD_UTS_LEN);
301 error |= __copy_to_user(&name->version, &system_utsname.version, 301 error |= __copy_to_user(&name->version, &utsname()->version,
302 __OLD_UTS_LEN); 302 __OLD_UTS_LEN);
303 error |= __put_user(0, name->version + __OLD_UTS_LEN); 303 error |= __put_user(0, name->version + __OLD_UTS_LEN);
304 error |= __copy_to_user(&name->machine, &system_utsname.machine, 304 error |= __copy_to_user(&name->machine, &utsname()->machine,
305 __OLD_UTS_LEN); 305 __OLD_UTS_LEN);
306 error |= override_machine(name->machine); 306 error |= override_machine(name->machine);
307 up_read(&uts_sem); 307 up_read(&uts_sem);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index b4ed362c457a..85b9244a098c 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -117,8 +117,6 @@ unsigned tb_to_ns_shift;
117 117
118struct gettimeofday_struct do_gtod; 118struct gettimeofday_struct do_gtod;
119 119
120extern unsigned long wall_jiffies;
121
122extern struct timezone sys_tz; 120extern struct timezone sys_tz;
123static long timezone_offset; 121static long timezone_offset;
124 122
@@ -693,7 +691,7 @@ void timer_interrupt(struct pt_regs * regs)
693 tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy; 691 tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy;
694 if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) { 692 if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
695 tb_last_jiffy = tb_next_jiffy; 693 tb_last_jiffy = tb_next_jiffy;
696 do_timer(regs); 694 do_timer(1);
697 timer_recalc_offset(tb_last_jiffy); 695 timer_recalc_offset(tb_last_jiffy);
698 timer_check_rtc(); 696 timer_check_rtc();
699 } 697 }
@@ -816,11 +814,6 @@ int do_settimeofday(struct timespec *tv)
816 /* 814 /*
817 * Subtract off the number of nanoseconds since the 815 * Subtract off the number of nanoseconds since the
818 * beginning of the last tick. 816 * beginning of the last tick.
819 * Note that since we don't increment jiffies_64 anywhere other
820 * than in do_timer (since we don't have a lost tick problem),
821 * wall_jiffies will always be the same as jiffies,
822 * and therefore the (jiffies - wall_jiffies) computation
823 * has been removed.
824 */ 817 */
825 tb_delta = tb_ticks_since(tb_last_jiffy); 818 tb_delta = tb_ticks_since(tb_last_jiffy);
826 tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */ 819 tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 78a0d59903ee..e8fa50624b70 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -333,7 +333,7 @@ good_area:
333 /* protection fault */ 333 /* protection fault */
334 if (error_code & 0x08000000) 334 if (error_code & 0x08000000)
335 goto bad_area; 335 goto bad_area;
336 if (!(vma->vm_flags & (VM_READ | VM_EXEC))) 336 if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
337 goto bad_area; 337 goto bad_area;
338 } 338 }
339 339
@@ -386,7 +386,7 @@ bad_area_nosemaphore:
386 */ 386 */
387out_of_memory: 387out_of_memory:
388 up_read(&mm->mmap_sem); 388 up_read(&mm->mmap_sem);
389 if (current->pid == 1) { 389 if (is_init(current)) {
390 yield(); 390 yield();
391 down_read(&mm->mmap_sem); 391 down_read(&mm->mmap_sem);
392 goto survive; 392 goto survive;
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index eebd8b83a6b0..16fe027bbc12 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -256,20 +256,22 @@ void __init do_init_bootmem(void)
256 256
257 boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages); 257 boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages);
258 258
259 /* Add active regions with valid PFNs */
260 for (i = 0; i < lmb.memory.cnt; i++) {
261 unsigned long start_pfn, end_pfn;
262 start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT;
263 end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i);
264 add_active_range(0, start_pfn, end_pfn);
265 }
266
259 /* Add all physical memory to the bootmem map, mark each area 267 /* Add all physical memory to the bootmem map, mark each area
260 * present. 268 * present.
261 */ 269 */
262 for (i = 0; i < lmb.memory.cnt; i++) {
263 unsigned long base = lmb.memory.region[i].base;
264 unsigned long size = lmb_size_bytes(&lmb.memory, i);
265#ifdef CONFIG_HIGHMEM 270#ifdef CONFIG_HIGHMEM
266 if (base >= total_lowmem) 271 free_bootmem_with_active_regions(0, total_lowmem >> PAGE_SHIFT);
267 continue; 272#else
268 if (base + size > total_lowmem) 273 free_bootmem_with_active_regions(0, max_pfn);
269 size = total_lowmem - base;
270#endif 274#endif
271 free_bootmem(base, size);
272 }
273 275
274 /* reserve the sections we're already using */ 276 /* reserve the sections we're already using */
275 for (i = 0; i < lmb.reserved.cnt; i++) 277 for (i = 0; i < lmb.reserved.cnt; i++)
@@ -277,9 +279,8 @@ void __init do_init_bootmem(void)
277 lmb_size_bytes(&lmb.reserved, i)); 279 lmb_size_bytes(&lmb.reserved, i));
278 280
279 /* XXX need to clip this if using highmem? */ 281 /* XXX need to clip this if using highmem? */
280 for (i = 0; i < lmb.memory.cnt; i++) 282 sparse_memory_present_with_active_regions(0);
281 memory_present(0, lmb_start_pfn(&lmb.memory, i), 283
282 lmb_end_pfn(&lmb.memory, i));
283 init_bootmem_done = 1; 284 init_bootmem_done = 1;
284} 285}
285 286
@@ -288,10 +289,9 @@ void __init do_init_bootmem(void)
288 */ 289 */
289void __init paging_init(void) 290void __init paging_init(void)
290{ 291{
291 unsigned long zones_size[MAX_NR_ZONES];
292 unsigned long zholes_size[MAX_NR_ZONES];
293 unsigned long total_ram = lmb_phys_mem_size(); 292 unsigned long total_ram = lmb_phys_mem_size();
294 unsigned long top_of_ram = lmb_end_of_DRAM(); 293 unsigned long top_of_ram = lmb_end_of_DRAM();
294 unsigned long max_zone_pfns[MAX_NR_ZONES];
295 295
296#ifdef CONFIG_HIGHMEM 296#ifdef CONFIG_HIGHMEM
297 map_page(PKMAP_BASE, 0, 0); /* XXX gross */ 297 map_page(PKMAP_BASE, 0, 0); /* XXX gross */
@@ -307,26 +307,13 @@ void __init paging_init(void)
307 top_of_ram, total_ram); 307 top_of_ram, total_ram);
308 printk(KERN_DEBUG "Memory hole size: %ldMB\n", 308 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
309 (top_of_ram - total_ram) >> 20); 309 (top_of_ram - total_ram) >> 20);
310 /*
311 * All pages are DMA-able so we put them all in the DMA zone.
312 */
313 memset(zones_size, 0, sizeof(zones_size));
314 memset(zholes_size, 0, sizeof(zholes_size));
315
316 zones_size[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
317 zholes_size[ZONE_DMA] = (top_of_ram - total_ram) >> PAGE_SHIFT;
318
319#ifdef CONFIG_HIGHMEM 310#ifdef CONFIG_HIGHMEM
320 zones_size[ZONE_DMA] = total_lowmem >> PAGE_SHIFT; 311 max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
321 zones_size[ZONE_HIGHMEM] = (total_memory - total_lowmem) >> PAGE_SHIFT; 312 max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
322 zholes_size[ZONE_HIGHMEM] = (top_of_ram - total_ram) >> PAGE_SHIFT;
323#else 313#else
324 zones_size[ZONE_DMA] = top_of_ram >> PAGE_SHIFT; 314 max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT;
325 zholes_size[ZONE_DMA] = (top_of_ram - total_ram) >> PAGE_SHIFT; 315#endif
326#endif /* CONFIG_HIGHMEM */ 316 free_area_init_nodes(max_zone_pfns);
327
328 free_area_init_node(0, NODE_DATA(0), zones_size,
329 __pa(PAGE_OFFSET) >> PAGE_SHIFT, zholes_size);
330} 317}
331#endif /* ! CONFIG_NEED_MULTIPLE_NODES */ 318#endif /* ! CONFIG_NEED_MULTIPLE_NODES */
332 319
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 6c0f1c7d83e5..43c272075e1a 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -39,96 +39,6 @@ static bootmem_data_t __initdata plat_node_bdata[MAX_NUMNODES];
39static int min_common_depth; 39static int min_common_depth;
40static int n_mem_addr_cells, n_mem_size_cells; 40static int n_mem_addr_cells, n_mem_size_cells;
41 41
42/*
43 * We need somewhere to store start/end/node for each region until we have
44 * allocated the real node_data structures.
45 */
46#define MAX_REGIONS (MAX_LMB_REGIONS*2)
47static struct {
48 unsigned long start_pfn;
49 unsigned long end_pfn;
50 int nid;
51} init_node_data[MAX_REGIONS] __initdata;
52
53int __init early_pfn_to_nid(unsigned long pfn)
54{
55 unsigned int i;
56
57 for (i = 0; init_node_data[i].end_pfn; i++) {
58 unsigned long start_pfn = init_node_data[i].start_pfn;
59 unsigned long end_pfn = init_node_data[i].end_pfn;
60
61 if ((start_pfn <= pfn) && (pfn < end_pfn))
62 return init_node_data[i].nid;
63 }
64
65 return -1;
66}
67
68void __init add_region(unsigned int nid, unsigned long start_pfn,
69 unsigned long pages)
70{
71 unsigned int i;
72
73 dbg("add_region nid %d start_pfn 0x%lx pages 0x%lx\n",
74 nid, start_pfn, pages);
75
76 for (i = 0; init_node_data[i].end_pfn; i++) {
77 if (init_node_data[i].nid != nid)
78 continue;
79 if (init_node_data[i].end_pfn == start_pfn) {
80 init_node_data[i].end_pfn += pages;
81 return;
82 }
83 if (init_node_data[i].start_pfn == (start_pfn + pages)) {
84 init_node_data[i].start_pfn -= pages;
85 return;
86 }
87 }
88
89 /*
90 * Leave last entry NULL so we dont iterate off the end (we use
91 * entry.end_pfn to terminate the walk).
92 */
93 if (i >= (MAX_REGIONS - 1)) {
94 printk(KERN_ERR "WARNING: too many memory regions in "
95 "numa code, truncating\n");
96 return;
97 }
98
99 init_node_data[i].start_pfn = start_pfn;
100 init_node_data[i].end_pfn = start_pfn + pages;
101 init_node_data[i].nid = nid;
102}
103
104/* We assume init_node_data has no overlapping regions */
105void __init get_region(unsigned int nid, unsigned long *start_pfn,
106 unsigned long *end_pfn, unsigned long *pages_present)
107{
108 unsigned int i;
109
110 *start_pfn = -1UL;
111 *end_pfn = *pages_present = 0;
112
113 for (i = 0; init_node_data[i].end_pfn; i++) {
114 if (init_node_data[i].nid != nid)
115 continue;
116
117 *pages_present += init_node_data[i].end_pfn -
118 init_node_data[i].start_pfn;
119
120 if (init_node_data[i].start_pfn < *start_pfn)
121 *start_pfn = init_node_data[i].start_pfn;
122
123 if (init_node_data[i].end_pfn > *end_pfn)
124 *end_pfn = init_node_data[i].end_pfn;
125 }
126
127 /* We didnt find a matching region, return start/end as 0 */
128 if (*start_pfn == -1UL)
129 *start_pfn = 0;
130}
131
132static void __cpuinit map_cpu_to_node(int cpu, int node) 42static void __cpuinit map_cpu_to_node(int cpu, int node)
133{ 43{
134 numa_cpu_lookup_table[cpu] = node; 44 numa_cpu_lookup_table[cpu] = node;
@@ -468,8 +378,8 @@ new_range:
468 continue; 378 continue;
469 } 379 }
470 380
471 add_region(nid, start >> PAGE_SHIFT, 381 add_active_range(nid, start >> PAGE_SHIFT,
472 size >> PAGE_SHIFT); 382 (start >> PAGE_SHIFT) + (size >> PAGE_SHIFT));
473 383
474 if (--ranges) 384 if (--ranges)
475 goto new_range; 385 goto new_range;
@@ -482,6 +392,7 @@ static void __init setup_nonnuma(void)
482{ 392{
483 unsigned long top_of_ram = lmb_end_of_DRAM(); 393 unsigned long top_of_ram = lmb_end_of_DRAM();
484 unsigned long total_ram = lmb_phys_mem_size(); 394 unsigned long total_ram = lmb_phys_mem_size();
395 unsigned long start_pfn, end_pfn;
485 unsigned int i; 396 unsigned int i;
486 397
487 printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n", 398 printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
@@ -489,9 +400,11 @@ static void __init setup_nonnuma(void)
489 printk(KERN_DEBUG "Memory hole size: %ldMB\n", 400 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
490 (top_of_ram - total_ram) >> 20); 401 (top_of_ram - total_ram) >> 20);
491 402
492 for (i = 0; i < lmb.memory.cnt; ++i) 403 for (i = 0; i < lmb.memory.cnt; ++i) {
493 add_region(0, lmb.memory.region[i].base >> PAGE_SHIFT, 404 start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT;
494 lmb_size_pages(&lmb.memory, i)); 405 end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i);
406 add_active_range(0, start_pfn, end_pfn);
407 }
495 node_set_online(0); 408 node_set_online(0);
496} 409}
497 410
@@ -630,11 +543,11 @@ void __init do_init_bootmem(void)
630 (void *)(unsigned long)boot_cpuid); 543 (void *)(unsigned long)boot_cpuid);
631 544
632 for_each_online_node(nid) { 545 for_each_online_node(nid) {
633 unsigned long start_pfn, end_pfn, pages_present; 546 unsigned long start_pfn, end_pfn;
634 unsigned long bootmem_paddr; 547 unsigned long bootmem_paddr;
635 unsigned long bootmap_pages; 548 unsigned long bootmap_pages;
636 549
637 get_region(nid, &start_pfn, &end_pfn, &pages_present); 550 get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
638 551
639 /* Allocate the node structure node local if possible */ 552 /* Allocate the node structure node local if possible */
640 NODE_DATA(nid) = careful_allocation(nid, 553 NODE_DATA(nid) = careful_allocation(nid,
@@ -667,19 +580,7 @@ void __init do_init_bootmem(void)
667 init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT, 580 init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT,
668 start_pfn, end_pfn); 581 start_pfn, end_pfn);
669 582
670 /* Add free regions on this node */ 583 free_bootmem_with_active_regions(nid, end_pfn);
671 for (i = 0; init_node_data[i].end_pfn; i++) {
672 unsigned long start, end;
673
674 if (init_node_data[i].nid != nid)
675 continue;
676
677 start = init_node_data[i].start_pfn << PAGE_SHIFT;
678 end = init_node_data[i].end_pfn << PAGE_SHIFT;
679
680 dbg("free_bootmem %lx %lx\n", start, end - start);
681 free_bootmem_node(NODE_DATA(nid), start, end - start);
682 }
683 584
684 /* Mark reserved regions on this node */ 585 /* Mark reserved regions on this node */
685 for (i = 0; i < lmb.reserved.cnt; i++) { 586 for (i = 0; i < lmb.reserved.cnt; i++) {
@@ -710,44 +611,16 @@ void __init do_init_bootmem(void)
710 } 611 }
711 } 612 }
712 613
713 /* Add regions into sparsemem */ 614 sparse_memory_present_with_active_regions(nid);
714 for (i = 0; init_node_data[i].end_pfn; i++) {
715 unsigned long start, end;
716
717 if (init_node_data[i].nid != nid)
718 continue;
719
720 start = init_node_data[i].start_pfn;
721 end = init_node_data[i].end_pfn;
722
723 memory_present(nid, start, end);
724 }
725 } 615 }
726} 616}
727 617
728void __init paging_init(void) 618void __init paging_init(void)
729{ 619{
730 unsigned long zones_size[MAX_NR_ZONES]; 620 unsigned long max_zone_pfns[MAX_NR_ZONES] = {
731 unsigned long zholes_size[MAX_NR_ZONES]; 621 lmb_end_of_DRAM() >> PAGE_SHIFT
732 int nid; 622 };
733 623 free_area_init_nodes(max_zone_pfns);
734 memset(zones_size, 0, sizeof(zones_size));
735 memset(zholes_size, 0, sizeof(zholes_size));
736
737 for_each_online_node(nid) {
738 unsigned long start_pfn, end_pfn, pages_present;
739
740 get_region(nid, &start_pfn, &end_pfn, &pages_present);
741
742 zones_size[ZONE_DMA] = end_pfn - start_pfn;
743 zholes_size[ZONE_DMA] = zones_size[ZONE_DMA] - pages_present;
744
745 dbg("free_area_init node %d %lx %lx (hole: %lx)\n", nid,
746 zones_size[ZONE_DMA], start_pfn, zholes_size[ZONE_DMA]);
747
748 free_area_init_node(nid, NODE_DATA(nid), zones_size, start_pfn,
749 zholes_size);
750 }
751} 624}
752 625
753static int __init early_numa(char *p) 626static int __init early_numa(char *p)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 7b4572805db9..3950ddccb2c8 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -82,7 +82,6 @@ spufs_new_inode(struct super_block *sb, int mode)
82 inode->i_mode = mode; 82 inode->i_mode = mode;
83 inode->i_uid = current->fsuid; 83 inode->i_uid = current->fsuid;
84 inode->i_gid = current->fsgid; 84 inode->i_gid = current->fsgid;
85 inode->i_blksize = PAGE_CACHE_SIZE;
86 inode->i_blocks = 0; 85 inode->i_blocks = 0;
87 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 86 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
88out: 87out:
@@ -120,7 +119,7 @@ spufs_new_file(struct super_block *sb, struct dentry *dentry,
120 ret = 0; 119 ret = 0;
121 inode->i_op = &spufs_file_iops; 120 inode->i_op = &spufs_file_iops;
122 inode->i_fop = fops; 121 inode->i_fop = fops;
123 inode->u.generic_ip = SPUFS_I(inode)->i_ctx = get_spu_context(ctx); 122 inode->i_private = SPUFS_I(inode)->i_ctx = get_spu_context(ctx);
124 d_add(dentry, inode); 123 d_add(dentry, inode);
125out: 124out:
126 return ret; 125 return ret;
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 1a2c2a50f922..1983b640bac1 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -357,7 +357,7 @@ static int dma_and_signal_ce_msg(char *ce_msg,
357 */ 357 */
358static int shutdown(void) 358static int shutdown(void)
359{ 359{
360 int rc = kill_proc(1, SIGINT, 1); 360 int rc = kill_cad_pid(SIGINT, 1);
361 361
362 if (rc) { 362 if (rc) {
363 printk(KERN_ALERT "mf.c: SIGINT to init failed (%d), " 363 printk(KERN_ALERT "mf.c: SIGINT to init failed (%d), "
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
index d30466d74194..9d22361a26d6 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -104,7 +104,7 @@ static void g5_smu_switch_volt(int speed_mode)
104{ 104{
105 struct smu_simple_cmd cmd; 105 struct smu_simple_cmd cmd;
106 106
107 DECLARE_COMPLETION(comp); 107 DECLARE_COMPLETION_ONSTACK(comp);
108 smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 8, smu_done_complete, 108 smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 8, smu_done_complete,
109 &comp, 'V', 'S', 'L', 'E', 'W', 109 &comp, 'V', 'S', 'L', 'E', 'W',
110 0xff, g5_fvt_cur+1, speed_mode); 110 0xff, g5_fvt_cur+1, speed_mode);
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index 6a36ea9bf673..692945c14919 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -195,7 +195,7 @@ static void pmu_nvram_complete(struct adb_request *req)
195static unsigned char pmu_nvram_read_byte(int addr) 195static unsigned char pmu_nvram_read_byte(int addr)
196{ 196{
197 struct adb_request req; 197 struct adb_request req;
198 DECLARE_COMPLETION(req_complete); 198 DECLARE_COMPLETION_ONSTACK(req_complete);
199 199
200 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL; 200 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
201 if (pmu_request(&req, pmu_nvram_complete, 3, PMU_READ_NVRAM, 201 if (pmu_request(&req, pmu_nvram_complete, 3, PMU_READ_NVRAM,
@@ -211,7 +211,7 @@ static unsigned char pmu_nvram_read_byte(int addr)
211static void pmu_nvram_write_byte(int addr, unsigned char val) 211static void pmu_nvram_write_byte(int addr, unsigned char val)
212{ 212{
213 struct adb_request req; 213 struct adb_request req;
214 DECLARE_COMPLETION(req_complete); 214 DECLARE_COMPLETION_ONSTACK(req_complete);
215 215
216 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL; 216 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
217 if (pmu_request(&req, pmu_nvram_complete, 4, PMU_WRITE_NVRAM, 217 if (pmu_request(&req, pmu_nvram_complete, 4, PMU_WRITE_NVRAM,
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index 641e6511cf06..446e17d162a5 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -85,7 +85,7 @@ static int hcall_inst_seq_open(struct inode *inode, struct file *file)
85 85
86 rc = seq_open(file, &hcall_inst_seq_ops); 86 rc = seq_open(file, &hcall_inst_seq_ops);
87 seq = file->private_data; 87 seq = file->private_data;
88 seq->private = file->f_dentry->d_inode->u.generic_ip; 88 seq->private = file->f_dentry->d_inode->i_private;
89 89
90 return rc; 90 return rc;
91} 91}
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 903115d67fdc..311ed1993fc0 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -337,7 +337,7 @@ static int recover_mce(struct pt_regs *regs, struct rtas_error_log * err)
337 err->disposition == RTAS_DISP_NOT_RECOVERED && 337 err->disposition == RTAS_DISP_NOT_RECOVERED &&
338 err->target == RTAS_TARGET_MEMORY && 338 err->target == RTAS_TARGET_MEMORY &&
339 err->type == RTAS_TYPE_ECC_UNCORR && 339 err->type == RTAS_TYPE_ECC_UNCORR &&
340 !(current->pid == 0 || current->pid == 1)) { 340 !(current->pid == 0 || is_init(current))) {
341 /* Kill off a user process with an ECC error */ 341 /* Kill off a user process with an ECC error */
342 printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n", 342 printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n",
343 current->pid); 343 current->pid);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 2551da46b2a6..43dbf737698c 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -342,7 +342,7 @@ static int __init pSeries_init_panel(void)
342{ 342{
343 /* Manually leave the kernel version on the panel. */ 343 /* Manually leave the kernel version on the panel. */
344 ppc_md.progress("Linux ppc64\n", 0); 344 ppc_md.progress("Linux ppc64\n", 0);
345 ppc_md.progress(system_utsname.release, 0); 345 ppc_md.progress(init_utsname()->version, 0);
346 346
347 return 0; 347 return 0;
348} 348}
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index b604926401f5..723972bb5bd9 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -339,7 +339,7 @@ static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase,
339 for (pos = readb(devbase + PCI_CAPABILITY_LIST); pos != 0; 339 for (pos = readb(devbase + PCI_CAPABILITY_LIST); pos != 0;
340 pos = readb(devbase + pos + PCI_CAP_LIST_NEXT)) { 340 pos = readb(devbase + pos + PCI_CAP_LIST_NEXT)) {
341 u8 id = readb(devbase + pos + PCI_CAP_LIST_ID); 341 u8 id = readb(devbase + pos + PCI_CAP_LIST_ID);
342 if (id == PCI_CAP_ID_HT_IRQCONF) { 342 if (id == PCI_CAP_ID_HT) {
343 id = readb(devbase + pos + 3); 343 id = readb(devbase + pos + 3);
344 if (id == 0x80) 344 if (id == 0x80)
345 break; 345 break;