Commit 426dcd4b authored by Mike Rapoport's avatar Mike Rapoport Committed by Linus Torvalds

hexagon: switch to NO_BOOTMEM

Patch series "switch several architectures NO_BOOTMEM".

These patches perform conversion to NO_BOOTMEM of hexagon, nios2, uml and
unicore32.

This patch (of 7):

Add registration of the system memory with memblock, eliminate bootmem
initialization and convert early memory reservations from bootmem to
memblock.

Link: http://lkml.kernel.org/r/1533326330-31677-2-git-send-email-rppt@linux.vnet.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Acked-by: default avatarRichard Kuo <rkuo@codeaurora.org>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Rob Herring <robh@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9b5a8e00
...@@ -21,6 +21,9 @@ config HEXAGON ...@@ -21,6 +21,9 @@ config HEXAGON
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select HAVE_ARCH_KGDB select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRACEHOOK
select HAVE_MEMBLOCK
select ARCH_DISCARD_MEMBLOCK
select NO_BOOTMEM
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
select NO_IOPORT_MAP select NO_IOPORT_MAP
select GENERIC_IOMAP select GENERIC_IOMAP
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/memblock.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <asm/tlb.h> #include <asm/tlb.h>
...@@ -176,7 +177,6 @@ size_t hexagon_coherent_pool_size = (size_t) (DMA_RESERVE << 22); ...@@ -176,7 +177,6 @@ size_t hexagon_coherent_pool_size = (size_t) (DMA_RESERVE << 22);
void __init setup_arch_memory(void) void __init setup_arch_memory(void)
{ {
int bootmap_size;
/* XXX Todo: this probably should be cleaned up */ /* XXX Todo: this probably should be cleaned up */
u32 *segtable = (u32 *) &swapper_pg_dir[0]; u32 *segtable = (u32 *) &swapper_pg_dir[0];
u32 *segtable_end; u32 *segtable_end;
...@@ -195,18 +195,22 @@ void __init setup_arch_memory(void) ...@@ -195,18 +195,22 @@ void __init setup_arch_memory(void)
bootmem_lastpg = PFN_DOWN((bootmem_lastpg << PAGE_SHIFT) & bootmem_lastpg = PFN_DOWN((bootmem_lastpg << PAGE_SHIFT) &
~((BIG_KERNEL_PAGE_SIZE) - 1)); ~((BIG_KERNEL_PAGE_SIZE) - 1));
memblock_add(PHYS_OFFSET,
(bootmem_lastpg - ARCH_PFN_OFFSET) << PAGE_SHIFT);
/* Reserve kernel text/data/bss */
memblock_reserve(PHYS_OFFSET,
(bootmem_startpg - ARCH_PFN_OFFSET) << PAGE_SHIFT);
/* /*
* Reserve the top DMA_RESERVE bytes of RAM for DMA (uncached) * Reserve the top DMA_RESERVE bytes of RAM for DMA (uncached)
* memory allocation * memory allocation
*/ */
max_low_pfn = bootmem_lastpg - PFN_DOWN(DMA_RESERVED_BYTES); max_low_pfn = bootmem_lastpg - PFN_DOWN(DMA_RESERVED_BYTES);
min_low_pfn = ARCH_PFN_OFFSET; min_low_pfn = ARCH_PFN_OFFSET;
bootmap_size = init_bootmem_node(NODE_DATA(0), bootmem_startpg, min_low_pfn, max_low_pfn); memblock_reserve(PFN_PHYS(max_low_pfn), DMA_RESERVED_BYTES);
printk(KERN_INFO "bootmem_startpg: 0x%08lx\n", bootmem_startpg); printk(KERN_INFO "bootmem_startpg: 0x%08lx\n", bootmem_startpg);
printk(KERN_INFO "bootmem_lastpg: 0x%08lx\n", bootmem_lastpg); printk(KERN_INFO "bootmem_lastpg: 0x%08lx\n", bootmem_lastpg);
printk(KERN_INFO "bootmap_size: %d\n", bootmap_size);
printk(KERN_INFO "min_low_pfn: 0x%08lx\n", min_low_pfn); printk(KERN_INFO "min_low_pfn: 0x%08lx\n", min_low_pfn);
printk(KERN_INFO "max_low_pfn: 0x%08lx\n", max_low_pfn); printk(KERN_INFO "max_low_pfn: 0x%08lx\n", max_low_pfn);
...@@ -256,14 +260,6 @@ void __init setup_arch_memory(void) ...@@ -256,14 +260,6 @@ void __init setup_arch_memory(void)
printk(KERN_INFO "*segtable = 0x%08x\n", *segtable); printk(KERN_INFO "*segtable = 0x%08x\n", *segtable);
#endif #endif
/*
* Free all the memory that wasn't taken up by the bootmap, the DMA
* reserve, or kernel itself.
*/
free_bootmem(PFN_PHYS(bootmem_startpg) + bootmap_size,
PFN_PHYS(bootmem_lastpg - bootmem_startpg) - bootmap_size -
DMA_RESERVED_BYTES);
/* /*
* The bootmem allocator seemingly just lives to feed memory * The bootmem allocator seemingly just lives to feed memory
* to the paging system * to the paging system
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment