Glauber Costa | c27cfeff | 2008-03-03 14:12:29 -0300 | [diff] [blame] | 1 | #ifndef _ASM_X86_SMP_H_ |
| 2 | #define _ASM_X86_SMP_H_ |
| 3 | #ifndef __ASSEMBLY__ |
Glauber Costa | 53ebef4 | 2008-03-03 14:12:31 -0300 | [diff] [blame] | 4 | #include <linux/cpumask.h> |
Glauber Costa | 93b016f | 2008-03-03 14:12:40 -0300 | [diff] [blame] | 5 | #include <linux/init.h> |
Glauber de Oliveira Costa | 7e1efc0 | 2008-03-19 14:25:18 -0300 | [diff] [blame] | 6 | #include <asm/percpu.h> |
Glauber Costa | 53ebef4 | 2008-03-03 14:12:31 -0300 | [diff] [blame] | 7 | |
| 8 | extern cpumask_t cpu_callout_map; |
| 9 | |
| 10 | extern int smp_num_siblings; |
| 11 | extern unsigned int num_processors; |
Glauber Costa | c27cfeff | 2008-03-03 14:12:29 -0300 | [diff] [blame] | 12 | |
Glauber de Oliveira Costa | 7e1efc0 | 2008-03-19 14:25:18 -0300 | [diff] [blame] | 13 | extern u16 x86_cpu_to_apicid_init[]; |
| 14 | extern u16 x86_bios_cpu_apicid_init[]; |
| 15 | extern void *x86_cpu_to_apicid_early_ptr; |
| 16 | extern void *x86_bios_cpu_apicid_early_ptr; |
| 17 | |
| 18 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
| 19 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); |
| 20 | DECLARE_PER_CPU(u16, cpu_llc_id); |
| 21 | DECLARE_PER_CPU(u16, x86_cpu_to_apicid); |
| 22 | DECLARE_PER_CPU(u16, x86_bios_cpu_apicid); |
| 23 | |
Glauber Costa | 4206882 | 2008-03-03 14:13:09 -0300 | [diff] [blame] | 24 | /* |
| 25 | * Trampoline 80x86 program as an array. |
| 26 | */ |
| 27 | extern const unsigned char trampoline_data []; |
| 28 | extern const unsigned char trampoline_end []; |
Glauber Costa | 91718e8 | 2008-03-03 14:13:12 -0300 | [diff] [blame] | 29 | extern unsigned char *trampoline_base; |
Glauber Costa | 4206882 | 2008-03-03 14:13:09 -0300 | [diff] [blame] | 30 | |
Glauber de Oliveira Costa | 9d97d0d | 2008-03-19 14:25:57 -0300 | [diff] [blame] | 31 | /* Static state in head.S used to set up a CPU */ |
| 32 | extern struct { |
| 33 | void *sp; |
| 34 | unsigned short ss; |
| 35 | } stack_start; |
| 36 | |
| 37 | |
Glauber Costa | 1669402 | 2008-03-03 14:12:32 -0300 | [diff] [blame] | 38 | struct smp_ops { |
| 39 | void (*smp_prepare_boot_cpu)(void); |
| 40 | void (*smp_prepare_cpus)(unsigned max_cpus); |
| 41 | int (*cpu_up)(unsigned cpu); |
| 42 | void (*smp_cpus_done)(unsigned max_cpus); |
| 43 | |
| 44 | void (*smp_send_stop)(void); |
| 45 | void (*smp_send_reschedule)(int cpu); |
| 46 | int (*smp_call_function_mask)(cpumask_t mask, |
| 47 | void (*func)(void *info), void *info, |
| 48 | int wait); |
| 49 | }; |
| 50 | |
Glauber Costa | 1452207 | 2008-03-03 14:12:59 -0300 | [diff] [blame] | 51 | /* Globals due to paravirt */ |
| 52 | extern void set_cpu_sibling_map(int cpu); |
| 53 | |
Glauber Costa | c76cb36 | 2008-03-03 14:12:33 -0300 | [diff] [blame] | 54 | #ifdef CONFIG_SMP |
Glauber de Oliveira Costa | d0173ae | 2008-03-19 14:24:59 -0300 | [diff] [blame] | 55 | #ifndef CONFIG_PARAVIRT |
| 56 | #define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0) |
| 57 | #endif |
Glauber Costa | c76cb36 | 2008-03-03 14:12:33 -0300 | [diff] [blame] | 58 | extern struct smp_ops smp_ops; |
Glauber Costa | 8678969 | 2008-03-03 14:12:34 -0300 | [diff] [blame] | 59 | |
Glauber Costa | 377d698 | 2008-03-03 14:12:51 -0300 | [diff] [blame] | 60 | static inline void smp_send_stop(void) |
| 61 | { |
| 62 | smp_ops.smp_send_stop(); |
| 63 | } |
| 64 | |
Glauber Costa | 1e3fac8 | 2008-03-03 14:12:37 -0300 | [diff] [blame] | 65 | static inline void smp_prepare_boot_cpu(void) |
| 66 | { |
| 67 | smp_ops.smp_prepare_boot_cpu(); |
| 68 | } |
| 69 | |
Glauber Costa | 7557da6 | 2008-03-03 14:12:38 -0300 | [diff] [blame] | 70 | static inline void smp_prepare_cpus(unsigned int max_cpus) |
| 71 | { |
| 72 | smp_ops.smp_prepare_cpus(max_cpus); |
| 73 | } |
| 74 | |
Glauber Costa | c559764 | 2008-03-03 14:12:39 -0300 | [diff] [blame] | 75 | static inline void smp_cpus_done(unsigned int max_cpus) |
| 76 | { |
| 77 | smp_ops.smp_cpus_done(max_cpus); |
| 78 | } |
| 79 | |
Glauber Costa | 71d1954 | 2008-03-03 14:12:36 -0300 | [diff] [blame] | 80 | static inline int __cpu_up(unsigned int cpu) |
| 81 | { |
| 82 | return smp_ops.cpu_up(cpu); |
| 83 | } |
| 84 | |
Glauber Costa | 8678969 | 2008-03-03 14:12:34 -0300 | [diff] [blame] | 85 | static inline void smp_send_reschedule(int cpu) |
| 86 | { |
| 87 | smp_ops.smp_send_reschedule(cpu); |
| 88 | } |
Glauber Costa | 64b1a21e0 | 2008-03-03 14:12:35 -0300 | [diff] [blame] | 89 | |
| 90 | static inline int smp_call_function_mask(cpumask_t mask, |
| 91 | void (*func) (void *info), void *info, |
| 92 | int wait) |
| 93 | { |
| 94 | return smp_ops.smp_call_function_mask(mask, func, info, wait); |
| 95 | } |
Glauber Costa | 71d1954 | 2008-03-03 14:12:36 -0300 | [diff] [blame] | 96 | |
Glauber Costa | 1e3fac8 | 2008-03-03 14:12:37 -0300 | [diff] [blame] | 97 | void native_smp_prepare_boot_cpu(void); |
Glauber Costa | 7557da6 | 2008-03-03 14:12:38 -0300 | [diff] [blame] | 98 | void native_smp_prepare_cpus(unsigned int max_cpus); |
Glauber Costa | c559764 | 2008-03-03 14:12:39 -0300 | [diff] [blame] | 99 | void native_smp_cpus_done(unsigned int max_cpus); |
Glauber Costa | 71d1954 | 2008-03-03 14:12:36 -0300 | [diff] [blame] | 100 | int native_cpu_up(unsigned int cpunum); |
Glauber Costa | 93b016f | 2008-03-03 14:12:40 -0300 | [diff] [blame] | 101 | |
Glauber Costa | 69c18c1 | 2008-03-03 14:13:07 -0300 | [diff] [blame] | 102 | extern int __cpu_disable(void); |
| 103 | extern void __cpu_die(unsigned int cpu); |
| 104 | |
Glauber Costa | 93b016f | 2008-03-03 14:12:40 -0300 | [diff] [blame] | 105 | extern unsigned disabled_cpus; |
Glauber Costa | 68a1c3f | 2008-03-03 14:12:42 -0300 | [diff] [blame] | 106 | extern void prefill_possible_map(void); |
Glauber Costa | 91718e8 | 2008-03-03 14:13:12 -0300 | [diff] [blame] | 107 | |
| 108 | #define SMP_TRAMPOLINE_BASE 0x6000 |
| 109 | extern unsigned long setup_trampoline(void); |
Glauber de Oliveira Costa | 1d89a7f | 2008-03-19 14:25:05 -0300 | [diff] [blame] | 110 | |
| 111 | void smp_store_cpu_info(int id); |
Glauber de Oliveira Costa | c70dcb7 | 2008-03-19 14:25:58 -0300 | [diff] [blame^] | 112 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
| 113 | #else |
| 114 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid |
Glauber Costa | c76cb36 | 2008-03-03 14:12:33 -0300 | [diff] [blame] | 115 | #endif |
Glauber Costa | 1669402 | 2008-03-03 14:12:32 -0300 | [diff] [blame] | 116 | |
Thomas Gleixner | 96a388d | 2007-10-11 11:20:03 +0200 | [diff] [blame] | 117 | #ifdef CONFIG_X86_32 |
| 118 | # include "smp_32.h" |
| 119 | #else |
| 120 | # include "smp_64.h" |
| 121 | #endif |
Glauber Costa | c27cfeff | 2008-03-03 14:12:29 -0300 | [diff] [blame] | 122 | |
Glauber Costa | 1dbb472 | 2008-03-03 14:13:01 -0300 | [diff] [blame] | 123 | #ifdef CONFIG_HOTPLUG_CPU |
| 124 | extern void cpu_exit_clear(void); |
| 125 | extern void cpu_uninit(void); |
| 126 | extern void remove_siblinginfo(int cpu); |
| 127 | #endif |
| 128 | |
Glauber Costa | 639acb1 | 2008-03-03 14:12:30 -0300 | [diff] [blame] | 129 | extern void smp_alloc_memory(void); |
| 130 | extern void lock_ipi_call_lock(void); |
| 131 | extern void unlock_ipi_call_lock(void); |
Glauber Costa | c27cfeff | 2008-03-03 14:12:29 -0300 | [diff] [blame] | 132 | #endif /* __ASSEMBLY__ */ |
| 133 | #endif |