Hi Wentao,
I've been back and forth on this project and another, so sorry for no response last week. I've been through a number of permutations of mappings and kernel changes in attacking this problem, so I'll just post what I have now (and how it's failing) and hopefully you may have some suggestions.
I had our board image remapped to eliminate the 'gap' between SDRAM and SRAM. So, now the map looks like this:
0x0-0x07ffffff -- 128MB of SDRAM
0x08000000-0x09000000 -- 16 MB of SRAM
So, again, I'd like to run code in SRAM but allocate kernel memory in SDRAM. I edited paging_init to give all of SRAM to ZONE_DMA:
zones_size = (0x08000000-PAGE_OFFSET) >> PAGE_SHIFT;
and I changed ZONE_NORMAL accordingly:
zones_size =(end_mem-0x08000000) >> PAGE_SHIFT;
(note: here end_mem is 0x09000000)
Then I edited page.h to# define PAGE_OFFSET as 0. These changes build fine and boot on the new image. However, when I try:
char * str = kmalloc(2048,GFP_DMA)
...I get the following 'page allocation failure':
swapper: page allocation failure. order:0, mode:0x1
Stack from 08327eb8:<0>
<0> 00000000<0> 0802dc14<0> 00000000<0> 00000000<0> 00000001<0> 00000003<0> 00000000<0> 00000001<0>
<0> 00000000<0> 0817b8ec<0> 0817b8e0<0> 082f2060<0> 0817b8e0<0> deadbeef<0> 0802dc44<0> 08031a54<0>
<0> 00000000<0> 08032300<0> deadbeef<0> deadbeef<0> deadbeef<0> deadbeef<0> fffffc18<0> 00000001<0>
<0> 00000001<0> 00000001<0> 08031fb8<0> 08c0e000<0> 08169f90<0> deadbeef<0> fffffc18<0> 00000001<0>
<0> 00000000<0> 0816c608<0> 081698f8<0> 0816c30c<0> 0816c8d0<0> 00000001<0> 00000001<0> 08169a0c<0>
<0> 00000000<0> 0816c890<0> 08000274<0> deadbeef<0> deadbeef<0> deadbeef<0> 081756c0<0> 080044c4<0>
Call Trace:<0>
<0> <0> <0> <0> <0>
<0> <0> <0>
Just wondering if there is anything you could suggest I do. My options are fairly open (that is, I can remap SDRAM somewhere else if necessary). Let me know if anything needs clarified.
Thanks in advance,
Ryan
Quantapoint, Inc.