aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2016-04-03 06:14:49 -0400
committerStafford Horne <shorne@gmail.com>2016-12-12 09:10:00 -0500
commit266c7fad157265bb54d17db1c9545f2aaa488643 (patch)
tree9fd40c1afd0a49822b92babf032b42b9751dfb56
parent994894c3f710f5d8ca89d22988fe715db57bbc87 (diff)
openrisc: Consolidate setup to use memblock instead of bootmem
Clearing out one todo item. Use the memblock boot time memory which is the current standard. Tested-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jonas <jonas@southpole.se> Signed-off-by: Stafford Horne <shorne@gmail.com>
-rw-r--r--arch/openrisc/Kconfig1
-rw-r--r--arch/openrisc/TODO.openrisc3
-rw-r--r--arch/openrisc/include/asm/pgalloc.h1
-rw-r--r--arch/openrisc/kernel/setup.c36
-rw-r--r--arch/openrisc/mm/init.c2
-rw-r--r--arch/openrisc/mm/ioremap.c4
6 files changed, 14 insertions, 33 deletions
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 691e1af22b99..8d22015fde3e 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -26,6 +26,7 @@ config OPENRISC
26 select HAVE_DEBUG_STACKOVERFLOW 26 select HAVE_DEBUG_STACKOVERFLOW
27 select OR1K_PIC 27 select OR1K_PIC
28 select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1 28 select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1
29 select NO_BOOTMEM
29 30
30config MMU 31config MMU
31 def_bool y 32 def_bool y
diff --git a/arch/openrisc/TODO.openrisc b/arch/openrisc/TODO.openrisc
index acfeef9c58e3..0eb04c8240f9 100644
--- a/arch/openrisc/TODO.openrisc
+++ b/arch/openrisc/TODO.openrisc
@@ -5,9 +5,6 @@ that are due for investigation shortly, i.e. our TODO list:
5 5
6-- Implement the rest of the DMA API... dma_map_sg, etc. 6-- Implement the rest of the DMA API... dma_map_sg, etc.
7 7
8-- Consolidate usage of memblock and bootmem... move everything over to
9 memblock.
10
11-- Finish the renaming cleanup... there are references to or32 in the code 8-- Finish the renaming cleanup... there are references to or32 in the code
12 which was an older name for the architecture. The name we've settled on is 9 which was an older name for the architecture. The name we've settled on is
13 or1k and this change is slowly trickling through the stack. For the time 10 or1k and this change is slowly trickling through the stack. For the time
diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h
index 87eebd185089..3e1a46615120 100644
--- a/arch/openrisc/include/asm/pgalloc.h
+++ b/arch/openrisc/include/asm/pgalloc.h
@@ -23,7 +23,6 @@
23#include <linux/threads.h> 23#include <linux/threads.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/memblock.h> 25#include <linux/memblock.h>
26#include <linux/bootmem.h>
27 26
28extern int mem_init_done; 27extern int mem_init_done;
29 28
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index d2f78cf79b4b..6329d7a493ff 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -50,18 +50,16 @@
50 50
51#include "vmlinux.h" 51#include "vmlinux.h"
52 52
53static unsigned long __init setup_memory(void) 53static void __init setup_memory(void)
54{ 54{
55 unsigned long bootmap_size;
56 unsigned long ram_start_pfn; 55 unsigned long ram_start_pfn;
57 unsigned long free_ram_start_pfn;
58 unsigned long ram_end_pfn; 56 unsigned long ram_end_pfn;
59 phys_addr_t memory_start, memory_end; 57 phys_addr_t memory_start, memory_end;
60 struct memblock_region *region; 58 struct memblock_region *region;
61 59
62 memory_end = memory_start = 0; 60 memory_end = memory_start = 0;
63 61
64 /* Find main memory where is the kernel */ 62 /* Find main memory where is the kernel, we assume its the only one */
65 for_each_memblock(memory, region) { 63 for_each_memblock(memory, region) {
66 memory_start = region->base; 64 memory_start = region->base;
67 memory_end = region->base + region->size; 65 memory_end = region->base + region->size;
@@ -74,10 +72,11 @@ static unsigned long __init setup_memory(void)
74 } 72 }
75 73
76 ram_start_pfn = PFN_UP(memory_start); 74 ram_start_pfn = PFN_UP(memory_start);
77 /* free_ram_start_pfn is first page after kernel */
78 free_ram_start_pfn = PFN_UP(__pa(_end));
79 ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM()); 75 ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM());
80 76
77 /* setup bootmem globals (we use no_bootmem, but mm still depends on this) */
78 min_low_pfn = ram_start_pfn;
79 max_low_pfn = ram_end_pfn;
81 max_pfn = ram_end_pfn; 80 max_pfn = ram_end_pfn;
82 81
83 /* 82 /*
@@ -85,22 +84,13 @@ static unsigned long __init setup_memory(void)
85 * 84 *
86 * This makes the memory from the end of the kernel to the end of 85 * This makes the memory from the end of the kernel to the end of
87 * RAM usable. 86 * RAM usable.
88 * init_bootmem sets the global values min_low_pfn, max_low_pfn.
89 */ 87 */
90 bootmap_size = init_bootmem(free_ram_start_pfn, 88 memblock_reserve(__pa(_stext), _end - _stext);
91 ram_end_pfn - ram_start_pfn); 89
92 free_bootmem(PFN_PHYS(free_ram_start_pfn), 90 early_init_fdt_reserve_self();
93 (ram_end_pfn - free_ram_start_pfn) << PAGE_SHIFT); 91 early_init_fdt_scan_reserved_mem();
94 reserve_bootmem(PFN_PHYS(free_ram_start_pfn), bootmap_size,
95 BOOTMEM_DEFAULT);
96
97 for_each_memblock(reserved, region) {
98 printk(KERN_INFO "Reserved - 0x%08x-0x%08x\n",
99 (u32) region->base, (u32) region->size);
100 reserve_bootmem(region->base, region->size, BOOTMEM_DEFAULT);
101 }
102 92
103 return ram_end_pfn; 93 memblock_dump_all();
104} 94}
105 95
106struct cpuinfo cpuinfo; 96struct cpuinfo cpuinfo;
@@ -272,8 +262,6 @@ void calibrate_delay(void)
272 262
273void __init setup_arch(char **cmdline_p) 263void __init setup_arch(char **cmdline_p)
274{ 264{
275 unsigned long max_low_pfn;
276
277 unflatten_and_copy_device_tree(); 265 unflatten_and_copy_device_tree();
278 266
279 setup_cpuinfo(); 267 setup_cpuinfo();
@@ -294,8 +282,8 @@ void __init setup_arch(char **cmdline_p)
294 initrd_below_start_ok = 1; 282 initrd_below_start_ok = 1;
295#endif 283#endif
296 284
297 /* setup bootmem allocator */ 285 /* setup memblock allocator */
298 max_low_pfn = setup_memory(); 286 setup_memory();
299 287
300 /* paging_init() sets up the MMU and marks all pages as reserved */ 288 /* paging_init() sets up the MMU and marks all pages as reserved */
301 paging_init(); 289 paging_init();
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index b782ce9ccad9..f67d82b9d22f 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -106,7 +106,7 @@ static void __init map_ram(void)
106 } 106 }
107 107
108 /* Alloc one page for holding PTE's... */ 108 /* Alloc one page for holding PTE's... */
109 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); 109 pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
110 set_pmd(pme, __pmd(_KERNPG_TABLE + __pa(pte))); 110 set_pmd(pme, __pmd(_KERNPG_TABLE + __pa(pte)));
111 111
112 /* Fill the newly allocated page with PTE'S */ 112 /* Fill the newly allocated page with PTE'S */
diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c
index fa60b81aee3e..8705a46218f9 100644
--- a/arch/openrisc/mm/ioremap.c
+++ b/arch/openrisc/mm/ioremap.c
@@ -124,11 +124,7 @@ pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm,
124 if (likely(mem_init_done)) { 124 if (likely(mem_init_done)) {
125 pte = (pte_t *) __get_free_page(GFP_KERNEL); 125 pte = (pte_t *) __get_free_page(GFP_KERNEL);
126 } else { 126 } else {
127 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
128#if 0
129 /* FIXME: use memblock... */
130 pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE)); 127 pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
131#endif
132 } 128 }
133 129
134 if (pte) 130 if (pte)