powerpc/mm: Add mask of always present MMU features

On the same principle as commit 773edeadf6 ("powerpc/mm: Add mask
of possible MMU features"), add mask for MMU features that are
always there in order to optimise out dead branches.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/4943775fbe91885eb3e09133b093aaf62e55c715.1603348103.git.christophe.leroy@csgroup.eu
This commit is contained in:
Christophe Leroy 2020-10-22 06:29:27 +00:00 committed by Michael Ellerman
parent f10881a46f
commit f9158d58a4
1 changed files with 25 additions and 0 deletions

View File

@ -206,8 +206,30 @@ enum {
0,
};
#ifdef CONFIG_PPC_8xx
#define MMU_FTRS_ALWAYS MMU_FTR_TYPE_8xx
#endif
#ifdef CONFIG_40x
#define MMU_FTRS_ALWAYS MMU_FTR_TYPE_40x
#endif
#ifdef CONFIG_PPC_47x
#define MMU_FTRS_ALWAYS MMU_FTR_TYPE_47x
#elif defined(CONFIG_44x)
#define MMU_FTRS_ALWAYS MMU_FTR_TYPE_44x
#endif
#if defined(CONFIG_E200) || defined(CONFIG_E500)
#define MMU_FTRS_ALWAYS MMU_FTR_TYPE_FSL_E
#endif
#ifndef MMU_FTRS_ALWAYS
#define MMU_FTRS_ALWAYS 0
#endif
static inline bool early_mmu_has_feature(unsigned long feature)
{
if (MMU_FTRS_ALWAYS & feature)
return true;
return !!(MMU_FTRS_POSSIBLE & cur_cpu_spec->mmu_features & feature);
}
@ -236,6 +258,9 @@ static __always_inline bool mmu_has_feature(unsigned long feature)
}
#endif
if (MMU_FTRS_ALWAYS & feature)
return true;
if (!(MMU_FTRS_POSSIBLE & feature))
return false;