2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
22 * Topology of a NUMA or HTT system.
24 * The top level topology is an array of pointers to groups. Each group
25 * contains a bitmask of cpus in its group or subgroups. It may also
26 * contain a pointer to an array of child groups.
28 * The bitmasks at non leaf groups may be used by consumers who support
29 * a smaller depth than the hardware provides.
31 * The topology may be omitted by systems where all CPUs are equal.
35 cpumask_t cg_mask; /* Mask of cpus in this group. */
36 int cg_count; /* Count of cpus in this group. */
37 int cg_children; /* Number of children groups. */
38 struct cpu_group *cg_child; /* Optional child group. */
42 int ct_count; /* Count of groups. */
43 struct cpu_group *ct_group; /* Array of pointers to cpu groups. */
46 extern struct cpu_top *smp_topology;
47 extern void (*cpustop_restartfunc)(void);
48 extern int smp_active;
50 extern volatile cpumask_t started_cpus;
51 extern volatile cpumask_t stopped_cpus;
52 extern cpumask_t idle_cpus_mask;
53 extern cpumask_t hlt_cpus_mask;
54 extern cpumask_t logical_cpus_mask;
57 extern u_int mp_maxid;
58 extern int mp_maxcpus;
60 extern volatile int smp_started;
62 extern cpumask_t all_cpus;
65 * Macro allowing us to determine whether a CPU is absent at any given
66 * time, thus permitting us to configure sparse maps of cpuid-dependent
67 * (per-CPU) structures.
69 #define CPU_ABSENT(x_cpu) ((all_cpus & (1 << (x_cpu))) == 0)
73 * Machine dependent functions used to initialize MP support.
75 * The cpu_mp_probe() should check to see if MP support is present and return
76 * zero if it is not or non-zero if it is. If MP support is present, then
77 * cpu_mp_start() will be called so that MP can be enabled. This function
78 * should do things such as startup secondary processors. It should also
79 * setup mp_ncpus, all_cpus, and smp_cpus. It should also ensure that
80 * smp_active and smp_started are initialized at the appropriate time.
81 * Once cpu_mp_start() returns, machine independent MP startup code will be
82 * executed and a simple message will be output to the console. Finally,
83 * cpu_mp_announce() will be called so that machine dependent messages about
84 * the MP support may be output to the console if desired.
86 * The cpu_setmaxid() function is called very early during the boot process
87 * so that the MD code may set mp_maxid to provide an upper bound on CPU IDs
88 * that other subsystems may use. If a platform is not able to determine
89 * the exact maximum ID that early, then it may set mp_maxid to MAXCPU - 1.
93 void cpu_mp_announce(void);
94 int cpu_mp_probe(void);
95 void cpu_mp_setmaxid(void);
96 void cpu_mp_start(void);
98 void forward_signal(struct thread *);
99 void forward_roundrobin(void);
100 int restart_cpus(cpumask_t);
101 int stop_cpus(cpumask_t);
102 void smp_rendezvous_action(void);
103 extern struct mtx smp_ipi_mtx;
106 void smp_no_rendevous_barrier(void *);
107 void smp_rendezvous(void (*)(void *),
111 void smp_rendezvous_cpus(cpumask_t,
118 #endif /* _SYS_SMP_H_ */