Skip to contentSkip to conversation

PPC 85xx failure with odd memory sizes and CONFIG_HIGHMEM

PATCH In review Dale Farnsworth 3 participants 6 messages Oct 3, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC 85xx failure with odd memory sizes and CONFIG_HIGHMEM

From: Dale Farnsworth <[email protected]>

The CONFIG_FSL_BOOKE mmu setup code fails when CONFIG_HIGHMEM=y and the 3 fixed TLB entries cannot exactly map the lowmem size. Each TLB entry can map 4MB, 16MB, 64MB or 256MB, so the failure is observed when the kernel lowmem size is not equal to the sum of up to 3 of those values.

Normally, memory is sized in nice numbers, but I observed this problem while testing a crash dump kernel. The failure can also be observed by artificially reducing the kernel's main memory via the mem= kernel command line parameter.

This commit fixes the problem by setting __initial_memory_limit in adjust_total_lowmem().

---
 arch/powerpc/mm/fsl_booke_mmu.c |    2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/mm/fsl_booke_mmu.c +2 -0
Index: linux-2.6.21/arch/powerpc/mm/fsl_booke_mmu.c
===================================================================
@@ -60,6 +60,7 @@ unsigned int num_tlbcam_entries;
 static unsigned long __cam0, __cam1, __cam2;
 extern unsigned long total_lowmem;
 extern unsigned long __max_low_memory;
+extern unsigned long __initial_memory_limit;
 #define MAX_LOW_MEM	CONFIG_LOWMEM_SIZE
 
 #define NUM_TLBCAMS	(16)
@@ -233,4 +234,5 @@ adjust_total_lowmem(void)
 			__cam0 >> 20, __cam1 >> 20, __cam2 >> 20,
 			(total_lowmem - __cam0 - __cam1 - __cam2) >> 20);
 	__max_low_memory = max_low_mem = __cam0 + __cam1 + __cam2;
+	__initial_memory_limit = __max_low_memory;
 }
#1 lore raw
Quoted 7 lines

From: Dale Farnsworth
=20
The CONFIG_FSL_BOOKE mmu setup code fails when CONFIG_HIGHMEM=3Dy and the 3 fixed TLB entries cannot exactly map the lowmem size. Each TLB entry can map 4MB, 16MB, 64MB or 256MB, so the failure is observed when the kernel lowmem size is not equal to the sum of up to 3 of those values.

Does this mean you cannot run 1G of lowmem on a 85xx?

On 82xx I run 1G of lowmem, and when we finaly upgrade our product to a 85xx something, Iw was planning on doing the same.

(For those interested:
To run 1G lowmwm on 82xx (at least under arch/ppc) CONFIG_ADVANCED_OPTIONS=3Dy CONFIG_HIGHMEM_START=3D0xfe000000 CONFIG_LOWMEM_SIZE_BOOL=3Dy CONFIG_LOWMEM_SIZE=3D0x40000000 CONFIG_KERNEL_START_BOOL=3Dy CONFIG_KERNEL_START=3D0xa0000000

#2 lore raw
Quoted 9 lines · Rune Torgersen
Quoted 7 lines

From: Dale Farnsworth

The CONFIG_FSL_BOOKE mmu setup code fails when CONFIG_HIGHMEM=y and the 3 fixed TLB entries cannot exactly map the lowmem size. Each TLB entry can map 4MB, 16MB, 64MB or 256MB, so the failure is observed when the kernel lowmem size is not equal to the sum of up to 3 of those values.

Does this mean you cannot run 1G of lowmem on a 85xx?

I think you can, and maybe I should have added 1GB to my list of sizes above. But, my 85xx system only has 256MB, so I can't test it.

-Dale

#3 lore raw
In reply to Rune Torgersen
Quoted 8 lines · Rune Torgersen
Quoted 7 lines

From: Dale Farnsworth

The CONFIG_FSL_BOOKE mmu setup code fails when CONFIG_HIGHMEM=y and the 3 fixed TLB entries cannot exactly map the lowmem size. Each TLB entry can map 4MB, 16MB, 64MB or 256MB, so the failure is observed when the kernel lowmem size is not equal to the sum of up to 3 of those values.

Quoted 4 lines

Does this mean you cannot run 1G of lowmem on a 85xx?

On 82xx I run 1G of lowmem, and when we finaly upgrade our product to a 85xx something, Iw was planning on doing the same.

The code would have to change to allow for 1G of lowmem.

Max lowmem with KERNELBASE @ 0xc000_0000 is 768M.

- k

#4 lore raw
Quoted 3 lines

From: Kumar Gala
The code would have to change to allow for 1G of lowmem. Max lowmem with KERNELBASE @ 0xc000_0000 is 768M.

Which is why I asked. On 82xx it is supported without a codechange by setting KERNELBASE to 0xa000_0000 in Kconfig menu (and also changing start of virtual mem, also done by config option).

#5 lore raw
Quoted 7 lines · Rune Torgersen
Quoted 3 lines

From: Kumar Gala
The code would have to change to allow for 1G of lowmem. Max lowmem with KERNELBASE @ 0xc000_0000 is 768M.

Which is why I asked. On 82xx it is supported without a codechange by setting KERNELBASE to 0xa000_0000 in Kconfig menu (and also changing start of virtual mem, also done by config option).

we could make this work. Its just no one's griped about needing it to date.

Its a bit of testing to make sure we respect the kernel config changes and a slight be of code to handle using up to 1G TLB sizes on e500v2 or greater.

- k