]> git.karo-electronics.de Git - linux-beck.git/commitdiff
m68k: Increase initial mapping to 8 or 16 MiB if possible
authorAndreas Schwab <schwab@linux-m68k.org>
Thu, 24 Apr 2014 10:24:48 +0000 (12:24 +0200)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Wed, 28 May 2014 08:11:54 +0000 (10:11 +0200)
If the size of the first memory chunk is at least 8 or 16 MiB increase the
initial mapping to 8 resp. 16 MiB instead of 4 MiB.
This makes it possible to
  1. Map more memory in the first node without running out of space for the
     page tables,
  2. Boot kernels that don't fit in 4 MiB (e.g. multi_defconfig).

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
  - Add support for 8 MiB,
  - Store initial mapping size in head.S for later reuse,
  - Add comment about large kernels.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/kernel/head.S
arch/m68k/mm/motorola.c

index 15c8f55e4835900433a39bd25af3ada2d95f1143..dbb118e1a4e091985724cf27fe4e1ce1e12248a2 100644 (file)
 
 .globl kernel_pg_dir
 .globl availmem
+.globl m68k_init_mapped_size
 .globl m68k_pgtable_cachemode
 .globl m68k_supervisor_cachemode
 #ifdef CONFIG_MVME16x
@@ -907,10 +908,21 @@ L(nocon):
  *
  *     This block of code does what's necessary to map in the various kinds
  *     of machines for execution of Linux.
- *     First map the first 4 MB of kernel code & data
+ *     First map the first 4, 8, or 16 MB of kernel code & data
  */
 
-       mmu_map #PAGE_OFFSET,%pc@(L(phys_kernel_start)),#4*1024*1024,\
+       get_bi_record BI_MEMCHUNK
+       movel   %a0@(4),%d0
+       movel   #16*1024*1024,%d1
+       cmpl    %d0,%d1
+       jls     1f
+       lsrl    #1,%d1
+       cmpl    %d0,%d1
+       jls     1f
+       lsrl    #1,%d1
+1:
+       movel   %d1,m68k_init_mapped_size
+       mmu_map #PAGE_OFFSET,%pc@(L(phys_kernel_start)),%d1,\
                %pc@(m68k_supervisor_cachemode)
 
        putc    'C'
@@ -3730,6 +3742,9 @@ func_return       console_plot_pixel
 __INITDATA
        .align  4
 
+m68k_init_mapped_size:
+       .long   0
+
 #if defined(CONFIG_ATARI) || defined(CONFIG_AMIGA) || \
     defined(CONFIG_HP300) || defined(CONFIG_APOLLO)
 L(custom):
index 7d4024432163ffa534665582fcf522ed4e9ea51f..b958916e5eac96b250ef08e556983e059d7d0850 100644 (file)
@@ -45,7 +45,7 @@ EXPORT_SYMBOL(mm_cachebits);
 #endif
 
 /* size of memory already mapped in head.S */
-#define INIT_MAPPED_SIZE       (4UL<<20)
+extern __initdata unsigned long m68k_init_mapped_size;
 
 extern unsigned long availmem;
 
@@ -271,10 +271,12 @@ void __init paging_init(void)
         */
        addr = m68k_memory[0].addr;
        size = m68k_memory[0].size;
-       free_bootmem_node(NODE_DATA(0), availmem, min(INIT_MAPPED_SIZE, size) - (availmem - addr));
+       free_bootmem_node(NODE_DATA(0), availmem,
+                         min(m68k_init_mapped_size, size) - (availmem - addr));
        map_node(0);
-       if (size > INIT_MAPPED_SIZE)
-               free_bootmem_node(NODE_DATA(0), addr + INIT_MAPPED_SIZE, size - INIT_MAPPED_SIZE);
+       if (size > m68k_init_mapped_size)
+               free_bootmem_node(NODE_DATA(0), addr + m68k_init_mapped_size,
+                                 size - m68k_init_mapped_size);
 
        for (i = 1; i < m68k_num_memory; i++)
                map_node(i);