linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/fsl-booke: Fix settlbcam for 64-bit
@ 2011-10-12 18:22 Becky Bruce
  2011-10-12 18:32 ` Kumar Gala
  0 siblings, 1 reply; 2+ messages in thread
From: Becky Bruce @ 2011-10-12 18:22 UTC (permalink / raw)
  To: linuxppc-dev

From: Becky Bruce <beckyb@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@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;
 
 #ifdef CONFIG_SMP
 	if ((flags & _PAGE_NO_CACHE) == 0)
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/fsl-booke: Fix settlbcam for 64-bit
  2011-10-12 18:22 [PATCH] powerpc/fsl-booke: Fix settlbcam for 64-bit Becky Bruce
@ 2011-10-12 18:32 ` Kumar Gala
  0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2011-10-12 18:32 UTC (permalink / raw)
  To: Becky Bruce; +Cc: linuxppc-dev


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

> From: Becky Bruce <beckyb@kernel.crashing.org>
>=20
> 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).
>=20
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
> arch/powerpc/mm/fsl_booke_mmu.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>=20
> 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;
>=20
> 	asm (PPC_CNTLZL "%0,%1" : "=3Dr" (lz) : "r" (size));
> -	tsize =3D 21 - lz;
> +	tsize =3D __ilog2(size) - 10;

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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-12 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12 18:22 [PATCH] powerpc/fsl-booke: Fix settlbcam for 64-bit Becky Bruce
2011-10-12 18:32 ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).