Skip to contentSkip to conversation

powerpc/fsl-booke: Fix settlbcam for 64-bit

PATCH Superseded Becky Bruce 2 participants 2 messages Oct 12, 2011 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

From: Becky Bruce <[email protected]>

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).

---
 arch/powerpc/mm/fsl_booke_mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/mm/fsl_booke_mmu.c +1 -1
index f7802c8..54897c0 100644
@@ -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)
Signature · 1 line
1.5.6.5
#1 lore raw

=

Quoted 13 lines · Becky Bruce

From: Becky Bruce <[email protected]>
=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

---
arch/powerpc/mm/fsl_booke_mmu.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)

=20

= renamed from arch/powerpc/mm/fsl_booke_mmu.c +0 -0

b/arch/powerpc/mm/fsl_booke_mmu.c

arch/powerpc/mm/fsl_booke_mmu.c static void settlbcam(int index, unsigned long =

Quoted 4 lines

index f7802c8..54897c0 100644

arch/powerpc/mm/fsl_booke_mmu.c +0 -0
@@ -111,7 +111,7 @@ static void settlbcam(int index, unsigned long =

virt, phys_addr_t phys,

arch/powerpc/mm/fsl_booke_mmu.c

Quoted 5 lines
arch/powerpc/mm/fsl_booke_mmu.c +0 -0
 	unsigned int tsize, lz;

=20

	asm (PPC_CNTLZL "%0,%1" : "=3Dr" (lz) : "r" (size));
arch/powerpc/mm/fsl_booke_mmu.c +1 -1
-	tsize =3D 21 - lz;
+	tsize =3D __ilog2(size) - 10;

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

Quoted 10 lines

=20

#ifdef CONFIG_SMP
	if ((flags & _PAGE_NO_CACHE) =3D=3D 0)

--=20
1.5.6.5
=20
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev