aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBob Picco <bob.picco@hp.com>2005-10-04 15:13:57 -0400
committerTony Luck <tony.luck@intel.com>2005-10-04 16:21:38 -0400
commit2d4b1fa234417b902c9d3034442387c1805bfa7b (patch)
tree2ed92c7f82eec32a86f2047ac9e9534d7912e305 /arch
parent1be7d9935b9c7fb9bd5964bfaf3ac543381277db (diff)
[PATCH] V5 ia64 SPARSEMEM - SPARSEMEM code changes
This patch is the minimal set of changes required by ia64 to use SPARSEMEM. Signed-off-by: Bob Picco <bob.picco@hp.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/mm/discontig.c43
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/mm/numa.c24
3 files changed, 66 insertions, 3 deletions
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index b5c90e548195..a3788fb84809 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -421,6 +421,37 @@ static void __init memory_less_nodes(void)
421 return; 421 return;
422} 422}
423 423
424#ifdef CONFIG_SPARSEMEM
425/**
426 * register_sparse_mem - notify SPARSEMEM that this memory range exists.
427 * @start: physical start of range
428 * @end: physical end of range
429 * @arg: unused
430 *
431 * Simply calls SPARSEMEM to register memory section(s).
432 */
433static int __init register_sparse_mem(unsigned long start, unsigned long end,
434 void *arg)
435{
436 int nid;
437
438 start = __pa(start) >> PAGE_SHIFT;
439 end = __pa(end) >> PAGE_SHIFT;
440 nid = early_pfn_to_nid(start);
441 memory_present(nid, start, end);
442
443 return 0;
444}
445
446static void __init arch_sparse_init(void)
447{
448 efi_memmap_walk(register_sparse_mem, NULL);
449 sparse_init();
450}
451#else
452#define arch_sparse_init() do {} while (0)
453#endif
454
424/** 455/**
425 * find_memory - walk the EFI memory map and setup the bootmem allocator 456 * find_memory - walk the EFI memory map and setup the bootmem allocator
426 * 457 *
@@ -528,8 +559,10 @@ void show_mem(void)
528 int shared = 0, cached = 0, reserved = 0; 559 int shared = 0, cached = 0, reserved = 0;
529 printk("Node ID: %d\n", pgdat->node_id); 560 printk("Node ID: %d\n", pgdat->node_id);
530 for(i = 0; i < pgdat->node_spanned_pages; i++) { 561 for(i = 0; i < pgdat->node_spanned_pages; i++) {
531 struct page *page = pgdat_page_nr(pgdat, i); 562 struct page *page;
532 if (!ia64_pfn_valid(pgdat->node_start_pfn+i)) 563 if (pfn_valid(pgdat->node_start_pfn + i))
564 page = pfn_to_page(pgdat->node_start_pfn + i);
565 else
533 continue; 566 continue;
534 if (PageReserved(page)) 567 if (PageReserved(page))
535 reserved++; 568 reserved++;
@@ -648,12 +681,16 @@ void __init paging_init(void)
648 681
649 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; 682 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
650 683
684 arch_sparse_init();
685
651 efi_memmap_walk(filter_rsvd_memory, count_node_pages); 686 efi_memmap_walk(filter_rsvd_memory, count_node_pages);
652 687
688#ifdef CONFIG_VIRTUAL_MEM_MAP
653 vmalloc_end -= PAGE_ALIGN(max_low_pfn * sizeof(struct page)); 689 vmalloc_end -= PAGE_ALIGN(max_low_pfn * sizeof(struct page));
654 vmem_map = (struct page *) vmalloc_end; 690 vmem_map = (struct page *) vmalloc_end;
655 efi_memmap_walk(create_mem_map_page_table, NULL); 691 efi_memmap_walk(create_mem_map_page_table, NULL);
656 printk("Virtual mem_map starts at 0x%p\n", vmem_map); 692 printk("Virtual mem_map starts at 0x%p\n", vmem_map);
693#endif
657 694
658 for_each_online_node(node) { 695 for_each_online_node(node) {
659 memset(zones_size, 0, sizeof(zones_size)); 696 memset(zones_size, 0, sizeof(zones_size));
@@ -690,7 +727,9 @@ void __init paging_init(void)
690 727
691 pfn_offset = mem_data[node].min_pfn; 728 pfn_offset = mem_data[node].min_pfn;
692 729
730#ifdef CONFIG_VIRTUAL_MEM_MAP
693 NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset; 731 NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
732#endif
694 free_area_init_node(node, NODE_DATA(node), zones_size, 733 free_area_init_node(node, NODE_DATA(node), zones_size,
695 pfn_offset, zholes_size); 734 pfn_offset, zholes_size);
696 } 735 }
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 1281c609ee98..98246acd4991 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -593,7 +593,7 @@ mem_init (void)
593 platform_dma_init(); 593 platform_dma_init();
594#endif 594#endif
595 595
596#ifndef CONFIG_DISCONTIGMEM 596#ifdef CONFIG_FLATMEM
597 if (!mem_map) 597 if (!mem_map)
598 BUG(); 598 BUG();
599 max_mapnr = max_low_pfn; 599 max_mapnr = max_low_pfn;
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index 77118bbf3d8b..4e5c8b36ad93 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -47,3 +47,27 @@ paddr_to_nid(unsigned long paddr)
47 47
48 return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0); 48 return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
49} 49}
50
51#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA)
52/*
53 * Because of holes evaluate on section limits.
54 * If the section of memory exists, then return the node where the section
55 * resides. Otherwise return node 0 as the default. This is used by
56 * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where
57 * the section resides.
58 */
59int early_pfn_to_nid(unsigned long pfn)
60{
61 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
62
63 for (i = 0; i < num_node_memblks; i++) {
64 ssec = node_memblk[i].start_paddr >> PA_SECTION_SHIFT;
65 esec = (node_memblk[i].start_paddr + node_memblk[i].size +
66 ((1L << PA_SECTION_SHIFT) - 1)) >> PA_SECTION_SHIFT;
67 if (section >= ssec && section < esec)
68 return node_memblk[i].nid;
69 }
70
71 return 0;
72}
73#endif