[RFC PATCH 4/6] powerpc/64s: Make hash MMU code build configurable

Christophe Leroy christophe.leroy at csgroup.eu
Sat Aug 28 19:34:35 AEST 2021



Le 27/08/2021 à 18:34, Nicholas Piggin a écrit :
> Introduce a new option CONFIG_PPC_64S_HASH_MMU which allows the 64s hash
> MMU code to be compiled out if radix is selected and the minimum
> supported CPU type is POWER9 or higher, and KVM is not selected.
> 
> This saves 128kB kernel image size (90kB text) on powernv_defconfig
> minus KVM, 350kB on pseries_defconfig minus KVM, 40kB on a tiny config.
> 
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---

...

> @@ -324,6 +330,7 @@ static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
>   }
>   #endif /* !CONFIG_DEBUG_VM */
>   
> +#if defined(CONFIG_PPC_RADIX_MMU) && defined(CONFIG_PPC_64S_HASH_MMU)
>   static inline bool radix_enabled(void)
>   {
>   	return mmu_has_feature(MMU_FTR_TYPE_RADIX);
> @@ -333,6 +340,27 @@ static inline bool early_radix_enabled(void)
>   {
>   	return early_mmu_has_feature(MMU_FTR_TYPE_RADIX);
>   }
> +#elif defined(CONFIG_PPC_64S_HASH_MMU)
> +static inline bool radix_enabled(void)
> +{
> +	return false;
> +}
> +
> +static inline bool early_radix_enabled(void)
> +{
> +	return false;
> +}
> +#else
> +static inline bool radix_enabled(void)
> +{
> +	return true;
> +}
> +
> +static inline bool early_radix_enabled(void)
> +{
> +	return true;
> +}
> +#endif

You don't need something that complex. You don't need to change that at all indeed, just have to 
ensure that when CONFIG_PPC_64S_HASH_MMU is not selected you have MMU_FTR_TYPE_RADIX included in 
MMU_FTRS_ALWAYS and voila.

>   
>   #ifdef CONFIG_STRICT_KERNEL_RWX
>   static inline bool strict_kernel_rwx_enabled(void)


More information about the Linuxppc-dev mailing list