Subject: sa1100 memory limit?

From: Chris Blazie <[email-masked]>
Date: Wed, 17 May 2000 12:02:42 -0400 (EDT)

As of yesterday I have everything working on our SA1110
development board.  All memory problems stopped when I lowered the total
memory defined in the kernel to 32MB.  Next I added my changes to Russel
and Nicolas's latest patches (2.3.99-pre8-rmk1-np2) and experimented with
my bank declarations in arch.c and the MEM_SIZE definition in setup.c.  I
can use just about any combination of bank declarations (allowing enough
memory at C0008000 for kernel and ramdisk) and still operate, but any
amount over 32MB causes an oops on kernel boot like the one below.

	In page_alloc.c, BUG() is executed because page-mem_map >=
max_mapnr.  max_mapnr is initialized in arch/arm/mm/init.c:

        max_mapnr   = MAP_NR(high_memory);

and high_memory == 0xc2000000 at that point.  So it seems an implicit 32MB
memory limit exists, unless I have something else set up incorrectly.  I'm
looking, but appreciate any pointers while I try to run this down.  I also
noticed in include/asm/arch/mmzone.h: 

/*
 * 32MB max in each bank, must fit with __virt_to_phys() &
__phys_to_virt()
 */
#define NODE_MAX_MEM_SHIFT      25
#define NODE_MAX_MEM_SIZE       (1<<NODE_MAX_MEM_SHIFT)

	Is this an absolute limit on bank size to 32MB?

Thanks,
Chris

Linux version 2.3.99-pre8-rmk1-np2 (root@cassius) (gcc version 2.95.2
20000212 0
Architecture: Blazie Engineering Sherman
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
On node 1 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Calibrating delay loop... 124.52 BogoMIPS
kernel BUG at page_alloc.c:89!
Unable to handle kernel NULL pointer dereference at virtual address
00000000
pgd = c0004000
*pgd = c00d5001, *pmd = c00d5001, *pte = c00d408b, *ppte = c00d400a
Internal error: Oops: 0
CPU: 0
pc : [<c001643c>]    lr : [<c001e030>]
sp : c00a9f24  ip : c00a9ee0  fp : c00a9f34
r10: 00000001  r9 : 00002000  r8 : 00000000
r7 : 00000000  r6 : 00000091  r5 : c20028d8  r4 : 00000000
r3 : 00000000  r2 : c00b1e9c  r1 : c00b1e9c  r0 : 00000022
Flags: nZCv  IRQs on  FIQs off  Mode SVC_32  Segment kernel
Control: C000517D  Table: C000517D  DAC: 0000001D
Process swapper (pid: 0, stackpage=c00a9000)
Stack: 
c00a9f00:                                               c001e030 c001643c
60000 
c00a9f20: ffffffff c20028f0 c00a9f68 c00a9f38  c0036570 c001640c 60000053
00000 
c00a9f40: c20028d8 00000000 00000091 c00b63fc  00000001 00002000 00000001
c00a9 
c00a9f60: c00a9f6c c000b708 c00364dc 00000001  c00b63e4 00000020 00000259
c000f 
c00a9f80: c00b2298 c00c9758 c00a9fa4 c00a9f98  c000b91c c000b63c c00a9fe0
c00a9 
c00a9fa0: c000a158 c000b8f8 c001de3c 00000020  000000ab 00000259 00000000
c00d0 
c00a9fc0: c00c81f4 c00c8240 c00aaa34 6901b115  c000ecfc c00a9ffc c00a9fe4
c0008 
c00a9fe0: c000a078 c00aaa94 c00d1198 c00d1198  00000000 c00aa000 c0008080
c0008 
Backtrace: 
Function entered at [<c0016400>] from [<c0036570>]
 r4 = C20028F0 
Function entered at [<c00364d0>] from [<c000b708>]
Function entered at [<c000b630>] from [<c000b91c>]
Function entered at [<c000b8ec>] from [<c000a158>]
Function entered at [<c000a06c>] from [<c000886c>]
Function entered at [<c0008788>] from [<c0008080>]
 r5 = C00D1198  r4 = C00D1198 
Code: eb001e7c e3a03000 (e5833000) e91ba810 c0091a48 
Kernel panic: Attempted to kill the idle task!
In idle task - not syncing

unsubscribe: body of `unsubscribe linux-arm-kernel' to [email-masked]

---

From: Nicolas Pitre <[email-masked]>
Date: Wed, 17 May 2000 12:35:51 -0400 (EDT)

> amount over 32MB causes an oops on kernel boot like the one below.
[...]
> 	Is this an absolute limit on bank size to 32MB?

Don't look any further!!  You found it.

What's the actual maximum memory bank size on the SA1110?  It's 32 MB on
the SA1100 I think.  That's why that limit was 32 MB.

To fix that, simply change the NODE_MAX_MEM_SHIFT value and modify
__virt_to_phys() and __phys_to_virt() macros accordingly.

Nicolas

---

From: Chris Blazie <[email-masked]>
Date: Wed, 17 May 2000 12:48:51 -0400 (EDT)

> the SA1100 I think.  That's why that limit was 32 MB.

	According to the SA1100 and SA1110 reference (memory map), each
dynamic memory bank is 128MB max.  So bank 0 is C0000000 to C7FFFFFF, bank
1 at C8000000 and so on.

	Also...if the problem were a bank size limit, I should still be
able to handle up to 64MB, correct?  32MB per bank.  My problem is
anything over 32MB TOTAL gives the oops.

Chris

---

From: Bill Pringlemeir <[email-masked]>
Date: 17 May 2000 13:13:34 -0400

>>>>> "Chris" == Chris Blazie <[email-masked]> writes:

    Chris> 	According to the SA1100 and SA1110 reference (memory
    Chris> map), each dynamic memory bank is 128MB max.  So bank 0 is
    Chris> C0000000 to C7FFFFFF, bank 1 at C8000000 and so on.

    Chris> 	Also...if the problem were a bank size limit, I should
    Chris> still be able to handle up to 64MB, correct?  32MB per
    Chris> bank.  My problem is anything over 32MB TOTAL gives the
    Chris> oops.

Could it be related to the fact that the branch instruction is a
24 bit signed offset giving a range of +/- 32MB?  If you have code
living outside this range and a direct jump is made, this could 
cause problems.

The Sa1110 can have four banks of 128MB for 1/2 GB total.  There 
is a hard limit set by the physical addresses of the banks.

fwiw,
Bill

-- 
I couldn't care less about your whale.  
You pathetic working quiche-eater!

---

From: Chris Blazie <[email-masked]>
Date: Wed, 17 May 2000 13:28:28 -0400 (EDT)

> living outside this range and a direct jump is made, this could 

	True, but there are various Netwinders with >32MB and the SA110 is
very, very similar to a StrongARM.

Chris

---

From: Nicolas Pitre <[email-masked]>
Date: Wed, 17 May 2000 18:15:39 -0400 (EDT)

> dynamic memory bank is 128MB max.  So bank 0 is C0000000 to C7FFFFFF, bank

This is the physical address space reserved for each bank.  However I
doubt you can actually put 128 MB of RAM on a single bank.  Can you?

> anything over 32MB TOTAL gives the oops.

That's strange...

Nicolas

---

From: "J.D. Bakker" <[email-masked]>
Date: Thu, 18 May 2000 00:02:07 +0200

>doubt you can actually put 128 MB of RAM on a single bank.  Can you?

You can, using four byte-wide 256Mb devices on SA-1110.

JDB
[who has 64MB single bank expansion cards for LART]

--
LART. 250 MIPS under one Watt. Free hardware design files.
http://www.lart.tudelft.nl/