^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2010 Loongson Inc. & Lemote Inc. &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Institute of Computing Technology
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Author: Xiang Gao, gaoxiang@ict.ac.cn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Huacai Chen, chenhc@lemote.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Xiaofu Meng, Shuangshuang Zhang
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/mmzone.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/nodemask.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/swap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/memblock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/pfn.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/highmem.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/pgalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/sections.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <asm/bootinfo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <asm/mc146818-time.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <asm/time.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <asm/wbflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <boot_param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static struct pglist_data prealloc__node_data[MAX_NUMNODES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) EXPORT_SYMBOL(__node_distances);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct pglist_data *__node_data[MAX_NUMNODES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) EXPORT_SYMBOL(__node_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) cpumask_t __node_cpumask[MAX_NUMNODES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) EXPORT_SYMBOL(__node_cpumask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static void enable_lpa(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) unsigned long value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) value = __read_32bit_c0_register($16, 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) value |= 0x00000080;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) __write_32bit_c0_register($16, 3, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) value = __read_32bit_c0_register($16, 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) pr_info("CP0_Config3: CP0 16.3 (0x%lx)\n", value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) value = __read_32bit_c0_register($5, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) value |= 0x20000000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) __write_32bit_c0_register($5, 1, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) value = __read_32bit_c0_register($5, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) pr_info("CP0_PageGrain: CP0 5.1 (0x%lx)\n", value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static void cpu_node_probe(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) nodes_clear(node_possible_map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) nodes_clear(node_online_map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) for (i = 0; i < loongson_sysconf.nr_nodes; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) node_set_state(num_online_nodes(), N_POSSIBLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) node_set_online(num_online_nodes());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) pr_info("NUMA: Discovered %d cpus on %d nodes\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) loongson_sysconf.nr_cpus, num_online_nodes());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static int __init compute_node_distance(int row, int col)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) int package_row = row * loongson_sysconf.cores_per_node /
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) loongson_sysconf.cores_per_package;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) int package_col = col * loongson_sysconf.cores_per_node /
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) loongson_sysconf.cores_per_package;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) if (col == row)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) return LOCAL_DISTANCE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) else if (package_row == package_col)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) return 40;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) return 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) static void __init init_topology_matrix(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) int row, col;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) for (row = 0; row < MAX_NUMNODES; row++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) for (col = 0; col < MAX_NUMNODES; col++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) __node_distances[row][col] = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) for_each_online_node(row) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) for_each_online_node(col) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) __node_distances[row][col] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) compute_node_distance(row, col);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) static void __init szmem(unsigned int node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) u32 i, mem_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static unsigned long num_physpages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) u64 node_id, node_psize, start_pfn, end_pfn, mem_start, mem_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /* Parse memory information and activate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) for (i = 0; i < loongson_memmap->nr_map; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) node_id = loongson_memmap->map[i].node_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) if (node_id != node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) mem_type = loongson_memmap->map[i].mem_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) mem_size = loongson_memmap->map[i].mem_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) mem_start = loongson_memmap->map[i].mem_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) switch (mem_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) case SYSTEM_RAM_LOW:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) start_pfn = ((node_id << 44) + mem_start) >> PAGE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) node_psize = (mem_size << 20) >> PAGE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) end_pfn = start_pfn + node_psize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) num_physpages += node_psize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) (u32)node_id, mem_type, mem_start, mem_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) start_pfn, end_pfn, num_physpages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) memblock_add_node(PFN_PHYS(start_pfn),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) PFN_PHYS(node_psize), node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) case SYSTEM_RAM_HIGH:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) start_pfn = ((node_id << 44) + mem_start) >> PAGE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) node_psize = (mem_size << 20) >> PAGE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) end_pfn = start_pfn + node_psize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) num_physpages += node_psize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) (u32)node_id, mem_type, mem_start, mem_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) start_pfn, end_pfn, num_physpages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) memblock_add_node(PFN_PHYS(start_pfn),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) PFN_PHYS(node_psize), node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) case SYSTEM_RAM_RESERVED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) (u32)node_id, mem_type, mem_start, mem_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) memblock_reserve(((node_id << 44) + mem_start),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) mem_size << 20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) static void __init node_mem_init(unsigned int node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) unsigned long node_addrspace_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) unsigned long start_pfn, end_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) node_addrspace_offset = nid_to_addrbase(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) pr_info("Node%d's addrspace_offset is 0x%lx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) node, node_addrspace_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) pr_info("Node%d: start_pfn=0x%lx, end_pfn=0x%lx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) node, start_pfn, end_pfn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) __node_data[node] = prealloc__node_data + node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) NODE_DATA(node)->node_start_pfn = start_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) if (node == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /* kernel end address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /* used by finalize_initrd() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) max_low_pfn = end_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /* Reserve the kernel text/data/bss */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) memblock_reserve(start_pfn << PAGE_SHIFT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) ((kernel_end_pfn - start_pfn) << PAGE_SHIFT));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) /* Reserve 0xfe000000~0xffffffff for RS780E integrated GPU */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) if (node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) memblock_reserve((node_addrspace_offset | 0xfe000000),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 32 << 20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /* Reserve pfn range 0~node[0]->node_start_pfn */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) memblock_reserve(0, PAGE_SIZE * start_pfn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) static __init void prom_meminit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) unsigned int node, cpu, active_cpu = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) cpu_node_probe();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) init_topology_matrix();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) for (node = 0; node < loongson_sysconf.nr_nodes; node++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (node_online(node)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) szmem(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) node_mem_init(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) cpumask_clear(&__node_cpumask[node]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) max_low_pfn = PHYS_PFN(memblock_end_of_DRAM());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) for (cpu = 0; cpu < loongson_sysconf.nr_cpus; cpu++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) node = cpu / loongson_sysconf.cores_per_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) if (node >= num_online_nodes())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) node = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) if (loongson_sysconf.reserved_cpus_mask & (1<<cpu))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) cpumask_set_cpu(active_cpu, &__node_cpumask[node]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) pr_info("NUMA: set cpumask cpu %d on node %d\n", active_cpu, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) active_cpu++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) void __init paging_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) unsigned long zones_size[MAX_NR_ZONES] = {0, };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) pagetable_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) zones_size[ZONE_DMA32] = MAX_DMA32_PFN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) zones_size[ZONE_NORMAL] = max_low_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) free_area_init(zones_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) void __init mem_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) memblock_free_all();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) setup_zero_pages(); /* This comes from node 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) mem_init_print_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) /* All PCI device belongs to logical Node-0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) int pcibus_to_node(struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) EXPORT_SYMBOL(pcibus_to_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) void __init prom_init_numa_memory(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) enable_lpa();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) prom_meminit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) EXPORT_SYMBOL(prom_init_numa_memory);