8 #include "kernel/kernel.h"
12 /* number of CPUs (execution strands in the system */
13 EXTERN
unsigned ncpus
;
14 /* Number of virtual strands per physical core */
15 EXTERN
unsigned ht_per_core
;
16 /* which cpu is bootstrapping */
17 EXTERN
unsigned bsp_cpu_id
;
19 #define cpu_is_bsp(cpu) (bsp_cpu_id == cpu)
22 * SMP initialization is largely architecture dependent and each architecture
23 * must provide a method how to do it. If initiating SMP fails the function does
24 * not report it. However it must put the system in such a state that it falls
25 * back to a uniprocessor system. Although the uniprocessor configuration may be
26 * suboptimal, the system must be able to run on the bootstrap processor as if
27 * it was the only processor in the system
32 #define CPU_IS_READY 2
38 EXTERN
struct cpu cpus
[CONFIG_MAX_CPUS
];
40 #define cpu_set_flag(cpu, flag) do { cpus[cpu].flags |= (flag); } while(0)
41 #define cpu_clear_flag(cpu, flag) do { cpus[cpu].flags &= ~(flag); } while(0)
42 #define cpu_test_flag(cpu, flag) (cpus[cpu].flags & (flag))
43 #define cpu_is_ready(cpu) cpu_test_flag(cpu, CPU_IS_READY)
46 * Big Kernel Lock prevents more then one cpu executing the kernel code
48 SPINLOCK_DECLARE(big_kernel_lock
)
50 * to sync the booting APs
52 SPINLOCK_DECLARE(boot_lock
)
54 void wait_for_APs_to_finish_booting(void);
55 void ap_boot_finished(unsigned cpu
);
56 void smp_shutdown_aps(void );
59 void smp_ipi_halt_handler(void);
60 void smp_ipi_sched_handler(void);
62 void smp_schedule(unsigned cpu
);
63 /* stop a processes on a different cpu */
64 void smp_schedule_stop_proc(struct proc
* p
);
65 /* stop a process on a different cpu because its address space is being changed */
66 void smp_schedule_vminhibit(struct proc
* p
);
67 /* stop the process and for saving its full context */
68 void smp_schedule_stop_proc_save_ctx(struct proc
* p
);
69 /* migrate the full context of a process to the destination CPU */
70 void smp_schedule_migrate_proc(struct proc
* p
, unsigned dest_cpu
);
72 void arch_send_smp_schedule_ipi(unsigned cpu
);
73 void arch_smp_halt_cpu(void);
75 /* deal with x-cpu scheduling event */
76 void smp_sched_handler(void);
78 #endif /* __ASSEMBLY__ */
80 #endif /* CONFIG_SMP */
82 #endif /* __SMP_H__ */