diff options
author | Anton Arapov <anton@redhat.com> | 2012-10-29 11:15:37 +0100 |
---|---|---|
committer | Anton Arapov <anton@redhat.com> | 2012-10-29 11:15:37 +0100 |
commit | 7d558cd9c7b18e4b16953265aa0da45e63f3b968 (patch) | |
tree | 7135d5a810768c9c619346282ee9cfdf1765e225 /arch/powerpc/kernel/vdso.c | |
parent | 985ef6b2108ed28ffd5f6630e1e0fce2e2a775f2 (diff) | |
download | kernel-uprobes-7d558cd9c7b18e4b16953265aa0da45e63f3b968.tar.gz kernel-uprobes-7d558cd9c7b18e4b16953265aa0da45e63f3b968.tar.xz kernel-uprobes-7d558cd9c7b18e4b16953265aa0da45e63f3b968.zip |
Signed-off-by: Anton Arapov <anton@redhat.com>
Diffstat (limited to 'arch/powerpc/kernel/vdso.c')
-rw-r--r-- | arch/powerpc/kernel/vdso.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index 9eb5b9b536a..b67db22e102 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c @@ -706,6 +706,34 @@ static void __init vdso_setup_syscall_map(void) } } +#ifdef CONFIG_PPC64 +int __cpuinit vdso_getcpu_init(void) +{ + unsigned long cpu, node, val; + + /* + * SPRG3 contains the CPU in the bottom 16 bits and the NUMA node in + * the next 16 bits. The VDSO uses this to implement getcpu(). + */ + cpu = get_cpu(); + WARN_ON_ONCE(cpu > 0xffff); + + node = cpu_to_node(cpu); + WARN_ON_ONCE(node > 0xffff); + + val = (cpu & 0xfff) | ((node & 0xffff) << 16); + mtspr(SPRN_SPRG3, val); +#ifdef CONFIG_KVM_BOOK3S_HANDLER + get_paca()->kvm_hstate.sprg3 = val; +#endif + + put_cpu(); + + return 0; +} +/* We need to call this before SMP init */ +early_initcall(vdso_getcpu_init); +#endif static int __init vdso_init(void) { |