aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/asm-offsets.c4
-rw-r--r--arch/powerpc/kernel/entry_32.S5
-rw-r--r--arch/powerpc/kernel/entry_64.S8
-rw-r--r--arch/powerpc/kernel/epapr_hcalls.S28
-rw-r--r--arch/powerpc/kernel/epapr_paravirt.c11
-rw-r--r--arch/powerpc/kernel/kvm.c2
-rw-r--r--arch/powerpc/kernel/legacy_serial.c2
-rw-r--r--arch/powerpc/kernel/of_platform.c2
-rw-r--r--arch/powerpc/kernel/pci-common.c4
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c5
-rw-r--r--arch/powerpc/kernel/process.c64
-rw-r--r--arch/powerpc/kernel/signal.c4
-rw-r--r--arch/powerpc/kernel/signal_64.c2
-rw-r--r--arch/powerpc/kernel/smp.c46
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c17
-rw-r--r--arch/powerpc/kernel/sysfs.c4
-rw-r--r--arch/powerpc/kernel/time.c20
-rw-r--r--arch/powerpc/kernel/uprobes.c6
19 files changed, 125 insertions, 113 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 7523539cfe9f..4e23ba2f3ca7 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -441,8 +441,7 @@ int main(void)
441 DEFINE(KVM_HOST_LPCR, offsetof(struct kvm, arch.host_lpcr)); 441 DEFINE(KVM_HOST_LPCR, offsetof(struct kvm, arch.host_lpcr));
442 DEFINE(KVM_HOST_SDR1, offsetof(struct kvm, arch.host_sdr1)); 442 DEFINE(KVM_HOST_SDR1, offsetof(struct kvm, arch.host_sdr1));
443 DEFINE(KVM_TLBIE_LOCK, offsetof(struct kvm, arch.tlbie_lock)); 443 DEFINE(KVM_TLBIE_LOCK, offsetof(struct kvm, arch.tlbie_lock));
444 DEFINE(KVM_ONLINE_CPUS, offsetof(struct kvm, online_vcpus.counter)); 444 DEFINE(KVM_NEED_FLUSH, offsetof(struct kvm, arch.need_tlb_flush.bits));
445 DEFINE(KVM_LAST_VCPU, offsetof(struct kvm, arch.last_vcpu));
446 DEFINE(KVM_LPCR, offsetof(struct kvm, arch.lpcr)); 445 DEFINE(KVM_LPCR, offsetof(struct kvm, arch.lpcr));
447 DEFINE(KVM_RMOR, offsetof(struct kvm, arch.rmor)); 446 DEFINE(KVM_RMOR, offsetof(struct kvm, arch.rmor));
448 DEFINE(KVM_VRMA_SLB_V, offsetof(struct kvm, arch.vrma_slb_v)); 447 DEFINE(KVM_VRMA_SLB_V, offsetof(struct kvm, arch.vrma_slb_v));
@@ -470,7 +469,6 @@ int main(void)
470 DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb)); 469 DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb));
471 DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max)); 470 DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max));
472 DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr)); 471 DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr));
473 DEFINE(VCPU_LAST_CPU, offsetof(struct kvm_vcpu, arch.last_cpu));
474 DEFINE(VCPU_FAULT_DSISR, offsetof(struct kvm_vcpu, arch.fault_dsisr)); 472 DEFINE(VCPU_FAULT_DSISR, offsetof(struct kvm_vcpu, arch.fault_dsisr));
475 DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar)); 473 DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar));
476 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); 474 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 9499385676e7..d22e73e4618b 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -444,11 +444,6 @@ ret_from_kernel_thread:
444 PPC440EP_ERR42 444 PPC440EP_ERR42
445 blrl 445 blrl
446 li r3,0 446 li r3,0
447 b do_exit # no return
448
449 .globl __ret_from_kernel_execve
450__ret_from_kernel_execve:
451 addi r1,r3,-STACK_FRAME_OVERHEAD
452 b ret_from_syscall 447 b ret_from_syscall
453 448
454/* Traced system call support */ 449/* Traced system call support */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index ad7666695761..b310a0573625 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -373,19 +373,13 @@ _GLOBAL(ret_from_fork)
373_GLOBAL(ret_from_kernel_thread) 373_GLOBAL(ret_from_kernel_thread)
374 bl .schedule_tail 374 bl .schedule_tail
375 REST_NVGPRS(r1) 375 REST_NVGPRS(r1)
376 REST_GPR(2,r1)
377 li r3,0 376 li r3,0
378 std r3,0(r1) 377 std r3,0(r1)
378 ld r14, 0(r14)
379 mtlr r14 379 mtlr r14
380 mr r3,r15 380 mr r3,r15
381 blrl 381 blrl
382 li r3,0 382 li r3,0
383 b .do_exit # no return
384
385_GLOBAL(__ret_from_kernel_execve)
386 addi r1,r3,-STACK_FRAME_OVERHEAD
387 li r10,1
388 std r10,SOFTE(r1)
389 b syscall_exit 383 b syscall_exit
390 384
391 .section ".toc","aw" 385 .section ".toc","aw"
diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
index 697b390ebfd8..62c0dc237826 100644
--- a/arch/powerpc/kernel/epapr_hcalls.S
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -8,13 +8,41 @@
8 */ 8 */
9 9
10#include <linux/threads.h> 10#include <linux/threads.h>
11#include <asm/epapr_hcalls.h>
11#include <asm/reg.h> 12#include <asm/reg.h>
12#include <asm/page.h> 13#include <asm/page.h>
13#include <asm/cputable.h> 14#include <asm/cputable.h>
14#include <asm/thread_info.h> 15#include <asm/thread_info.h>
15#include <asm/ppc_asm.h> 16#include <asm/ppc_asm.h>
17#include <asm/asm-compat.h>
16#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
17 19
20/* epapr_ev_idle() was derived from e500_idle() */
21_GLOBAL(epapr_ev_idle)
22 CURRENT_THREAD_INFO(r3, r1)
23 PPC_LL r4, TI_LOCAL_FLAGS(r3) /* set napping bit */
24 ori r4, r4,_TLF_NAPPING /* so when we take an exception */
25 PPC_STL r4, TI_LOCAL_FLAGS(r3) /* it will return to our caller */
26
27 wrteei 1
28
29idle_loop:
30 LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
31
32.global epapr_ev_idle_start
33epapr_ev_idle_start:
34 li r3, -1
35 nop
36 nop
37 nop
38
39 /*
40 * Guard against spurious wakeups from a hypervisor --
41 * only interrupt will cause us to return to LR due to
42 * _TLF_NAPPING.
43 */
44 b idle_loop
45
18/* Hypercall entry point. Will be patched with device tree instructions. */ 46/* Hypercall entry point. Will be patched with device tree instructions. */
19.global epapr_hypercall_start 47.global epapr_hypercall_start
20epapr_hypercall_start: 48epapr_hypercall_start:
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index 028aeae370b6..f3eab8594d9f 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -21,6 +21,10 @@
21#include <asm/epapr_hcalls.h> 21#include <asm/epapr_hcalls.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/code-patching.h> 23#include <asm/code-patching.h>
24#include <asm/machdep.h>
25
26extern void epapr_ev_idle(void);
27extern u32 epapr_ev_idle_start[];
24 28
25bool epapr_paravirt_enabled; 29bool epapr_paravirt_enabled;
26 30
@@ -41,8 +45,13 @@ static int __init epapr_paravirt_init(void)
41 if (len % 4 || len > (4 * 4)) 45 if (len % 4 || len > (4 * 4))
42 return -ENODEV; 46 return -ENODEV;
43 47
44 for (i = 0; i < (len / 4); i++) 48 for (i = 0; i < (len / 4); i++) {
45 patch_instruction(epapr_hypercall_start + i, insts[i]); 49 patch_instruction(epapr_hypercall_start + i, insts[i]);
50 patch_instruction(epapr_ev_idle_start + i, insts[i]);
51 }
52
53 if (of_get_property(hyper_node, "has-idle", NULL))
54 ppc_md.power_save = epapr_ev_idle;
46 55
47 epapr_paravirt_enabled = true; 56 epapr_paravirt_enabled = true;
48 57
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 867db1de8949..a61b133c4f99 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -419,7 +419,7 @@ static void kvm_map_magic_page(void *data)
419 in[0] = KVM_MAGIC_PAGE; 419 in[0] = KVM_MAGIC_PAGE;
420 in[1] = KVM_MAGIC_PAGE; 420 in[1] = KVM_MAGIC_PAGE;
421 421
422 kvm_hypercall(in, out, HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE); 422 kvm_hypercall(in, out, KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE));
423 423
424 *features = out[0]; 424 *features = out[0];
425} 425}
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index bedd12e1cfbc..0733b05eb856 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -387,7 +387,7 @@ void __init find_legacy_serial_ports(void)
387 of_node_put(parent); 387 of_node_put(parent);
388 continue; 388 continue;
389 } 389 }
390 /* Check for known pciclass, and also check wether we have 390 /* Check for known pciclass, and also check whether we have
391 * a device with child nodes for ports or not 391 * a device with child nodes for ports or not
392 */ 392 */
393 if (of_device_is_compatible(np, "pciclass,0700") || 393 if (of_device_is_compatible(np, "pciclass,0700") ||
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 2049f2d00ffe..9db8ec07ec94 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -82,7 +82,7 @@ static int __devinit of_pci_phb_probe(struct platform_device *dev)
82 return -ENXIO; 82 return -ENXIO;
83 83
84 /* Claim resources. This might need some rework as well depending 84 /* Claim resources. This might need some rework as well depending
85 * wether we are doing probe-only or not, like assigning unassigned 85 * whether we are doing probe-only or not, like assigning unassigned
86 * resources etc... 86 * resources etc...
87 */ 87 */
88 pcibios_claim_one_bus(phb->bus); 88 pcibios_claim_one_bus(phb->bus);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 7f94f760dd0c..abc0d0856994 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1428,8 +1428,6 @@ void __init pcibios_resource_survey(void)
1428 ppc_md.pcibios_fixup(); 1428 ppc_md.pcibios_fixup();
1429} 1429}
1430 1430
1431#ifdef CONFIG_HOTPLUG
1432
1433/* This is used by the PCI hotplug driver to allocate resource 1431/* This is used by the PCI hotplug driver to allocate resource
1434 * of newly plugged busses. We can try to consolidate with the 1432 * of newly plugged busses. We can try to consolidate with the
1435 * rest of the code later, for now, keep it as-is as our main 1433 * rest of the code later, for now, keep it as-is as our main
@@ -1488,8 +1486,6 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1488} 1486}
1489EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); 1487EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1490 1488
1491#endif /* CONFIG_HOTPLUG */
1492
1493int pcibios_enable_device(struct pci_dev *dev, int mask) 1489int pcibios_enable_device(struct pci_dev *dev, int mask)
1494{ 1490{
1495 if (ppc_md.pcibios_enable_device_hook) 1491 if (ppc_md.pcibios_enable_device_hook)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 4ff190ff24a0..2cbe6768fddd 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -74,8 +74,6 @@ static int __init pcibios_init(void)
74 74
75subsys_initcall(pcibios_init); 75subsys_initcall(pcibios_init);
76 76
77#ifdef CONFIG_HOTPLUG
78
79int pcibios_unmap_io_space(struct pci_bus *bus) 77int pcibios_unmap_io_space(struct pci_bus *bus)
80{ 78{
81 struct pci_controller *hose; 79 struct pci_controller *hose;
@@ -124,8 +122,6 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
124} 122}
125EXPORT_SYMBOL_GPL(pcibios_unmap_io_space); 123EXPORT_SYMBOL_GPL(pcibios_unmap_io_space);
126 124
127#endif /* CONFIG_HOTPLUG */
128
129static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose) 125static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose)
130{ 126{
131 struct vm_struct *area; 127 struct vm_struct *area;
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 19e4288d8486..78b8766fd79e 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -43,6 +43,7 @@
43#include <asm/dcr.h> 43#include <asm/dcr.h>
44#include <asm/ftrace.h> 44#include <asm/ftrace.h>
45#include <asm/switch_to.h> 45#include <asm/switch_to.h>
46#include <asm/epapr_hcalls.h>
46 47
47#ifdef CONFIG_PPC32 48#ifdef CONFIG_PPC32
48extern void transfer_to_handler(void); 49extern void transfer_to_handler(void);
@@ -191,3 +192,7 @@ EXPORT_SYMBOL(__arch_hweight64);
191#ifdef CONFIG_PPC_BOOK3S_64 192#ifdef CONFIG_PPC_BOOK3S_64
192EXPORT_SYMBOL_GPL(mmu_psize_defs); 193EXPORT_SYMBOL_GPL(mmu_psize_defs);
193#endif 194#endif
195
196#ifdef CONFIG_EPAPR_PARAVIRT
197EXPORT_SYMBOL(epapr_hypercall_start);
198#endif
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ba48233500f6..81430674e71c 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -733,8 +733,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
733extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */ 733extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */
734 734
735int copy_thread(unsigned long clone_flags, unsigned long usp, 735int copy_thread(unsigned long clone_flags, unsigned long usp,
736 unsigned long arg, struct task_struct *p, 736 unsigned long arg, struct task_struct *p)
737 struct pt_regs *regs)
738{ 737{
739 struct pt_regs *childregs, *kregs; 738 struct pt_regs *childregs, *kregs;
740 extern void ret_from_fork(void); 739 extern void ret_from_fork(void);
@@ -745,25 +744,25 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
745 /* Copy registers */ 744 /* Copy registers */
746 sp -= sizeof(struct pt_regs); 745 sp -= sizeof(struct pt_regs);
747 childregs = (struct pt_regs *) sp; 746 childregs = (struct pt_regs *) sp;
748 if (!regs) { 747 if (unlikely(p->flags & PF_KTHREAD)) {
749 /* for kernel thread, set `current' and stackptr in new task */ 748 struct thread_info *ti = (void *)task_stack_page(p);
750 memset(childregs, 0, sizeof(struct pt_regs)); 749 memset(childregs, 0, sizeof(struct pt_regs));
751 childregs->gpr[1] = sp + sizeof(struct pt_regs); 750 childregs->gpr[1] = sp + sizeof(struct pt_regs);
751 childregs->gpr[14] = usp; /* function */
752#ifdef CONFIG_PPC64 752#ifdef CONFIG_PPC64
753 childregs->gpr[14] = *(unsigned long *)usp;
754 childregs->gpr[2] = ((unsigned long *)usp)[1],
755 clear_tsk_thread_flag(p, TIF_32BIT); 753 clear_tsk_thread_flag(p, TIF_32BIT);
756#else 754 childregs->softe = 1;
757 childregs->gpr[14] = usp; /* function */
758 childregs->gpr[2] = (unsigned long) p;
759#endif 755#endif
760 childregs->gpr[15] = arg; 756 childregs->gpr[15] = arg;
761 p->thread.regs = NULL; /* no user register state */ 757 p->thread.regs = NULL; /* no user register state */
758 ti->flags |= _TIF_RESTOREALL;
762 f = ret_from_kernel_thread; 759 f = ret_from_kernel_thread;
763 } else { 760 } else {
761 struct pt_regs *regs = current_pt_regs();
764 CHECK_FULL_REGS(regs); 762 CHECK_FULL_REGS(regs);
765 *childregs = *regs; 763 *childregs = *regs;
766 childregs->gpr[1] = usp; 764 if (usp)
765 childregs->gpr[1] = usp;
767 p->thread.regs = childregs; 766 p->thread.regs = childregs;
768 childregs->gpr[3] = 0; /* Result from fork() */ 767 childregs->gpr[3] = 0; /* Result from fork() */
769 if (clone_flags & CLONE_SETTLS) { 768 if (clone_flags & CLONE_SETTLS) {
@@ -1027,51 +1026,6 @@ int get_unalign_ctl(struct task_struct *tsk, unsigned long adr)
1027 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); 1026 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr);
1028} 1027}
1029 1028
1030#define TRUNC_PTR(x) ((typeof(x))(((unsigned long)(x)) & 0xffffffff))
1031
1032int sys_clone(unsigned long clone_flags, unsigned long usp,
1033 int __user *parent_tidp, void __user *child_threadptr,
1034 int __user *child_tidp, int p6,
1035 struct pt_regs *regs)
1036{
1037 CHECK_FULL_REGS(regs);
1038 if (usp == 0)
1039 usp = regs->gpr[1]; /* stack pointer for child */
1040#ifdef CONFIG_PPC64
1041 if (is_32bit_task()) {
1042 parent_tidp = TRUNC_PTR(parent_tidp);
1043 child_tidp = TRUNC_PTR(child_tidp);
1044 }
1045#endif
1046 return do_fork(clone_flags, usp, regs, 0, parent_tidp, child_tidp);
1047}
1048
1049int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3,
1050 unsigned long p4, unsigned long p5, unsigned long p6,
1051 struct pt_regs *regs)
1052{
1053 CHECK_FULL_REGS(regs);
1054 return do_fork(SIGCHLD, regs->gpr[1], regs, 0, NULL, NULL);
1055}
1056
1057int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3,
1058 unsigned long p4, unsigned long p5, unsigned long p6,
1059 struct pt_regs *regs)
1060{
1061 CHECK_FULL_REGS(regs);
1062 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1],
1063 regs, 0, NULL, NULL);
1064}
1065
1066void __ret_from_kernel_execve(struct pt_regs *normal)
1067__noreturn;
1068
1069void ret_from_kernel_execve(struct pt_regs *normal)
1070{
1071 set_thread_flag(TIF_RESTOREALL);
1072 __ret_from_kernel_execve(normal);
1073}
1074
1075static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, 1029static inline int valid_irq_stack(unsigned long sp, struct task_struct *p,
1076 unsigned long nbytes) 1030 unsigned long nbytes)
1077{ 1031{
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index a2dc75793bd5..3b997118df50 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -158,10 +158,8 @@ static int do_signal(struct pt_regs *regs)
158 158
159void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 159void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
160{ 160{
161 if (thread_info_flags & _TIF_UPROBE) { 161 if (thread_info_flags & _TIF_UPROBE)
162 clear_thread_flag(TIF_UPROBE);
163 uprobe_notify_resume(regs); 162 uprobe_notify_resume(regs);
164 }
165 163
166 if (thread_info_flags & _TIF_SIGPENDING) 164 if (thread_info_flags & _TIF_SIGPENDING)
167 do_signal(regs); 165 do_signal(regs);
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index d183f8719a50..1ca045d44324 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -83,7 +83,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
83 * the context). This is very important because we must ensure we 83 * the context). This is very important because we must ensure we
84 * don't lose the VRSAVE content that may have been set prior to 84 * don't lose the VRSAVE content that may have been set prior to
85 * the process doing its first vector operation 85 * the process doing its first vector operation
86 * Userland shall check AT_HWCAP to know wether it can rely on the 86 * Userland shall check AT_HWCAP to know whether it can rely on the
87 * v_regs pointer or not 87 * v_regs pointer or not
88 */ 88 */
89#ifdef CONFIG_ALTIVEC 89#ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 2b952b5386fd..e5b133ebd8a5 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -427,6 +427,45 @@ int generic_check_cpu_restart(unsigned int cpu)
427{ 427{
428 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE; 428 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE;
429} 429}
430
431static atomic_t secondary_inhibit_count;
432
433/*
434 * Don't allow secondary CPU threads to come online
435 */
436void inhibit_secondary_onlining(void)
437{
438 /*
439 * This makes secondary_inhibit_count stable during cpu
440 * online/offline operations.
441 */
442 get_online_cpus();
443
444 atomic_inc(&secondary_inhibit_count);
445 put_online_cpus();
446}
447EXPORT_SYMBOL_GPL(inhibit_secondary_onlining);
448
449/*
450 * Allow secondary CPU threads to come online again
451 */
452void uninhibit_secondary_onlining(void)
453{
454 get_online_cpus();
455 atomic_dec(&secondary_inhibit_count);
456 put_online_cpus();
457}
458EXPORT_SYMBOL_GPL(uninhibit_secondary_onlining);
459
460static int secondaries_inhibited(void)
461{
462 return atomic_read(&secondary_inhibit_count);
463}
464
465#else /* HOTPLUG_CPU */
466
467#define secondaries_inhibited() 0
468
430#endif 469#endif
431 470
432static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle) 471static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle)
@@ -445,6 +484,13 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
445{ 484{
446 int rc, c; 485 int rc, c;
447 486
487 /*
488 * Don't allow secondary threads to come online if inhibited
489 */
490 if (threads_per_core > 1 && secondaries_inhibited() &&
491 cpu % threads_per_core != 0)
492 return -EBUSY;
493
448 if (smp_ops == NULL || 494 if (smp_ops == NULL ||
449 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu))) 495 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
450 return -EINVAL; 496 return -EINVAL;
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 9c2ed90ece8f..8a93778ed9f5 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -175,19 +175,10 @@ asmlinkage long compat_sys_prctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 a
175 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 175 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
176 * and the register representation of a signed int (msr in 64-bit mode) is performed. 176 * and the register representation of a signed int (msr in 64-bit mode) is performed.
177 */ 177 */
178asmlinkage long compat_sys_sched_rr_get_interval(u32 pid, struct compat_timespec __user *interval) 178asmlinkage long compat_sys_sched_rr_get_interval_wrapper(u32 pid,
179{ 179 struct compat_timespec __user *interval)
180 struct timespec t; 180{
181 int ret; 181 return compat_sys_sched_rr_get_interval((int)pid, interval);
182 mm_segment_t old_fs = get_fs ();
183
184 /* The __user pointer cast is valid because of the set_fs() */
185 set_fs (KERNEL_DS);
186 ret = sys_sched_rr_get_interval((int)pid, (struct timespec __user *) &t);
187 set_fs (old_fs);
188 if (put_compat_timespec(&t, interval))
189 return -EFAULT;
190 return ret;
191} 182}
192 183
193/* Note: it is necessary to treat mode as an unsigned int, 184/* Note: it is necessary to treat mode as an unsigned int,
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index cf357a059ddb..3ce1f864c2d3 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -607,7 +607,7 @@ static void register_nodes(void)
607 607
608int sysfs_add_device_to_node(struct device *dev, int nid) 608int sysfs_add_device_to_node(struct device *dev, int nid)
609{ 609{
610 struct node *node = &node_devices[nid]; 610 struct node *node = node_devices[nid];
611 return sysfs_create_link(&node->dev.kobj, &dev->kobj, 611 return sysfs_create_link(&node->dev.kobj, &dev->kobj,
612 kobject_name(&dev->kobj)); 612 kobject_name(&dev->kobj));
613} 613}
@@ -615,7 +615,7 @@ EXPORT_SYMBOL_GPL(sysfs_add_device_to_node);
615 615
616void sysfs_remove_device_from_node(struct device *dev, int nid) 616void sysfs_remove_device_from_node(struct device *dev, int nid)
617{ 617{
618 struct node *node = &node_devices[nid]; 618 struct node *node = node_devices[nid];
619 sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj)); 619 sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj));
620} 620}
621EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); 621EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index ce4cb772dc78..b3b14352b05e 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -297,6 +297,8 @@ static u64 vtime_delta(struct task_struct *tsk,
297 u64 now, nowscaled, deltascaled; 297 u64 now, nowscaled, deltascaled;
298 u64 udelta, delta, user_scaled; 298 u64 udelta, delta, user_scaled;
299 299
300 WARN_ON_ONCE(!irqs_disabled());
301
300 now = mftb(); 302 now = mftb();
301 nowscaled = read_spurr(now); 303 nowscaled = read_spurr(now);
302 get_paca()->system_time += now - get_paca()->starttime; 304 get_paca()->system_time += now - get_paca()->starttime;
@@ -355,15 +357,15 @@ void vtime_account_idle(struct task_struct *tsk)
355} 357}
356 358
357/* 359/*
358 * Transfer the user and system times accumulated in the paca 360 * Transfer the user time accumulated in the paca
359 * by the exception entry and exit code to the generic process 361 * by the exception entry and exit code to the generic
360 * user and system time records. 362 * process user time records.
361 * Must be called with interrupts disabled. 363 * Must be called with interrupts disabled.
362 * Assumes that vtime_account() has been called recently 364 * Assumes that vtime_account_system/idle() has been called
363 * (i.e. since the last entry from usermode) so that 365 * recently (i.e. since the last entry from usermode) so that
364 * get_paca()->user_time_scaled is up to date. 366 * get_paca()->user_time_scaled is up to date.
365 */ 367 */
366void account_process_tick(struct task_struct *tsk, int user_tick) 368void vtime_account_user(struct task_struct *tsk)
367{ 369{
368 cputime_t utime, utimescaled; 370 cputime_t utime, utimescaled;
369 371
@@ -375,12 +377,6 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
375 account_user_time(tsk, utime, utimescaled); 377 account_user_time(tsk, utime, utimescaled);
376} 378}
377 379
378void vtime_task_switch(struct task_struct *prev)
379{
380 vtime_account(prev);
381 account_process_tick(prev, 0);
382}
383
384#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */ 380#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */
385#define calc_cputime_factors() 381#define calc_cputime_factors()
386#endif 382#endif
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index d2d46d1014f8..bc77834dbf43 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -64,6 +64,8 @@ int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
64 autask->saved_trap_nr = current->thread.trap_nr; 64 autask->saved_trap_nr = current->thread.trap_nr;
65 current->thread.trap_nr = UPROBE_TRAP_NR; 65 current->thread.trap_nr = UPROBE_TRAP_NR;
66 regs->nip = current->utask->xol_vaddr; 66 regs->nip = current->utask->xol_vaddr;
67
68 user_enable_single_step(current);
67 return 0; 69 return 0;
68} 70}
69 71
@@ -119,6 +121,8 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
119 * to be executed. 121 * to be executed.
120 */ 122 */
121 regs->nip = utask->vaddr + MAX_UINSN_BYTES; 123 regs->nip = utask->vaddr + MAX_UINSN_BYTES;
124
125 user_disable_single_step(current);
122 return 0; 126 return 0;
123} 127}
124 128
@@ -162,6 +166,8 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
162 166
163 current->thread.trap_nr = utask->autask.saved_trap_nr; 167 current->thread.trap_nr = utask->autask.saved_trap_nr;
164 instruction_pointer_set(regs, utask->vaddr); 168 instruction_pointer_set(regs, utask->vaddr);
169
170 user_disable_single_step(current);
165} 171}
166 172
167/* 173/*