[PATCH] powerpc/fsl-booke: Fix settlbcam for 64-bit

Kumar Gala galak at kernel.crashing.org
Thu Oct 13 05:32:54 EST 2011


On Oct 12, 2011, at 1:22 PM, Becky Bruce wrote:

> From: Becky Bruce <beckyb at kernel.crashing.org>
> 
> Currently, it does a cntlzd on the size and then subtracts it from
> 21.... this doesn't take into account the varying size of a "long".
> Just use __ilog instead (and subtract the 10 we have to subtract
> to get to the tsize encoding).
> 
> Signed-off-by: Becky Bruce <beckyb at kernel.crashing.org>
> ---
> arch/powerpc/mm/fsl_booke_mmu.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
> index f7802c8..54897c0 100644
> --- a/arch/powerpc/mm/fsl_booke_mmu.c
> +++ b/arch/powerpc/mm/fsl_booke_mmu.c
> @@ -111,7 +111,7 @@ static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
> 	unsigned int tsize, lz;
> 
> 	asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (size));
> -	tsize = 21 - lz;
> +	tsize = __ilog2(size) - 10;

If you do this you don't need 'lz' or the asm() statement.

> 
> #ifdef CONFIG_SMP
> 	if ((flags & _PAGE_NO_CACHE) == 0)
> -- 
> 1.5.6.5
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev



More information about the Linuxppc-dev mailing list