powerpc/mm: Avoid unnecessary test and reduce code size

no_selective_tlbil hence the use of either steal_all_contexts()
or steal_context_up() depends on the subarch, it won't change
during run. Only the 8xx uses steal_all_contexts and CONFIG_PPC_8xx
is exclusive of other processors.

This patch replaces the test of no_selective_tlbil global var by
a test of CONFIG_PPC_8xx selection. It avoids the test and
removes unnecessary code.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Christophe Leroy 2018-03-21 15:07:49 +01:00 committed by Michael Ellerman
parent 8820a44738
commit 48bdcace59

View File

@ -62,7 +62,6 @@ static unsigned long *context_map;
static unsigned long *stale_map[NR_CPUS]; static unsigned long *stale_map[NR_CPUS];
static struct mm_struct **context_mm; static struct mm_struct **context_mm;
static DEFINE_RAW_SPINLOCK(context_lock); static DEFINE_RAW_SPINLOCK(context_lock);
static bool no_selective_tlbil;
#define CTX_MAP_SIZE \ #define CTX_MAP_SIZE \
(sizeof(unsigned long) * (last_context / BITS_PER_LONG + 1)) (sizeof(unsigned long) * (last_context / BITS_PER_LONG + 1))
@ -279,7 +278,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next,
goto stolen; goto stolen;
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
if (no_selective_tlbil) if (IS_ENABLED(CONFIG_PPC_8xx))
id = steal_all_contexts(); id = steal_all_contexts();
else else
id = steal_context_up(id); id = steal_context_up(id);
@ -440,16 +439,12 @@ void __init mmu_context_init(void)
* present if needed. * present if needed.
* -- BenH * -- BenH
*/ */
if (mmu_has_feature(MMU_FTR_TYPE_8xx)) { if (mmu_has_feature(MMU_FTR_TYPE_8xx))
last_context = 16; last_context = 16;
no_selective_tlbil = true; else if (mmu_has_feature(MMU_FTR_TYPE_47x))
} else if (mmu_has_feature(MMU_FTR_TYPE_47x)) {
last_context = 65535; last_context = 65535;
no_selective_tlbil = false; else
} else {
last_context = 255; last_context = 255;
no_selective_tlbil = false;
}
#ifdef DEBUG_CLAMP_LAST_CONTEXT #ifdef DEBUG_CLAMP_LAST_CONTEXT
last_context = DEBUG_CLAMP_LAST_CONTEXT; last_context = DEBUG_CLAMP_LAST_CONTEXT;