aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2014-07-09 22:29:21 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-07-28 00:10:24 -0400
commitcec15488c7e165a10f4c61cfba91c779e6afd19d (patch)
tree2b5d74e2d07357b16446bcd4880b2e18a26a0b38 /arch
parent13b3d13b813ab834fac67dc05f8b86dbcc29c134 (diff)
powerpc: Pull out ksp_vsid logic into a helper
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/process.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e39f388fc25c..9c34327e38ca 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1095,6 +1095,23 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
1095 return 0; 1095 return 0;
1096} 1096}
1097 1097
1098static void setup_ksp_vsid(struct task_struct *p, unsigned long sp)
1099{
1100#ifdef CONFIG_PPC_STD_MMU_64
1101 unsigned long sp_vsid;
1102 unsigned long llp = mmu_psize_defs[mmu_linear_psize].sllp;
1103
1104 if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
1105 sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_1T)
1106 << SLB_VSID_SHIFT_1T;
1107 else
1108 sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_256M)
1109 << SLB_VSID_SHIFT;
1110 sp_vsid |= SLB_VSID_KERNEL | llp;
1111 p->thread.ksp_vsid = sp_vsid;
1112#endif
1113}
1114
1098/* 1115/*
1099 * Copy a thread.. 1116 * Copy a thread..
1100 */ 1117 */
@@ -1174,21 +1191,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
1174 p->thread.vr_save_area = NULL; 1191 p->thread.vr_save_area = NULL;
1175#endif 1192#endif
1176 1193
1177#ifdef CONFIG_PPC_STD_MMU_64 1194 setup_ksp_vsid(p, sp);
1178 {
1179 unsigned long sp_vsid;
1180 unsigned long llp = mmu_psize_defs[mmu_linear_psize].sllp;
1181 1195
1182 if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
1183 sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_1T)
1184 << SLB_VSID_SHIFT_1T;
1185 else
1186 sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_256M)
1187 << SLB_VSID_SHIFT;
1188 sp_vsid |= SLB_VSID_KERNEL | llp;
1189 p->thread.ksp_vsid = sp_vsid;
1190 }
1191#endif /* CONFIG_PPC_STD_MMU_64 */
1192#ifdef CONFIG_PPC64 1196#ifdef CONFIG_PPC64
1193 if (cpu_has_feature(CPU_FTR_DSCR)) { 1197 if (cpu_has_feature(CPU_FTR_DSCR)) {
1194 p->thread.dscr_inherit = current->thread.dscr_inherit; 1198 p->thread.dscr_inherit = current->thread.dscr_inherit;