numa.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_NUMA_H
  3. #define _ASM_X86_NUMA_H
  4. #include <linux/nodemask.h>
  5. #include <linux/errno.h>
  6. #include <asm/topology.h>
  7. #include <asm/apicdef.h>
  8. #ifdef CONFIG_NUMA
  9. #define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
  10. extern int numa_off;
  11. /*
  12. * __apicid_to_node[] stores the raw mapping between physical apicid and
  13. * node and is used to initialize cpu_to_node mapping.
  14. *
  15. * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus
  16. * should be accessed by the accessors - set_apicid_to_node() and
  17. * numa_cpu_node().
  18. */
  19. extern s16 __apicid_to_node[MAX_LOCAL_APIC];
  20. extern nodemask_t numa_nodes_parsed __initdata;
  21. extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);
  22. extern void __init numa_set_distance(int from, int to, int distance);
  23. static inline void set_apicid_to_node(int apicid, s16 node)
  24. {
  25. __apicid_to_node[apicid] = node;
  26. }
  27. extern int numa_cpu_node(int cpu);
  28. #else /* CONFIG_NUMA */
  29. static inline void set_apicid_to_node(int apicid, s16 node)
  30. {
  31. }
  32. static inline int numa_cpu_node(int cpu)
  33. {
  34. return NUMA_NO_NODE;
  35. }
  36. #endif /* CONFIG_NUMA */
  37. #ifdef CONFIG_X86_32
  38. # include <asm/numa_32.h>
  39. #endif
  40. #ifdef CONFIG_NUMA
  41. extern void numa_set_node(int cpu, int node);
  42. extern void numa_clear_node(int cpu);
  43. extern void __init init_cpu_to_node(void);
  44. extern void numa_add_cpu(int cpu);
  45. extern void numa_remove_cpu(int cpu);
  46. extern void init_gi_nodes(void);
  47. #else /* CONFIG_NUMA */
  48. static inline void numa_set_node(int cpu, int node) { }
  49. static inline void numa_clear_node(int cpu) { }
  50. static inline void init_cpu_to_node(void) { }
  51. static inline void numa_add_cpu(int cpu) { }
  52. static inline void numa_remove_cpu(int cpu) { }
  53. static inline void init_gi_nodes(void) { }
  54. #endif /* CONFIG_NUMA */
  55. #ifdef CONFIG_DEBUG_PER_CPU_MAPS
  56. void debug_cpumask_set_cpu(int cpu, int node, bool enable);
  57. #endif
  58. #ifdef CONFIG_NUMA_EMU
  59. #define FAKE_NODE_MIN_SIZE ((u64)32 << 20)
  60. #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
  61. int numa_emu_cmdline(char *str);
  62. #else /* CONFIG_NUMA_EMU */
  63. static inline int numa_emu_cmdline(char *str)
  64. {
  65. return -EINVAL;
  66. }
  67. #endif /* CONFIG_NUMA_EMU */
  68. #endif /* _ASM_X86_NUMA_H */