Re: [PATCH] powerpc/32s: fix BATs setting with CONFIG_STRICT_KERNEL_RWX

From: Segher Boessenkool
Date: Mon Apr 29 2019 - 08:03:54 EST


Acked-by: Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx>

(But see comments below.)

On Mon, Apr 29, 2019 at 09:08:09AM +0000, Christophe Leroy wrote:
> diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
> index bf1de3ca39bc..37cf2af98f6a 100644
> --- a/arch/powerpc/mm/ppc_mmu_32.c
> +++ b/arch/powerpc/mm/ppc_mmu_32.c
> @@ -101,7 +101,7 @@ static int find_free_bat(void)
> static unsigned int block_size(unsigned long base, unsigned long top)
> {
> unsigned int max_size = (cpu_has_feature(CPU_FTR_601) ? 8 : 256) << 20;
> - unsigned int base_shift = (fls(base) - 1) & 31;
> + unsigned int base_shift = (ffs(base) - 1) & 31;
> unsigned int block_shift = (fls(top - base) - 1) & 31;

The code is quite confusing now... Add a comment, or improve it?


Segher