aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/Kconfig10
-rw-r--r--arch/sh/kernel/setup.c26
-rw-r--r--arch/sh/mm/init.c21
-rw-r--r--include/asm-sh/mmzone.h61
-rw-r--r--include/asm-sh/page.h7
5 files changed, 9 insertions, 116 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 7d31d628cdec..64f5ae0ff96d 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -490,16 +490,6 @@ config CPU_SUBTYPE_ST40
490 depends on CPU_SUBTYPE_ST40STB1 || CPU_SUBTYPE_ST40GX1 490 depends on CPU_SUBTYPE_ST40STB1 || CPU_SUBTYPE_ST40GX1
491 default y 491 default y
492 492
493config ARCH_DISCONTIGMEM_ENABLE
494 bool
495 depends on SH_HP690
496 default y
497 help
498 Say Y to upport efficient handling of discontiguous physical memory,
499 for architectures which are either NUMA (Non-Uniform Memory Access)
500 or have huge holes in the physical address space for other reasons.
501 See <file:Documentation/vm/numa> for more.
502
503source "mm/Kconfig" 493source "mm/Kconfig"
504 494
505config ZERO_PAGE_OFFSET 495config ZERO_PAGE_OFFSET
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 25b9d9ebe858..036050b377cd 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -83,9 +83,9 @@ static struct sh_machine_vector* __init get_mv_byname(const char* name);
83/* ... */ 83/* ... */
84#define COMMAND_LINE ((char *) (PARAM+0x100)) 84#define COMMAND_LINE ((char *) (PARAM+0x100))
85 85
86#define RAMDISK_IMAGE_START_MASK 0x07FF 86#define RAMDISK_IMAGE_START_MASK 0x07FF
87#define RAMDISK_PROMPT_FLAG 0x8000 87#define RAMDISK_PROMPT_FLAG 0x8000
88#define RAMDISK_LOAD_FLAG 0x4000 88#define RAMDISK_LOAD_FLAG 0x4000
89 89
90static char command_line[COMMAND_LINE_SIZE] = { 0, }; 90static char command_line[COMMAND_LINE_SIZE] = { 0, };
91 91
@@ -284,18 +284,6 @@ void __init setup_arch(char **cmdline_p)
284#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) 284#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
285#define PFN_PHYS(x) ((x) << PAGE_SHIFT) 285#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
286 286
287#ifdef CONFIG_DISCONTIGMEM
288 NODE_DATA(0)->bdata = &discontig_node_bdata[0];
289 NODE_DATA(1)->bdata = &discontig_node_bdata[1];
290
291 bootmap_size = init_bootmem_node(NODE_DATA(1),
292 PFN_UP(__MEMORY_START_2ND),
293 PFN_UP(__MEMORY_START_2ND),
294 PFN_DOWN(__MEMORY_START_2ND+__MEMORY_SIZE_2ND));
295 free_bootmem_node(NODE_DATA(1), __MEMORY_START_2ND, __MEMORY_SIZE_2ND);
296 reserve_bootmem_node(NODE_DATA(1), __MEMORY_START_2ND, bootmap_size);
297#endif
298
299 /* 287 /*
300 * Find the highest page frame number we have available 288 * Find the highest page frame number we have available
301 */ 289 */
@@ -306,10 +294,10 @@ void __init setup_arch(char **cmdline_p)
306 */ 294 */
307 max_low_pfn = max_pfn; 295 max_low_pfn = max_pfn;
308 296
309 /* 297 /*
310 * Partially used pages are not usable - thus 298 * Partially used pages are not usable - thus
311 * we are rounding upwards: 299 * we are rounding upwards:
312 */ 300 */
313 start_pfn = PFN_UP(__pa(_end)); 301 start_pfn = PFN_UP(__pa(_end));
314 302
315 /* 303 /*
@@ -360,12 +348,12 @@ void __init setup_arch(char **cmdline_p)
360 reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE); 348 reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE);
361 349
362#ifdef CONFIG_BLK_DEV_INITRD 350#ifdef CONFIG_BLK_DEV_INITRD
363 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); 351 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
364 if (&__rd_start != &__rd_end) { 352 if (&__rd_start != &__rd_end) {
365 LOADER_TYPE = 1; 353 LOADER_TYPE = 1;
366 INITRD_START = PHYSADDR((unsigned long)&__rd_start) - __MEMORY_START; 354 INITRD_START = PHYSADDR((unsigned long)&__rd_start) - __MEMORY_START;
367 INITRD_SIZE = (unsigned long)&__rd_end - (unsigned long)&__rd_start; 355 INITRD_SIZE = (unsigned long)&__rd_end - (unsigned long)&__rd_start;
368 } 356 }
369 357
370 if (LOADER_TYPE && INITRD_START) { 358 if (LOADER_TYPE && INITRD_START) {
371 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 359 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 4e9c854845a4..e342565f75fb 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -51,11 +51,6 @@ unsigned long mmu_context_cache = NO_CONTEXT;
51#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn) 51#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn)
52#endif 52#endif
53 53
54#ifdef CONFIG_DISCONTIGMEM
55pg_data_t discontig_page_data[MAX_NUMNODES];
56bootmem_data_t discontig_node_bdata[MAX_NUMNODES];
57#endif
58
59void (*copy_page)(void *from, void *to); 54void (*copy_page)(void *from, void *to);
60void (*clear_page)(void *to); 55void (*clear_page)(void *to);
61 56
@@ -216,15 +211,6 @@ void __init paging_init(void)
216#endif 211#endif
217 NODE_DATA(0)->node_mem_map = NULL; 212 NODE_DATA(0)->node_mem_map = NULL;
218 free_area_init_node(0, NODE_DATA(0), zones_size, __MEMORY_START >> PAGE_SHIFT, 0); 213 free_area_init_node(0, NODE_DATA(0), zones_size, __MEMORY_START >> PAGE_SHIFT, 0);
219
220#ifdef CONFIG_DISCONTIGMEM
221 /*
222 * And for discontig, do some more fixups on the zone sizes..
223 */
224 zones_size[ZONE_DMA] = __MEMORY_SIZE_2ND >> PAGE_SHIFT;
225 zones_size[ZONE_NORMAL] = 0;
226 free_area_init_node(1, NODE_DATA(1), zones_size, __MEMORY_START_2ND >> PAGE_SHIFT, 0);
227#endif
228} 214}
229 215
230void __init mem_init(void) 216void __init mem_init(void)
@@ -248,7 +234,7 @@ void __init mem_init(void)
248 memset(empty_zero_page, 0, PAGE_SIZE); 234 memset(empty_zero_page, 0, PAGE_SIZE);
249 __flush_wback_region(empty_zero_page, PAGE_SIZE); 235 __flush_wback_region(empty_zero_page, PAGE_SIZE);
250 236
251 /* 237 /*
252 * Setup wrappers for copy/clear_page(), these will get overridden 238 * Setup wrappers for copy/clear_page(), these will get overridden
253 * later in the boot process if a better method is available. 239 * later in the boot process if a better method is available.
254 */ 240 */
@@ -257,9 +243,6 @@ void __init mem_init(void)
257 243
258 /* this will put all low memory onto the freelists */ 244 /* this will put all low memory onto the freelists */
259 totalram_pages += free_all_bootmem_node(NODE_DATA(0)); 245 totalram_pages += free_all_bootmem_node(NODE_DATA(0));
260#ifdef CONFIG_DISCONTIGMEM
261 totalram_pages += free_all_bootmem_node(NODE_DATA(1));
262#endif
263 reservedpages = 0; 246 reservedpages = 0;
264 for (tmp = 0; tmp < num_physpages; tmp++) 247 for (tmp = 0; tmp < num_physpages; tmp++)
265 /* 248 /*
@@ -286,7 +269,7 @@ void __init mem_init(void)
286void free_initmem(void) 269void free_initmem(void)
287{ 270{
288 unsigned long addr; 271 unsigned long addr;
289 272
290 addr = (unsigned long)(&__init_begin); 273 addr = (unsigned long)(&__init_begin);
291 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { 274 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
292 ClearPageReserved(virt_to_page(addr)); 275 ClearPageReserved(virt_to_page(addr));
diff --git a/include/asm-sh/mmzone.h b/include/asm-sh/mmzone.h
deleted file mode 100644
index 0e7406601fdf..000000000000
--- a/include/asm-sh/mmzone.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * linux/include/asm-sh/mmzone.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_SH_MMZONE_H
9#define __ASM_SH_MMZONE_H
10
11#include <linux/config.h>
12
13#ifdef CONFIG_DISCONTIGMEM
14
15/* Currently, just for HP690 */
16#define PHYSADDR_TO_NID(phys) ((((phys) - __MEMORY_START) >= 0x01000000)?1:0)
17
18extern pg_data_t discontig_page_data[MAX_NUMNODES];
19extern bootmem_data_t discontig_node_bdata[MAX_NUMNODES];
20
21/*
22 * Following are macros that each numa implmentation must define.
23 */
24
25/*
26 * Given a kernel address, find the home node of the underlying memory.
27 */
28#define KVADDR_TO_NID(kaddr) PHYSADDR_TO_NID(__pa(kaddr))
29
30/*
31 * Return a pointer to the node data for node n.
32 */
33#define NODE_DATA(nid) (&discontig_page_data[nid])
34
35/*
36 * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
37 */
38#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
39
40#define phys_to_page(phys) \
41({ unsigned int node = PHYSADDR_TO_NID(phys); \
42 NODE_MEM_MAP(node) \
43 + (((phys) - NODE_DATA(node)->node_start_paddr) >> PAGE_SHIFT); })
44
45static inline int is_valid_page(struct page *page)
46{
47 unsigned int i;
48
49 for (i = 0; i < MAX_NUMNODES; i++) {
50 if (page >= NODE_MEM_MAP(i) &&
51 page < NODE_MEM_MAP(i) + NODE_DATA(i)->node_size)
52 return 1;
53 }
54 return 0;
55}
56
57#define VALID_PAGE(page) is_valid_page(page)
58#define page_to_phys(page) PHYSADDR(page_address(page))
59
60#endif /* CONFIG_DISCONTIGMEM */
61#endif
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 324e6cc5ecf7..972c3f655b2a 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -93,11 +93,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
93 93
94#define __MEMORY_START CONFIG_MEMORY_START 94#define __MEMORY_START CONFIG_MEMORY_START
95#define __MEMORY_SIZE CONFIG_MEMORY_SIZE 95#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
96#ifdef CONFIG_DISCONTIGMEM
97/* Just for HP690, for now.. */
98#define __MEMORY_START_2ND (__MEMORY_START+0x02000000)
99#define __MEMORY_SIZE_2ND 0x001000000 /* 16MB */
100#endif
101 96
102#define PAGE_OFFSET (0x80000000UL) 97#define PAGE_OFFSET (0x80000000UL)
103#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 98#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
@@ -105,10 +100,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
105 100
106#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 101#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
107 102
108#ifndef CONFIG_DISCONTIGMEM
109#define phys_to_page(phys) (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT)) 103#define phys_to_page(phys) (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT))
110#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START) 104#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START)
111#endif
112 105
113/* PFN start number, because of __MEMORY_START */ 106/* PFN start number, because of __MEMORY_START */
114#define PFN_START (__MEMORY_START >> PAGE_SHIFT) 107#define PFN_START (__MEMORY_START >> PAGE_SHIFT)