Skip to content

Commit 486df8b

Browse files
andreas-schwabgeertu
authored andcommitted
m68k: Increase initial mapping to 8 or 16 MiB if possible
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>
1 parent 44074e8 commit 486df8b

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

‎arch/m68k/kernel/head.S‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292

293293
.globl kernel_pg_dir
294294
.globl availmem
295+
.globl m68k_init_mapped_size
295296
.globl m68k_pgtable_cachemode
296297
.globl m68k_supervisor_cachemode
297298
#ifdef CONFIG_MVME16x
@@ -907,10 +908,21 @@ L(nocon):
907908
*
908909
* This block of code does what's necessary to map in the various kinds
909910
* of machines for execution of Linux.
910-
* First map the first 4 MB of kernel code & data
911+
* First map the first 4, 8, or 16 MB of kernel code & data
911912
*/
912913

913-
mmu_map #PAGE_OFFSET,%pc@(L(phys_kernel_start)),#4*1024*1024,\
914+
get_bi_record BI_MEMCHUNK
915+
movel %a0@(4),%d0
916+
movel #16*1024*1024,%d1
917+
cmpl %d0,%d1
918+
jls 1f
919+
lsrl #1,%d1
920+
cmpl %d0,%d1
921+
jls 1f
922+
lsrl #1,%d1
923+
1:
924+
movel %d1,m68k_init_mapped_size
925+
mmu_map #PAGE_OFFSET,%pc@(L(phys_kernel_start)),%d1,\
914926
%pc@(m68k_supervisor_cachemode)
915927

916928
putc 'C'
@@ -3730,6 +3742,9 @@ func_return console_plot_pixel
37303742
__INITDATA
37313743
.align 4
37323744

3745+
m68k_init_mapped_size:
3746+
.long 0
3747+
37333748
#if defined(CONFIG_ATARI) || defined(CONFIG_AMIGA) || \
37343749
defined(CONFIG_HP300) || defined(CONFIG_APOLLO)
37353750
L(custom):

‎arch/m68k/mm/motorola.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ EXPORT_SYMBOL(mm_cachebits);
4545
#endif
4646

4747
/* size of memory already mapped in head.S */
48-
#define INIT_MAPPED_SIZE (4UL<<20)
48+
extern __initdata unsigned long m68k_init_mapped_size;
4949

5050
extern unsigned long availmem;
5151

@@ -271,10 +271,12 @@ void __init paging_init(void)
271271
*/
272272
addr = m68k_memory[0].addr;
273273
size = m68k_memory[0].size;
274-
free_bootmem_node(NODE_DATA(0), availmem, min(INIT_MAPPED_SIZE, size) - (availmem - addr));
274+
free_bootmem_node(NODE_DATA(0), availmem,
275+
min(m68k_init_mapped_size, size) - (availmem - addr));
275276
map_node(0);
276-
if (size > INIT_MAPPED_SIZE)
277-
free_bootmem_node(NODE_DATA(0), addr + INIT_MAPPED_SIZE, size - INIT_MAPPED_SIZE);
277+
if (size > m68k_init_mapped_size)
278+
free_bootmem_node(NODE_DATA(0), addr + m68k_init_mapped_size,
279+
size - m68k_init_mapped_size);
278280

279281
for (i = 1; i < m68k_num_memory; i++)
280282
map_node(i);

0 commit comments

Comments
 (0)