Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_NUMA_H
0003 #define _LINUX_NUMA_H
0004 #include <linux/types.h>
0005 
0006 #ifdef CONFIG_NODES_SHIFT
0007 #define NODES_SHIFT     CONFIG_NODES_SHIFT
0008 #else
0009 #define NODES_SHIFT     0
0010 #endif
0011 
0012 #define MAX_NUMNODES    (1 << NODES_SHIFT)
0013 
0014 #define NUMA_NO_NODE    (-1)
0015 
0016 /* optionally keep NUMA memory info available post init */
0017 #ifdef CONFIG_NUMA_KEEP_MEMINFO
0018 #define __initdata_or_meminfo
0019 #else
0020 #define __initdata_or_meminfo __initdata
0021 #endif
0022 
0023 #ifdef CONFIG_NUMA
0024 #include <linux/printk.h>
0025 #include <asm/sparsemem.h>
0026 
0027 /* Generic implementation available */
0028 int numa_map_to_online_node(int node);
0029 
0030 #ifndef memory_add_physaddr_to_nid
0031 static inline int memory_add_physaddr_to_nid(u64 start)
0032 {
0033     pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n",
0034             start);
0035     return 0;
0036 }
0037 #endif
0038 #ifndef phys_to_target_node
0039 static inline int phys_to_target_node(u64 start)
0040 {
0041     pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
0042             start);
0043     return 0;
0044 }
0045 #endif
0046 #else /* !CONFIG_NUMA */
0047 static inline int numa_map_to_online_node(int node)
0048 {
0049     return NUMA_NO_NODE;
0050 }
0051 static inline int memory_add_physaddr_to_nid(u64 start)
0052 {
0053     return 0;
0054 }
0055 static inline int phys_to_target_node(u64 start)
0056 {
0057     return 0;
0058 }
0059 #endif
0060 
0061 #ifdef CONFIG_HAVE_ARCH_NODE_DEV_GROUP
0062 extern const struct attribute_group arch_node_dev_group;
0063 #endif
0064 
0065 #endif /* _LINUX_NUMA_H */