18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_NUMA_H 38c2ecf20Sopenharmony_ci#define __ASM_NUMA_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/topology.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifdef CONFIG_NUMA 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2) 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ciint __node_distance(int from, int to); 128c2ecf20Sopenharmony_ci#define node_distance(a, b) __node_distance(a, b) 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciextern nodemask_t numa_nodes_parsed __initdata; 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciextern bool numa_off; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* Mappings between node number and cpus on that node. */ 198c2ecf20Sopenharmony_ciextern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; 208c2ecf20Sopenharmony_civoid numa_clear_node(unsigned int cpu); 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_PER_CPU_MAPS 238c2ecf20Sopenharmony_ciconst struct cpumask *cpumask_of_node(int node); 248c2ecf20Sopenharmony_ci#else 258c2ecf20Sopenharmony_ci/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ 268c2ecf20Sopenharmony_cistatic inline const struct cpumask *cpumask_of_node(int node) 278c2ecf20Sopenharmony_ci{ 288c2ecf20Sopenharmony_ci if (node == NUMA_NO_NODE) 298c2ecf20Sopenharmony_ci return cpu_all_mask; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci return node_to_cpumask_map[node]; 328c2ecf20Sopenharmony_ci} 338c2ecf20Sopenharmony_ci#endif 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_civoid __init arm64_numa_init(void); 368c2ecf20Sopenharmony_ciint __init numa_add_memblk(int nodeid, u64 start, u64 end); 378c2ecf20Sopenharmony_civoid __init numa_set_distance(int from, int to, int distance); 388c2ecf20Sopenharmony_civoid __init numa_free_distance(void); 398c2ecf20Sopenharmony_civoid __init early_map_cpu_to_node(unsigned int cpu, int nid); 408c2ecf20Sopenharmony_civoid numa_store_cpu_info(unsigned int cpu); 418c2ecf20Sopenharmony_civoid numa_add_cpu(unsigned int cpu); 428c2ecf20Sopenharmony_civoid numa_remove_cpu(unsigned int cpu); 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#else /* CONFIG_NUMA */ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cistatic inline void numa_store_cpu_info(unsigned int cpu) { } 478c2ecf20Sopenharmony_cistatic inline void numa_add_cpu(unsigned int cpu) { } 488c2ecf20Sopenharmony_cistatic inline void numa_remove_cpu(unsigned int cpu) { } 498c2ecf20Sopenharmony_cistatic inline void arm64_numa_init(void) { } 508c2ecf20Sopenharmony_cistatic inline void early_map_cpu_to_node(unsigned int cpu, int nid) { } 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#endif /* CONFIG_NUMA */ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#endif /* __ASM_NUMA_H */ 55