Skip to content

Commit

Permalink
powerpc/mm: any thread in one core can be the first to setup TLB1
Browse files Browse the repository at this point in the history
On e6500, in the case of cpu hotplug, either thread in one core
may be the first thread initilzing the TLB1. The subsequent threads
must not setup it again.

The code is derived from the comment of Scott Wood.

Signed-off-by: Chenhui Zhao <chenhui.zhao@freescale.com>
Signed-off-by: Scott Wood <oss@buserror.net>
  • Loading branch information
chenhui zhao authored and Scott Wood committed Mar 5, 2016
1 parent d64716c commit ebb9d30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 8 additions & 0 deletions arch/powerpc/include/asm/cputhreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ static inline int cpu_last_thread_sibling(int cpu)
return cpu | (threads_per_core - 1);
}

static inline u32 get_tensr(void)
{
#ifdef CONFIG_BOOKE
if (cpu_has_feature(CPU_FTR_SMT))
return mfspr(SPRN_TENSR);
#endif
return 1;
}


#endif /* _ASM_POWERPC_CPUTHREADS_H */
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/mm/tlb_nohash.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,7 @@ static void early_init_this_mmu(void)
* transient mapping would cause problems.
*/
#ifdef CONFIG_SMP
if (cpu != boot_cpuid &&
(cpu != cpu_first_thread_sibling(cpu) ||
cpu == cpu_first_thread_sibling(boot_cpuid)))
if (hweight32(get_tensr()) > 1)
map = false;
#endif

Expand Down

0 comments on commit ebb9d30

Please sign in to comment.