]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
powerpc: Pull out ksp_vsid logic into a helper
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 10 Jul 2014 02:29:21 +0000 (12:29 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 28 Jul 2014 04:10:24 +0000 (14:10 +1000)
The previous patch left a bit of a wart in copy_process(). Clean it up a
bit by moving the logic out into a helper.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/process.c

index e39f388fc25ccb7c42f8083e14f752d535ae35ed..9c34327e38ca800865048496e1b7c3a7e2bd7091 100644 (file)
@@ -1095,6 +1095,23 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
        return 0;
 }
 
+static void setup_ksp_vsid(struct task_struct *p, unsigned long sp)
+{
+#ifdef CONFIG_PPC_STD_MMU_64
+       unsigned long sp_vsid;
+       unsigned long llp = mmu_psize_defs[mmu_linear_psize].sllp;
+
+       if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
+               sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_1T)
+                       << SLB_VSID_SHIFT_1T;
+       else
+               sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_256M)
+                       << SLB_VSID_SHIFT;
+       sp_vsid |= SLB_VSID_KERNEL | llp;
+       p->thread.ksp_vsid = sp_vsid;
+#endif
+}
+
 /*
  * Copy a thread..
  */
@@ -1174,21 +1191,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
        p->thread.vr_save_area = NULL;
 #endif
 
-#ifdef CONFIG_PPC_STD_MMU_64
-       {
-               unsigned long sp_vsid;
-               unsigned long llp = mmu_psize_defs[mmu_linear_psize].sllp;
+       setup_ksp_vsid(p, sp);
 
-               if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
-                       sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_1T)
-                               << SLB_VSID_SHIFT_1T;
-               else
-                       sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_256M)
-                               << SLB_VSID_SHIFT;
-               sp_vsid |= SLB_VSID_KERNEL | llp;
-               p->thread.ksp_vsid = sp_vsid;
-       }
-#endif /* CONFIG_PPC_STD_MMU_64 */
 #ifdef CONFIG_PPC64 
        if (cpu_has_feature(CPU_FTR_DSCR)) {
                p->thread.dscr_inherit = current->thread.dscr_inherit;