diff options
Diffstat (limited to 'arch/x86/include')
88 files changed, 1112 insertions, 2726 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index ab1d51a8855e..b03711d7990b 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -41,6 +41,21 @@ extern unsigned int apic_verbosity; | |||
41 | extern int local_apic_timer_c2_ok; | 41 | extern int local_apic_timer_c2_ok; |
42 | 42 | ||
43 | extern int disable_apic; | 43 | extern int disable_apic; |
44 | |||
45 | #ifdef CONFIG_SMP | ||
46 | extern void __inquire_remote_apic(int apicid); | ||
47 | #else /* CONFIG_SMP */ | ||
48 | static inline void __inquire_remote_apic(int apicid) | ||
49 | { | ||
50 | } | ||
51 | #endif /* CONFIG_SMP */ | ||
52 | |||
53 | static inline void default_inquire_remote_apic(int apicid) | ||
54 | { | ||
55 | if (apic_verbosity >= APIC_DEBUG) | ||
56 | __inquire_remote_apic(apicid); | ||
57 | } | ||
58 | |||
44 | /* | 59 | /* |
45 | * Basic functions accessing APICs. | 60 | * Basic functions accessing APICs. |
46 | */ | 61 | */ |
@@ -196,4 +211,22 @@ static inline void disable_local_APIC(void) { } | |||
196 | 211 | ||
197 | #endif /* !CONFIG_X86_LOCAL_APIC */ | 212 | #endif /* !CONFIG_X86_LOCAL_APIC */ |
198 | 213 | ||
214 | #ifdef CONFIG_X86_64 | ||
215 | #define SET_APIC_ID(x) (apic->set_apic_id(x)) | ||
216 | #else | ||
217 | |||
218 | #ifdef CONFIG_X86_LOCAL_APIC | ||
219 | static inline unsigned default_get_apic_id(unsigned long x) | ||
220 | { | ||
221 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | ||
222 | |||
223 | if (APIC_XAPIC(ver)) | ||
224 | return (x >> 24) & 0xFF; | ||
225 | else | ||
226 | return (x >> 24) & 0x0F; | ||
227 | } | ||
228 | #endif | ||
229 | |||
230 | #endif | ||
231 | |||
199 | #endif /* _ASM_X86_APIC_H */ | 232 | #endif /* _ASM_X86_APIC_H */ |
diff --git a/arch/x86/include/asm/apicnum.h b/arch/x86/include/asm/apicnum.h new file mode 100644 index 000000000000..82f613c607ce --- /dev/null +++ b/arch/x86/include/asm/apicnum.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _ASM_X86_APICNUM_H | ||
2 | #define _ASM_X86_APICNUM_H | ||
3 | |||
4 | /* define MAX_IO_APICS */ | ||
5 | #ifdef CONFIG_X86_32 | ||
6 | # define MAX_IO_APICS 64 | ||
7 | #else | ||
8 | # define MAX_IO_APICS 128 | ||
9 | # define MAX_LOCAL_APIC 32768 | ||
10 | #endif | ||
11 | |||
12 | #endif /* _ASM_X86_APICNUM_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/apm.h b/arch/x86/include/asm/apm.h index 20370c6db74b..20370c6db74b 100644 --- a/arch/x86/include/asm/mach-default/apm.h +++ b/arch/x86/include/asm/apm.h | |||
diff --git a/arch/x86/include/asm/bigsmp/apic.h b/arch/x86/include/asm/bigsmp/apic.h deleted file mode 100644 index d8dd9f537911..000000000000 --- a/arch/x86/include/asm/bigsmp/apic.h +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | #ifndef __ASM_MACH_APIC_H | ||
2 | #define __ASM_MACH_APIC_H | ||
3 | |||
4 | #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu)) | ||
5 | #define esr_disable (1) | ||
6 | |||
7 | static inline int apic_id_registered(void) | ||
8 | { | ||
9 | return (1); | ||
10 | } | ||
11 | |||
12 | static inline const cpumask_t *target_cpus(void) | ||
13 | { | ||
14 | #ifdef CONFIG_SMP | ||
15 | return &cpu_online_map; | ||
16 | #else | ||
17 | return &cpumask_of_cpu(0); | ||
18 | #endif | ||
19 | } | ||
20 | |||
21 | #undef APIC_DEST_LOGICAL | ||
22 | #define APIC_DEST_LOGICAL 0 | ||
23 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
24 | #define INT_DELIVERY_MODE (dest_Fixed) | ||
25 | #define INT_DEST_MODE (0) /* phys delivery to target proc */ | ||
26 | #define NO_BALANCE_IRQ (0) | ||
27 | |||
28 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
29 | { | ||
30 | return (0); | ||
31 | } | ||
32 | |||
33 | static inline unsigned long check_apicid_present(int bit) | ||
34 | { | ||
35 | return (1); | ||
36 | } | ||
37 | |||
38 | static inline unsigned long calculate_ldr(int cpu) | ||
39 | { | ||
40 | unsigned long val, id; | ||
41 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
42 | id = xapic_phys_to_log_apicid(cpu); | ||
43 | val |= SET_APIC_LOGICAL_ID(id); | ||
44 | return val; | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * Set up the logical destination ID. | ||
49 | * | ||
50 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
51 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
52 | * document number 292116). So here it goes... | ||
53 | */ | ||
54 | static inline void init_apic_ldr(void) | ||
55 | { | ||
56 | unsigned long val; | ||
57 | int cpu = smp_processor_id(); | ||
58 | |||
59 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
60 | val = calculate_ldr(cpu); | ||
61 | apic_write(APIC_LDR, val); | ||
62 | } | ||
63 | |||
64 | static inline void setup_apic_routing(void) | ||
65 | { | ||
66 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
67 | "Physflat", nr_ioapics); | ||
68 | } | ||
69 | |||
70 | static inline int multi_timer_check(int apic, int irq) | ||
71 | { | ||
72 | return (0); | ||
73 | } | ||
74 | |||
75 | static inline int apicid_to_node(int logical_apicid) | ||
76 | { | ||
77 | return apicid_2_node[hard_smp_processor_id()]; | ||
78 | } | ||
79 | |||
80 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
81 | { | ||
82 | if (mps_cpu < nr_cpu_ids) | ||
83 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
84 | |||
85 | return BAD_APICID; | ||
86 | } | ||
87 | |||
88 | static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) | ||
89 | { | ||
90 | return physid_mask_of_physid(phys_apicid); | ||
91 | } | ||
92 | |||
93 | extern u8 cpu_2_logical_apicid[]; | ||
94 | /* Mapping from cpu number to logical apicid */ | ||
95 | static inline int cpu_to_logical_apicid(int cpu) | ||
96 | { | ||
97 | if (cpu >= nr_cpu_ids) | ||
98 | return BAD_APICID; | ||
99 | return cpu_physical_id(cpu); | ||
100 | } | ||
101 | |||
102 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | ||
103 | { | ||
104 | /* For clustered we don't have a good way to do this yet - hack */ | ||
105 | return physids_promote(0xFFL); | ||
106 | } | ||
107 | |||
108 | static inline void setup_portio_remap(void) | ||
109 | { | ||
110 | } | ||
111 | |||
112 | static inline void enable_apic_mode(void) | ||
113 | { | ||
114 | } | ||
115 | |||
116 | static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
117 | { | ||
118 | return (1); | ||
119 | } | ||
120 | |||
121 | /* As we are using single CPU as destination, pick only one CPU here */ | ||
122 | static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
123 | { | ||
124 | int cpu; | ||
125 | int apicid; | ||
126 | |||
127 | cpu = first_cpu(*cpumask); | ||
128 | apicid = cpu_to_logical_apicid(cpu); | ||
129 | return apicid; | ||
130 | } | ||
131 | |||
132 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
133 | const struct cpumask *andmask) | ||
134 | { | ||
135 | int cpu; | ||
136 | |||
137 | /* | ||
138 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
139 | * May as well be the first. | ||
140 | */ | ||
141 | for_each_cpu_and(cpu, cpumask, andmask) | ||
142 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | ||
143 | break; | ||
144 | if (cpu < nr_cpu_ids) | ||
145 | return cpu_to_logical_apicid(cpu); | ||
146 | |||
147 | return BAD_APICID; | ||
148 | } | ||
149 | |||
150 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
151 | { | ||
152 | return cpuid_apic >> index_msb; | ||
153 | } | ||
154 | |||
155 | #endif /* __ASM_MACH_APIC_H */ | ||
diff --git a/arch/x86/include/asm/bigsmp/apicdef.h b/arch/x86/include/asm/bigsmp/apicdef.h deleted file mode 100644 index 392c3f5ef2fe..000000000000 --- a/arch/x86/include/asm/bigsmp/apicdef.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #ifndef __ASM_MACH_APICDEF_H | ||
2 | #define __ASM_MACH_APICDEF_H | ||
3 | |||
4 | #define APIC_ID_MASK (0xFF<<24) | ||
5 | |||
6 | static inline unsigned get_apic_id(unsigned long x) | ||
7 | { | ||
8 | return (((x)>>24)&0xFF); | ||
9 | } | ||
10 | |||
11 | #define GET_APIC_ID(x) get_apic_id(x) | ||
12 | |||
13 | #endif | ||
diff --git a/arch/x86/include/asm/bigsmp/ipi.h b/arch/x86/include/asm/bigsmp/ipi.h deleted file mode 100644 index 27fcd01b3ae6..000000000000 --- a/arch/x86/include/asm/bigsmp/ipi.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #ifndef __ASM_MACH_IPI_H | ||
2 | #define __ASM_MACH_IPI_H | ||
3 | |||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | ||
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
6 | |||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | ||
8 | { | ||
9 | send_IPI_mask_sequence(mask, vector); | ||
10 | } | ||
11 | |||
12 | static inline void send_IPI_allbutself(int vector) | ||
13 | { | ||
14 | send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
15 | } | ||
16 | |||
17 | static inline void send_IPI_all(int vector) | ||
18 | { | ||
19 | send_IPI_mask(cpu_online_mask, vector); | ||
20 | } | ||
21 | |||
22 | #endif /* __ASM_MACH_IPI_H */ | ||
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index bae482df6039..b185091bf19c 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h | |||
@@ -7,6 +7,20 @@ | |||
7 | #include <linux/nodemask.h> | 7 | #include <linux/nodemask.h> |
8 | #include <linux/percpu.h> | 8 | #include <linux/percpu.h> |
9 | 9 | ||
10 | #ifdef CONFIG_SMP | ||
11 | |||
12 | extern void prefill_possible_map(void); | ||
13 | |||
14 | #else /* CONFIG_SMP */ | ||
15 | |||
16 | static inline void prefill_possible_map(void) {} | ||
17 | |||
18 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid | ||
19 | #define safe_smp_processor_id() 0 | ||
20 | #define stack_smp_processor_id() 0 | ||
21 | |||
22 | #endif /* CONFIG_SMP */ | ||
23 | |||
10 | struct x86_cpu { | 24 | struct x86_cpu { |
11 | struct cpu cpu; | 25 | struct cpu cpu; |
12 | }; | 26 | }; |
@@ -17,4 +31,7 @@ extern void arch_unregister_cpu(int); | |||
17 | #endif | 31 | #endif |
18 | 32 | ||
19 | DECLARE_PER_CPU(int, cpu_state); | 33 | DECLARE_PER_CPU(int, cpu_state); |
34 | |||
35 | extern unsigned int boot_cpu_id; | ||
36 | |||
20 | #endif /* _ASM_X86_CPU_H */ | 37 | #endif /* _ASM_X86_CPU_H */ |
diff --git a/arch/x86/include/asm/cpumask.h b/arch/x86/include/asm/cpumask.h new file mode 100644 index 000000000000..a7f3c75f8ad7 --- /dev/null +++ b/arch/x86/include/asm/cpumask.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _ASM_X86_CPUMASK_H | ||
2 | #define _ASM_X86_CPUMASK_H | ||
3 | #ifndef __ASSEMBLY__ | ||
4 | #include <linux/cpumask.h> | ||
5 | |||
6 | #ifdef CONFIG_X86_64 | ||
7 | |||
8 | extern cpumask_var_t cpu_callin_mask; | ||
9 | extern cpumask_var_t cpu_callout_mask; | ||
10 | extern cpumask_var_t cpu_initialized_mask; | ||
11 | extern cpumask_var_t cpu_sibling_setup_mask; | ||
12 | |||
13 | extern void setup_cpu_local_masks(void); | ||
14 | |||
15 | #else /* CONFIG_X86_32 */ | ||
16 | |||
17 | extern cpumask_t cpu_callin_map; | ||
18 | extern cpumask_t cpu_callout_map; | ||
19 | extern cpumask_t cpu_initialized; | ||
20 | extern cpumask_t cpu_sibling_setup_map; | ||
21 | |||
22 | #define cpu_callin_mask ((struct cpumask *)&cpu_callin_map) | ||
23 | #define cpu_callout_mask ((struct cpumask *)&cpu_callout_map) | ||
24 | #define cpu_initialized_mask ((struct cpumask *)&cpu_initialized) | ||
25 | #define cpu_sibling_setup_mask ((struct cpumask *)&cpu_sibling_setup_map) | ||
26 | |||
27 | static inline void setup_cpu_local_masks(void) { } | ||
28 | |||
29 | #endif /* CONFIG_X86_32 */ | ||
30 | |||
31 | #endif /* __ASSEMBLY__ */ | ||
32 | #endif /* _ASM_X86_CPUMASK_H */ | ||
diff --git a/arch/x86/include/asm/current.h b/arch/x86/include/asm/current.h index 0930b4f8d672..c68c361697e1 100644 --- a/arch/x86/include/asm/current.h +++ b/arch/x86/include/asm/current.h | |||
@@ -1,39 +1,21 @@ | |||
1 | #ifndef _ASM_X86_CURRENT_H | 1 | #ifndef _ASM_X86_CURRENT_H |
2 | #define _ASM_X86_CURRENT_H | 2 | #define _ASM_X86_CURRENT_H |
3 | 3 | ||
4 | #ifdef CONFIG_X86_32 | ||
5 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
6 | #include <asm/percpu.h> | 5 | #include <asm/percpu.h> |
7 | 6 | ||
7 | #ifndef __ASSEMBLY__ | ||
8 | struct task_struct; | 8 | struct task_struct; |
9 | 9 | ||
10 | DECLARE_PER_CPU(struct task_struct *, current_task); | 10 | DECLARE_PER_CPU(struct task_struct *, current_task); |
11 | static __always_inline struct task_struct *get_current(void) | ||
12 | { | ||
13 | return x86_read_percpu(current_task); | ||
14 | } | ||
15 | |||
16 | #else /* X86_32 */ | ||
17 | |||
18 | #ifndef __ASSEMBLY__ | ||
19 | #include <asm/pda.h> | ||
20 | |||
21 | struct task_struct; | ||
22 | 11 | ||
23 | static __always_inline struct task_struct *get_current(void) | 12 | static __always_inline struct task_struct *get_current(void) |
24 | { | 13 | { |
25 | return read_pda(pcurrent); | 14 | return percpu_read(current_task); |
26 | } | 15 | } |
27 | 16 | ||
28 | #else /* __ASSEMBLY__ */ | 17 | #define current get_current() |
29 | |||
30 | #include <asm/asm-offsets.h> | ||
31 | #define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg | ||
32 | 18 | ||
33 | #endif /* __ASSEMBLY__ */ | 19 | #endif /* __ASSEMBLY__ */ |
34 | 20 | ||
35 | #endif /* X86_32 */ | ||
36 | |||
37 | #define current get_current() | ||
38 | |||
39 | #endif /* _ASM_X86_CURRENT_H */ | 21 | #endif /* _ASM_X86_CURRENT_H */ |
diff --git a/arch/x86/include/asm/mach-default/do_timer.h b/arch/x86/include/asm/do_timer.h index 23ecda0b28a0..23ecda0b28a0 100644 --- a/arch/x86/include/asm/mach-default/do_timer.h +++ b/arch/x86/include/asm/do_timer.h | |||
diff --git a/arch/x86/include/asm/mach-default/entry_arch.h b/arch/x86/include/asm/entry_arch.h index 6b1add8e31dd..854d538ae857 100644 --- a/arch/x86/include/asm/mach-default/entry_arch.h +++ b/arch/x86/include/asm/entry_arch.h | |||
@@ -9,12 +9,28 @@ | |||
9 | * is no hardware IRQ pin equivalent for them, they are triggered | 9 | * is no hardware IRQ pin equivalent for them, they are triggered |
10 | * through the ICC by us (IPIs) | 10 | * through the ICC by us (IPIs) |
11 | */ | 11 | */ |
12 | #ifdef CONFIG_X86_SMP | 12 | #ifdef CONFIG_SMP |
13 | BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR) | 13 | BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR) |
14 | BUILD_INTERRUPT(invalidate_interrupt,INVALIDATE_TLB_VECTOR) | ||
15 | BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR) | 14 | BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR) |
16 | BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR) | 15 | BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR) |
17 | BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) | 16 | BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) |
17 | |||
18 | BUILD_INTERRUPT3(invalidate_interrupt0,INVALIDATE_TLB_VECTOR_START+0, | ||
19 | smp_invalidate_interrupt) | ||
20 | BUILD_INTERRUPT3(invalidate_interrupt1,INVALIDATE_TLB_VECTOR_START+1, | ||
21 | smp_invalidate_interrupt) | ||
22 | BUILD_INTERRUPT3(invalidate_interrupt2,INVALIDATE_TLB_VECTOR_START+2, | ||
23 | smp_invalidate_interrupt) | ||
24 | BUILD_INTERRUPT3(invalidate_interrupt3,INVALIDATE_TLB_VECTOR_START+3, | ||
25 | smp_invalidate_interrupt) | ||
26 | BUILD_INTERRUPT3(invalidate_interrupt4,INVALIDATE_TLB_VECTOR_START+4, | ||
27 | smp_invalidate_interrupt) | ||
28 | BUILD_INTERRUPT3(invalidate_interrupt5,INVALIDATE_TLB_VECTOR_START+5, | ||
29 | smp_invalidate_interrupt) | ||
30 | BUILD_INTERRUPT3(invalidate_interrupt6,INVALIDATE_TLB_VECTOR_START+6, | ||
31 | smp_invalidate_interrupt) | ||
32 | BUILD_INTERRUPT3(invalidate_interrupt7,INVALIDATE_TLB_VECTOR_START+7, | ||
33 | smp_invalidate_interrupt) | ||
18 | #endif | 34 | #endif |
19 | 35 | ||
20 | /* | 36 | /* |
@@ -25,10 +41,15 @@ BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) | |||
25 | * a much simpler SMP time architecture: | 41 | * a much simpler SMP time architecture: |
26 | */ | 42 | */ |
27 | #ifdef CONFIG_X86_LOCAL_APIC | 43 | #ifdef CONFIG_X86_LOCAL_APIC |
44 | |||
28 | BUILD_INTERRUPT(apic_timer_interrupt,LOCAL_TIMER_VECTOR) | 45 | BUILD_INTERRUPT(apic_timer_interrupt,LOCAL_TIMER_VECTOR) |
29 | BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR) | 46 | BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR) |
30 | BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR) | 47 | BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR) |
31 | 48 | ||
49 | #ifdef CONFIG_PERF_COUNTERS | ||
50 | BUILD_INTERRUPT(perf_counter_interrupt, LOCAL_PERF_VECTOR) | ||
51 | #endif | ||
52 | |||
32 | #ifdef CONFIG_X86_MCE_P4THERMAL | 53 | #ifdef CONFIG_X86_MCE_P4THERMAL |
33 | BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR) | 54 | BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR) |
34 | #endif | 55 | #endif |
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h deleted file mode 100644 index c58b9cc74465..000000000000 --- a/arch/x86/include/asm/es7000/apic.h +++ /dev/null | |||
@@ -1,242 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_APIC_H | ||
2 | #define __ASM_ES7000_APIC_H | ||
3 | |||
4 | #include <linux/gfp.h> | ||
5 | |||
6 | #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu) | ||
7 | #define esr_disable (1) | ||
8 | |||
9 | static inline int apic_id_registered(void) | ||
10 | { | ||
11 | return (1); | ||
12 | } | ||
13 | |||
14 | static inline const cpumask_t *target_cpus_cluster(void) | ||
15 | { | ||
16 | return &CPU_MASK_ALL; | ||
17 | } | ||
18 | |||
19 | static inline const cpumask_t *target_cpus(void) | ||
20 | { | ||
21 | return &cpumask_of_cpu(smp_processor_id()); | ||
22 | } | ||
23 | |||
24 | #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER) | ||
25 | #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio) | ||
26 | #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */ | ||
27 | #define NO_BALANCE_IRQ_CLUSTER (1) | ||
28 | |||
29 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
30 | #define INT_DELIVERY_MODE (dest_Fixed) | ||
31 | #define INT_DEST_MODE (0) /* phys delivery to target procs */ | ||
32 | #define NO_BALANCE_IRQ (0) | ||
33 | #undef APIC_DEST_LOGICAL | ||
34 | #define APIC_DEST_LOGICAL 0x0 | ||
35 | |||
36 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
37 | { | ||
38 | return 0; | ||
39 | } | ||
40 | static inline unsigned long check_apicid_present(int bit) | ||
41 | { | ||
42 | return physid_isset(bit, phys_cpu_present_map); | ||
43 | } | ||
44 | |||
45 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
46 | |||
47 | static inline unsigned long calculate_ldr(int cpu) | ||
48 | { | ||
49 | unsigned long id; | ||
50 | id = xapic_phys_to_log_apicid(cpu); | ||
51 | return (SET_APIC_LOGICAL_ID(id)); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Set up the logical destination ID. | ||
56 | * | ||
57 | * Intel recommends to set DFR, LdR and TPR before enabling | ||
58 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
59 | * document number 292116). So here it goes... | ||
60 | */ | ||
61 | static inline void init_apic_ldr_cluster(void) | ||
62 | { | ||
63 | unsigned long val; | ||
64 | int cpu = smp_processor_id(); | ||
65 | |||
66 | apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER); | ||
67 | val = calculate_ldr(cpu); | ||
68 | apic_write(APIC_LDR, val); | ||
69 | } | ||
70 | |||
71 | static inline void init_apic_ldr(void) | ||
72 | { | ||
73 | unsigned long val; | ||
74 | int cpu = smp_processor_id(); | ||
75 | |||
76 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
77 | val = calculate_ldr(cpu); | ||
78 | apic_write(APIC_LDR, val); | ||
79 | } | ||
80 | |||
81 | extern int apic_version [MAX_APICS]; | ||
82 | static inline void setup_apic_routing(void) | ||
83 | { | ||
84 | int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); | ||
85 | printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", | ||
86 | (apic_version[apic] == 0x14) ? | ||
87 | "Physical Cluster" : "Logical Cluster", | ||
88 | nr_ioapics, cpus_addr(*target_cpus())[0]); | ||
89 | } | ||
90 | |||
91 | static inline int multi_timer_check(int apic, int irq) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static inline int apicid_to_node(int logical_apicid) | ||
97 | { | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | |||
102 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
103 | { | ||
104 | if (!mps_cpu) | ||
105 | return boot_cpu_physical_apicid; | ||
106 | else if (mps_cpu < nr_cpu_ids) | ||
107 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
108 | else | ||
109 | return BAD_APICID; | ||
110 | } | ||
111 | |||
112 | static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) | ||
113 | { | ||
114 | static int id = 0; | ||
115 | physid_mask_t mask; | ||
116 | mask = physid_mask_of_physid(id); | ||
117 | ++id; | ||
118 | return mask; | ||
119 | } | ||
120 | |||
121 | extern u8 cpu_2_logical_apicid[]; | ||
122 | /* Mapping from cpu number to logical apicid */ | ||
123 | static inline int cpu_to_logical_apicid(int cpu) | ||
124 | { | ||
125 | #ifdef CONFIG_SMP | ||
126 | if (cpu >= nr_cpu_ids) | ||
127 | return BAD_APICID; | ||
128 | return (int)cpu_2_logical_apicid[cpu]; | ||
129 | #else | ||
130 | return logical_smp_processor_id(); | ||
131 | #endif | ||
132 | } | ||
133 | |||
134 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | ||
135 | { | ||
136 | /* For clustered we don't have a good way to do this yet - hack */ | ||
137 | return physids_promote(0xff); | ||
138 | } | ||
139 | |||
140 | |||
141 | static inline void setup_portio_remap(void) | ||
142 | { | ||
143 | } | ||
144 | |||
145 | extern unsigned int boot_cpu_physical_apicid; | ||
146 | static inline int check_phys_apicid_present(int cpu_physical_apicid) | ||
147 | { | ||
148 | boot_cpu_physical_apicid = read_apic_id(); | ||
149 | return (1); | ||
150 | } | ||
151 | |||
152 | static inline unsigned int | ||
153 | cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | ||
154 | { | ||
155 | int num_bits_set; | ||
156 | int cpus_found = 0; | ||
157 | int cpu; | ||
158 | int apicid; | ||
159 | |||
160 | num_bits_set = cpumask_weight(cpumask); | ||
161 | /* Return id to all */ | ||
162 | if (num_bits_set == nr_cpu_ids) | ||
163 | return 0xFF; | ||
164 | /* | ||
165 | * The cpus in the mask must all be on the apic cluster. If are not | ||
166 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
167 | */ | ||
168 | cpu = cpumask_first(cpumask); | ||
169 | apicid = cpu_to_logical_apicid(cpu); | ||
170 | while (cpus_found < num_bits_set) { | ||
171 | if (cpumask_test_cpu(cpu, cpumask)) { | ||
172 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
173 | if (apicid_cluster(apicid) != | ||
174 | apicid_cluster(new_apicid)){ | ||
175 | printk ("%s: Not a valid mask!\n", __func__); | ||
176 | return 0xFF; | ||
177 | } | ||
178 | apicid = new_apicid; | ||
179 | cpus_found++; | ||
180 | } | ||
181 | cpu++; | ||
182 | } | ||
183 | return apicid; | ||
184 | } | ||
185 | |||
186 | static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
187 | { | ||
188 | int num_bits_set; | ||
189 | int cpus_found = 0; | ||
190 | int cpu; | ||
191 | int apicid; | ||
192 | |||
193 | num_bits_set = cpus_weight(*cpumask); | ||
194 | /* Return id to all */ | ||
195 | if (num_bits_set == nr_cpu_ids) | ||
196 | return cpu_to_logical_apicid(0); | ||
197 | /* | ||
198 | * The cpus in the mask must all be on the apic cluster. If are not | ||
199 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
200 | */ | ||
201 | cpu = first_cpu(*cpumask); | ||
202 | apicid = cpu_to_logical_apicid(cpu); | ||
203 | while (cpus_found < num_bits_set) { | ||
204 | if (cpu_isset(cpu, *cpumask)) { | ||
205 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
206 | if (apicid_cluster(apicid) != | ||
207 | apicid_cluster(new_apicid)){ | ||
208 | printk ("%s: Not a valid mask!\n", __func__); | ||
209 | return cpu_to_logical_apicid(0); | ||
210 | } | ||
211 | apicid = new_apicid; | ||
212 | cpus_found++; | ||
213 | } | ||
214 | cpu++; | ||
215 | } | ||
216 | return apicid; | ||
217 | } | ||
218 | |||
219 | |||
220 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | ||
221 | const struct cpumask *andmask) | ||
222 | { | ||
223 | int apicid = cpu_to_logical_apicid(0); | ||
224 | cpumask_var_t cpumask; | ||
225 | |||
226 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) | ||
227 | return apicid; | ||
228 | |||
229 | cpumask_and(cpumask, inmask, andmask); | ||
230 | cpumask_and(cpumask, cpumask, cpu_online_mask); | ||
231 | apicid = cpu_mask_to_apicid(cpumask); | ||
232 | |||
233 | free_cpumask_var(cpumask); | ||
234 | return apicid; | ||
235 | } | ||
236 | |||
237 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
238 | { | ||
239 | return cpuid_apic >> index_msb; | ||
240 | } | ||
241 | |||
242 | #endif /* __ASM_ES7000_APIC_H */ | ||
diff --git a/arch/x86/include/asm/es7000/apicdef.h b/arch/x86/include/asm/es7000/apicdef.h deleted file mode 100644 index 8b234a3cb851..000000000000 --- a/arch/x86/include/asm/es7000/apicdef.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_APICDEF_H | ||
2 | #define __ASM_ES7000_APICDEF_H | ||
3 | |||
4 | #define APIC_ID_MASK (0xFF<<24) | ||
5 | |||
6 | static inline unsigned get_apic_id(unsigned long x) | ||
7 | { | ||
8 | return (((x)>>24)&0xFF); | ||
9 | } | ||
10 | |||
11 | #define GET_APIC_ID(x) get_apic_id(x) | ||
12 | |||
13 | #endif | ||
diff --git a/arch/x86/include/asm/es7000/ipi.h b/arch/x86/include/asm/es7000/ipi.h deleted file mode 100644 index 7e8ed24d4b8a..000000000000 --- a/arch/x86/include/asm/es7000/ipi.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_IPI_H | ||
2 | #define __ASM_ES7000_IPI_H | ||
3 | |||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | ||
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
6 | |||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | ||
8 | { | ||
9 | send_IPI_mask_sequence(mask, vector); | ||
10 | } | ||
11 | |||
12 | static inline void send_IPI_allbutself(int vector) | ||
13 | { | ||
14 | send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
15 | } | ||
16 | |||
17 | static inline void send_IPI_all(int vector) | ||
18 | { | ||
19 | send_IPI_mask(cpu_online_mask, vector); | ||
20 | } | ||
21 | |||
22 | #endif /* __ASM_ES7000_IPI_H */ | ||
diff --git a/arch/x86/include/asm/es7000/mpparse.h b/arch/x86/include/asm/es7000/mpparse.h deleted file mode 100644 index c1629b090ec2..000000000000 --- a/arch/x86/include/asm/es7000/mpparse.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_MPPARSE_H | ||
2 | #define __ASM_ES7000_MPPARSE_H | ||
3 | |||
4 | #include <linux/acpi.h> | ||
5 | |||
6 | extern int parse_unisys_oem (char *oemptr); | ||
7 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
8 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
9 | extern void setup_unisys(void); | ||
10 | |||
11 | #ifndef CONFIG_X86_GENERICARCH | ||
12 | extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id); | ||
13 | extern int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid); | ||
14 | #endif | ||
15 | |||
16 | #ifdef CONFIG_ACPI | ||
17 | |||
18 | static inline int es7000_check_dsdt(void) | ||
19 | { | ||
20 | struct acpi_table_header header; | ||
21 | |||
22 | if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) && | ||
23 | !strncmp(header.oem_id, "UNISYS", 6)) | ||
24 | return 1; | ||
25 | return 0; | ||
26 | } | ||
27 | #endif | ||
28 | |||
29 | #endif /* __ASM_MACH_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/es7000/wakecpu.h b/arch/x86/include/asm/es7000/wakecpu.h deleted file mode 100644 index 78f0daaee436..000000000000 --- a/arch/x86/include/asm/es7000/wakecpu.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_WAKECPU_H | ||
2 | #define __ASM_ES7000_WAKECPU_H | ||
3 | |||
4 | #define TRAMPOLINE_PHYS_LOW 0x467 | ||
5 | #define TRAMPOLINE_PHYS_HIGH 0x469 | ||
6 | |||
7 | static inline void wait_for_init_deassert(atomic_t *deassert) | ||
8 | { | ||
9 | #ifndef CONFIG_ES7000_CLUSTERED_APIC | ||
10 | while (!atomic_read(deassert)) | ||
11 | cpu_relax(); | ||
12 | #endif | ||
13 | return; | ||
14 | } | ||
15 | |||
16 | /* Nothing to do for most platforms, since cleared by the INIT cycle */ | ||
17 | static inline void smp_callin_clear_local_apic(void) | ||
18 | { | ||
19 | } | ||
20 | |||
21 | static inline void store_NMI_vector(unsigned short *high, unsigned short *low) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | extern void __inquire_remote_apic(int apicid); | ||
30 | |||
31 | static inline void inquire_remote_apic(int apicid) | ||
32 | { | ||
33 | if (apic_verbosity >= APIC_DEBUG) | ||
34 | __inquire_remote_apic(apicid); | ||
35 | } | ||
36 | |||
37 | #endif /* __ASM_MACH_WAKECPU_H */ | ||
diff --git a/arch/x86/include/asm/genapic.h b/arch/x86/include/asm/genapic.h index d48bee663a6f..273b99452ae0 100644 --- a/arch/x86/include/asm/genapic.h +++ b/arch/x86/include/asm/genapic.h | |||
@@ -1,5 +1,263 @@ | |||
1 | #ifndef _ASM_X86_GENAPIC_H | ||
2 | #define _ASM_X86_GENAPIC_H | ||
3 | |||
4 | #include <linux/cpumask.h> | ||
5 | |||
6 | #include <asm/mpspec.h> | ||
7 | #include <asm/atomic.h> | ||
8 | |||
9 | /* | ||
10 | * Copyright 2004 James Cleverdon, IBM. | ||
11 | * Subject to the GNU Public License, v.2 | ||
12 | * | ||
13 | * Generic APIC sub-arch data struct. | ||
14 | * | ||
15 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by | ||
16 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and | ||
17 | * James Cleverdon. | ||
18 | */ | ||
19 | struct genapic { | ||
20 | char *name; | ||
21 | |||
22 | int (*probe)(void); | ||
23 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | ||
24 | int (*apic_id_registered)(void); | ||
25 | |||
26 | u32 irq_delivery_mode; | ||
27 | u32 irq_dest_mode; | ||
28 | |||
29 | const struct cpumask *(*target_cpus)(void); | ||
30 | |||
31 | int disable_esr; | ||
32 | |||
33 | int dest_logical; | ||
34 | unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid); | ||
35 | unsigned long (*check_apicid_present)(int apicid); | ||
36 | |||
37 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | ||
38 | void (*init_apic_ldr)(void); | ||
39 | |||
40 | physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map); | ||
41 | |||
42 | void (*setup_apic_routing)(void); | ||
43 | int (*multi_timer_check)(int apic, int irq); | ||
44 | int (*apicid_to_node)(int logical_apicid); | ||
45 | int (*cpu_to_logical_apicid)(int cpu); | ||
46 | int (*cpu_present_to_apicid)(int mps_cpu); | ||
47 | physid_mask_t (*apicid_to_cpu_present)(int phys_apicid); | ||
48 | void (*setup_portio_remap)(void); | ||
49 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); | ||
50 | void (*enable_apic_mode)(void); | ||
51 | int (*phys_pkg_id)(int cpuid_apic, int index_msb); | ||
52 | |||
53 | /* | ||
54 | * When one of the next two hooks returns 1 the genapic | ||
55 | * is switched to this. Essentially they are additional | ||
56 | * probe functions: | ||
57 | */ | ||
58 | int (*mps_oem_check)(struct mpc_table *mpc, char *oem, char *productid); | ||
59 | |||
60 | unsigned int (*get_apic_id)(unsigned long x); | ||
61 | unsigned long (*set_apic_id)(unsigned int id); | ||
62 | unsigned long apic_id_mask; | ||
63 | |||
64 | unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); | ||
65 | unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, | ||
66 | const struct cpumask *andmask); | ||
67 | |||
68 | /* ipi */ | ||
69 | void (*send_IPI_mask)(const struct cpumask *mask, int vector); | ||
70 | void (*send_IPI_mask_allbutself)(const struct cpumask *mask, | ||
71 | int vector); | ||
72 | void (*send_IPI_allbutself)(int vector); | ||
73 | void (*send_IPI_all)(int vector); | ||
74 | void (*send_IPI_self)(int vector); | ||
75 | |||
76 | /* wakeup_secondary_cpu */ | ||
77 | int (*wakeup_cpu)(int apicid, unsigned long start_eip); | ||
78 | |||
79 | int trampoline_phys_low; | ||
80 | int trampoline_phys_high; | ||
81 | |||
82 | void (*wait_for_init_deassert)(atomic_t *deassert); | ||
83 | void (*smp_callin_clear_local_apic)(void); | ||
84 | void (*store_NMI_vector)(unsigned short *high, unsigned short *low); | ||
85 | void (*inquire_remote_apic)(int apicid); | ||
86 | }; | ||
87 | |||
88 | extern struct genapic *apic; | ||
89 | |||
90 | /* | ||
91 | * Warm reset vector default position: | ||
92 | */ | ||
93 | #define DEFAULT_TRAMPOLINE_PHYS_LOW 0x467 | ||
94 | #define DEFAULT_TRAMPOLINE_PHYS_HIGH 0x469 | ||
95 | |||
1 | #ifdef CONFIG_X86_32 | 96 | #ifdef CONFIG_X86_32 |
2 | # include "genapic_32.h" | 97 | extern void es7000_update_genapic_to_cluster(void); |
3 | #else | 98 | #else |
4 | # include "genapic_64.h" | 99 | extern struct genapic apic_flat; |
100 | extern struct genapic apic_physflat; | ||
101 | extern struct genapic apic_x2apic_cluster; | ||
102 | extern struct genapic apic_x2apic_phys; | ||
103 | extern int default_acpi_madt_oem_check(char *, char *); | ||
104 | |||
105 | extern void apic_send_IPI_self(int vector); | ||
106 | |||
107 | extern struct genapic apic_x2apic_uv_x; | ||
108 | DECLARE_PER_CPU(int, x2apic_extra_bits); | ||
109 | |||
110 | extern void default_setup_apic_routing(void); | ||
111 | |||
112 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
113 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
5 | #endif | 114 | #endif |
115 | |||
116 | static inline void default_wait_for_init_deassert(atomic_t *deassert) | ||
117 | { | ||
118 | while (!atomic_read(deassert)) | ||
119 | cpu_relax(); | ||
120 | return; | ||
121 | } | ||
122 | |||
123 | extern void generic_bigsmp_probe(void); | ||
124 | |||
125 | |||
126 | #ifdef CONFIG_X86_LOCAL_APIC | ||
127 | |||
128 | #include <asm/smp.h> | ||
129 | |||
130 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
131 | |||
132 | static inline const struct cpumask *default_target_cpus(void) | ||
133 | { | ||
134 | #ifdef CONFIG_SMP | ||
135 | return cpu_online_mask; | ||
136 | #else | ||
137 | return cpumask_of(0); | ||
138 | #endif | ||
139 | } | ||
140 | |||
141 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); | ||
142 | |||
143 | |||
144 | static inline unsigned int read_apic_id(void) | ||
145 | { | ||
146 | unsigned int reg; | ||
147 | |||
148 | reg = apic_read(APIC_ID); | ||
149 | |||
150 | return apic->get_apic_id(reg); | ||
151 | } | ||
152 | |||
153 | #ifdef CONFIG_X86_64 | ||
154 | extern void default_setup_apic_routing(void); | ||
155 | #else | ||
156 | |||
157 | /* | ||
158 | * Set up the logical destination ID. | ||
159 | * | ||
160 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
161 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
162 | * document number 292116). So here it goes... | ||
163 | */ | ||
164 | extern void default_init_apic_ldr(void); | ||
165 | |||
166 | static inline int default_apic_id_registered(void) | ||
167 | { | ||
168 | return physid_isset(read_apic_id(), phys_cpu_present_map); | ||
169 | } | ||
170 | |||
171 | static inline unsigned int | ||
172 | default_cpu_mask_to_apicid(const struct cpumask *cpumask) | ||
173 | { | ||
174 | return cpumask_bits(cpumask)[0]; | ||
175 | } | ||
176 | |||
177 | static inline unsigned int | ||
178 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
179 | const struct cpumask *andmask) | ||
180 | { | ||
181 | unsigned long mask1 = cpumask_bits(cpumask)[0]; | ||
182 | unsigned long mask2 = cpumask_bits(andmask)[0]; | ||
183 | unsigned long mask3 = cpumask_bits(cpu_online_mask)[0]; | ||
184 | |||
185 | return (unsigned int)(mask1 & mask2 & mask3); | ||
186 | } | ||
187 | |||
188 | static inline int default_phys_pkg_id(int cpuid_apic, int index_msb) | ||
189 | { | ||
190 | return cpuid_apic >> index_msb; | ||
191 | } | ||
192 | |||
193 | static inline void default_setup_apic_routing(void) | ||
194 | { | ||
195 | #ifdef CONFIG_X86_IO_APIC | ||
196 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
197 | "Flat", nr_ioapics); | ||
198 | #endif | ||
199 | } | ||
200 | |||
201 | extern int default_apicid_to_node(int logical_apicid); | ||
202 | |||
203 | #endif | ||
204 | |||
205 | static inline unsigned long default_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
206 | { | ||
207 | return physid_isset(apicid, bitmap); | ||
208 | } | ||
209 | |||
210 | static inline unsigned long default_check_apicid_present(int bit) | ||
211 | { | ||
212 | return physid_isset(bit, phys_cpu_present_map); | ||
213 | } | ||
214 | |||
215 | static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map) | ||
216 | { | ||
217 | return phys_map; | ||
218 | } | ||
219 | |||
220 | /* Mapping from cpu number to logical apicid */ | ||
221 | static inline int default_cpu_to_logical_apicid(int cpu) | ||
222 | { | ||
223 | return 1 << cpu; | ||
224 | } | ||
225 | |||
226 | static inline int __default_cpu_present_to_apicid(int mps_cpu) | ||
227 | { | ||
228 | if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu)) | ||
229 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
230 | else | ||
231 | return BAD_APICID; | ||
232 | } | ||
233 | |||
234 | static inline int | ||
235 | __default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
236 | { | ||
237 | return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map); | ||
238 | } | ||
239 | |||
240 | #ifdef CONFIG_X86_32 | ||
241 | static inline int default_cpu_present_to_apicid(int mps_cpu) | ||
242 | { | ||
243 | return __default_cpu_present_to_apicid(mps_cpu); | ||
244 | } | ||
245 | |||
246 | static inline int | ||
247 | default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
248 | { | ||
249 | return __default_check_phys_apicid_present(boot_cpu_physical_apicid); | ||
250 | } | ||
251 | #else | ||
252 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
253 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
254 | #endif | ||
255 | |||
256 | static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid) | ||
257 | { | ||
258 | return physid_mask_of_physid(phys_apicid); | ||
259 | } | ||
260 | |||
261 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
262 | |||
263 | #endif /* _ASM_X86_GENAPIC_64_H */ | ||
diff --git a/arch/x86/include/asm/genapic_32.h b/arch/x86/include/asm/genapic_32.h deleted file mode 100644 index 2c05b737ee22..000000000000 --- a/arch/x86/include/asm/genapic_32.h +++ /dev/null | |||
@@ -1,148 +0,0 @@ | |||
1 | #ifndef _ASM_X86_GENAPIC_32_H | ||
2 | #define _ASM_X86_GENAPIC_32_H | ||
3 | |||
4 | #include <asm/mpspec.h> | ||
5 | #include <asm/atomic.h> | ||
6 | |||
7 | /* | ||
8 | * Generic APIC driver interface. | ||
9 | * | ||
10 | * An straight forward mapping of the APIC related parts of the | ||
11 | * x86 subarchitecture interface to a dynamic object. | ||
12 | * | ||
13 | * This is used by the "generic" x86 subarchitecture. | ||
14 | * | ||
15 | * Copyright 2003 Andi Kleen, SuSE Labs. | ||
16 | */ | ||
17 | |||
18 | struct mpc_bus; | ||
19 | struct mpc_table; | ||
20 | struct mpc_cpu; | ||
21 | |||
22 | struct genapic { | ||
23 | char *name; | ||
24 | int (*probe)(void); | ||
25 | |||
26 | int (*apic_id_registered)(void); | ||
27 | const struct cpumask *(*target_cpus)(void); | ||
28 | int int_delivery_mode; | ||
29 | int int_dest_mode; | ||
30 | int ESR_DISABLE; | ||
31 | int apic_destination_logical; | ||
32 | unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid); | ||
33 | unsigned long (*check_apicid_present)(int apicid); | ||
34 | int no_balance_irq; | ||
35 | int no_ioapic_check; | ||
36 | void (*init_apic_ldr)(void); | ||
37 | physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map); | ||
38 | |||
39 | void (*setup_apic_routing)(void); | ||
40 | int (*multi_timer_check)(int apic, int irq); | ||
41 | int (*apicid_to_node)(int logical_apicid); | ||
42 | int (*cpu_to_logical_apicid)(int cpu); | ||
43 | int (*cpu_present_to_apicid)(int mps_cpu); | ||
44 | physid_mask_t (*apicid_to_cpu_present)(int phys_apicid); | ||
45 | void (*setup_portio_remap)(void); | ||
46 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); | ||
47 | void (*enable_apic_mode)(void); | ||
48 | u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb); | ||
49 | |||
50 | /* mpparse */ | ||
51 | /* When one of the next two hooks returns 1 the genapic | ||
52 | is switched to this. Essentially they are additional probe | ||
53 | functions. */ | ||
54 | int (*mps_oem_check)(struct mpc_table *mpc, char *oem, | ||
55 | char *productid); | ||
56 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | ||
57 | |||
58 | unsigned (*get_apic_id)(unsigned long x); | ||
59 | unsigned long apic_id_mask; | ||
60 | unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); | ||
61 | unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, | ||
62 | const struct cpumask *andmask); | ||
63 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | ||
64 | |||
65 | #ifdef CONFIG_SMP | ||
66 | /* ipi */ | ||
67 | void (*send_IPI_mask)(const struct cpumask *mask, int vector); | ||
68 | void (*send_IPI_mask_allbutself)(const struct cpumask *mask, | ||
69 | int vector); | ||
70 | void (*send_IPI_allbutself)(int vector); | ||
71 | void (*send_IPI_all)(int vector); | ||
72 | #endif | ||
73 | int (*wakeup_cpu)(int apicid, unsigned long start_eip); | ||
74 | int trampoline_phys_low; | ||
75 | int trampoline_phys_high; | ||
76 | void (*wait_for_init_deassert)(atomic_t *deassert); | ||
77 | void (*smp_callin_clear_local_apic)(void); | ||
78 | void (*store_NMI_vector)(unsigned short *high, unsigned short *low); | ||
79 | void (*restore_NMI_vector)(unsigned short *high, unsigned short *low); | ||
80 | void (*inquire_remote_apic)(int apicid); | ||
81 | }; | ||
82 | |||
83 | #define APICFUNC(x) .x = x, | ||
84 | |||
85 | /* More functions could be probably marked IPIFUNC and save some space | ||
86 | in UP GENERICARCH kernels, but I don't have the nerve right now | ||
87 | to untangle this mess. -AK */ | ||
88 | #ifdef CONFIG_SMP | ||
89 | #define IPIFUNC(x) APICFUNC(x) | ||
90 | #else | ||
91 | #define IPIFUNC(x) | ||
92 | #endif | ||
93 | |||
94 | #define APIC_INIT(aname, aprobe) \ | ||
95 | { \ | ||
96 | .name = aname, \ | ||
97 | .probe = aprobe, \ | ||
98 | .int_delivery_mode = INT_DELIVERY_MODE, \ | ||
99 | .int_dest_mode = INT_DEST_MODE, \ | ||
100 | .no_balance_irq = NO_BALANCE_IRQ, \ | ||
101 | .ESR_DISABLE = esr_disable, \ | ||
102 | .apic_destination_logical = APIC_DEST_LOGICAL, \ | ||
103 | APICFUNC(apic_id_registered) \ | ||
104 | APICFUNC(target_cpus) \ | ||
105 | APICFUNC(check_apicid_used) \ | ||
106 | APICFUNC(check_apicid_present) \ | ||
107 | APICFUNC(init_apic_ldr) \ | ||
108 | APICFUNC(ioapic_phys_id_map) \ | ||
109 | APICFUNC(setup_apic_routing) \ | ||
110 | APICFUNC(multi_timer_check) \ | ||
111 | APICFUNC(apicid_to_node) \ | ||
112 | APICFUNC(cpu_to_logical_apicid) \ | ||
113 | APICFUNC(cpu_present_to_apicid) \ | ||
114 | APICFUNC(apicid_to_cpu_present) \ | ||
115 | APICFUNC(setup_portio_remap) \ | ||
116 | APICFUNC(check_phys_apicid_present) \ | ||
117 | APICFUNC(mps_oem_check) \ | ||
118 | APICFUNC(get_apic_id) \ | ||
119 | .apic_id_mask = APIC_ID_MASK, \ | ||
120 | APICFUNC(cpu_mask_to_apicid) \ | ||
121 | APICFUNC(cpu_mask_to_apicid_and) \ | ||
122 | APICFUNC(vector_allocation_domain) \ | ||
123 | APICFUNC(acpi_madt_oem_check) \ | ||
124 | IPIFUNC(send_IPI_mask) \ | ||
125 | IPIFUNC(send_IPI_allbutself) \ | ||
126 | IPIFUNC(send_IPI_all) \ | ||
127 | APICFUNC(enable_apic_mode) \ | ||
128 | APICFUNC(phys_pkg_id) \ | ||
129 | .trampoline_phys_low = TRAMPOLINE_PHYS_LOW, \ | ||
130 | .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH, \ | ||
131 | APICFUNC(wait_for_init_deassert) \ | ||
132 | APICFUNC(smp_callin_clear_local_apic) \ | ||
133 | APICFUNC(store_NMI_vector) \ | ||
134 | APICFUNC(restore_NMI_vector) \ | ||
135 | APICFUNC(inquire_remote_apic) \ | ||
136 | } | ||
137 | |||
138 | extern struct genapic *genapic; | ||
139 | extern void es7000_update_genapic_to_cluster(void); | ||
140 | |||
141 | enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; | ||
142 | #define get_uv_system_type() UV_NONE | ||
143 | #define is_uv_system() 0 | ||
144 | #define uv_wakeup_secondary(a, b) 1 | ||
145 | #define uv_system_init() do {} while (0) | ||
146 | |||
147 | |||
148 | #endif /* _ASM_X86_GENAPIC_32_H */ | ||
diff --git a/arch/x86/include/asm/genapic_64.h b/arch/x86/include/asm/genapic_64.h deleted file mode 100644 index adf32fb56aa6..000000000000 --- a/arch/x86/include/asm/genapic_64.h +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | #ifndef _ASM_X86_GENAPIC_64_H | ||
2 | #define _ASM_X86_GENAPIC_64_H | ||
3 | |||
4 | #include <linux/cpumask.h> | ||
5 | |||
6 | /* | ||
7 | * Copyright 2004 James Cleverdon, IBM. | ||
8 | * Subject to the GNU Public License, v.2 | ||
9 | * | ||
10 | * Generic APIC sub-arch data struct. | ||
11 | * | ||
12 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by | ||
13 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and | ||
14 | * James Cleverdon. | ||
15 | */ | ||
16 | |||
17 | struct genapic { | ||
18 | char *name; | ||
19 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | ||
20 | u32 int_delivery_mode; | ||
21 | u32 int_dest_mode; | ||
22 | int (*apic_id_registered)(void); | ||
23 | const struct cpumask *(*target_cpus)(void); | ||
24 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | ||
25 | void (*init_apic_ldr)(void); | ||
26 | /* ipi */ | ||
27 | void (*send_IPI_mask)(const struct cpumask *mask, int vector); | ||
28 | void (*send_IPI_mask_allbutself)(const struct cpumask *mask, | ||
29 | int vector); | ||
30 | void (*send_IPI_allbutself)(int vector); | ||
31 | void (*send_IPI_all)(int vector); | ||
32 | void (*send_IPI_self)(int vector); | ||
33 | /* */ | ||
34 | unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); | ||
35 | unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, | ||
36 | const struct cpumask *andmask); | ||
37 | unsigned int (*phys_pkg_id)(int index_msb); | ||
38 | unsigned int (*get_apic_id)(unsigned long x); | ||
39 | unsigned long (*set_apic_id)(unsigned int id); | ||
40 | unsigned long apic_id_mask; | ||
41 | /* wakeup_secondary_cpu */ | ||
42 | int (*wakeup_cpu)(int apicid, unsigned long start_eip); | ||
43 | }; | ||
44 | |||
45 | extern struct genapic *genapic; | ||
46 | |||
47 | extern struct genapic apic_flat; | ||
48 | extern struct genapic apic_physflat; | ||
49 | extern struct genapic apic_x2apic_cluster; | ||
50 | extern struct genapic apic_x2apic_phys; | ||
51 | extern int acpi_madt_oem_check(char *, char *); | ||
52 | |||
53 | extern void apic_send_IPI_self(int vector); | ||
54 | enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; | ||
55 | extern enum uv_system_type get_uv_system_type(void); | ||
56 | extern int is_uv_system(void); | ||
57 | |||
58 | extern struct genapic apic_x2apic_uv_x; | ||
59 | DECLARE_PER_CPU(int, x2apic_extra_bits); | ||
60 | extern void uv_cpu_init(void); | ||
61 | extern void uv_system_init(void); | ||
62 | extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip); | ||
63 | |||
64 | extern void setup_apic_routing(void); | ||
65 | |||
66 | #endif /* _ASM_X86_GENAPIC_64_H */ | ||
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h index 000787df66e6..176f058e7159 100644 --- a/arch/x86/include/asm/hardirq.h +++ b/arch/x86/include/asm/hardirq.h | |||
@@ -1,11 +1,52 @@ | |||
1 | #ifdef CONFIG_X86_32 | 1 | #ifndef _ASM_X86_HARDIRQ_H |
2 | # include "hardirq_32.h" | 2 | #define _ASM_X86_HARDIRQ_H |
3 | #else | 3 | |
4 | # include "hardirq_64.h" | 4 | #include <linux/threads.h> |
5 | #include <linux/irq.h> | ||
6 | |||
7 | typedef struct { | ||
8 | unsigned int __softirq_pending; | ||
9 | unsigned int __nmi_count; /* arch dependent */ | ||
10 | unsigned int irq0_irqs; | ||
11 | #ifdef CONFIG_X86_LOCAL_APIC | ||
12 | unsigned int apic_timer_irqs; /* arch dependent */ | ||
13 | unsigned int irq_spurious_count; | ||
14 | #endif | ||
15 | #ifdef CONFIG_SMP | ||
16 | unsigned int irq_resched_count; | ||
17 | unsigned int irq_call_count; | ||
18 | unsigned int irq_tlb_count; | ||
19 | #endif | ||
20 | #ifdef CONFIG_X86_MCE | ||
21 | unsigned int irq_thermal_count; | ||
22 | # ifdef CONFIG_X86_64 | ||
23 | unsigned int irq_threshold_count; | ||
24 | # endif | ||
5 | #endif | 25 | #endif |
26 | } ____cacheline_aligned irq_cpustat_t; | ||
27 | |||
28 | DECLARE_PER_CPU(irq_cpustat_t, irq_stat); | ||
29 | |||
30 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ | ||
31 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS | ||
32 | |||
33 | #define __ARCH_IRQ_STAT | ||
34 | |||
35 | #define inc_irq_stat(member) percpu_add(irq_stat.member, 1) | ||
36 | |||
37 | #define local_softirq_pending() percpu_read(irq_stat.__softirq_pending) | ||
38 | |||
39 | #define __ARCH_SET_SOFTIRQ_PENDING | ||
40 | |||
41 | #define set_softirq_pending(x) percpu_write(irq_stat.__softirq_pending, (x)) | ||
42 | #define or_softirq_pending(x) percpu_or(irq_stat.__softirq_pending, (x)) | ||
43 | |||
44 | extern void ack_bad_irq(unsigned int irq); | ||
6 | 45 | ||
7 | extern u64 arch_irq_stat_cpu(unsigned int cpu); | 46 | extern u64 arch_irq_stat_cpu(unsigned int cpu); |
8 | #define arch_irq_stat_cpu arch_irq_stat_cpu | 47 | #define arch_irq_stat_cpu arch_irq_stat_cpu |
9 | 48 | ||
10 | extern u64 arch_irq_stat(void); | 49 | extern u64 arch_irq_stat(void); |
11 | #define arch_irq_stat arch_irq_stat | 50 | #define arch_irq_stat arch_irq_stat |
51 | |||
52 | #endif /* _ASM_X86_HARDIRQ_H */ | ||
diff --git a/arch/x86/include/asm/hardirq_32.h b/arch/x86/include/asm/hardirq_32.h deleted file mode 100644 index cf7954d1405f..000000000000 --- a/arch/x86/include/asm/hardirq_32.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #ifndef _ASM_X86_HARDIRQ_32_H | ||
2 | #define _ASM_X86_HARDIRQ_32_H | ||
3 | |||
4 | #include <linux/threads.h> | ||
5 | #include <linux/irq.h> | ||
6 | |||
7 | typedef struct { | ||
8 | unsigned int __softirq_pending; | ||
9 | unsigned long idle_timestamp; | ||
10 | unsigned int __nmi_count; /* arch dependent */ | ||
11 | unsigned int apic_timer_irqs; /* arch dependent */ | ||
12 | unsigned int irq0_irqs; | ||
13 | unsigned int irq_resched_count; | ||
14 | unsigned int irq_call_count; | ||
15 | unsigned int irq_tlb_count; | ||
16 | unsigned int irq_thermal_count; | ||
17 | unsigned int irq_spurious_count; | ||
18 | } ____cacheline_aligned irq_cpustat_t; | ||
19 | |||
20 | DECLARE_PER_CPU(irq_cpustat_t, irq_stat); | ||
21 | |||
22 | #define __ARCH_IRQ_STAT | ||
23 | #define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member) | ||
24 | |||
25 | #define inc_irq_stat(member) (__get_cpu_var(irq_stat).member++) | ||
26 | |||
27 | void ack_bad_irq(unsigned int irq); | ||
28 | #include <linux/irq_cpustat.h> | ||
29 | |||
30 | #endif /* _ASM_X86_HARDIRQ_32_H */ | ||
diff --git a/arch/x86/include/asm/hardirq_64.h b/arch/x86/include/asm/hardirq_64.h deleted file mode 100644 index b5a6b5d56704..000000000000 --- a/arch/x86/include/asm/hardirq_64.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #ifndef _ASM_X86_HARDIRQ_64_H | ||
2 | #define _ASM_X86_HARDIRQ_64_H | ||
3 | |||
4 | #include <linux/threads.h> | ||
5 | #include <linux/irq.h> | ||
6 | #include <asm/pda.h> | ||
7 | #include <asm/apic.h> | ||
8 | |||
9 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ | ||
10 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS | ||
11 | |||
12 | #define __ARCH_IRQ_STAT 1 | ||
13 | |||
14 | #define inc_irq_stat(member) add_pda(member, 1) | ||
15 | |||
16 | #define local_softirq_pending() read_pda(__softirq_pending) | ||
17 | |||
18 | #define __ARCH_SET_SOFTIRQ_PENDING 1 | ||
19 | |||
20 | #define set_softirq_pending(x) write_pda(__softirq_pending, (x)) | ||
21 | #define or_softirq_pending(x) or_pda(__softirq_pending, (x)) | ||
22 | |||
23 | extern void ack_bad_irq(unsigned int irq); | ||
24 | |||
25 | #endif /* _ASM_X86_HARDIRQ_64_H */ | ||
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 8de644b6b959..1a20e3d12006 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h | |||
@@ -71,12 +71,6 @@ extern void setup_ioapic_dest(void); | |||
71 | extern void enable_IO_APIC(void); | 71 | extern void enable_IO_APIC(void); |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | /* IPI functions */ | ||
75 | #ifdef CONFIG_X86_32 | ||
76 | extern void send_IPI_self(int vector); | ||
77 | #endif | ||
78 | extern void send_IPI(int dest, int vector); | ||
79 | |||
80 | /* Statistics */ | 74 | /* Statistics */ |
81 | extern atomic_t irq_err_count; | 75 | extern atomic_t irq_err_count; |
82 | extern atomic_t irq_mis_count; | 76 | extern atomic_t irq_mis_count; |
@@ -84,21 +78,11 @@ extern atomic_t irq_mis_count; | |||
84 | /* EISA */ | 78 | /* EISA */ |
85 | extern void eisa_set_level_irq(unsigned int irq); | 79 | extern void eisa_set_level_irq(unsigned int irq); |
86 | 80 | ||
87 | /* Voyager functions */ | ||
88 | extern asmlinkage void vic_cpi_interrupt(void); | ||
89 | extern asmlinkage void vic_sys_interrupt(void); | ||
90 | extern asmlinkage void vic_cmn_interrupt(void); | ||
91 | extern asmlinkage void qic_timer_interrupt(void); | ||
92 | extern asmlinkage void qic_invalidate_interrupt(void); | ||
93 | extern asmlinkage void qic_reschedule_interrupt(void); | ||
94 | extern asmlinkage void qic_enable_irq_interrupt(void); | ||
95 | extern asmlinkage void qic_call_function_interrupt(void); | ||
96 | |||
97 | /* SMP */ | 81 | /* SMP */ |
98 | extern void smp_apic_timer_interrupt(struct pt_regs *); | 82 | extern void smp_apic_timer_interrupt(struct pt_regs *); |
99 | extern void smp_spurious_interrupt(struct pt_regs *); | 83 | extern void smp_spurious_interrupt(struct pt_regs *); |
100 | extern void smp_error_interrupt(struct pt_regs *); | 84 | extern void smp_error_interrupt(struct pt_regs *); |
101 | #ifdef CONFIG_X86_SMP | 85 | #ifdef CONFIG_SMP |
102 | extern void smp_reschedule_interrupt(struct pt_regs *); | 86 | extern void smp_reschedule_interrupt(struct pt_regs *); |
103 | extern void smp_call_function_interrupt(struct pt_regs *); | 87 | extern void smp_call_function_interrupt(struct pt_regs *); |
104 | extern void smp_call_function_single_interrupt(struct pt_regs *); | 88 | extern void smp_call_function_single_interrupt(struct pt_regs *); |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 1dbbdf4be9b4..bcf7ea4e1367 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -91,7 +91,7 @@ extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr); | |||
91 | 91 | ||
92 | extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, | 92 | extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, |
93 | unsigned long prot_val); | 93 | unsigned long prot_val); |
94 | extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size); | 94 | extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size); |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * early_ioremap() and early_iounmap() are for temporary early boot-time | 97 | * early_ioremap() and early_iounmap() are for temporary early boot-time |
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 7a1f44ac1f17..309d0e23193a 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -114,38 +114,16 @@ struct IR_IO_APIC_route_entry { | |||
114 | extern int nr_ioapics; | 114 | extern int nr_ioapics; |
115 | extern int nr_ioapic_registers[MAX_IO_APICS]; | 115 | extern int nr_ioapic_registers[MAX_IO_APICS]; |
116 | 116 | ||
117 | /* | ||
118 | * MP-BIOS irq configuration table structures: | ||
119 | */ | ||
120 | |||
121 | #define MP_MAX_IOAPIC_PIN 127 | 117 | #define MP_MAX_IOAPIC_PIN 127 |
122 | 118 | ||
123 | struct mp_config_ioapic { | ||
124 | unsigned long mp_apicaddr; | ||
125 | unsigned int mp_apicid; | ||
126 | unsigned char mp_type; | ||
127 | unsigned char mp_apicver; | ||
128 | unsigned char mp_flags; | ||
129 | }; | ||
130 | |||
131 | struct mp_config_intsrc { | ||
132 | unsigned int mp_dstapic; | ||
133 | unsigned char mp_type; | ||
134 | unsigned char mp_irqtype; | ||
135 | unsigned short mp_irqflag; | ||
136 | unsigned char mp_srcbus; | ||
137 | unsigned char mp_srcbusirq; | ||
138 | unsigned char mp_dstirq; | ||
139 | }; | ||
140 | |||
141 | /* I/O APIC entries */ | 119 | /* I/O APIC entries */ |
142 | extern struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; | 120 | extern struct mpc_ioapic mp_ioapics[MAX_IO_APICS]; |
143 | 121 | ||
144 | /* # of MP IRQ source entries */ | 122 | /* # of MP IRQ source entries */ |
145 | extern int mp_irq_entries; | 123 | extern int mp_irq_entries; |
146 | 124 | ||
147 | /* MP IRQ source entries */ | 125 | /* MP IRQ source entries */ |
148 | extern struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; | 126 | extern struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; |
149 | 127 | ||
150 | /* non-0 if default (table-less) MP configuration */ | 128 | /* non-0 if default (table-less) MP configuration */ |
151 | extern int mpc_default_type; | 129 | extern int mpc_default_type; |
@@ -165,15 +143,6 @@ extern int noioapicreroute; | |||
165 | /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */ | 143 | /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */ |
166 | extern int timer_through_8259; | 144 | extern int timer_through_8259; |
167 | 145 | ||
168 | static inline void disable_ioapic_setup(void) | ||
169 | { | ||
170 | #ifdef CONFIG_PCI | ||
171 | noioapicquirk = 1; | ||
172 | noioapicreroute = -1; | ||
173 | #endif | ||
174 | skip_ioapic_setup = 1; | ||
175 | } | ||
176 | |||
177 | /* | 146 | /* |
178 | * If we use the IO-APIC for IRQ routing, disable automatic | 147 | * If we use the IO-APIC for IRQ routing, disable automatic |
179 | * assignment of PCI IRQ's. | 148 | * assignment of PCI IRQ's. |
diff --git a/arch/x86/include/asm/ipi.h b/arch/x86/include/asm/ipi.h index c745a306f7d3..5f2efc5d9927 100644 --- a/arch/x86/include/asm/ipi.h +++ b/arch/x86/include/asm/ipi.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_X86_IPI_H | 1 | #ifndef _ASM_X86_IPI_H |
2 | #define _ASM_X86_IPI_H | 2 | #define _ASM_X86_IPI_H |
3 | 3 | ||
4 | #ifdef CONFIG_X86_LOCAL_APIC | ||
5 | |||
4 | /* | 6 | /* |
5 | * Copyright 2004 James Cleverdon, IBM. | 7 | * Copyright 2004 James Cleverdon, IBM. |
6 | * Subject to the GNU Public License, v.2 | 8 | * Subject to the GNU Public License, v.2 |
@@ -55,8 +57,8 @@ static inline void __xapic_wait_icr_idle(void) | |||
55 | cpu_relax(); | 57 | cpu_relax(); |
56 | } | 58 | } |
57 | 59 | ||
58 | static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, | 60 | static inline void |
59 | unsigned int dest) | 61 | __default_send_IPI_shortcut(unsigned int shortcut, int vector, unsigned int dest) |
60 | { | 62 | { |
61 | /* | 63 | /* |
62 | * Subtle. In the case of the 'never do double writes' workaround | 64 | * Subtle. In the case of the 'never do double writes' workaround |
@@ -87,8 +89,8 @@ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, | |||
87 | * This is used to send an IPI with no shorthand notation (the destination is | 89 | * This is used to send an IPI with no shorthand notation (the destination is |
88 | * specified in bits 56 to 63 of the ICR). | 90 | * specified in bits 56 to 63 of the ICR). |
89 | */ | 91 | */ |
90 | static inline void __send_IPI_dest_field(unsigned int mask, int vector, | 92 | static inline void |
91 | unsigned int dest) | 93 | __default_send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest) |
92 | { | 94 | { |
93 | unsigned long cfg; | 95 | unsigned long cfg; |
94 | 96 | ||
@@ -117,41 +119,46 @@ static inline void __send_IPI_dest_field(unsigned int mask, int vector, | |||
117 | native_apic_mem_write(APIC_ICR, cfg); | 119 | native_apic_mem_write(APIC_ICR, cfg); |
118 | } | 120 | } |
119 | 121 | ||
120 | static inline void send_IPI_mask_sequence(const struct cpumask *mask, | 122 | extern void default_send_IPI_mask_sequence_phys(const struct cpumask *mask, |
121 | int vector) | 123 | int vector); |
122 | { | 124 | extern void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, |
123 | unsigned long flags; | 125 | int vector); |
124 | unsigned long query_cpu; | 126 | #include <asm/genapic.h> |
125 | 127 | ||
126 | /* | 128 | extern void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, |
127 | * Hack. The clustered APIC addressing mode doesn't allow us to send | 129 | int vector); |
128 | * to an arbitrary mask, so I do a unicast to each CPU instead. | 130 | extern void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, |
129 | * - mbligh | 131 | int vector); |
130 | */ | 132 | |
131 | local_irq_save(flags); | 133 | /* Avoid include hell */ |
132 | for_each_cpu(query_cpu, mask) { | 134 | #define NMI_VECTOR 0x02 |
133 | __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu), | 135 | |
134 | vector, APIC_DEST_PHYSICAL); | 136 | extern int no_broadcast; |
135 | } | 137 | |
136 | local_irq_restore(flags); | 138 | static inline void __default_local_send_IPI_allbutself(int vector) |
139 | { | ||
140 | if (no_broadcast || vector == NMI_VECTOR) | ||
141 | apic->send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
142 | else | ||
143 | __default_send_IPI_shortcut(APIC_DEST_ALLBUT, vector, apic->dest_logical); | ||
137 | } | 144 | } |
138 | 145 | ||
139 | static inline void send_IPI_mask_allbutself(const struct cpumask *mask, | 146 | static inline void __default_local_send_IPI_all(int vector) |
140 | int vector) | ||
141 | { | 147 | { |
142 | unsigned long flags; | 148 | if (no_broadcast || vector == NMI_VECTOR) |
143 | unsigned int query_cpu; | 149 | apic->send_IPI_mask(cpu_online_mask, vector); |
144 | unsigned int this_cpu = smp_processor_id(); | 150 | else |
145 | 151 | __default_send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->dest_logical); | |
146 | /* See Hack comment above */ | ||
147 | |||
148 | local_irq_save(flags); | ||
149 | for_each_cpu(query_cpu, mask) | ||
150 | if (query_cpu != this_cpu) | ||
151 | __send_IPI_dest_field( | ||
152 | per_cpu(x86_cpu_to_apicid, query_cpu), | ||
153 | vector, APIC_DEST_PHYSICAL); | ||
154 | local_irq_restore(flags); | ||
155 | } | 152 | } |
156 | 153 | ||
154 | #ifdef CONFIG_X86_32 | ||
155 | extern void default_send_IPI_mask_logical(const struct cpumask *mask, | ||
156 | int vector); | ||
157 | extern void default_send_IPI_allbutself(int vector); | ||
158 | extern void default_send_IPI_all(int vector); | ||
159 | extern void default_send_IPI_self(int vector); | ||
160 | #endif | ||
161 | |||
162 | #endif | ||
163 | |||
157 | #endif /* _ASM_X86_IPI_H */ | 164 | #endif /* _ASM_X86_IPI_H */ |
diff --git a/arch/x86/include/asm/irq_regs.h b/arch/x86/include/asm/irq_regs.h index 89c898ab298b..77843225b7ea 100644 --- a/arch/x86/include/asm/irq_regs.h +++ b/arch/x86/include/asm/irq_regs.h | |||
@@ -1,5 +1,31 @@ | |||
1 | #ifdef CONFIG_X86_32 | 1 | /* |
2 | # include "irq_regs_32.h" | 2 | * Per-cpu current frame pointer - the location of the last exception frame on |
3 | #else | 3 | * the stack, stored in the per-cpu area. |
4 | # include "irq_regs_64.h" | 4 | * |
5 | #endif | 5 | * Jeremy Fitzhardinge <jeremy@goop.org> |
6 | */ | ||
7 | #ifndef _ASM_X86_IRQ_REGS_H | ||
8 | #define _ASM_X86_IRQ_REGS_H | ||
9 | |||
10 | #include <asm/percpu.h> | ||
11 | |||
12 | #define ARCH_HAS_OWN_IRQ_REGS | ||
13 | |||
14 | DECLARE_PER_CPU(struct pt_regs *, irq_regs); | ||
15 | |||
16 | static inline struct pt_regs *get_irq_regs(void) | ||
17 | { | ||
18 | return percpu_read(irq_regs); | ||
19 | } | ||
20 | |||
21 | static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) | ||
22 | { | ||
23 | struct pt_regs *old_regs; | ||
24 | |||
25 | old_regs = get_irq_regs(); | ||
26 | percpu_write(irq_regs, new_regs); | ||
27 | |||
28 | return old_regs; | ||
29 | } | ||
30 | |||
31 | #endif /* _ASM_X86_IRQ_REGS_32_H */ | ||
diff --git a/arch/x86/include/asm/irq_regs_32.h b/arch/x86/include/asm/irq_regs_32.h deleted file mode 100644 index 86afd7473457..000000000000 --- a/arch/x86/include/asm/irq_regs_32.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * Per-cpu current frame pointer - the location of the last exception frame on | ||
3 | * the stack, stored in the per-cpu area. | ||
4 | * | ||
5 | * Jeremy Fitzhardinge <jeremy@goop.org> | ||
6 | */ | ||
7 | #ifndef _ASM_X86_IRQ_REGS_32_H | ||
8 | #define _ASM_X86_IRQ_REGS_32_H | ||
9 | |||
10 | #include <asm/percpu.h> | ||
11 | |||
12 | #define ARCH_HAS_OWN_IRQ_REGS | ||
13 | |||
14 | DECLARE_PER_CPU(struct pt_regs *, irq_regs); | ||
15 | |||
16 | static inline struct pt_regs *get_irq_regs(void) | ||
17 | { | ||
18 | return x86_read_percpu(irq_regs); | ||
19 | } | ||
20 | |||
21 | static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) | ||
22 | { | ||
23 | struct pt_regs *old_regs; | ||
24 | |||
25 | old_regs = get_irq_regs(); | ||
26 | x86_write_percpu(irq_regs, new_regs); | ||
27 | |||
28 | return old_regs; | ||
29 | } | ||
30 | |||
31 | #endif /* _ASM_X86_IRQ_REGS_32_H */ | ||
diff --git a/arch/x86/include/asm/irq_regs_64.h b/arch/x86/include/asm/irq_regs_64.h deleted file mode 100644 index 3dd9c0b70270..000000000000 --- a/arch/x86/include/asm/irq_regs_64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/irq_regs.h> | ||
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h index f7ff65032b9d..b07278c55e9e 100644 --- a/arch/x86/include/asm/irq_vectors.h +++ b/arch/x86/include/asm/irq_vectors.h | |||
@@ -1,47 +1,69 @@ | |||
1 | #ifndef _ASM_X86_IRQ_VECTORS_H | 1 | #ifndef _ASM_X86_IRQ_VECTORS_H |
2 | #define _ASM_X86_IRQ_VECTORS_H | 2 | #define _ASM_X86_IRQ_VECTORS_H |
3 | 3 | ||
4 | #include <linux/threads.h> | 4 | /* |
5 | * Linux IRQ vector layout. | ||
6 | * | ||
7 | * There are 256 IDT entries (per CPU - each entry is 8 bytes) which can | ||
8 | * be defined by Linux. They are used as a jump table by the CPU when a | ||
9 | * given vector is triggered - by a CPU-external, CPU-internal or | ||
10 | * software-triggered event. | ||
11 | * | ||
12 | * Linux sets the kernel code address each entry jumps to early during | ||
13 | * bootup, and never changes them. This is the general layout of the | ||
14 | * IDT entries: | ||
15 | * | ||
16 | * Vectors 0 ... 31 : system traps and exceptions - hardcoded events | ||
17 | * Vectors 32 ... 127 : device interrupts | ||
18 | * Vector 128 : legacy int80 syscall interface | ||
19 | * Vectors 129 ... 237 : device interrupts | ||
20 | * Vectors 238 ... 255 : special interrupts | ||
21 | * | ||
22 | * 64-bit x86 has per CPU IDT tables, 32-bit has one shared IDT table. | ||
23 | * | ||
24 | * This file enumerates the exact layout of them: | ||
25 | */ | ||
5 | 26 | ||
6 | #define NMI_VECTOR 0x02 | 27 | #define NMI_VECTOR 0x02 |
7 | 28 | ||
8 | /* | 29 | /* |
9 | * IDT vectors usable for external interrupt sources start | 30 | * IDT vectors usable for external interrupt sources start |
10 | * at 0x20: | 31 | * at 0x20: |
11 | */ | 32 | */ |
12 | #define FIRST_EXTERNAL_VECTOR 0x20 | 33 | #define FIRST_EXTERNAL_VECTOR 0x20 |
13 | 34 | ||
14 | #ifdef CONFIG_X86_32 | 35 | #ifdef CONFIG_X86_32 |
15 | # define SYSCALL_VECTOR 0x80 | 36 | # define SYSCALL_VECTOR 0x80 |
16 | #else | 37 | #else |
17 | # define IA32_SYSCALL_VECTOR 0x80 | 38 | # define IA32_SYSCALL_VECTOR 0x80 |
18 | #endif | 39 | #endif |
19 | 40 | ||
20 | /* | 41 | /* |
21 | * Reserve the lowest usable priority level 0x20 - 0x2f for triggering | 42 | * Reserve the lowest usable priority level 0x20 - 0x2f for triggering |
22 | * cleanup after irq migration. | 43 | * cleanup after irq migration. |
23 | */ | 44 | */ |
24 | #define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR | 45 | #define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR |
25 | 46 | ||
26 | /* | 47 | /* |
27 | * Vectors 0x30-0x3f are used for ISA interrupts. | 48 | * Vectors 0x30-0x3f are used for ISA interrupts. |
28 | */ | 49 | */ |
29 | #define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR + 0x10) | 50 | #define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR + 0x10) |
30 | #define IRQ1_VECTOR (IRQ0_VECTOR + 1) | 51 | |
31 | #define IRQ2_VECTOR (IRQ0_VECTOR + 2) | 52 | #define IRQ1_VECTOR (IRQ0_VECTOR + 1) |
32 | #define IRQ3_VECTOR (IRQ0_VECTOR + 3) | 53 | #define IRQ2_VECTOR (IRQ0_VECTOR + 2) |
33 | #define IRQ4_VECTOR (IRQ0_VECTOR + 4) | 54 | #define IRQ3_VECTOR (IRQ0_VECTOR + 3) |
34 | #define IRQ5_VECTOR (IRQ0_VECTOR + 5) | 55 | #define IRQ4_VECTOR (IRQ0_VECTOR + 4) |
35 | #define IRQ6_VECTOR (IRQ0_VECTOR + 6) | 56 | #define IRQ5_VECTOR (IRQ0_VECTOR + 5) |
36 | #define IRQ7_VECTOR (IRQ0_VECTOR + 7) | 57 | #define IRQ6_VECTOR (IRQ0_VECTOR + 6) |
37 | #define IRQ8_VECTOR (IRQ0_VECTOR + 8) | 58 | #define IRQ7_VECTOR (IRQ0_VECTOR + 7) |
38 | #define IRQ9_VECTOR (IRQ0_VECTOR + 9) | 59 | #define IRQ8_VECTOR (IRQ0_VECTOR + 8) |
39 | #define IRQ10_VECTOR (IRQ0_VECTOR + 10) | 60 | #define IRQ9_VECTOR (IRQ0_VECTOR + 9) |
40 | #define IRQ11_VECTOR (IRQ0_VECTOR + 11) | 61 | #define IRQ10_VECTOR (IRQ0_VECTOR + 10) |
41 | #define IRQ12_VECTOR (IRQ0_VECTOR + 12) | 62 | #define IRQ11_VECTOR (IRQ0_VECTOR + 11) |
42 | #define IRQ13_VECTOR (IRQ0_VECTOR + 13) | 63 | #define IRQ12_VECTOR (IRQ0_VECTOR + 12) |
43 | #define IRQ14_VECTOR (IRQ0_VECTOR + 14) | 64 | #define IRQ13_VECTOR (IRQ0_VECTOR + 13) |
44 | #define IRQ15_VECTOR (IRQ0_VECTOR + 15) | 65 | #define IRQ14_VECTOR (IRQ0_VECTOR + 14) |
66 | #define IRQ15_VECTOR (IRQ0_VECTOR + 15) | ||
45 | 67 | ||
46 | /* | 68 | /* |
47 | * Special IRQ vectors used by the SMP architecture, 0xf0-0xff | 69 | * Special IRQ vectors used by the SMP architecture, 0xf0-0xff |
@@ -49,119 +71,98 @@ | |||
49 | * some of the following vectors are 'rare', they are merged | 71 | * some of the following vectors are 'rare', they are merged |
50 | * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. | 72 | * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. |
51 | * TLB, reschedule and local APIC vectors are performance-critical. | 73 | * TLB, reschedule and local APIC vectors are performance-critical. |
52 | * | ||
53 | * Vectors 0xf0-0xfa are free (reserved for future Linux use). | ||
54 | */ | 74 | */ |
55 | #ifdef CONFIG_X86_32 | ||
56 | |||
57 | # define SPURIOUS_APIC_VECTOR 0xff | ||
58 | # define ERROR_APIC_VECTOR 0xfe | ||
59 | # define INVALIDATE_TLB_VECTOR 0xfd | ||
60 | # define RESCHEDULE_VECTOR 0xfc | ||
61 | # define CALL_FUNCTION_VECTOR 0xfb | ||
62 | # define CALL_FUNCTION_SINGLE_VECTOR 0xfa | ||
63 | # define THERMAL_APIC_VECTOR 0xf0 | ||
64 | |||
65 | #else | ||
66 | 75 | ||
67 | #define SPURIOUS_APIC_VECTOR 0xff | 76 | #define SPURIOUS_APIC_VECTOR 0xff |
77 | /* | ||
78 | * Sanity check | ||
79 | */ | ||
80 | #if ((SPURIOUS_APIC_VECTOR & 0x0F) != 0x0F) | ||
81 | # error SPURIOUS_APIC_VECTOR definition error | ||
82 | #endif | ||
83 | |||
68 | #define ERROR_APIC_VECTOR 0xfe | 84 | #define ERROR_APIC_VECTOR 0xfe |
69 | #define RESCHEDULE_VECTOR 0xfd | 85 | #define RESCHEDULE_VECTOR 0xfd |
70 | #define CALL_FUNCTION_VECTOR 0xfc | 86 | #define CALL_FUNCTION_VECTOR 0xfc |
71 | #define CALL_FUNCTION_SINGLE_VECTOR 0xfb | 87 | #define CALL_FUNCTION_SINGLE_VECTOR 0xfb |
72 | #define THERMAL_APIC_VECTOR 0xfa | 88 | #define THERMAL_APIC_VECTOR 0xfa |
73 | #define THRESHOLD_APIC_VECTOR 0xf9 | ||
74 | #define UV_BAU_MESSAGE 0xf8 | ||
75 | #define INVALIDATE_TLB_VECTOR_END 0xf7 | ||
76 | #define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */ | ||
77 | |||
78 | #define NUM_INVALIDATE_TLB_VECTORS 8 | ||
79 | 89 | ||
90 | #ifdef CONFIG_X86_32 | ||
91 | /* 0xf8 - 0xf9 : free */ | ||
92 | #else | ||
93 | # define THRESHOLD_APIC_VECTOR 0xf9 | ||
94 | # define UV_BAU_MESSAGE 0xf8 | ||
80 | #endif | 95 | #endif |
81 | 96 | ||
97 | /* f0-f7 used for spreading out TLB flushes: */ | ||
98 | #define INVALIDATE_TLB_VECTOR_END 0xf7 | ||
99 | #define INVALIDATE_TLB_VECTOR_START 0xf0 | ||
100 | #define NUM_INVALIDATE_TLB_VECTORS 8 | ||
101 | |||
82 | /* | 102 | /* |
83 | * Local APIC timer IRQ vector is on a different priority level, | 103 | * Local APIC timer IRQ vector is on a different priority level, |
84 | * to work around the 'lost local interrupt if more than 2 IRQ | 104 | * to work around the 'lost local interrupt if more than 2 IRQ |
85 | * sources per level' errata. | 105 | * sources per level' errata. |
86 | */ | 106 | */ |
87 | #define LOCAL_TIMER_VECTOR 0xef | 107 | #define LOCAL_TIMER_VECTOR 0xef |
108 | |||
109 | /* | ||
110 | * Performance monitoring interrupt vector: | ||
111 | */ | ||
112 | #define LOCAL_PERF_VECTOR 0xee | ||
88 | 113 | ||
89 | /* | 114 | /* |
90 | * First APIC vector available to drivers: (vectors 0x30-0xee) we | 115 | * First APIC vector available to drivers: (vectors 0x30-0xee) we |
91 | * start at 0x31(0x41) to spread out vectors evenly between priority | 116 | * start at 0x31(0x41) to spread out vectors evenly between priority |
92 | * levels. (0x80 is the syscall vector) | 117 | * levels. (0x80 is the syscall vector) |
93 | */ | 118 | */ |
94 | #define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2) | 119 | #define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2) |
95 | |||
96 | #define NR_VECTORS 256 | ||
97 | 120 | ||
98 | #define FPU_IRQ 13 | 121 | #define NR_VECTORS 256 |
99 | 122 | ||
100 | #define FIRST_VM86_IRQ 3 | 123 | #define FPU_IRQ 13 |
101 | #define LAST_VM86_IRQ 15 | ||
102 | #define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15) | ||
103 | 124 | ||
104 | #define NR_IRQS_LEGACY 16 | 125 | #define FIRST_VM86_IRQ 3 |
126 | #define LAST_VM86_IRQ 15 | ||
105 | 127 | ||
106 | #if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER) | 128 | #ifndef __ASSEMBLY__ |
107 | 129 | static inline int invalid_vm86_irq(int irq) | |
108 | #ifndef CONFIG_SPARSE_IRQ | 130 | { |
109 | # if NR_CPUS < MAX_IO_APICS | 131 | return irq < 3 || irq > 15; |
110 | # define NR_IRQS (NR_VECTORS + (32 * NR_CPUS)) | 132 | } |
111 | # else | ||
112 | # define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS)) | ||
113 | # endif | ||
114 | #else | ||
115 | # if (8 * NR_CPUS) > (32 * MAX_IO_APICS) | ||
116 | # define NR_IRQS (NR_VECTORS + (8 * NR_CPUS)) | ||
117 | # else | ||
118 | # define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS)) | ||
119 | # endif | ||
120 | #endif | 133 | #endif |
121 | 134 | ||
122 | #elif defined(CONFIG_X86_VOYAGER) | 135 | /* |
123 | 136 | * Size the maximum number of interrupts. | |
124 | # define NR_IRQS 224 | 137 | * |
138 | * If the irq_desc[] array has a sparse layout, we can size things | ||
139 | * generously - it scales up linearly with the maximum number of CPUs, | ||
140 | * and the maximum number of IO-APICs, whichever is higher. | ||
141 | * | ||
142 | * In other cases we size more conservatively, to not create too large | ||
143 | * static arrays. | ||
144 | */ | ||
125 | 145 | ||
126 | #else /* IO_APIC || VOYAGER */ | 146 | #define NR_IRQS_LEGACY 16 |
127 | 147 | ||
128 | # define NR_IRQS 16 | 148 | #define CPU_VECTOR_LIMIT ( 8 * NR_CPUS ) |
149 | #define IO_APIC_VECTOR_LIMIT ( 32 * MAX_IO_APICS ) | ||
129 | 150 | ||
151 | #ifdef CONFIG_X86_IO_APIC | ||
152 | # ifdef CONFIG_SPARSE_IRQ | ||
153 | # define NR_IRQS \ | ||
154 | (CPU_VECTOR_LIMIT > IO_APIC_VECTOR_LIMIT ? \ | ||
155 | (NR_VECTORS + CPU_VECTOR_LIMIT) : \ | ||
156 | (NR_VECTORS + IO_APIC_VECTOR_LIMIT)) | ||
157 | # else | ||
158 | # if NR_CPUS < MAX_IO_APICS | ||
159 | # define NR_IRQS (NR_VECTORS + 4*CPU_VECTOR_LIMIT) | ||
160 | # else | ||
161 | # define NR_IRQS (NR_VECTORS + IO_APIC_VECTOR_LIMIT) | ||
162 | # endif | ||
163 | # endif | ||
164 | #else /* !CONFIG_X86_IO_APIC: */ | ||
165 | # define NR_IRQS NR_IRQS_LEGACY | ||
130 | #endif | 166 | #endif |
131 | 167 | ||
132 | /* Voyager specific defines */ | ||
133 | /* These define the CPIs we use in linux */ | ||
134 | #define VIC_CPI_LEVEL0 0 | ||
135 | #define VIC_CPI_LEVEL1 1 | ||
136 | /* now the fake CPIs */ | ||
137 | #define VIC_TIMER_CPI 2 | ||
138 | #define VIC_INVALIDATE_CPI 3 | ||
139 | #define VIC_RESCHEDULE_CPI 4 | ||
140 | #define VIC_ENABLE_IRQ_CPI 5 | ||
141 | #define VIC_CALL_FUNCTION_CPI 6 | ||
142 | #define VIC_CALL_FUNCTION_SINGLE_CPI 7 | ||
143 | |||
144 | /* Now the QIC CPIs: Since we don't need the two initial levels, | ||
145 | * these are 2 less than the VIC CPIs */ | ||
146 | #define QIC_CPI_OFFSET 1 | ||
147 | #define QIC_TIMER_CPI (VIC_TIMER_CPI - QIC_CPI_OFFSET) | ||
148 | #define QIC_INVALIDATE_CPI (VIC_INVALIDATE_CPI - QIC_CPI_OFFSET) | ||
149 | #define QIC_RESCHEDULE_CPI (VIC_RESCHEDULE_CPI - QIC_CPI_OFFSET) | ||
150 | #define QIC_ENABLE_IRQ_CPI (VIC_ENABLE_IRQ_CPI - QIC_CPI_OFFSET) | ||
151 | #define QIC_CALL_FUNCTION_CPI (VIC_CALL_FUNCTION_CPI - QIC_CPI_OFFSET) | ||
152 | #define QIC_CALL_FUNCTION_SINGLE_CPI (VIC_CALL_FUNCTION_SINGLE_CPI - QIC_CPI_OFFSET) | ||
153 | |||
154 | #define VIC_START_FAKE_CPI VIC_TIMER_CPI | ||
155 | #define VIC_END_FAKE_CPI VIC_CALL_FUNCTION_SINGLE_CPI | ||
156 | |||
157 | /* this is the SYS_INT CPI. */ | ||
158 | #define VIC_SYS_INT 8 | ||
159 | #define VIC_CMN_INT 15 | ||
160 | |||
161 | /* This is the boot CPI for alternate processors. It gets overwritten | ||
162 | * by the above once the system has activated all available processors */ | ||
163 | #define VIC_CPU_BOOT_CPI VIC_CPI_LEVEL0 | ||
164 | #define VIC_CPU_BOOT_ERRATA_CPI (VIC_CPI_LEVEL0 + 8) | ||
165 | |||
166 | |||
167 | #endif /* _ASM_X86_IRQ_VECTORS_H */ | 168 | #endif /* _ASM_X86_IRQ_VECTORS_H */ |
diff --git a/arch/x86/include/asm/mach-default/mach_apic.h b/arch/x86/include/asm/mach-default/mach_apic.h deleted file mode 100644 index cc09cbbee27e..000000000000 --- a/arch/x86/include/asm/mach-default/mach_apic.h +++ /dev/null | |||
@@ -1,168 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_APIC_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_APIC_H | ||
3 | |||
4 | #ifdef CONFIG_X86_LOCAL_APIC | ||
5 | |||
6 | #include <mach_apicdef.h> | ||
7 | #include <asm/smp.h> | ||
8 | |||
9 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
10 | |||
11 | static inline const struct cpumask *target_cpus(void) | ||
12 | { | ||
13 | #ifdef CONFIG_SMP | ||
14 | return cpu_online_mask; | ||
15 | #else | ||
16 | return cpumask_of(0); | ||
17 | #endif | ||
18 | } | ||
19 | |||
20 | #define NO_BALANCE_IRQ (0) | ||
21 | #define esr_disable (0) | ||
22 | |||
23 | #ifdef CONFIG_X86_64 | ||
24 | #include <asm/genapic.h> | ||
25 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) | ||
26 | #define INT_DEST_MODE (genapic->int_dest_mode) | ||
27 | #define TARGET_CPUS (genapic->target_cpus()) | ||
28 | #define apic_id_registered (genapic->apic_id_registered) | ||
29 | #define init_apic_ldr (genapic->init_apic_ldr) | ||
30 | #define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid) | ||
31 | #define cpu_mask_to_apicid_and (genapic->cpu_mask_to_apicid_and) | ||
32 | #define phys_pkg_id (genapic->phys_pkg_id) | ||
33 | #define vector_allocation_domain (genapic->vector_allocation_domain) | ||
34 | #define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID))) | ||
35 | #define send_IPI_self (genapic->send_IPI_self) | ||
36 | #define wakeup_secondary_cpu (genapic->wakeup_cpu) | ||
37 | extern void setup_apic_routing(void); | ||
38 | #else | ||
39 | #define INT_DELIVERY_MODE dest_LowestPrio | ||
40 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ | ||
41 | #define TARGET_CPUS (target_cpus()) | ||
42 | #define wakeup_secondary_cpu wakeup_secondary_cpu_via_init | ||
43 | /* | ||
44 | * Set up the logical destination ID. | ||
45 | * | ||
46 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
47 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
48 | * document number 292116). So here it goes... | ||
49 | */ | ||
50 | static inline void init_apic_ldr(void) | ||
51 | { | ||
52 | unsigned long val; | ||
53 | |||
54 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
55 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
56 | val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id()); | ||
57 | apic_write(APIC_LDR, val); | ||
58 | } | ||
59 | |||
60 | static inline int apic_id_registered(void) | ||
61 | { | ||
62 | return physid_isset(read_apic_id(), phys_cpu_present_map); | ||
63 | } | ||
64 | |||
65 | static inline unsigned int cpu_mask_to_apicid(const struct cpumask *cpumask) | ||
66 | { | ||
67 | return cpumask_bits(cpumask)[0]; | ||
68 | } | ||
69 | |||
70 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
71 | const struct cpumask *andmask) | ||
72 | { | ||
73 | unsigned long mask1 = cpumask_bits(cpumask)[0]; | ||
74 | unsigned long mask2 = cpumask_bits(andmask)[0]; | ||
75 | unsigned long mask3 = cpumask_bits(cpu_online_mask)[0]; | ||
76 | |||
77 | return (unsigned int)(mask1 & mask2 & mask3); | ||
78 | } | ||
79 | |||
80 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
81 | { | ||
82 | return cpuid_apic >> index_msb; | ||
83 | } | ||
84 | |||
85 | static inline void setup_apic_routing(void) | ||
86 | { | ||
87 | #ifdef CONFIG_X86_IO_APIC | ||
88 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
89 | "Flat", nr_ioapics); | ||
90 | #endif | ||
91 | } | ||
92 | |||
93 | static inline int apicid_to_node(int logical_apicid) | ||
94 | { | ||
95 | #ifdef CONFIG_SMP | ||
96 | return apicid_2_node[hard_smp_processor_id()]; | ||
97 | #else | ||
98 | return 0; | ||
99 | #endif | ||
100 | } | ||
101 | |||
102 | static inline void vector_allocation_domain(int cpu, struct cpumask *retmask) | ||
103 | { | ||
104 | /* Careful. Some cpus do not strictly honor the set of cpus | ||
105 | * specified in the interrupt destination when using lowest | ||
106 | * priority interrupt delivery mode. | ||
107 | * | ||
108 | * In particular there was a hyperthreading cpu observed to | ||
109 | * deliver interrupts to the wrong hyperthread when only one | ||
110 | * hyperthread was specified in the interrupt desitination. | ||
111 | */ | ||
112 | *retmask = (cpumask_t) { { [0] = APIC_ALL_CPUS } }; | ||
113 | } | ||
114 | #endif | ||
115 | |||
116 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
117 | { | ||
118 | return physid_isset(apicid, bitmap); | ||
119 | } | ||
120 | |||
121 | static inline unsigned long check_apicid_present(int bit) | ||
122 | { | ||
123 | return physid_isset(bit, phys_cpu_present_map); | ||
124 | } | ||
125 | |||
126 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | ||
127 | { | ||
128 | return phys_map; | ||
129 | } | ||
130 | |||
131 | static inline int multi_timer_check(int apic, int irq) | ||
132 | { | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | /* Mapping from cpu number to logical apicid */ | ||
137 | static inline int cpu_to_logical_apicid(int cpu) | ||
138 | { | ||
139 | return 1 << cpu; | ||
140 | } | ||
141 | |||
142 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
143 | { | ||
144 | if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu)) | ||
145 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
146 | else | ||
147 | return BAD_APICID; | ||
148 | } | ||
149 | |||
150 | static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) | ||
151 | { | ||
152 | return physid_mask_of_physid(phys_apicid); | ||
153 | } | ||
154 | |||
155 | static inline void setup_portio_remap(void) | ||
156 | { | ||
157 | } | ||
158 | |||
159 | static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
160 | { | ||
161 | return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map); | ||
162 | } | ||
163 | |||
164 | static inline void enable_apic_mode(void) | ||
165 | { | ||
166 | } | ||
167 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
168 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_APIC_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_apicdef.h b/arch/x86/include/asm/mach-default/mach_apicdef.h deleted file mode 100644 index 53179936d6c6..000000000000 --- a/arch/x86/include/asm/mach-default/mach_apicdef.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H | ||
3 | |||
4 | #include <asm/apic.h> | ||
5 | |||
6 | #ifdef CONFIG_X86_64 | ||
7 | #define APIC_ID_MASK (genapic->apic_id_mask) | ||
8 | #define GET_APIC_ID(x) (genapic->get_apic_id(x)) | ||
9 | #define SET_APIC_ID(x) (genapic->set_apic_id(x)) | ||
10 | #else | ||
11 | #define APIC_ID_MASK (0xF<<24) | ||
12 | static inline unsigned get_apic_id(unsigned long x) | ||
13 | { | ||
14 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | ||
15 | if (APIC_XAPIC(ver)) | ||
16 | return (((x)>>24)&0xFF); | ||
17 | else | ||
18 | return (((x)>>24)&0xF); | ||
19 | } | ||
20 | |||
21 | #define GET_APIC_ID(x) get_apic_id(x) | ||
22 | #endif | ||
23 | |||
24 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_ipi.h b/arch/x86/include/asm/mach-default/mach_ipi.h deleted file mode 100644 index 191312d155da..000000000000 --- a/arch/x86/include/asm/mach-default/mach_ipi.h +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_IPI_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_IPI_H | ||
3 | |||
4 | /* Avoid include hell */ | ||
5 | #define NMI_VECTOR 0x02 | ||
6 | |||
7 | void send_IPI_mask_bitmask(const struct cpumask *mask, int vector); | ||
8 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
9 | void __send_IPI_shortcut(unsigned int shortcut, int vector); | ||
10 | |||
11 | extern int no_broadcast; | ||
12 | |||
13 | #ifdef CONFIG_X86_64 | ||
14 | #include <asm/genapic.h> | ||
15 | #define send_IPI_mask (genapic->send_IPI_mask) | ||
16 | #define send_IPI_mask_allbutself (genapic->send_IPI_mask_allbutself) | ||
17 | #else | ||
18 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | ||
19 | { | ||
20 | send_IPI_mask_bitmask(mask, vector); | ||
21 | } | ||
22 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
23 | #endif | ||
24 | |||
25 | static inline void __local_send_IPI_allbutself(int vector) | ||
26 | { | ||
27 | if (no_broadcast || vector == NMI_VECTOR) | ||
28 | send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
29 | else | ||
30 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); | ||
31 | } | ||
32 | |||
33 | static inline void __local_send_IPI_all(int vector) | ||
34 | { | ||
35 | if (no_broadcast || vector == NMI_VECTOR) | ||
36 | send_IPI_mask(cpu_online_mask, vector); | ||
37 | else | ||
38 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector); | ||
39 | } | ||
40 | |||
41 | #ifdef CONFIG_X86_64 | ||
42 | #define send_IPI_allbutself (genapic->send_IPI_allbutself) | ||
43 | #define send_IPI_all (genapic->send_IPI_all) | ||
44 | #else | ||
45 | static inline void send_IPI_allbutself(int vector) | ||
46 | { | ||
47 | /* | ||
48 | * if there are no other CPUs in the system then we get an APIC send | ||
49 | * error if we try to broadcast, thus avoid sending IPIs in this case. | ||
50 | */ | ||
51 | if (!(num_online_cpus() > 1)) | ||
52 | return; | ||
53 | |||
54 | __local_send_IPI_allbutself(vector); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | static inline void send_IPI_all(int vector) | ||
59 | { | ||
60 | __local_send_IPI_all(vector); | ||
61 | } | ||
62 | #endif | ||
63 | |||
64 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_IPI_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_mpparse.h b/arch/x86/include/asm/mach-default/mach_mpparse.h deleted file mode 100644 index c70a263d68cd..000000000000 --- a/arch/x86/include/asm/mach-default/mach_mpparse.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H | ||
3 | |||
4 | static inline int | ||
5 | mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
6 | { | ||
7 | return 0; | ||
8 | } | ||
9 | |||
10 | /* Hook from generic ACPI tables.c */ | ||
11 | static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
12 | { | ||
13 | return 0; | ||
14 | } | ||
15 | |||
16 | |||
17 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_mpspec.h b/arch/x86/include/asm/mach-default/mach_mpspec.h deleted file mode 100644 index e85ede686be8..000000000000 --- a/arch/x86/include/asm/mach-default/mach_mpspec.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_MPSPEC_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_MPSPEC_H | ||
3 | |||
4 | #define MAX_IRQ_SOURCES 256 | ||
5 | |||
6 | #if CONFIG_BASE_SMALL == 0 | ||
7 | #define MAX_MP_BUSSES 256 | ||
8 | #else | ||
9 | #define MAX_MP_BUSSES 32 | ||
10 | #endif | ||
11 | |||
12 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_MPSPEC_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_wakecpu.h b/arch/x86/include/asm/mach-default/mach_wakecpu.h deleted file mode 100644 index 89897a6a65b9..000000000000 --- a/arch/x86/include/asm/mach-default/mach_wakecpu.h +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H | ||
3 | |||
4 | #define TRAMPOLINE_PHYS_LOW (0x467) | ||
5 | #define TRAMPOLINE_PHYS_HIGH (0x469) | ||
6 | |||
7 | static inline void wait_for_init_deassert(atomic_t *deassert) | ||
8 | { | ||
9 | while (!atomic_read(deassert)) | ||
10 | cpu_relax(); | ||
11 | return; | ||
12 | } | ||
13 | |||
14 | /* Nothing to do for most platforms, since cleared by the INIT cycle */ | ||
15 | static inline void smp_callin_clear_local_apic(void) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | static inline void store_NMI_vector(unsigned short *high, unsigned short *low) | ||
20 | { | ||
21 | } | ||
22 | |||
23 | static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) | ||
24 | { | ||
25 | } | ||
26 | |||
27 | #ifdef CONFIG_SMP | ||
28 | extern void __inquire_remote_apic(int apicid); | ||
29 | #else /* CONFIG_SMP */ | ||
30 | static inline void __inquire_remote_apic(int apicid) | ||
31 | { | ||
32 | } | ||
33 | #endif /* CONFIG_SMP */ | ||
34 | |||
35 | static inline void inquire_remote_apic(int apicid) | ||
36 | { | ||
37 | if (apic_verbosity >= APIC_DEBUG) | ||
38 | __inquire_remote_apic(apicid); | ||
39 | } | ||
40 | |||
41 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/gpio.h b/arch/x86/include/asm/mach-generic/gpio.h deleted file mode 100644 index 995c45efdb33..000000000000 --- a/arch/x86/include/asm/mach-generic/gpio.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_GPIO_H | ||
2 | #define _ASM_X86_MACH_GENERIC_GPIO_H | ||
3 | |||
4 | int gpio_request(unsigned gpio, const char *label); | ||
5 | void gpio_free(unsigned gpio); | ||
6 | int gpio_direction_input(unsigned gpio); | ||
7 | int gpio_direction_output(unsigned gpio, int value); | ||
8 | int gpio_get_value(unsigned gpio); | ||
9 | void gpio_set_value(unsigned gpio, int value); | ||
10 | int gpio_to_irq(unsigned gpio); | ||
11 | int irq_to_gpio(unsigned irq); | ||
12 | |||
13 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
14 | |||
15 | #endif /* _ASM_X86_MACH_GENERIC_GPIO_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_apic.h b/arch/x86/include/asm/mach-generic/mach_apic.h deleted file mode 100644 index 48553e958ad5..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_apic.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_APIC_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_APIC_H | ||
3 | |||
4 | #include <asm/genapic.h> | ||
5 | |||
6 | #define esr_disable (genapic->ESR_DISABLE) | ||
7 | #define NO_BALANCE_IRQ (genapic->no_balance_irq) | ||
8 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) | ||
9 | #define INT_DEST_MODE (genapic->int_dest_mode) | ||
10 | #undef APIC_DEST_LOGICAL | ||
11 | #define APIC_DEST_LOGICAL (genapic->apic_destination_logical) | ||
12 | #define TARGET_CPUS (genapic->target_cpus()) | ||
13 | #define apic_id_registered (genapic->apic_id_registered) | ||
14 | #define init_apic_ldr (genapic->init_apic_ldr) | ||
15 | #define ioapic_phys_id_map (genapic->ioapic_phys_id_map) | ||
16 | #define setup_apic_routing (genapic->setup_apic_routing) | ||
17 | #define multi_timer_check (genapic->multi_timer_check) | ||
18 | #define apicid_to_node (genapic->apicid_to_node) | ||
19 | #define cpu_to_logical_apicid (genapic->cpu_to_logical_apicid) | ||
20 | #define cpu_present_to_apicid (genapic->cpu_present_to_apicid) | ||
21 | #define apicid_to_cpu_present (genapic->apicid_to_cpu_present) | ||
22 | #define setup_portio_remap (genapic->setup_portio_remap) | ||
23 | #define check_apicid_present (genapic->check_apicid_present) | ||
24 | #define check_phys_apicid_present (genapic->check_phys_apicid_present) | ||
25 | #define check_apicid_used (genapic->check_apicid_used) | ||
26 | #define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid) | ||
27 | #define cpu_mask_to_apicid_and (genapic->cpu_mask_to_apicid_and) | ||
28 | #define vector_allocation_domain (genapic->vector_allocation_domain) | ||
29 | #define enable_apic_mode (genapic->enable_apic_mode) | ||
30 | #define phys_pkg_id (genapic->phys_pkg_id) | ||
31 | #define wakeup_secondary_cpu (genapic->wakeup_cpu) | ||
32 | |||
33 | extern void generic_bigsmp_probe(void); | ||
34 | |||
35 | #endif /* _ASM_X86_MACH_GENERIC_MACH_APIC_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_apicdef.h b/arch/x86/include/asm/mach-generic/mach_apicdef.h deleted file mode 100644 index 68041f3802f4..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_apicdef.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_APICDEF_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_APICDEF_H | ||
3 | |||
4 | #ifndef APIC_DEFINITION | ||
5 | #include <asm/genapic.h> | ||
6 | |||
7 | #define GET_APIC_ID (genapic->get_apic_id) | ||
8 | #define APIC_ID_MASK (genapic->apic_id_mask) | ||
9 | #endif | ||
10 | |||
11 | #endif /* _ASM_X86_MACH_GENERIC_MACH_APICDEF_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_ipi.h b/arch/x86/include/asm/mach-generic/mach_ipi.h deleted file mode 100644 index ffd637e3c3d9..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_ipi.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_IPI_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_IPI_H | ||
3 | |||
4 | #include <asm/genapic.h> | ||
5 | |||
6 | #define send_IPI_mask (genapic->send_IPI_mask) | ||
7 | #define send_IPI_allbutself (genapic->send_IPI_allbutself) | ||
8 | #define send_IPI_all (genapic->send_IPI_all) | ||
9 | |||
10 | #endif /* _ASM_X86_MACH_GENERIC_MACH_IPI_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_mpparse.h b/arch/x86/include/asm/mach-generic/mach_mpparse.h deleted file mode 100644 index 9444ab8dca94..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_mpparse.h +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H | ||
3 | |||
4 | |||
5 | extern int mps_oem_check(struct mpc_table *, char *, char *); | ||
6 | |||
7 | extern int acpi_madt_oem_check(char *, char *); | ||
8 | |||
9 | #endif /* _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_mpspec.h b/arch/x86/include/asm/mach-generic/mach_mpspec.h deleted file mode 100644 index 3bc407226578..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_mpspec.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_MPSPEC_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_MPSPEC_H | ||
3 | |||
4 | #define MAX_IRQ_SOURCES 256 | ||
5 | |||
6 | /* Summit or generic (i.e. installer) kernels need lots of bus entries. */ | ||
7 | /* Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. */ | ||
8 | #define MAX_MP_BUSSES 260 | ||
9 | |||
10 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | ||
11 | |||
12 | #endif /* _ASM_X86_MACH_GENERIC_MACH_MPSPEC_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_wakecpu.h b/arch/x86/include/asm/mach-generic/mach_wakecpu.h deleted file mode 100644 index 1ab16b168c8a..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_wakecpu.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H | ||
3 | |||
4 | #define TRAMPOLINE_PHYS_LOW (genapic->trampoline_phys_low) | ||
5 | #define TRAMPOLINE_PHYS_HIGH (genapic->trampoline_phys_high) | ||
6 | #define wait_for_init_deassert (genapic->wait_for_init_deassert) | ||
7 | #define smp_callin_clear_local_apic (genapic->smp_callin_clear_local_apic) | ||
8 | #define store_NMI_vector (genapic->store_NMI_vector) | ||
9 | #define restore_NMI_vector (genapic->restore_NMI_vector) | ||
10 | #define inquire_remote_apic (genapic->inquire_remote_apic) | ||
11 | |||
12 | #endif /* _ASM_X86_MACH_GENERIC_MACH_APIC_H */ | ||
diff --git a/arch/x86/include/asm/mach-rdc321x/gpio.h b/arch/x86/include/asm/mach-rdc321x/gpio.h deleted file mode 100644 index c210ab5788b0..000000000000 --- a/arch/x86/include/asm/mach-rdc321x/gpio.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_RDC321X_GPIO_H | ||
2 | #define _ASM_X86_MACH_RDC321X_GPIO_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | |||
6 | extern int rdc_gpio_get_value(unsigned gpio); | ||
7 | extern void rdc_gpio_set_value(unsigned gpio, int value); | ||
8 | extern int rdc_gpio_direction_input(unsigned gpio); | ||
9 | extern int rdc_gpio_direction_output(unsigned gpio, int value); | ||
10 | extern int rdc_gpio_request(unsigned gpio, const char *label); | ||
11 | extern void rdc_gpio_free(unsigned gpio); | ||
12 | extern void __init rdc321x_gpio_setup(void); | ||
13 | |||
14 | /* Wrappers for the arch-neutral GPIO API */ | ||
15 | |||
16 | static inline int gpio_request(unsigned gpio, const char *label) | ||
17 | { | ||
18 | return rdc_gpio_request(gpio, label); | ||
19 | } | ||
20 | |||
21 | static inline void gpio_free(unsigned gpio) | ||
22 | { | ||
23 | might_sleep(); | ||
24 | rdc_gpio_free(gpio); | ||
25 | } | ||
26 | |||
27 | static inline int gpio_direction_input(unsigned gpio) | ||
28 | { | ||
29 | return rdc_gpio_direction_input(gpio); | ||
30 | } | ||
31 | |||
32 | static inline int gpio_direction_output(unsigned gpio, int value) | ||
33 | { | ||
34 | return rdc_gpio_direction_output(gpio, value); | ||
35 | } | ||
36 | |||
37 | static inline int gpio_get_value(unsigned gpio) | ||
38 | { | ||
39 | return rdc_gpio_get_value(gpio); | ||
40 | } | ||
41 | |||
42 | static inline void gpio_set_value(unsigned gpio, int value) | ||
43 | { | ||
44 | rdc_gpio_set_value(gpio, value); | ||
45 | } | ||
46 | |||
47 | static inline int gpio_to_irq(unsigned gpio) | ||
48 | { | ||
49 | return gpio; | ||
50 | } | ||
51 | |||
52 | static inline int irq_to_gpio(unsigned irq) | ||
53 | { | ||
54 | return irq; | ||
55 | } | ||
56 | |||
57 | /* For cansleep */ | ||
58 | #include <asm-generic/gpio.h> | ||
59 | |||
60 | #endif /* _ASM_X86_MACH_RDC321X_GPIO_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_timer.h b/arch/x86/include/asm/mach_timer.h index 853728519ae9..853728519ae9 100644 --- a/arch/x86/include/asm/mach-default/mach_timer.h +++ b/arch/x86/include/asm/mach_timer.h | |||
diff --git a/arch/x86/include/asm/mach-default/mach_traps.h b/arch/x86/include/asm/mach_traps.h index f7920601e472..f7920601e472 100644 --- a/arch/x86/include/asm/mach-default/mach_traps.h +++ b/arch/x86/include/asm/mach_traps.h | |||
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 8aeeb3fd73db..52948df9cd1d 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h | |||
@@ -21,11 +21,54 @@ static inline void paravirt_activate_mm(struct mm_struct *prev, | |||
21 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | 21 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); |
22 | void destroy_context(struct mm_struct *mm); | 22 | void destroy_context(struct mm_struct *mm); |
23 | 23 | ||
24 | #ifdef CONFIG_X86_32 | 24 | |
25 | # include "mmu_context_32.h" | 25 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) |
26 | #else | 26 | { |
27 | # include "mmu_context_64.h" | 27 | #ifdef CONFIG_SMP |
28 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) | ||
29 | percpu_write(cpu_tlbstate.state, TLBSTATE_LAZY); | ||
30 | #endif | ||
31 | } | ||
32 | |||
33 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
34 | struct task_struct *tsk) | ||
35 | { | ||
36 | unsigned cpu = smp_processor_id(); | ||
37 | |||
38 | if (likely(prev != next)) { | ||
39 | /* stop flush ipis for the previous mm */ | ||
40 | cpu_clear(cpu, prev->cpu_vm_mask); | ||
41 | #ifdef CONFIG_SMP | ||
42 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); | ||
43 | percpu_write(cpu_tlbstate.active_mm, next); | ||
28 | #endif | 44 | #endif |
45 | cpu_set(cpu, next->cpu_vm_mask); | ||
46 | |||
47 | /* Re-load page tables */ | ||
48 | load_cr3(next->pgd); | ||
49 | |||
50 | /* | ||
51 | * load the LDT, if the LDT is different: | ||
52 | */ | ||
53 | if (unlikely(prev->context.ldt != next->context.ldt)) | ||
54 | load_LDT_nolock(&next->context); | ||
55 | } | ||
56 | #ifdef CONFIG_SMP | ||
57 | else { | ||
58 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); | ||
59 | BUG_ON(percpu_read(cpu_tlbstate.active_mm) != next); | ||
60 | |||
61 | if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { | ||
62 | /* We were in lazy tlb mode and leave_mm disabled | ||
63 | * tlb flush IPI delivery. We must reload CR3 | ||
64 | * to make sure to use no freed page tables. | ||
65 | */ | ||
66 | load_cr3(next->pgd); | ||
67 | load_LDT_nolock(&next->context); | ||
68 | } | ||
69 | } | ||
70 | #endif | ||
71 | } | ||
29 | 72 | ||
30 | #define activate_mm(prev, next) \ | 73 | #define activate_mm(prev, next) \ |
31 | do { \ | 74 | do { \ |
@@ -33,5 +76,17 @@ do { \ | |||
33 | switch_mm((prev), (next), NULL); \ | 76 | switch_mm((prev), (next), NULL); \ |
34 | } while (0); | 77 | } while (0); |
35 | 78 | ||
79 | #ifdef CONFIG_X86_32 | ||
80 | #define deactivate_mm(tsk, mm) \ | ||
81 | do { \ | ||
82 | loadsegment(gs, 0); \ | ||
83 | } while (0) | ||
84 | #else | ||
85 | #define deactivate_mm(tsk, mm) \ | ||
86 | do { \ | ||
87 | load_gs_index(0); \ | ||
88 | loadsegment(fs, 0); \ | ||
89 | } while (0) | ||
90 | #endif | ||
36 | 91 | ||
37 | #endif /* _ASM_X86_MMU_CONTEXT_H */ | 92 | #endif /* _ASM_X86_MMU_CONTEXT_H */ |
diff --git a/arch/x86/include/asm/mmu_context_32.h b/arch/x86/include/asm/mmu_context_32.h deleted file mode 100644 index 7e98ce1d2c0e..000000000000 --- a/arch/x86/include/asm/mmu_context_32.h +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MMU_CONTEXT_32_H | ||
2 | #define _ASM_X86_MMU_CONTEXT_32_H | ||
3 | |||
4 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
5 | { | ||
6 | #ifdef CONFIG_SMP | ||
7 | if (x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_OK) | ||
8 | x86_write_percpu(cpu_tlbstate.state, TLBSTATE_LAZY); | ||
9 | #endif | ||
10 | } | ||
11 | |||
12 | static inline void switch_mm(struct mm_struct *prev, | ||
13 | struct mm_struct *next, | ||
14 | struct task_struct *tsk) | ||
15 | { | ||
16 | int cpu = smp_processor_id(); | ||
17 | |||
18 | if (likely(prev != next)) { | ||
19 | /* stop flush ipis for the previous mm */ | ||
20 | cpu_clear(cpu, prev->cpu_vm_mask); | ||
21 | #ifdef CONFIG_SMP | ||
22 | x86_write_percpu(cpu_tlbstate.state, TLBSTATE_OK); | ||
23 | x86_write_percpu(cpu_tlbstate.active_mm, next); | ||
24 | #endif | ||
25 | cpu_set(cpu, next->cpu_vm_mask); | ||
26 | |||
27 | /* Re-load page tables */ | ||
28 | load_cr3(next->pgd); | ||
29 | |||
30 | /* | ||
31 | * load the LDT, if the LDT is different: | ||
32 | */ | ||
33 | if (unlikely(prev->context.ldt != next->context.ldt)) | ||
34 | load_LDT_nolock(&next->context); | ||
35 | } | ||
36 | #ifdef CONFIG_SMP | ||
37 | else { | ||
38 | x86_write_percpu(cpu_tlbstate.state, TLBSTATE_OK); | ||
39 | BUG_ON(x86_read_percpu(cpu_tlbstate.active_mm) != next); | ||
40 | |||
41 | if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { | ||
42 | /* We were in lazy tlb mode and leave_mm disabled | ||
43 | * tlb flush IPI delivery. We must reload %cr3. | ||
44 | */ | ||
45 | load_cr3(next->pgd); | ||
46 | load_LDT_nolock(&next->context); | ||
47 | } | ||
48 | } | ||
49 | #endif | ||
50 | } | ||
51 | |||
52 | #define deactivate_mm(tsk, mm) \ | ||
53 | asm("movl %0,%%gs": :"r" (0)); | ||
54 | |||
55 | #endif /* _ASM_X86_MMU_CONTEXT_32_H */ | ||
diff --git a/arch/x86/include/asm/mmu_context_64.h b/arch/x86/include/asm/mmu_context_64.h deleted file mode 100644 index 677d36e9540a..000000000000 --- a/arch/x86/include/asm/mmu_context_64.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MMU_CONTEXT_64_H | ||
2 | #define _ASM_X86_MMU_CONTEXT_64_H | ||
3 | |||
4 | #include <asm/pda.h> | ||
5 | |||
6 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
7 | { | ||
8 | #ifdef CONFIG_SMP | ||
9 | if (read_pda(mmu_state) == TLBSTATE_OK) | ||
10 | write_pda(mmu_state, TLBSTATE_LAZY); | ||
11 | #endif | ||
12 | } | ||
13 | |||
14 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
15 | struct task_struct *tsk) | ||
16 | { | ||
17 | unsigned cpu = smp_processor_id(); | ||
18 | if (likely(prev != next)) { | ||
19 | /* stop flush ipis for the previous mm */ | ||
20 | cpu_clear(cpu, prev->cpu_vm_mask); | ||
21 | #ifdef CONFIG_SMP | ||
22 | write_pda(mmu_state, TLBSTATE_OK); | ||
23 | write_pda(active_mm, next); | ||
24 | #endif | ||
25 | cpu_set(cpu, next->cpu_vm_mask); | ||
26 | load_cr3(next->pgd); | ||
27 | |||
28 | if (unlikely(next->context.ldt != prev->context.ldt)) | ||
29 | load_LDT_nolock(&next->context); | ||
30 | } | ||
31 | #ifdef CONFIG_SMP | ||
32 | else { | ||
33 | write_pda(mmu_state, TLBSTATE_OK); | ||
34 | if (read_pda(active_mm) != next) | ||
35 | BUG(); | ||
36 | if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { | ||
37 | /* We were in lazy tlb mode and leave_mm disabled | ||
38 | * tlb flush IPI delivery. We must reload CR3 | ||
39 | * to make sure to use no freed page tables. | ||
40 | */ | ||
41 | load_cr3(next->pgd); | ||
42 | load_LDT_nolock(&next->context); | ||
43 | } | ||
44 | } | ||
45 | #endif | ||
46 | } | ||
47 | |||
48 | #define deactivate_mm(tsk, mm) \ | ||
49 | do { \ | ||
50 | load_gs_index(0); \ | ||
51 | asm volatile("movl %0,%%fs"::"r"(0)); \ | ||
52 | } while (0) | ||
53 | |||
54 | #endif /* _ASM_X86_MMU_CONTEXT_64_H */ | ||
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h index 62d14ce3cd00..d22f732eab8f 100644 --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h | |||
@@ -9,7 +9,18 @@ extern int apic_version[MAX_APICS]; | |||
9 | extern int pic_mode; | 9 | extern int pic_mode; |
10 | 10 | ||
11 | #ifdef CONFIG_X86_32 | 11 | #ifdef CONFIG_X86_32 |
12 | #include <mach_mpspec.h> | 12 | |
13 | /* | ||
14 | * Summit or generic (i.e. installer) kernels need lots of bus entries. | ||
15 | * Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. | ||
16 | */ | ||
17 | #if CONFIG_BASE_SMALL == 0 | ||
18 | # define MAX_MP_BUSSES 260 | ||
19 | #else | ||
20 | # define MAX_MP_BUSSES 32 | ||
21 | #endif | ||
22 | |||
23 | #define MAX_IRQ_SOURCES 256 | ||
13 | 24 | ||
14 | extern unsigned int def_to_bigsmp; | 25 | extern unsigned int def_to_bigsmp; |
15 | extern u8 apicid_2_node[]; | 26 | extern u8 apicid_2_node[]; |
@@ -20,15 +31,15 @@ extern int mp_bus_id_to_local[MAX_MP_BUSSES]; | |||
20 | extern int quad_local_to_mp_bus_id [NR_CPUS/4][4]; | 31 | extern int quad_local_to_mp_bus_id [NR_CPUS/4][4]; |
21 | #endif | 32 | #endif |
22 | 33 | ||
23 | #define MAX_APICID 256 | 34 | #define MAX_APICID 256 |
24 | 35 | ||
25 | #else | 36 | #else /* CONFIG_X86_64: */ |
26 | 37 | ||
27 | #define MAX_MP_BUSSES 256 | 38 | #define MAX_MP_BUSSES 256 |
28 | /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ | 39 | /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ |
29 | #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) | 40 | #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) |
30 | 41 | ||
31 | #endif | 42 | #endif /* CONFIG_X86_64 */ |
32 | 43 | ||
33 | extern void early_find_smp_config(void); | 44 | extern void early_find_smp_config(void); |
34 | extern void early_get_smp_config(void); | 45 | extern void early_get_smp_config(void); |
@@ -45,11 +56,13 @@ extern int smp_found_config; | |||
45 | extern int mpc_default_type; | 56 | extern int mpc_default_type; |
46 | extern unsigned long mp_lapic_addr; | 57 | extern unsigned long mp_lapic_addr; |
47 | 58 | ||
48 | extern void find_smp_config(void); | ||
49 | extern void get_smp_config(void); | 59 | extern void get_smp_config(void); |
60 | |||
50 | #ifdef CONFIG_X86_MPPARSE | 61 | #ifdef CONFIG_X86_MPPARSE |
62 | extern void find_smp_config(void); | ||
51 | extern void early_reserve_e820_mpc_new(void); | 63 | extern void early_reserve_e820_mpc_new(void); |
52 | #else | 64 | #else |
65 | static inline void find_smp_config(void) { } | ||
53 | static inline void early_reserve_e820_mpc_new(void) { } | 66 | static inline void early_reserve_e820_mpc_new(void) { } |
54 | #endif | 67 | #endif |
55 | 68 | ||
@@ -142,4 +155,10 @@ static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map) | |||
142 | 155 | ||
143 | extern physid_mask_t phys_cpu_present_map; | 156 | extern physid_mask_t phys_cpu_present_map; |
144 | 157 | ||
158 | extern int generic_mps_oem_check(struct mpc_table *, char *, char *); | ||
159 | |||
160 | extern int default_acpi_madt_oem_check(char *, char *); | ||
161 | |||
162 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | ||
163 | |||
145 | #endif /* _ASM_X86_MPSPEC_H */ | 164 | #endif /* _ASM_X86_MPSPEC_H */ |
diff --git a/arch/x86/include/asm/mpspec_def.h b/arch/x86/include/asm/mpspec_def.h index 59568bc4767f..4a7f96d7c188 100644 --- a/arch/x86/include/asm/mpspec_def.h +++ b/arch/x86/include/asm/mpspec_def.h | |||
@@ -24,17 +24,18 @@ | |||
24 | # endif | 24 | # endif |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | struct intel_mp_floating { | 27 | /* Intel MP Floating Pointer Structure */ |
28 | char mpf_signature[4]; /* "_MP_" */ | 28 | struct mpf_intel { |
29 | unsigned int mpf_physptr; /* Configuration table address */ | 29 | char signature[4]; /* "_MP_" */ |
30 | unsigned char mpf_length; /* Our length (paragraphs) */ | 30 | unsigned int physptr; /* Configuration table address */ |
31 | unsigned char mpf_specification;/* Specification version */ | 31 | unsigned char length; /* Our length (paragraphs) */ |
32 | unsigned char mpf_checksum; /* Checksum (makes sum 0) */ | 32 | unsigned char specification; /* Specification version */ |
33 | unsigned char mpf_feature1; /* Standard or configuration ? */ | 33 | unsigned char checksum; /* Checksum (makes sum 0) */ |
34 | unsigned char mpf_feature2; /* Bit7 set for IMCR|PIC */ | 34 | unsigned char feature1; /* Standard or configuration ? */ |
35 | unsigned char mpf_feature3; /* Unused (0) */ | 35 | unsigned char feature2; /* Bit7 set for IMCR|PIC */ |
36 | unsigned char mpf_feature4; /* Unused (0) */ | 36 | unsigned char feature3; /* Unused (0) */ |
37 | unsigned char mpf_feature5; /* Unused (0) */ | 37 | unsigned char feature4; /* Unused (0) */ |
38 | unsigned char feature5; /* Unused (0) */ | ||
38 | }; | 39 | }; |
39 | 40 | ||
40 | #define MPC_SIGNATURE "PCMP" | 41 | #define MPC_SIGNATURE "PCMP" |
diff --git a/arch/x86/include/asm/numaq/apic.h b/arch/x86/include/asm/numaq/apic.h deleted file mode 100644 index bf37bc49bd8e..000000000000 --- a/arch/x86/include/asm/numaq/apic.h +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_APIC_H | ||
2 | #define __ASM_NUMAQ_APIC_H | ||
3 | |||
4 | #include <asm/io.h> | ||
5 | #include <linux/mmzone.h> | ||
6 | #include <linux/nodemask.h> | ||
7 | |||
8 | #define APIC_DFR_VALUE (APIC_DFR_CLUSTER) | ||
9 | |||
10 | static inline const cpumask_t *target_cpus(void) | ||
11 | { | ||
12 | return &CPU_MASK_ALL; | ||
13 | } | ||
14 | |||
15 | #define NO_BALANCE_IRQ (1) | ||
16 | #define esr_disable (1) | ||
17 | |||
18 | #define INT_DELIVERY_MODE dest_LowestPrio | ||
19 | #define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */ | ||
20 | |||
21 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
22 | { | ||
23 | return physid_isset(apicid, bitmap); | ||
24 | } | ||
25 | static inline unsigned long check_apicid_present(int bit) | ||
26 | { | ||
27 | return physid_isset(bit, phys_cpu_present_map); | ||
28 | } | ||
29 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
30 | |||
31 | static inline int apic_id_registered(void) | ||
32 | { | ||
33 | return 1; | ||
34 | } | ||
35 | |||
36 | static inline void init_apic_ldr(void) | ||
37 | { | ||
38 | /* Already done in NUMA-Q firmware */ | ||
39 | } | ||
40 | |||
41 | static inline void setup_apic_routing(void) | ||
42 | { | ||
43 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
44 | "NUMA-Q", nr_ioapics); | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * Skip adding the timer int on secondary nodes, which causes | ||
49 | * a small but painful rift in the time-space continuum. | ||
50 | */ | ||
51 | static inline int multi_timer_check(int apic, int irq) | ||
52 | { | ||
53 | return apic != 0 && irq == 0; | ||
54 | } | ||
55 | |||
56 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | ||
57 | { | ||
58 | /* We don't have a good way to do this yet - hack */ | ||
59 | return physids_promote(0xFUL); | ||
60 | } | ||
61 | |||
62 | /* Mapping from cpu number to logical apicid */ | ||
63 | extern u8 cpu_2_logical_apicid[]; | ||
64 | static inline int cpu_to_logical_apicid(int cpu) | ||
65 | { | ||
66 | if (cpu >= nr_cpu_ids) | ||
67 | return BAD_APICID; | ||
68 | return (int)cpu_2_logical_apicid[cpu]; | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * Supporting over 60 cpus on NUMA-Q requires a locality-dependent | ||
73 | * cpu to APIC ID relation to properly interact with the intelligent | ||
74 | * mode of the cluster controller. | ||
75 | */ | ||
76 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
77 | { | ||
78 | if (mps_cpu < 60) | ||
79 | return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3)); | ||
80 | else | ||
81 | return BAD_APICID; | ||
82 | } | ||
83 | |||
84 | static inline int apicid_to_node(int logical_apicid) | ||
85 | { | ||
86 | return logical_apicid >> 4; | ||
87 | } | ||
88 | |||
89 | static inline physid_mask_t apicid_to_cpu_present(int logical_apicid) | ||
90 | { | ||
91 | int node = apicid_to_node(logical_apicid); | ||
92 | int cpu = __ffs(logical_apicid & 0xf); | ||
93 | |||
94 | return physid_mask_of_physid(cpu + 4*node); | ||
95 | } | ||
96 | |||
97 | extern void *xquad_portio; | ||
98 | |||
99 | static inline void setup_portio_remap(void) | ||
100 | { | ||
101 | int num_quads = num_online_nodes(); | ||
102 | |||
103 | if (num_quads <= 1) | ||
104 | return; | ||
105 | |||
106 | printk("Remapping cross-quad port I/O for %d quads\n", num_quads); | ||
107 | xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD); | ||
108 | printk("xquad_portio vaddr 0x%08lx, len %08lx\n", | ||
109 | (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD); | ||
110 | } | ||
111 | |||
112 | static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
113 | { | ||
114 | return (1); | ||
115 | } | ||
116 | |||
117 | static inline void enable_apic_mode(void) | ||
118 | { | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * We use physical apicids here, not logical, so just return the default | ||
123 | * physical broadcast to stop people from breaking us | ||
124 | */ | ||
125 | static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
126 | { | ||
127 | return (int) 0xF; | ||
128 | } | ||
129 | |||
130 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
131 | const struct cpumask *andmask) | ||
132 | { | ||
133 | return (int) 0xF; | ||
134 | } | ||
135 | |||
136 | /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */ | ||
137 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
138 | { | ||
139 | return cpuid_apic >> index_msb; | ||
140 | } | ||
141 | |||
142 | #endif /* __ASM_NUMAQ_APIC_H */ | ||
diff --git a/arch/x86/include/asm/numaq/apicdef.h b/arch/x86/include/asm/numaq/apicdef.h deleted file mode 100644 index e012a46cc22a..000000000000 --- a/arch/x86/include/asm/numaq/apicdef.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_APICDEF_H | ||
2 | #define __ASM_NUMAQ_APICDEF_H | ||
3 | |||
4 | |||
5 | #define APIC_ID_MASK (0xF<<24) | ||
6 | |||
7 | static inline unsigned get_apic_id(unsigned long x) | ||
8 | { | ||
9 | return (((x)>>24)&0x0F); | ||
10 | } | ||
11 | |||
12 | #define GET_APIC_ID(x) get_apic_id(x) | ||
13 | |||
14 | #endif | ||
diff --git a/arch/x86/include/asm/numaq/ipi.h b/arch/x86/include/asm/numaq/ipi.h deleted file mode 100644 index a8374c652778..000000000000 --- a/arch/x86/include/asm/numaq/ipi.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_IPI_H | ||
2 | #define __ASM_NUMAQ_IPI_H | ||
3 | |||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | ||
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
6 | |||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | ||
8 | { | ||
9 | send_IPI_mask_sequence(mask, vector); | ||
10 | } | ||
11 | |||
12 | static inline void send_IPI_allbutself(int vector) | ||
13 | { | ||
14 | send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
15 | } | ||
16 | |||
17 | static inline void send_IPI_all(int vector) | ||
18 | { | ||
19 | send_IPI_mask(cpu_online_mask, vector); | ||
20 | } | ||
21 | |||
22 | #endif /* __ASM_NUMAQ_IPI_H */ | ||
diff --git a/arch/x86/include/asm/numaq/mpparse.h b/arch/x86/include/asm/numaq/mpparse.h deleted file mode 100644 index a2eeefcd1cc7..000000000000 --- a/arch/x86/include/asm/numaq/mpparse.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_MPPARSE_H | ||
2 | #define __ASM_NUMAQ_MPPARSE_H | ||
3 | |||
4 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | ||
5 | |||
6 | #endif /* __ASM_NUMAQ_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/numaq/wakecpu.h b/arch/x86/include/asm/numaq/wakecpu.h deleted file mode 100644 index 6f499df8eddb..000000000000 --- a/arch/x86/include/asm/numaq/wakecpu.h +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_WAKECPU_H | ||
2 | #define __ASM_NUMAQ_WAKECPU_H | ||
3 | |||
4 | /* This file copes with machines that wakeup secondary CPUs by NMIs */ | ||
5 | |||
6 | #define TRAMPOLINE_PHYS_LOW (0x8) | ||
7 | #define TRAMPOLINE_PHYS_HIGH (0xa) | ||
8 | |||
9 | /* We don't do anything here because we use NMI's to boot instead */ | ||
10 | static inline void wait_for_init_deassert(atomic_t *deassert) | ||
11 | { | ||
12 | } | ||
13 | |||
14 | /* | ||
15 | * Because we use NMIs rather than the INIT-STARTUP sequence to | ||
16 | * bootstrap the CPUs, the APIC may be in a weird state. Kick it. | ||
17 | */ | ||
18 | static inline void smp_callin_clear_local_apic(void) | ||
19 | { | ||
20 | clear_local_APIC(); | ||
21 | } | ||
22 | |||
23 | static inline void store_NMI_vector(unsigned short *high, unsigned short *low) | ||
24 | { | ||
25 | printk("Storing NMI vector\n"); | ||
26 | *high = | ||
27 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)); | ||
28 | *low = | ||
29 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)); | ||
30 | } | ||
31 | |||
32 | static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) | ||
33 | { | ||
34 | printk("Restoring NMI vector\n"); | ||
35 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) = | ||
36 | *high; | ||
37 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = | ||
38 | *low; | ||
39 | } | ||
40 | |||
41 | static inline void inquire_remote_apic(int apicid) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | #endif /* __ASM_NUMAQ_WAKECPU_H */ | ||
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h index e9873a2e8695..6b9810859daf 100644 --- a/arch/x86/include/asm/page.h +++ b/arch/x86/include/asm/page.h | |||
@@ -147,7 +147,7 @@ static inline pteval_t native_pte_val(pte_t pte) | |||
147 | return pte.pte; | 147 | return pte.pte; |
148 | } | 148 | } |
149 | 149 | ||
150 | static inline pteval_t native_pte_flags(pte_t pte) | 150 | static inline pteval_t pte_flags(pte_t pte) |
151 | { | 151 | { |
152 | return native_pte_val(pte) & PTE_FLAGS_MASK; | 152 | return native_pte_val(pte) & PTE_FLAGS_MASK; |
153 | } | 153 | } |
@@ -173,7 +173,6 @@ static inline pteval_t native_pte_flags(pte_t pte) | |||
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | #define pte_val(x) native_pte_val(x) | 175 | #define pte_val(x) native_pte_val(x) |
176 | #define pte_flags(x) native_pte_flags(x) | ||
177 | #define __pte(x) native_make_pte(x) | 176 | #define __pte(x) native_make_pte(x) |
178 | 177 | ||
179 | #endif /* CONFIG_PARAVIRT */ | 178 | #endif /* CONFIG_PARAVIRT */ |
diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h index 5ebca29f44f0..e27fdbe5f9e4 100644 --- a/arch/x86/include/asm/page_64.h +++ b/arch/x86/include/asm/page_64.h | |||
@@ -13,8 +13,8 @@ | |||
13 | #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1) | 13 | #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1) |
14 | #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) | 14 | #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) |
15 | 15 | ||
16 | #define IRQSTACK_ORDER 2 | 16 | #define IRQ_STACK_ORDER 2 |
17 | #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) | 17 | #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) |
18 | 18 | ||
19 | #define STACKFAULT_STACK 1 | 19 | #define STACKFAULT_STACK 1 |
20 | #define DOUBLEFAULT_STACK 2 | 20 | #define DOUBLEFAULT_STACK 2 |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index ba3e2ff6aedc..7e674ea80f0d 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -244,7 +244,8 @@ struct pv_mmu_ops { | |||
244 | void (*flush_tlb_user)(void); | 244 | void (*flush_tlb_user)(void); |
245 | void (*flush_tlb_kernel)(void); | 245 | void (*flush_tlb_kernel)(void); |
246 | void (*flush_tlb_single)(unsigned long addr); | 246 | void (*flush_tlb_single)(unsigned long addr); |
247 | void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm, | 247 | void (*flush_tlb_others)(const struct cpumask *cpus, |
248 | struct mm_struct *mm, | ||
248 | unsigned long va); | 249 | unsigned long va); |
249 | 250 | ||
250 | /* Hooks for allocating and freeing a pagetable top-level */ | 251 | /* Hooks for allocating and freeing a pagetable top-level */ |
@@ -279,7 +280,6 @@ struct pv_mmu_ops { | |||
279 | pte_t *ptep, pte_t pte); | 280 | pte_t *ptep, pte_t pte); |
280 | 281 | ||
281 | pteval_t (*pte_val)(pte_t); | 282 | pteval_t (*pte_val)(pte_t); |
282 | pteval_t (*pte_flags)(pte_t); | ||
283 | pte_t (*make_pte)(pteval_t pte); | 283 | pte_t (*make_pte)(pteval_t pte); |
284 | 284 | ||
285 | pgdval_t (*pgd_val)(pgd_t); | 285 | pgdval_t (*pgd_val)(pgd_t); |
@@ -984,10 +984,11 @@ static inline void __flush_tlb_single(unsigned long addr) | |||
984 | PVOP_VCALL1(pv_mmu_ops.flush_tlb_single, addr); | 984 | PVOP_VCALL1(pv_mmu_ops.flush_tlb_single, addr); |
985 | } | 985 | } |
986 | 986 | ||
987 | static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, | 987 | static inline void flush_tlb_others(const struct cpumask *cpumask, |
988 | struct mm_struct *mm, | ||
988 | unsigned long va) | 989 | unsigned long va) |
989 | { | 990 | { |
990 | PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va); | 991 | PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, cpumask, mm, va); |
991 | } | 992 | } |
992 | 993 | ||
993 | static inline int paravirt_pgd_alloc(struct mm_struct *mm) | 994 | static inline int paravirt_pgd_alloc(struct mm_struct *mm) |
@@ -1084,23 +1085,6 @@ static inline pteval_t pte_val(pte_t pte) | |||
1084 | return ret; | 1085 | return ret; |
1085 | } | 1086 | } |
1086 | 1087 | ||
1087 | static inline pteval_t pte_flags(pte_t pte) | ||
1088 | { | ||
1089 | pteval_t ret; | ||
1090 | |||
1091 | if (sizeof(pteval_t) > sizeof(long)) | ||
1092 | ret = PVOP_CALL2(pteval_t, pv_mmu_ops.pte_flags, | ||
1093 | pte.pte, (u64)pte.pte >> 32); | ||
1094 | else | ||
1095 | ret = PVOP_CALL1(pteval_t, pv_mmu_ops.pte_flags, | ||
1096 | pte.pte); | ||
1097 | |||
1098 | #ifdef CONFIG_PARAVIRT_DEBUG | ||
1099 | BUG_ON(ret & PTE_PFN_MASK); | ||
1100 | #endif | ||
1101 | return ret; | ||
1102 | } | ||
1103 | |||
1104 | static inline pgd_t __pgd(pgdval_t val) | 1088 | static inline pgd_t __pgd(pgdval_t val) |
1105 | { | 1089 | { |
1106 | pgdval_t ret; | 1090 | pgdval_t ret; |
@@ -1389,8 +1373,6 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, | |||
1389 | void _paravirt_nop(void); | 1373 | void _paravirt_nop(void); |
1390 | #define paravirt_nop ((void *)_paravirt_nop) | 1374 | #define paravirt_nop ((void *)_paravirt_nop) |
1391 | 1375 | ||
1392 | void paravirt_use_bytelocks(void); | ||
1393 | |||
1394 | #ifdef CONFIG_SMP | 1376 | #ifdef CONFIG_SMP |
1395 | 1377 | ||
1396 | static inline int __raw_spin_is_locked(struct raw_spinlock *lock) | 1378 | static inline int __raw_spin_is_locked(struct raw_spinlock *lock) |
diff --git a/arch/x86/include/asm/pat.h b/arch/x86/include/asm/pat.h index b8493b3b9890..9709fdff6615 100644 --- a/arch/x86/include/asm/pat.h +++ b/arch/x86/include/asm/pat.h | |||
@@ -5,10 +5,8 @@ | |||
5 | 5 | ||
6 | #ifdef CONFIG_X86_PAT | 6 | #ifdef CONFIG_X86_PAT |
7 | extern int pat_enabled; | 7 | extern int pat_enabled; |
8 | extern void validate_pat_support(struct cpuinfo_x86 *c); | ||
9 | #else | 8 | #else |
10 | static const int pat_enabled; | 9 | static const int pat_enabled; |
11 | static inline void validate_pat_support(struct cpuinfo_x86 *c) { } | ||
12 | #endif | 10 | #endif |
13 | 11 | ||
14 | extern void pat_init(void); | 12 | extern void pat_init(void); |
@@ -17,6 +15,4 @@ extern int reserve_memtype(u64 start, u64 end, | |||
17 | unsigned long req_type, unsigned long *ret_type); | 15 | unsigned long req_type, unsigned long *ret_type); |
18 | extern int free_memtype(u64 start, u64 end); | 16 | extern int free_memtype(u64 start, u64 end); |
19 | 17 | ||
20 | extern void pat_disable(char *reason); | ||
21 | |||
22 | #endif /* _ASM_X86_PAT_H */ | 18 | #endif /* _ASM_X86_PAT_H */ |
diff --git a/arch/x86/include/asm/mach-default/pci-functions.h b/arch/x86/include/asm/pci-functions.h index ed0bab427354..ed0bab427354 100644 --- a/arch/x86/include/asm/mach-default/pci-functions.h +++ b/arch/x86/include/asm/pci-functions.h | |||
diff --git a/arch/x86/include/asm/pda.h b/arch/x86/include/asm/pda.h deleted file mode 100644 index 2fbfff88df37..000000000000 --- a/arch/x86/include/asm/pda.h +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | #ifndef _ASM_X86_PDA_H | ||
2 | #define _ASM_X86_PDA_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | #include <linux/stddef.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/cache.h> | ||
8 | #include <asm/page.h> | ||
9 | |||
10 | /* Per processor datastructure. %gs points to it while the kernel runs */ | ||
11 | struct x8664_pda { | ||
12 | struct task_struct *pcurrent; /* 0 Current process */ | ||
13 | unsigned long data_offset; /* 8 Per cpu data offset from linker | ||
14 | address */ | ||
15 | unsigned long kernelstack; /* 16 top of kernel stack for current */ | ||
16 | unsigned long oldrsp; /* 24 user rsp for system call */ | ||
17 | int irqcount; /* 32 Irq nesting counter. Starts -1 */ | ||
18 | unsigned int cpunumber; /* 36 Logical CPU number */ | ||
19 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
20 | unsigned long stack_canary; /* 40 stack canary value */ | ||
21 | /* gcc-ABI: this canary MUST be at | ||
22 | offset 40!!! */ | ||
23 | #endif | ||
24 | char *irqstackptr; | ||
25 | short nodenumber; /* number of current node (32k max) */ | ||
26 | short in_bootmem; /* pda lives in bootmem */ | ||
27 | unsigned int __softirq_pending; | ||
28 | unsigned int __nmi_count; /* number of NMI on this CPUs */ | ||
29 | short mmu_state; | ||
30 | short isidle; | ||
31 | struct mm_struct *active_mm; | ||
32 | unsigned apic_timer_irqs; | ||
33 | unsigned irq0_irqs; | ||
34 | unsigned irq_resched_count; | ||
35 | unsigned irq_call_count; | ||
36 | unsigned irq_tlb_count; | ||
37 | unsigned irq_thermal_count; | ||
38 | unsigned irq_threshold_count; | ||
39 | unsigned irq_spurious_count; | ||
40 | } ____cacheline_aligned_in_smp; | ||
41 | |||
42 | extern struct x8664_pda **_cpu_pda; | ||
43 | extern void pda_init(int); | ||
44 | |||
45 | #define cpu_pda(i) (_cpu_pda[i]) | ||
46 | |||
47 | /* | ||
48 | * There is no fast way to get the base address of the PDA, all the accesses | ||
49 | * have to mention %fs/%gs. So it needs to be done this Torvaldian way. | ||
50 | */ | ||
51 | extern void __bad_pda_field(void) __attribute__((noreturn)); | ||
52 | |||
53 | /* | ||
54 | * proxy_pda doesn't actually exist, but tell gcc it is accessed for | ||
55 | * all PDA accesses so it gets read/write dependencies right. | ||
56 | */ | ||
57 | extern struct x8664_pda _proxy_pda; | ||
58 | |||
59 | #define pda_offset(field) offsetof(struct x8664_pda, field) | ||
60 | |||
61 | #define pda_to_op(op, field, val) \ | ||
62 | do { \ | ||
63 | typedef typeof(_proxy_pda.field) T__; \ | ||
64 | if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \ | ||
65 | switch (sizeof(_proxy_pda.field)) { \ | ||
66 | case 2: \ | ||
67 | asm(op "w %1,%%gs:%c2" : \ | ||
68 | "+m" (_proxy_pda.field) : \ | ||
69 | "ri" ((T__)val), \ | ||
70 | "i"(pda_offset(field))); \ | ||
71 | break; \ | ||
72 | case 4: \ | ||
73 | asm(op "l %1,%%gs:%c2" : \ | ||
74 | "+m" (_proxy_pda.field) : \ | ||
75 | "ri" ((T__)val), \ | ||
76 | "i" (pda_offset(field))); \ | ||
77 | break; \ | ||
78 | case 8: \ | ||
79 | asm(op "q %1,%%gs:%c2": \ | ||
80 | "+m" (_proxy_pda.field) : \ | ||
81 | "ri" ((T__)val), \ | ||
82 | "i"(pda_offset(field))); \ | ||
83 | break; \ | ||
84 | default: \ | ||
85 | __bad_pda_field(); \ | ||
86 | } \ | ||
87 | } while (0) | ||
88 | |||
89 | #define pda_from_op(op, field) \ | ||
90 | ({ \ | ||
91 | typeof(_proxy_pda.field) ret__; \ | ||
92 | switch (sizeof(_proxy_pda.field)) { \ | ||
93 | case 2: \ | ||
94 | asm(op "w %%gs:%c1,%0" : \ | ||
95 | "=r" (ret__) : \ | ||
96 | "i" (pda_offset(field)), \ | ||
97 | "m" (_proxy_pda.field)); \ | ||
98 | break; \ | ||
99 | case 4: \ | ||
100 | asm(op "l %%gs:%c1,%0": \ | ||
101 | "=r" (ret__): \ | ||
102 | "i" (pda_offset(field)), \ | ||
103 | "m" (_proxy_pda.field)); \ | ||
104 | break; \ | ||
105 | case 8: \ | ||
106 | asm(op "q %%gs:%c1,%0": \ | ||
107 | "=r" (ret__) : \ | ||
108 | "i" (pda_offset(field)), \ | ||
109 | "m" (_proxy_pda.field)); \ | ||
110 | break; \ | ||
111 | default: \ | ||
112 | __bad_pda_field(); \ | ||
113 | } \ | ||
114 | ret__; \ | ||
115 | }) | ||
116 | |||
117 | #define read_pda(field) pda_from_op("mov", field) | ||
118 | #define write_pda(field, val) pda_to_op("mov", field, val) | ||
119 | #define add_pda(field, val) pda_to_op("add", field, val) | ||
120 | #define sub_pda(field, val) pda_to_op("sub", field, val) | ||
121 | #define or_pda(field, val) pda_to_op("or", field, val) | ||
122 | |||
123 | /* This is not atomic against other CPUs -- CPU preemption needs to be off */ | ||
124 | #define test_and_clear_bit_pda(bit, field) \ | ||
125 | ({ \ | ||
126 | int old__; \ | ||
127 | asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" \ | ||
128 | : "=r" (old__), "+m" (_proxy_pda.field) \ | ||
129 | : "dIr" (bit), "i" (pda_offset(field)) : "memory");\ | ||
130 | old__; \ | ||
131 | }) | ||
132 | |||
133 | #endif | ||
134 | |||
135 | #define PDA_STACKOFFSET (5*8) | ||
136 | |||
137 | #endif /* _ASM_X86_PDA_H */ | ||
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index ece72053ba63..0b64af4f13ac 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -2,53 +2,12 @@ | |||
2 | #define _ASM_X86_PERCPU_H | 2 | #define _ASM_X86_PERCPU_H |
3 | 3 | ||
4 | #ifdef CONFIG_X86_64 | 4 | #ifdef CONFIG_X86_64 |
5 | #include <linux/compiler.h> | 5 | #define __percpu_seg gs |
6 | 6 | #define __percpu_mov_op movq | |
7 | /* Same as asm-generic/percpu.h, except that we store the per cpu offset | 7 | #else |
8 | in the PDA. Longer term the PDA and every per cpu variable | 8 | #define __percpu_seg fs |
9 | should be just put into a single section and referenced directly | 9 | #define __percpu_mov_op movl |
10 | from %gs */ | ||
11 | |||
12 | #ifdef CONFIG_SMP | ||
13 | #include <asm/pda.h> | ||
14 | |||
15 | #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) | ||
16 | #define __my_cpu_offset read_pda(data_offset) | ||
17 | |||
18 | #define per_cpu_offset(x) (__per_cpu_offset(x)) | ||
19 | |||
20 | #endif | 10 | #endif |
21 | #include <asm-generic/percpu.h> | ||
22 | |||
23 | DECLARE_PER_CPU(struct x8664_pda, pda); | ||
24 | |||
25 | /* | ||
26 | * These are supposed to be implemented as a single instruction which | ||
27 | * operates on the per-cpu data base segment. x86-64 doesn't have | ||
28 | * that yet, so this is a fairly inefficient workaround for the | ||
29 | * meantime. The single instruction is atomic with respect to | ||
30 | * preemption and interrupts, so we need to explicitly disable | ||
31 | * interrupts here to achieve the same effect. However, because it | ||
32 | * can be used from within interrupt-disable/enable, we can't actually | ||
33 | * disable interrupts; disabling preemption is enough. | ||
34 | */ | ||
35 | #define x86_read_percpu(var) \ | ||
36 | ({ \ | ||
37 | typeof(per_cpu_var(var)) __tmp; \ | ||
38 | preempt_disable(); \ | ||
39 | __tmp = __get_cpu_var(var); \ | ||
40 | preempt_enable(); \ | ||
41 | __tmp; \ | ||
42 | }) | ||
43 | |||
44 | #define x86_write_percpu(var, val) \ | ||
45 | do { \ | ||
46 | preempt_disable(); \ | ||
47 | __get_cpu_var(var) = (val); \ | ||
48 | preempt_enable(); \ | ||
49 | } while(0) | ||
50 | |||
51 | #else /* CONFIG_X86_64 */ | ||
52 | 11 | ||
53 | #ifdef __ASSEMBLY__ | 12 | #ifdef __ASSEMBLY__ |
54 | 13 | ||
@@ -65,47 +24,26 @@ DECLARE_PER_CPU(struct x8664_pda, pda); | |||
65 | * PER_CPU(cpu_gdt_descr, %ebx) | 24 | * PER_CPU(cpu_gdt_descr, %ebx) |
66 | */ | 25 | */ |
67 | #ifdef CONFIG_SMP | 26 | #ifdef CONFIG_SMP |
68 | #define PER_CPU(var, reg) \ | 27 | #define PER_CPU(var, reg) \ |
69 | movl %fs:per_cpu__##this_cpu_off, reg; \ | 28 | __percpu_mov_op %__percpu_seg:per_cpu__this_cpu_off, reg; \ |
70 | lea per_cpu__##var(reg), reg | 29 | lea per_cpu__##var(reg), reg |
71 | #define PER_CPU_VAR(var) %fs:per_cpu__##var | 30 | #define PER_CPU_VAR(var) %__percpu_seg:per_cpu__##var |
72 | #else /* ! SMP */ | 31 | #else /* ! SMP */ |
73 | #define PER_CPU(var, reg) \ | 32 | #define PER_CPU(var, reg) \ |
74 | movl $per_cpu__##var, reg | 33 | __percpu_mov_op $per_cpu__##var, reg |
75 | #define PER_CPU_VAR(var) per_cpu__##var | 34 | #define PER_CPU_VAR(var) per_cpu__##var |
76 | #endif /* SMP */ | 35 | #endif /* SMP */ |
77 | 36 | ||
78 | #else /* ...!ASSEMBLY */ | 37 | #else /* ...!ASSEMBLY */ |
79 | 38 | ||
80 | /* | 39 | #include <linux/stringify.h> |
81 | * PER_CPU finds an address of a per-cpu variable. | ||
82 | * | ||
83 | * Args: | ||
84 | * var - variable name | ||
85 | * cpu - 32bit register containing the current CPU number | ||
86 | * | ||
87 | * The resulting address is stored in the "cpu" argument. | ||
88 | * | ||
89 | * Example: | ||
90 | * PER_CPU(cpu_gdt_descr, %ebx) | ||
91 | */ | ||
92 | #ifdef CONFIG_SMP | ||
93 | |||
94 | #define __my_cpu_offset x86_read_percpu(this_cpu_off) | ||
95 | 40 | ||
96 | /* fs segment starts at (positive) offset == __per_cpu_offset[cpu] */ | 41 | #ifdef CONFIG_SMP |
97 | #define __percpu_seg "%%fs:" | 42 | #define __percpu_arg(x) "%%"__stringify(__percpu_seg)":%P" #x |
98 | 43 | #define __my_cpu_offset percpu_read(this_cpu_off) | |
99 | #else /* !SMP */ | 44 | #else |
100 | 45 | #define __percpu_arg(x) "%" #x | |
101 | #define __percpu_seg "" | 46 | #endif |
102 | |||
103 | #endif /* SMP */ | ||
104 | |||
105 | #include <asm-generic/percpu.h> | ||
106 | |||
107 | /* We can use this directly for local CPU (faster). */ | ||
108 | DECLARE_PER_CPU(unsigned long, this_cpu_off); | ||
109 | 47 | ||
110 | /* For arch-specific code, we can use direct single-insn ops (they | 48 | /* For arch-specific code, we can use direct single-insn ops (they |
111 | * don't give an lvalue though). */ | 49 | * don't give an lvalue though). */ |
@@ -120,20 +58,25 @@ do { \ | |||
120 | } \ | 58 | } \ |
121 | switch (sizeof(var)) { \ | 59 | switch (sizeof(var)) { \ |
122 | case 1: \ | 60 | case 1: \ |
123 | asm(op "b %1,"__percpu_seg"%0" \ | 61 | asm(op "b %1,"__percpu_arg(0) \ |
124 | : "+m" (var) \ | 62 | : "+m" (var) \ |
125 | : "ri" ((T__)val)); \ | 63 | : "ri" ((T__)val)); \ |
126 | break; \ | 64 | break; \ |
127 | case 2: \ | 65 | case 2: \ |
128 | asm(op "w %1,"__percpu_seg"%0" \ | 66 | asm(op "w %1,"__percpu_arg(0) \ |
129 | : "+m" (var) \ | 67 | : "+m" (var) \ |
130 | : "ri" ((T__)val)); \ | 68 | : "ri" ((T__)val)); \ |
131 | break; \ | 69 | break; \ |
132 | case 4: \ | 70 | case 4: \ |
133 | asm(op "l %1,"__percpu_seg"%0" \ | 71 | asm(op "l %1,"__percpu_arg(0) \ |
134 | : "+m" (var) \ | 72 | : "+m" (var) \ |
135 | : "ri" ((T__)val)); \ | 73 | : "ri" ((T__)val)); \ |
136 | break; \ | 74 | break; \ |
75 | case 8: \ | ||
76 | asm(op "q %1,"__percpu_arg(0) \ | ||
77 | : "+m" (var) \ | ||
78 | : "re" ((T__)val)); \ | ||
79 | break; \ | ||
137 | default: __bad_percpu_size(); \ | 80 | default: __bad_percpu_size(); \ |
138 | } \ | 81 | } \ |
139 | } while (0) | 82 | } while (0) |
@@ -143,17 +86,22 @@ do { \ | |||
143 | typeof(var) ret__; \ | 86 | typeof(var) ret__; \ |
144 | switch (sizeof(var)) { \ | 87 | switch (sizeof(var)) { \ |
145 | case 1: \ | 88 | case 1: \ |
146 | asm(op "b "__percpu_seg"%1,%0" \ | 89 | asm(op "b "__percpu_arg(1)",%0" \ |
147 | : "=r" (ret__) \ | 90 | : "=r" (ret__) \ |
148 | : "m" (var)); \ | 91 | : "m" (var)); \ |
149 | break; \ | 92 | break; \ |
150 | case 2: \ | 93 | case 2: \ |
151 | asm(op "w "__percpu_seg"%1,%0" \ | 94 | asm(op "w "__percpu_arg(1)",%0" \ |
152 | : "=r" (ret__) \ | 95 | : "=r" (ret__) \ |
153 | : "m" (var)); \ | 96 | : "m" (var)); \ |
154 | break; \ | 97 | break; \ |
155 | case 4: \ | 98 | case 4: \ |
156 | asm(op "l "__percpu_seg"%1,%0" \ | 99 | asm(op "l "__percpu_arg(1)",%0" \ |
100 | : "=r" (ret__) \ | ||
101 | : "m" (var)); \ | ||
102 | break; \ | ||
103 | case 8: \ | ||
104 | asm(op "q "__percpu_arg(1)",%0" \ | ||
157 | : "=r" (ret__) \ | 105 | : "=r" (ret__) \ |
158 | : "m" (var)); \ | 106 | : "m" (var)); \ |
159 | break; \ | 107 | break; \ |
@@ -162,13 +110,30 @@ do { \ | |||
162 | ret__; \ | 110 | ret__; \ |
163 | }) | 111 | }) |
164 | 112 | ||
165 | #define x86_read_percpu(var) percpu_from_op("mov", per_cpu__##var) | 113 | #define percpu_read(var) percpu_from_op("mov", per_cpu__##var) |
166 | #define x86_write_percpu(var, val) percpu_to_op("mov", per_cpu__##var, val) | 114 | #define percpu_write(var, val) percpu_to_op("mov", per_cpu__##var, val) |
167 | #define x86_add_percpu(var, val) percpu_to_op("add", per_cpu__##var, val) | 115 | #define percpu_add(var, val) percpu_to_op("add", per_cpu__##var, val) |
168 | #define x86_sub_percpu(var, val) percpu_to_op("sub", per_cpu__##var, val) | 116 | #define percpu_sub(var, val) percpu_to_op("sub", per_cpu__##var, val) |
169 | #define x86_or_percpu(var, val) percpu_to_op("or", per_cpu__##var, val) | 117 | #define percpu_and(var, val) percpu_to_op("and", per_cpu__##var, val) |
118 | #define percpu_or(var, val) percpu_to_op("or", per_cpu__##var, val) | ||
119 | #define percpu_xor(var, val) percpu_to_op("xor", per_cpu__##var, val) | ||
120 | |||
121 | /* This is not atomic against other CPUs -- CPU preemption needs to be off */ | ||
122 | #define x86_test_and_clear_bit_percpu(bit, var) \ | ||
123 | ({ \ | ||
124 | int old__; \ | ||
125 | asm volatile("btr %2,"__percpu_arg(1)"\n\tsbbl %0,%0" \ | ||
126 | : "=r" (old__), "+m" (per_cpu__##var) \ | ||
127 | : "dIr" (bit)); \ | ||
128 | old__; \ | ||
129 | }) | ||
130 | |||
131 | #include <asm-generic/percpu.h> | ||
132 | |||
133 | /* We can use this directly for local CPU (faster). */ | ||
134 | DECLARE_PER_CPU(unsigned long, this_cpu_off); | ||
135 | |||
170 | #endif /* !__ASSEMBLY__ */ | 136 | #endif /* !__ASSEMBLY__ */ |
171 | #endif /* !CONFIG_X86_64 */ | ||
172 | 137 | ||
173 | #ifdef CONFIG_SMP | 138 | #ifdef CONFIG_SMP |
174 | 139 | ||
@@ -195,9 +160,9 @@ do { \ | |||
195 | #define early_per_cpu_ptr(_name) (_name##_early_ptr) | 160 | #define early_per_cpu_ptr(_name) (_name##_early_ptr) |
196 | #define early_per_cpu_map(_name, _idx) (_name##_early_map[_idx]) | 161 | #define early_per_cpu_map(_name, _idx) (_name##_early_map[_idx]) |
197 | #define early_per_cpu(_name, _cpu) \ | 162 | #define early_per_cpu(_name, _cpu) \ |
198 | (early_per_cpu_ptr(_name) ? \ | 163 | *(early_per_cpu_ptr(_name) ? \ |
199 | early_per_cpu_ptr(_name)[_cpu] : \ | 164 | &early_per_cpu_ptr(_name)[_cpu] : \ |
200 | per_cpu(_name, _cpu)) | 165 | &per_cpu(_name, _cpu)) |
201 | 166 | ||
202 | #else /* !CONFIG_SMP */ | 167 | #else /* !CONFIG_SMP */ |
203 | #define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue) \ | 168 | #define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue) \ |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 4f5af8447d54..6f7c102018bf 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -240,64 +240,78 @@ static inline int pmd_large(pmd_t pte) | |||
240 | (_PAGE_PSE | _PAGE_PRESENT); | 240 | (_PAGE_PSE | _PAGE_PRESENT); |
241 | } | 241 | } |
242 | 242 | ||
243 | static inline pte_t pte_set_flags(pte_t pte, pteval_t set) | ||
244 | { | ||
245 | pteval_t v = native_pte_val(pte); | ||
246 | |||
247 | return native_make_pte(v | set); | ||
248 | } | ||
249 | |||
250 | static inline pte_t pte_clear_flags(pte_t pte, pteval_t clear) | ||
251 | { | ||
252 | pteval_t v = native_pte_val(pte); | ||
253 | |||
254 | return native_make_pte(v & ~clear); | ||
255 | } | ||
256 | |||
243 | static inline pte_t pte_mkclean(pte_t pte) | 257 | static inline pte_t pte_mkclean(pte_t pte) |
244 | { | 258 | { |
245 | return __pte(pte_val(pte) & ~_PAGE_DIRTY); | 259 | return pte_clear_flags(pte, _PAGE_DIRTY); |
246 | } | 260 | } |
247 | 261 | ||
248 | static inline pte_t pte_mkold(pte_t pte) | 262 | static inline pte_t pte_mkold(pte_t pte) |
249 | { | 263 | { |
250 | return __pte(pte_val(pte) & ~_PAGE_ACCESSED); | 264 | return pte_clear_flags(pte, _PAGE_ACCESSED); |
251 | } | 265 | } |
252 | 266 | ||
253 | static inline pte_t pte_wrprotect(pte_t pte) | 267 | static inline pte_t pte_wrprotect(pte_t pte) |
254 | { | 268 | { |
255 | return __pte(pte_val(pte) & ~_PAGE_RW); | 269 | return pte_clear_flags(pte, _PAGE_RW); |
256 | } | 270 | } |
257 | 271 | ||
258 | static inline pte_t pte_mkexec(pte_t pte) | 272 | static inline pte_t pte_mkexec(pte_t pte) |
259 | { | 273 | { |
260 | return __pte(pte_val(pte) & ~_PAGE_NX); | 274 | return pte_clear_flags(pte, _PAGE_NX); |
261 | } | 275 | } |
262 | 276 | ||
263 | static inline pte_t pte_mkdirty(pte_t pte) | 277 | static inline pte_t pte_mkdirty(pte_t pte) |
264 | { | 278 | { |
265 | return __pte(pte_val(pte) | _PAGE_DIRTY); | 279 | return pte_set_flags(pte, _PAGE_DIRTY); |
266 | } | 280 | } |
267 | 281 | ||
268 | static inline pte_t pte_mkyoung(pte_t pte) | 282 | static inline pte_t pte_mkyoung(pte_t pte) |
269 | { | 283 | { |
270 | return __pte(pte_val(pte) | _PAGE_ACCESSED); | 284 | return pte_set_flags(pte, _PAGE_ACCESSED); |
271 | } | 285 | } |
272 | 286 | ||
273 | static inline pte_t pte_mkwrite(pte_t pte) | 287 | static inline pte_t pte_mkwrite(pte_t pte) |
274 | { | 288 | { |
275 | return __pte(pte_val(pte) | _PAGE_RW); | 289 | return pte_set_flags(pte, _PAGE_RW); |
276 | } | 290 | } |
277 | 291 | ||
278 | static inline pte_t pte_mkhuge(pte_t pte) | 292 | static inline pte_t pte_mkhuge(pte_t pte) |
279 | { | 293 | { |
280 | return __pte(pte_val(pte) | _PAGE_PSE); | 294 | return pte_set_flags(pte, _PAGE_PSE); |
281 | } | 295 | } |
282 | 296 | ||
283 | static inline pte_t pte_clrhuge(pte_t pte) | 297 | static inline pte_t pte_clrhuge(pte_t pte) |
284 | { | 298 | { |
285 | return __pte(pte_val(pte) & ~_PAGE_PSE); | 299 | return pte_clear_flags(pte, _PAGE_PSE); |
286 | } | 300 | } |
287 | 301 | ||
288 | static inline pte_t pte_mkglobal(pte_t pte) | 302 | static inline pte_t pte_mkglobal(pte_t pte) |
289 | { | 303 | { |
290 | return __pte(pte_val(pte) | _PAGE_GLOBAL); | 304 | return pte_set_flags(pte, _PAGE_GLOBAL); |
291 | } | 305 | } |
292 | 306 | ||
293 | static inline pte_t pte_clrglobal(pte_t pte) | 307 | static inline pte_t pte_clrglobal(pte_t pte) |
294 | { | 308 | { |
295 | return __pte(pte_val(pte) & ~_PAGE_GLOBAL); | 309 | return pte_clear_flags(pte, _PAGE_GLOBAL); |
296 | } | 310 | } |
297 | 311 | ||
298 | static inline pte_t pte_mkspecial(pte_t pte) | 312 | static inline pte_t pte_mkspecial(pte_t pte) |
299 | { | 313 | { |
300 | return __pte(pte_val(pte) | _PAGE_SPECIAL); | 314 | return pte_set_flags(pte, _PAGE_SPECIAL); |
301 | } | 315 | } |
302 | 316 | ||
303 | extern pteval_t __supported_pte_mask; | 317 | extern pteval_t __supported_pte_mask; |
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index ba09289accaa..1df9637dfda3 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <asm/processor.h> | 11 | #include <asm/processor.h> |
12 | #include <linux/bitops.h> | 12 | #include <linux/bitops.h> |
13 | #include <linux/threads.h> | 13 | #include <linux/threads.h> |
14 | #include <asm/pda.h> | ||
15 | 14 | ||
16 | extern pud_t level3_kernel_pgt[512]; | 15 | extern pud_t level3_kernel_pgt[512]; |
17 | extern pud_t level3_ident_pgt[512]; | 16 | extern pud_t level3_ident_pgt[512]; |
diff --git a/arch/x86/include/asm/prctl.h b/arch/x86/include/asm/prctl.h index a8894647dd9a..3ac5032fae09 100644 --- a/arch/x86/include/asm/prctl.h +++ b/arch/x86/include/asm/prctl.h | |||
@@ -6,8 +6,4 @@ | |||
6 | #define ARCH_GET_FS 0x1003 | 6 | #define ARCH_GET_FS 0x1003 |
7 | #define ARCH_GET_GS 0x1004 | 7 | #define ARCH_GET_GS 0x1004 |
8 | 8 | ||
9 | #ifdef CONFIG_X86_64 | ||
10 | extern long sys_arch_prctl(int, unsigned long); | ||
11 | #endif /* CONFIG_X86_64 */ | ||
12 | |||
13 | #endif /* _ASM_X86_PRCTL_H */ | 9 | #endif /* _ASM_X86_PRCTL_H */ |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 091cd8855f2e..84afa0d4d717 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -73,7 +73,7 @@ struct cpuinfo_x86 { | |||
73 | char pad0; | 73 | char pad0; |
74 | #else | 74 | #else |
75 | /* Number of 4K pages in DTLB/ITLB combined(in pages): */ | 75 | /* Number of 4K pages in DTLB/ITLB combined(in pages): */ |
76 | int x86_tlbsize; | 76 | int x86_tlbsize; |
77 | __u8 x86_virt_bits; | 77 | __u8 x86_virt_bits; |
78 | __u8 x86_phys_bits; | 78 | __u8 x86_phys_bits; |
79 | #endif | 79 | #endif |
@@ -378,6 +378,22 @@ union thread_xstate { | |||
378 | 378 | ||
379 | #ifdef CONFIG_X86_64 | 379 | #ifdef CONFIG_X86_64 |
380 | DECLARE_PER_CPU(struct orig_ist, orig_ist); | 380 | DECLARE_PER_CPU(struct orig_ist, orig_ist); |
381 | |||
382 | union irq_stack_union { | ||
383 | char irq_stack[IRQ_STACK_SIZE]; | ||
384 | /* | ||
385 | * GCC hardcodes the stack canary as %gs:40. Since the | ||
386 | * irq_stack is the object at %gs:0, we reserve the bottom | ||
387 | * 48 bytes of the irq stack for the canary. | ||
388 | */ | ||
389 | struct { | ||
390 | char gs_base[40]; | ||
391 | unsigned long stack_canary; | ||
392 | }; | ||
393 | }; | ||
394 | |||
395 | DECLARE_PER_CPU(union irq_stack_union, irq_stack_union); | ||
396 | DECLARE_PER_CPU(char *, irq_stack_ptr); | ||
381 | #endif | 397 | #endif |
382 | 398 | ||
383 | extern void print_cpu_info(struct cpuinfo_x86 *); | 399 | extern void print_cpu_info(struct cpuinfo_x86 *); |
@@ -754,7 +770,6 @@ extern struct desc_ptr early_gdt_descr; | |||
754 | extern void cpu_set_gdt(int); | 770 | extern void cpu_set_gdt(int); |
755 | extern void switch_to_new_gdt(void); | 771 | extern void switch_to_new_gdt(void); |
756 | extern void cpu_init(void); | 772 | extern void cpu_init(void); |
757 | extern void init_gdt(int cpu); | ||
758 | 773 | ||
759 | static inline unsigned long get_debugctlmsr(void) | 774 | static inline unsigned long get_debugctlmsr(void) |
760 | { | 775 | { |
diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h index d6a22f92ba77..49fb3ecf3bb3 100644 --- a/arch/x86/include/asm/proto.h +++ b/arch/x86/include/asm/proto.h | |||
@@ -18,11 +18,7 @@ extern void syscall32_cpu_init(void); | |||
18 | 18 | ||
19 | extern void check_efer(void); | 19 | extern void check_efer(void); |
20 | 20 | ||
21 | #ifdef CONFIG_X86_BIOS_REBOOT | ||
22 | extern int reboot_force; | 21 | extern int reboot_force; |
23 | #else | ||
24 | static const int reboot_force = 0; | ||
25 | #endif | ||
26 | 22 | ||
27 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); | 23 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); |
28 | 24 | ||
diff --git a/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h b/arch/x86/include/asm/rdc321x_defs.h index c8e9c8bed3d0..c8e9c8bed3d0 100644 --- a/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h +++ b/arch/x86/include/asm/rdc321x_defs.h | |||
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index ebe858cdc8a3..45b40278b582 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_X86_SETUP_H | 1 | #ifndef _ASM_X86_SETUP_H |
2 | #define _ASM_X86_SETUP_H | 2 | #define _ASM_X86_SETUP_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
4 | #define COMMAND_LINE_SIZE 2048 | 6 | #define COMMAND_LINE_SIZE 2048 |
5 | 7 | ||
6 | #ifndef __ASSEMBLY__ | 8 | #ifndef __ASSEMBLY__ |
@@ -8,10 +10,8 @@ | |||
8 | /* Interrupt control for vSMPowered x86_64 systems */ | 10 | /* Interrupt control for vSMPowered x86_64 systems */ |
9 | void vsmp_init(void); | 11 | void vsmp_init(void); |
10 | 12 | ||
11 | |||
12 | void setup_bios_corruption_check(void); | 13 | void setup_bios_corruption_check(void); |
13 | 14 | ||
14 | |||
15 | #ifdef CONFIG_X86_VISWS | 15 | #ifdef CONFIG_X86_VISWS |
16 | extern void visws_early_detect(void); | 16 | extern void visws_early_detect(void); |
17 | extern int is_visws_box(void); | 17 | extern int is_visws_box(void); |
@@ -43,7 +43,7 @@ struct x86_quirks { | |||
43 | void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); | 43 | void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); |
44 | void (*mpc_oem_pci_bus)(struct mpc_bus *m); | 44 | void (*mpc_oem_pci_bus)(struct mpc_bus *m); |
45 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, | 45 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, |
46 | unsigned short oemsize); | 46 | unsigned short oemsize); |
47 | int (*setup_ioapic_ids)(void); | 47 | int (*setup_ioapic_ids)(void); |
48 | int (*update_genapic)(void); | 48 | int (*update_genapic)(void); |
49 | }; | 49 | }; |
@@ -56,8 +56,6 @@ extern unsigned long saved_video_mode; | |||
56 | #endif | 56 | #endif |
57 | #endif /* __ASSEMBLY__ */ | 57 | #endif /* __ASSEMBLY__ */ |
58 | 58 | ||
59 | #ifdef __KERNEL__ | ||
60 | |||
61 | #ifdef __i386__ | 59 | #ifdef __i386__ |
62 | 60 | ||
63 | #include <linux/pfn.h> | 61 | #include <linux/pfn.h> |
@@ -100,7 +98,6 @@ extern unsigned long init_pg_tables_start; | |||
100 | extern unsigned long init_pg_tables_end; | 98 | extern unsigned long init_pg_tables_end; |
101 | 99 | ||
102 | #else | 100 | #else |
103 | void __init x86_64_init_pda(void); | ||
104 | void __init x86_64_start_kernel(char *real_mode); | 101 | void __init x86_64_start_kernel(char *real_mode); |
105 | void __init x86_64_start_reservations(char *real_mode_data); | 102 | void __init x86_64_start_reservations(char *real_mode_data); |
106 | 103 | ||
diff --git a/arch/x86/include/asm/mach-default/setup_arch.h b/arch/x86/include/asm/setup_arch.h index 38846208b548..38846208b548 100644 --- a/arch/x86/include/asm/mach-default/setup_arch.h +++ b/arch/x86/include/asm/setup_arch.h | |||
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 19953df61c52..47d0e21f2b9e 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -15,34 +15,8 @@ | |||
15 | # include <asm/io_apic.h> | 15 | # include <asm/io_apic.h> |
16 | # endif | 16 | # endif |
17 | #endif | 17 | #endif |
18 | #include <asm/pda.h> | ||
19 | #include <asm/thread_info.h> | 18 | #include <asm/thread_info.h> |
20 | 19 | #include <asm/cpumask.h> | |
21 | #ifdef CONFIG_X86_64 | ||
22 | |||
23 | extern cpumask_var_t cpu_callin_mask; | ||
24 | extern cpumask_var_t cpu_callout_mask; | ||
25 | extern cpumask_var_t cpu_initialized_mask; | ||
26 | extern cpumask_var_t cpu_sibling_setup_mask; | ||
27 | |||
28 | #else /* CONFIG_X86_32 */ | ||
29 | |||
30 | extern cpumask_t cpu_callin_map; | ||
31 | extern cpumask_t cpu_callout_map; | ||
32 | extern cpumask_t cpu_initialized; | ||
33 | extern cpumask_t cpu_sibling_setup_map; | ||
34 | |||
35 | #define cpu_callin_mask ((struct cpumask *)&cpu_callin_map) | ||
36 | #define cpu_callout_mask ((struct cpumask *)&cpu_callout_map) | ||
37 | #define cpu_initialized_mask ((struct cpumask *)&cpu_initialized) | ||
38 | #define cpu_sibling_setup_mask ((struct cpumask *)&cpu_sibling_setup_map) | ||
39 | |||
40 | #endif /* CONFIG_X86_32 */ | ||
41 | |||
42 | extern void (*mtrr_hook)(void); | ||
43 | extern void zap_low_mappings(void); | ||
44 | |||
45 | extern int __cpuinit get_local_pda(int cpu); | ||
46 | 20 | ||
47 | extern int smp_num_siblings; | 21 | extern int smp_num_siblings; |
48 | extern unsigned int num_processors; | 22 | extern unsigned int num_processors; |
@@ -50,9 +24,7 @@ extern unsigned int num_processors; | |||
50 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 24 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
51 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | 25 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); |
52 | DECLARE_PER_CPU(u16, cpu_llc_id); | 26 | DECLARE_PER_CPU(u16, cpu_llc_id); |
53 | #ifdef CONFIG_X86_32 | ||
54 | DECLARE_PER_CPU(int, cpu_number); | 27 | DECLARE_PER_CPU(int, cpu_number); |
55 | #endif | ||
56 | 28 | ||
57 | static inline struct cpumask *cpu_sibling_mask(int cpu) | 29 | static inline struct cpumask *cpu_sibling_mask(int cpu) |
58 | { | 30 | { |
@@ -167,8 +139,6 @@ void play_dead_common(void); | |||
167 | void native_send_call_func_ipi(const struct cpumask *mask); | 139 | void native_send_call_func_ipi(const struct cpumask *mask); |
168 | void native_send_call_func_single_ipi(int cpu); | 140 | void native_send_call_func_single_ipi(int cpu); |
169 | 141 | ||
170 | extern void prefill_possible_map(void); | ||
171 | |||
172 | void smp_store_cpu_info(int id); | 142 | void smp_store_cpu_info(int id); |
173 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | 143 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
174 | 144 | ||
@@ -177,10 +147,6 @@ static inline int num_booting_cpus(void) | |||
177 | { | 147 | { |
178 | return cpumask_weight(cpu_callout_mask); | 148 | return cpumask_weight(cpu_callout_mask); |
179 | } | 149 | } |
180 | #else | ||
181 | static inline void prefill_possible_map(void) | ||
182 | { | ||
183 | } | ||
184 | #endif /* CONFIG_SMP */ | 150 | #endif /* CONFIG_SMP */ |
185 | 151 | ||
186 | extern unsigned disabled_cpus __cpuinitdata; | 152 | extern unsigned disabled_cpus __cpuinitdata; |
@@ -191,11 +157,11 @@ extern unsigned disabled_cpus __cpuinitdata; | |||
191 | * from the initial startup. We map APIC_BASE very early in page_setup(), | 157 | * from the initial startup. We map APIC_BASE very early in page_setup(), |
192 | * so this is correct in the x86 case. | 158 | * so this is correct in the x86 case. |
193 | */ | 159 | */ |
194 | #define raw_smp_processor_id() (x86_read_percpu(cpu_number)) | 160 | #define raw_smp_processor_id() (percpu_read(cpu_number)) |
195 | extern int safe_smp_processor_id(void); | 161 | extern int safe_smp_processor_id(void); |
196 | 162 | ||
197 | #elif defined(CONFIG_X86_64_SMP) | 163 | #elif defined(CONFIG_X86_64_SMP) |
198 | #define raw_smp_processor_id() read_pda(cpunumber) | 164 | #define raw_smp_processor_id() (percpu_read(cpu_number)) |
199 | 165 | ||
200 | #define stack_smp_processor_id() \ | 166 | #define stack_smp_processor_id() \ |
201 | ({ \ | 167 | ({ \ |
@@ -205,10 +171,6 @@ extern int safe_smp_processor_id(void); | |||
205 | }) | 171 | }) |
206 | #define safe_smp_processor_id() smp_processor_id() | 172 | #define safe_smp_processor_id() smp_processor_id() |
207 | 173 | ||
208 | #else /* !CONFIG_X86_32_SMP && !CONFIG_X86_64_SMP */ | ||
209 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid | ||
210 | #define safe_smp_processor_id() 0 | ||
211 | #define stack_smp_processor_id() 0 | ||
212 | #endif | 174 | #endif |
213 | 175 | ||
214 | #ifdef CONFIG_X86_LOCAL_APIC | 176 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -220,28 +182,9 @@ static inline int logical_smp_processor_id(void) | |||
220 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); | 182 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); |
221 | } | 183 | } |
222 | 184 | ||
223 | #include <mach_apicdef.h> | ||
224 | static inline unsigned int read_apic_id(void) | ||
225 | { | ||
226 | unsigned int reg; | ||
227 | |||
228 | reg = *(u32 *)(APIC_BASE + APIC_ID); | ||
229 | |||
230 | return GET_APIC_ID(reg); | ||
231 | } | ||
232 | #endif | 185 | #endif |
233 | 186 | ||
234 | |||
235 | # if defined(APIC_DEFINITION) || defined(CONFIG_X86_64) | ||
236 | extern int hard_smp_processor_id(void); | 187 | extern int hard_smp_processor_id(void); |
237 | # else | ||
238 | #include <mach_apicdef.h> | ||
239 | static inline int hard_smp_processor_id(void) | ||
240 | { | ||
241 | /* we don't want to mark this access volatile - bad code generation */ | ||
242 | return read_apic_id(); | ||
243 | } | ||
244 | # endif /* APIC_DEFINITION */ | ||
245 | 188 | ||
246 | #else /* CONFIG_X86_LOCAL_APIC */ | 189 | #else /* CONFIG_X86_LOCAL_APIC */ |
247 | 190 | ||
@@ -251,11 +194,5 @@ static inline int hard_smp_processor_id(void) | |||
251 | 194 | ||
252 | #endif /* CONFIG_X86_LOCAL_APIC */ | 195 | #endif /* CONFIG_X86_LOCAL_APIC */ |
253 | 196 | ||
254 | #ifdef CONFIG_X86_HAS_BOOT_CPU_ID | ||
255 | extern unsigned char boot_cpu_id; | ||
256 | #else | ||
257 | #define boot_cpu_id 0 | ||
258 | #endif | ||
259 | |||
260 | #endif /* __ASSEMBLY__ */ | 197 | #endif /* __ASSEMBLY__ */ |
261 | #endif /* _ASM_X86_SMP_H */ | 198 | #endif /* _ASM_X86_SMP_H */ |
diff --git a/arch/x86/include/asm/mach-default/smpboot_hooks.h b/arch/x86/include/asm/smpboot_hooks.h index 23bf52103b89..1def60114906 100644 --- a/arch/x86/include/asm/mach-default/smpboot_hooks.h +++ b/arch/x86/include/asm/smpboot_hooks.h | |||
@@ -13,10 +13,10 @@ static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) | |||
13 | CMOS_WRITE(0xa, 0xf); | 13 | CMOS_WRITE(0xa, 0xf); |
14 | local_flush_tlb(); | 14 | local_flush_tlb(); |
15 | pr_debug("1.\n"); | 15 | pr_debug("1.\n"); |
16 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) = | 16 | *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_high)) = |
17 | start_eip >> 4; | 17 | start_eip >> 4; |
18 | pr_debug("2.\n"); | 18 | pr_debug("2.\n"); |
19 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = | 19 | *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_low)) = |
20 | start_eip & 0xf; | 20 | start_eip & 0xf; |
21 | pr_debug("3.\n"); | 21 | pr_debug("3.\n"); |
22 | } | 22 | } |
@@ -34,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void) | |||
34 | */ | 34 | */ |
35 | CMOS_WRITE(0, 0xf); | 35 | CMOS_WRITE(0, 0xf); |
36 | 36 | ||
37 | *((volatile long *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0; | 37 | *((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline void __init smpboot_setup_io_apic(void) | 40 | static inline void __init smpboot_setup_io_apic(void) |
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index d17c91981da2..139b4249a5ec 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h | |||
@@ -172,70 +172,8 @@ static inline int __ticket_spin_is_contended(raw_spinlock_t *lock) | |||
172 | return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1; | 172 | return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1; |
173 | } | 173 | } |
174 | 174 | ||
175 | #ifdef CONFIG_PARAVIRT | 175 | #ifndef CONFIG_PARAVIRT |
176 | /* | ||
177 | * Define virtualization-friendly old-style lock byte lock, for use in | ||
178 | * pv_lock_ops if desired. | ||
179 | * | ||
180 | * This differs from the pre-2.6.24 spinlock by always using xchgb | ||
181 | * rather than decb to take the lock; this allows it to use a | ||
182 | * zero-initialized lock structure. It also maintains a 1-byte | ||
183 | * contention counter, so that we can implement | ||
184 | * __byte_spin_is_contended. | ||
185 | */ | ||
186 | struct __byte_spinlock { | ||
187 | s8 lock; | ||
188 | s8 spinners; | ||
189 | }; | ||
190 | |||
191 | static inline int __byte_spin_is_locked(raw_spinlock_t *lock) | ||
192 | { | ||
193 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
194 | return bl->lock != 0; | ||
195 | } | ||
196 | |||
197 | static inline int __byte_spin_is_contended(raw_spinlock_t *lock) | ||
198 | { | ||
199 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
200 | return bl->spinners != 0; | ||
201 | } | ||
202 | |||
203 | static inline void __byte_spin_lock(raw_spinlock_t *lock) | ||
204 | { | ||
205 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
206 | s8 val = 1; | ||
207 | |||
208 | asm("1: xchgb %1, %0\n" | ||
209 | " test %1,%1\n" | ||
210 | " jz 3f\n" | ||
211 | " " LOCK_PREFIX "incb %2\n" | ||
212 | "2: rep;nop\n" | ||
213 | " cmpb $1, %0\n" | ||
214 | " je 2b\n" | ||
215 | " " LOCK_PREFIX "decb %2\n" | ||
216 | " jmp 1b\n" | ||
217 | "3:" | ||
218 | : "+m" (bl->lock), "+q" (val), "+m" (bl->spinners): : "memory"); | ||
219 | } | ||
220 | |||
221 | static inline int __byte_spin_trylock(raw_spinlock_t *lock) | ||
222 | { | ||
223 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
224 | u8 old = 1; | ||
225 | |||
226 | asm("xchgb %1,%0" | ||
227 | : "+m" (bl->lock), "+q" (old) : : "memory"); | ||
228 | 176 | ||
229 | return old == 0; | ||
230 | } | ||
231 | |||
232 | static inline void __byte_spin_unlock(raw_spinlock_t *lock) | ||
233 | { | ||
234 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
235 | smp_wmb(); | ||
236 | bl->lock = 0; | ||
237 | } | ||
238 | #else /* !CONFIG_PARAVIRT */ | ||
239 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) | 177 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) |
240 | { | 178 | { |
241 | return __ticket_spin_is_locked(lock); | 179 | return __ticket_spin_is_locked(lock); |
@@ -267,7 +205,7 @@ static __always_inline void __raw_spin_lock_flags(raw_spinlock_t *lock, | |||
267 | __raw_spin_lock(lock); | 205 | __raw_spin_lock(lock); |
268 | } | 206 | } |
269 | 207 | ||
270 | #endif /* CONFIG_PARAVIRT */ | 208 | #endif |
271 | 209 | ||
272 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) | 210 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) |
273 | { | 211 | { |
@@ -329,8 +267,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *lock) | |||
329 | { | 267 | { |
330 | atomic_t *count = (atomic_t *)lock; | 268 | atomic_t *count = (atomic_t *)lock; |
331 | 269 | ||
332 | atomic_dec(count); | 270 | if (atomic_dec_return(count) >= 0) |
333 | if (atomic_read(count) >= 0) | ||
334 | return 1; | 271 | return 1; |
335 | atomic_inc(count); | 272 | atomic_inc(count); |
336 | return 0; | 273 | return 0; |
diff --git a/arch/x86/include/asm/stackprotector.h b/arch/x86/include/asm/stackprotector.h new file mode 100644 index 000000000000..36a700acaf2b --- /dev/null +++ b/arch/x86/include/asm/stackprotector.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef _ASM_STACKPROTECTOR_H | ||
2 | #define _ASM_STACKPROTECTOR_H 1 | ||
3 | |||
4 | #include <asm/tsc.h> | ||
5 | #include <asm/processor.h> | ||
6 | |||
7 | /* | ||
8 | * Initialize the stackprotector canary value. | ||
9 | * | ||
10 | * NOTE: this must only be called from functions that never return, | ||
11 | * and it must always be inlined. | ||
12 | */ | ||
13 | static __always_inline void boot_init_stack_canary(void) | ||
14 | { | ||
15 | u64 canary; | ||
16 | u64 tsc; | ||
17 | |||
18 | /* | ||
19 | * Build time only check to make sure the stack_canary is at | ||
20 | * offset 40 in the pda; this is a gcc ABI requirement | ||
21 | */ | ||
22 | BUILD_BUG_ON(offsetof(union irq_stack_union, stack_canary) != 40); | ||
23 | |||
24 | /* | ||
25 | * We both use the random pool and the current TSC as a source | ||
26 | * of randomness. The TSC only matters for very early init, | ||
27 | * there it already has some randomness on most systems. Later | ||
28 | * on during the bootup the random pool has true entropy too. | ||
29 | */ | ||
30 | get_random_bytes(&canary, sizeof(canary)); | ||
31 | tsc = __native_read_tsc(); | ||
32 | canary += tsc + (tsc << 32UL); | ||
33 | |||
34 | current->stack_canary = canary; | ||
35 | percpu_write(irq_stack_union.stack_canary, canary); | ||
36 | } | ||
37 | |||
38 | #endif | ||
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h deleted file mode 100644 index 93d2c8667cfe..000000000000 --- a/arch/x86/include/asm/summit/apic.h +++ /dev/null | |||
@@ -1,202 +0,0 @@ | |||
1 | #ifndef __ASM_SUMMIT_APIC_H | ||
2 | #define __ASM_SUMMIT_APIC_H | ||
3 | |||
4 | #include <asm/smp.h> | ||
5 | #include <linux/gfp.h> | ||
6 | |||
7 | #define esr_disable (1) | ||
8 | #define NO_BALANCE_IRQ (0) | ||
9 | |||
10 | /* In clustered mode, the high nibble of APIC ID is a cluster number. | ||
11 | * The low nibble is a 4-bit bitmap. */ | ||
12 | #define XAPIC_DEST_CPUS_SHIFT 4 | ||
13 | #define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1) | ||
14 | #define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT) | ||
15 | |||
16 | #define APIC_DFR_VALUE (APIC_DFR_CLUSTER) | ||
17 | |||
18 | static inline const cpumask_t *target_cpus(void) | ||
19 | { | ||
20 | /* CPU_MASK_ALL (0xff) has undefined behaviour with | ||
21 | * dest_LowestPrio mode logical clustered apic interrupt routing | ||
22 | * Just start on cpu 0. IRQ balancing will spread load | ||
23 | */ | ||
24 | return &cpumask_of_cpu(0); | ||
25 | } | ||
26 | |||
27 | #define INT_DELIVERY_MODE (dest_LowestPrio) | ||
28 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ | ||
29 | |||
30 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
31 | { | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | /* we don't use the phys_cpu_present_map to indicate apicid presence */ | ||
36 | static inline unsigned long check_apicid_present(int bit) | ||
37 | { | ||
38 | return 1; | ||
39 | } | ||
40 | |||
41 | #define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK) | ||
42 | |||
43 | extern u8 cpu_2_logical_apicid[]; | ||
44 | |||
45 | static inline void init_apic_ldr(void) | ||
46 | { | ||
47 | unsigned long val, id; | ||
48 | int count = 0; | ||
49 | u8 my_id = (u8)hard_smp_processor_id(); | ||
50 | u8 my_cluster = (u8)apicid_cluster(my_id); | ||
51 | #ifdef CONFIG_SMP | ||
52 | u8 lid; | ||
53 | int i; | ||
54 | |||
55 | /* Create logical APIC IDs by counting CPUs already in cluster. */ | ||
56 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { | ||
57 | lid = cpu_2_logical_apicid[i]; | ||
58 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) | ||
59 | ++count; | ||
60 | } | ||
61 | #endif | ||
62 | /* We only have a 4 wide bitmap in cluster mode. If a deranged | ||
63 | * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */ | ||
64 | BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT); | ||
65 | id = my_cluster | (1UL << count); | ||
66 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
67 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
68 | val |= SET_APIC_LOGICAL_ID(id); | ||
69 | apic_write(APIC_LDR, val); | ||
70 | } | ||
71 | |||
72 | static inline int multi_timer_check(int apic, int irq) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static inline int apic_id_registered(void) | ||
78 | { | ||
79 | return 1; | ||
80 | } | ||
81 | |||
82 | static inline void setup_apic_routing(void) | ||
83 | { | ||
84 | printk("Enabling APIC mode: Summit. Using %d I/O APICs\n", | ||
85 | nr_ioapics); | ||
86 | } | ||
87 | |||
88 | static inline int apicid_to_node(int logical_apicid) | ||
89 | { | ||
90 | #ifdef CONFIG_SMP | ||
91 | return apicid_2_node[hard_smp_processor_id()]; | ||
92 | #else | ||
93 | return 0; | ||
94 | #endif | ||
95 | } | ||
96 | |||
97 | /* Mapping from cpu number to logical apicid */ | ||
98 | static inline int cpu_to_logical_apicid(int cpu) | ||
99 | { | ||
100 | #ifdef CONFIG_SMP | ||
101 | if (cpu >= nr_cpu_ids) | ||
102 | return BAD_APICID; | ||
103 | return (int)cpu_2_logical_apicid[cpu]; | ||
104 | #else | ||
105 | return logical_smp_processor_id(); | ||
106 | #endif | ||
107 | } | ||
108 | |||
109 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
110 | { | ||
111 | if (mps_cpu < nr_cpu_ids) | ||
112 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
113 | else | ||
114 | return BAD_APICID; | ||
115 | } | ||
116 | |||
117 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_id_map) | ||
118 | { | ||
119 | /* For clustered we don't have a good way to do this yet - hack */ | ||
120 | return physids_promote(0x0F); | ||
121 | } | ||
122 | |||
123 | static inline physid_mask_t apicid_to_cpu_present(int apicid) | ||
124 | { | ||
125 | return physid_mask_of_physid(0); | ||
126 | } | ||
127 | |||
128 | static inline void setup_portio_remap(void) | ||
129 | { | ||
130 | } | ||
131 | |||
132 | static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
133 | { | ||
134 | return 1; | ||
135 | } | ||
136 | |||
137 | static inline void enable_apic_mode(void) | ||
138 | { | ||
139 | } | ||
140 | |||
141 | static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
142 | { | ||
143 | int num_bits_set; | ||
144 | int cpus_found = 0; | ||
145 | int cpu; | ||
146 | int apicid; | ||
147 | |||
148 | num_bits_set = cpus_weight(*cpumask); | ||
149 | /* Return id to all */ | ||
150 | if (num_bits_set >= nr_cpu_ids) | ||
151 | return (int) 0xFF; | ||
152 | /* | ||
153 | * The cpus in the mask must all be on the apic cluster. If are not | ||
154 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
155 | */ | ||
156 | cpu = first_cpu(*cpumask); | ||
157 | apicid = cpu_to_logical_apicid(cpu); | ||
158 | while (cpus_found < num_bits_set) { | ||
159 | if (cpu_isset(cpu, *cpumask)) { | ||
160 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
161 | if (apicid_cluster(apicid) != | ||
162 | apicid_cluster(new_apicid)){ | ||
163 | printk ("%s: Not a valid mask!\n", __func__); | ||
164 | return 0xFF; | ||
165 | } | ||
166 | apicid = apicid | new_apicid; | ||
167 | cpus_found++; | ||
168 | } | ||
169 | cpu++; | ||
170 | } | ||
171 | return apicid; | ||
172 | } | ||
173 | |||
174 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | ||
175 | const struct cpumask *andmask) | ||
176 | { | ||
177 | int apicid = cpu_to_logical_apicid(0); | ||
178 | cpumask_var_t cpumask; | ||
179 | |||
180 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) | ||
181 | return apicid; | ||
182 | |||
183 | cpumask_and(cpumask, inmask, andmask); | ||
184 | cpumask_and(cpumask, cpumask, cpu_online_mask); | ||
185 | apicid = cpu_mask_to_apicid(cpumask); | ||
186 | |||
187 | free_cpumask_var(cpumask); | ||
188 | return apicid; | ||
189 | } | ||
190 | |||
191 | /* cpuid returns the value latched in the HW at reset, not the APIC ID | ||
192 | * register's value. For any box whose BIOS changes APIC IDs, like | ||
193 | * clustered APIC systems, we must use hard_smp_processor_id. | ||
194 | * | ||
195 | * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. | ||
196 | */ | ||
197 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
198 | { | ||
199 | return hard_smp_processor_id() >> index_msb; | ||
200 | } | ||
201 | |||
202 | #endif /* __ASM_SUMMIT_APIC_H */ | ||
diff --git a/arch/x86/include/asm/summit/apicdef.h b/arch/x86/include/asm/summit/apicdef.h deleted file mode 100644 index f3fbca1f61c1..000000000000 --- a/arch/x86/include/asm/summit/apicdef.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #ifndef __ASM_SUMMIT_APICDEF_H | ||
2 | #define __ASM_SUMMIT_APICDEF_H | ||
3 | |||
4 | #define APIC_ID_MASK (0xFF<<24) | ||
5 | |||
6 | static inline unsigned get_apic_id(unsigned long x) | ||
7 | { | ||
8 | return (x>>24)&0xFF; | ||
9 | } | ||
10 | |||
11 | #define GET_APIC_ID(x) get_apic_id(x) | ||
12 | |||
13 | #endif | ||
diff --git a/arch/x86/include/asm/summit/ipi.h b/arch/x86/include/asm/summit/ipi.h deleted file mode 100644 index a8a2c24f50cc..000000000000 --- a/arch/x86/include/asm/summit/ipi.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | #ifndef __ASM_SUMMIT_IPI_H | ||
2 | #define __ASM_SUMMIT_IPI_H | ||
3 | |||
4 | void send_IPI_mask_sequence(const cpumask_t *mask, int vector); | ||
5 | void send_IPI_mask_allbutself(const cpumask_t *mask, int vector); | ||
6 | |||
7 | static inline void send_IPI_mask(const cpumask_t *mask, int vector) | ||
8 | { | ||
9 | send_IPI_mask_sequence(mask, vector); | ||
10 | } | ||
11 | |||
12 | static inline void send_IPI_allbutself(int vector) | ||
13 | { | ||
14 | cpumask_t mask = cpu_online_map; | ||
15 | cpu_clear(smp_processor_id(), mask); | ||
16 | |||
17 | if (!cpus_empty(mask)) | ||
18 | send_IPI_mask(&mask, vector); | ||
19 | } | ||
20 | |||
21 | static inline void send_IPI_all(int vector) | ||
22 | { | ||
23 | send_IPI_mask(&cpu_online_map, vector); | ||
24 | } | ||
25 | |||
26 | #endif /* __ASM_SUMMIT_IPI_H */ | ||
diff --git a/arch/x86/include/asm/summit/mpparse.h b/arch/x86/include/asm/summit/mpparse.h deleted file mode 100644 index 380e86c02363..000000000000 --- a/arch/x86/include/asm/summit/mpparse.h +++ /dev/null | |||
@@ -1,109 +0,0 @@ | |||
1 | #ifndef __ASM_SUMMIT_MPPARSE_H | ||
2 | #define __ASM_SUMMIT_MPPARSE_H | ||
3 | |||
4 | #include <asm/tsc.h> | ||
5 | |||
6 | extern int use_cyclone; | ||
7 | |||
8 | #ifdef CONFIG_X86_SUMMIT_NUMA | ||
9 | extern void setup_summit(void); | ||
10 | #else | ||
11 | #define setup_summit() {} | ||
12 | #endif | ||
13 | |||
14 | static inline int mps_oem_check(struct mpc_table *mpc, char *oem, | ||
15 | char *productid) | ||
16 | { | ||
17 | if (!strncmp(oem, "IBM ENSW", 8) && | ||
18 | (!strncmp(productid, "VIGIL SMP", 9) | ||
19 | || !strncmp(productid, "EXA", 3) | ||
20 | || !strncmp(productid, "RUTHLESS SMP", 12))){ | ||
21 | mark_tsc_unstable("Summit based system"); | ||
22 | use_cyclone = 1; /*enable cyclone-timer*/ | ||
23 | setup_summit(); | ||
24 | return 1; | ||
25 | } | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | /* Hook from generic ACPI tables.c */ | ||
30 | static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
31 | { | ||
32 | if (!strncmp(oem_id, "IBM", 3) && | ||
33 | (!strncmp(oem_table_id, "SERVIGIL", 8) | ||
34 | || !strncmp(oem_table_id, "EXA", 3))){ | ||
35 | mark_tsc_unstable("Summit based system"); | ||
36 | use_cyclone = 1; /*enable cyclone-timer*/ | ||
37 | setup_summit(); | ||
38 | return 1; | ||
39 | } | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | struct rio_table_hdr { | ||
44 | unsigned char version; /* Version number of this data structure */ | ||
45 | /* Version 3 adds chassis_num & WP_index */ | ||
46 | unsigned char num_scal_dev; /* # of Scalability devices (Twisters for Vigil) */ | ||
47 | unsigned char num_rio_dev; /* # of RIO I/O devices (Cyclones and Winnipegs) */ | ||
48 | } __attribute__((packed)); | ||
49 | |||
50 | struct scal_detail { | ||
51 | unsigned char node_id; /* Scalability Node ID */ | ||
52 | unsigned long CBAR; /* Address of 1MB register space */ | ||
53 | unsigned char port0node; /* Node ID port connected to: 0xFF=None */ | ||
54 | unsigned char port0port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
55 | unsigned char port1node; /* Node ID port connected to: 0xFF = None */ | ||
56 | unsigned char port1port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
57 | unsigned char port2node; /* Node ID port connected to: 0xFF = None */ | ||
58 | unsigned char port2port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
59 | unsigned char chassis_num; /* 1 based Chassis number (1 = boot node) */ | ||
60 | } __attribute__((packed)); | ||
61 | |||
62 | struct rio_detail { | ||
63 | unsigned char node_id; /* RIO Node ID */ | ||
64 | unsigned long BBAR; /* Address of 1MB register space */ | ||
65 | unsigned char type; /* Type of device */ | ||
66 | unsigned char owner_id; /* For WPEG: Node ID of Cyclone that owns this WPEG*/ | ||
67 | /* For CYC: Node ID of Twister that owns this CYC */ | ||
68 | unsigned char port0node; /* Node ID port connected to: 0xFF=None */ | ||
69 | unsigned char port0port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
70 | unsigned char port1node; /* Node ID port connected to: 0xFF=None */ | ||
71 | unsigned char port1port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
72 | unsigned char first_slot; /* For WPEG: Lowest slot number below this WPEG */ | ||
73 | /* For CYC: 0 */ | ||
74 | unsigned char status; /* For WPEG: Bit 0 = 1 : the XAPIC is used */ | ||
75 | /* = 0 : the XAPIC is not used, ie:*/ | ||
76 | /* ints fwded to another XAPIC */ | ||
77 | /* Bits1:7 Reserved */ | ||
78 | /* For CYC: Bits0:7 Reserved */ | ||
79 | unsigned char WP_index; /* For WPEG: WPEG instance index - lower ones have */ | ||
80 | /* lower slot numbers/PCI bus numbers */ | ||
81 | /* For CYC: No meaning */ | ||
82 | unsigned char chassis_num; /* 1 based Chassis number */ | ||
83 | /* For LookOut WPEGs this field indicates the */ | ||
84 | /* Expansion Chassis #, enumerated from Boot */ | ||
85 | /* Node WPEG external port, then Boot Node CYC */ | ||
86 | /* external port, then Next Vigil chassis WPEG */ | ||
87 | /* external port, etc. */ | ||
88 | /* Shared Lookouts have only 1 chassis number (the */ | ||
89 | /* first one assigned) */ | ||
90 | } __attribute__((packed)); | ||
91 | |||
92 | |||
93 | typedef enum { | ||
94 | CompatTwister = 0, /* Compatibility Twister */ | ||
95 | AltTwister = 1, /* Alternate Twister of internal 8-way */ | ||
96 | CompatCyclone = 2, /* Compatibility Cyclone */ | ||
97 | AltCyclone = 3, /* Alternate Cyclone of internal 8-way */ | ||
98 | CompatWPEG = 4, /* Compatibility WPEG */ | ||
99 | AltWPEG = 5, /* Second Planar WPEG */ | ||
100 | LookOutAWPEG = 6, /* LookOut WPEG */ | ||
101 | LookOutBWPEG = 7, /* LookOut WPEG */ | ||
102 | } node_type; | ||
103 | |||
104 | static inline int is_WPEG(struct rio_detail *rio){ | ||
105 | return (rio->type == CompatWPEG || rio->type == AltWPEG || | ||
106 | rio->type == LookOutAWPEG || rio->type == LookOutBWPEG); | ||
107 | } | ||
108 | |||
109 | #endif /* __ASM_SUMMIT_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index 8e626ea33a1a..c22383743f36 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -86,27 +86,44 @@ do { \ | |||
86 | , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \ | 86 | , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \ |
87 | "r12", "r13", "r14", "r15" | 87 | "r12", "r13", "r14", "r15" |
88 | 88 | ||
89 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
90 | #define __switch_canary \ | ||
91 | "movq %P[task_canary](%%rsi),%%r8\n\t" \ | ||
92 | "movq %%r8,"__percpu_arg([gs_canary])"\n\t" | ||
93 | #define __switch_canary_oparam \ | ||
94 | , [gs_canary] "=m" (per_cpu_var(irq_stack_union.stack_canary)) | ||
95 | #define __switch_canary_iparam \ | ||
96 | , [task_canary] "i" (offsetof(struct task_struct, stack_canary)) | ||
97 | #else /* CC_STACKPROTECTOR */ | ||
98 | #define __switch_canary | ||
99 | #define __switch_canary_oparam | ||
100 | #define __switch_canary_iparam | ||
101 | #endif /* CC_STACKPROTECTOR */ | ||
102 | |||
89 | /* Save restore flags to clear handle leaking NT */ | 103 | /* Save restore flags to clear handle leaking NT */ |
90 | #define switch_to(prev, next, last) \ | 104 | #define switch_to(prev, next, last) \ |
91 | asm volatile(SAVE_CONTEXT \ | 105 | asm volatile(SAVE_CONTEXT \ |
92 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ | 106 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ |
93 | "movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \ | 107 | "movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \ |
94 | "call __switch_to\n\t" \ | 108 | "call __switch_to\n\t" \ |
95 | ".globl thread_return\n" \ | 109 | ".globl thread_return\n" \ |
96 | "thread_return:\n\t" \ | 110 | "thread_return:\n\t" \ |
97 | "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ | 111 | "movq "__percpu_arg([current_task])",%%rsi\n\t" \ |
112 | __switch_canary \ | ||
98 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ | 113 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ |
99 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ | ||
100 | "movq %%rax,%%rdi\n\t" \ | 114 | "movq %%rax,%%rdi\n\t" \ |
101 | "jc ret_from_fork\n\t" \ | 115 | "testl %[_tif_fork],%P[ti_flags](%%r8)\n\t" \ |
116 | "jnz ret_from_fork\n\t" \ | ||
102 | RESTORE_CONTEXT \ | 117 | RESTORE_CONTEXT \ |
103 | : "=a" (last) \ | 118 | : "=a" (last) \ |
119 | __switch_canary_oparam \ | ||
104 | : [next] "S" (next), [prev] "D" (prev), \ | 120 | : [next] "S" (next), [prev] "D" (prev), \ |
105 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ | 121 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ |
106 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ | 122 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ |
107 | [tif_fork] "i" (TIF_FORK), \ | 123 | [_tif_fork] "i" (_TIF_FORK), \ |
108 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ | 124 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ |
109 | [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ | 125 | [current_task] "m" (per_cpu_var(current_task)) \ |
126 | __switch_canary_iparam \ | ||
110 | : "memory", "cc" __EXTRA_CLOBBER) | 127 | : "memory", "cc" __EXTRA_CLOBBER) |
111 | #endif | 128 | #endif |
112 | 129 | ||
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 98789647baa9..df9d5f78385e 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -40,6 +40,7 @@ struct thread_info { | |||
40 | */ | 40 | */ |
41 | __u8 supervisor_stack[0]; | 41 | __u8 supervisor_stack[0]; |
42 | #endif | 42 | #endif |
43 | int uaccess_err; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | #define INIT_THREAD_INFO(tsk) \ | 46 | #define INIT_THREAD_INFO(tsk) \ |
@@ -194,25 +195,21 @@ static inline struct thread_info *current_thread_info(void) | |||
194 | 195 | ||
195 | #else /* X86_32 */ | 196 | #else /* X86_32 */ |
196 | 197 | ||
197 | #include <asm/pda.h> | 198 | #include <asm/percpu.h> |
199 | #define KERNEL_STACK_OFFSET (5*8) | ||
198 | 200 | ||
199 | /* | 201 | /* |
200 | * macros/functions for gaining access to the thread information structure | 202 | * macros/functions for gaining access to the thread information structure |
201 | * preempt_count needs to be 1 initially, until the scheduler is functional. | 203 | * preempt_count needs to be 1 initially, until the scheduler is functional. |
202 | */ | 204 | */ |
203 | #ifndef __ASSEMBLY__ | 205 | #ifndef __ASSEMBLY__ |
204 | static inline struct thread_info *current_thread_info(void) | 206 | DECLARE_PER_CPU(unsigned long, kernel_stack); |
205 | { | ||
206 | struct thread_info *ti; | ||
207 | ti = (void *)(read_pda(kernelstack) + PDA_STACKOFFSET - THREAD_SIZE); | ||
208 | return ti; | ||
209 | } | ||
210 | 207 | ||
211 | /* do not use in interrupt context */ | 208 | static inline struct thread_info *current_thread_info(void) |
212 | static inline struct thread_info *stack_thread_info(void) | ||
213 | { | 209 | { |
214 | struct thread_info *ti; | 210 | struct thread_info *ti; |
215 | asm("andq %%rsp,%0; " : "=r" (ti) : "0" (~(THREAD_SIZE - 1))); | 211 | ti = (void *)(percpu_read(kernel_stack) + |
212 | KERNEL_STACK_OFFSET - THREAD_SIZE); | ||
216 | return ti; | 213 | return ti; |
217 | } | 214 | } |
218 | 215 | ||
@@ -220,8 +217,8 @@ static inline struct thread_info *stack_thread_info(void) | |||
220 | 217 | ||
221 | /* how to get the thread information struct from ASM */ | 218 | /* how to get the thread information struct from ASM */ |
222 | #define GET_THREAD_INFO(reg) \ | 219 | #define GET_THREAD_INFO(reg) \ |
223 | movq %gs:pda_kernelstack,reg ; \ | 220 | movq PER_CPU_VAR(kernel_stack),reg ; \ |
224 | subq $(THREAD_SIZE-PDA_STACKOFFSET),reg | 221 | subq $(THREAD_SIZE-KERNEL_STACK_OFFSET),reg |
225 | 222 | ||
226 | #endif | 223 | #endif |
227 | 224 | ||
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 0e7bbb549116..d3539f998f88 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -113,7 +113,7 @@ static inline void flush_tlb_range(struct vm_area_struct *vma, | |||
113 | __flush_tlb(); | 113 | __flush_tlb(); |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline void native_flush_tlb_others(const cpumask_t *cpumask, | 116 | static inline void native_flush_tlb_others(const struct cpumask *cpumask, |
117 | struct mm_struct *mm, | 117 | struct mm_struct *mm, |
118 | unsigned long va) | 118 | unsigned long va) |
119 | { | 119 | { |
@@ -142,31 +142,28 @@ static inline void flush_tlb_range(struct vm_area_struct *vma, | |||
142 | flush_tlb_mm(vma->vm_mm); | 142 | flush_tlb_mm(vma->vm_mm); |
143 | } | 143 | } |
144 | 144 | ||
145 | void native_flush_tlb_others(const cpumask_t *cpumask, struct mm_struct *mm, | 145 | void native_flush_tlb_others(const struct cpumask *cpumask, |
146 | unsigned long va); | 146 | struct mm_struct *mm, unsigned long va); |
147 | 147 | ||
148 | #define TLBSTATE_OK 1 | 148 | #define TLBSTATE_OK 1 |
149 | #define TLBSTATE_LAZY 2 | 149 | #define TLBSTATE_LAZY 2 |
150 | 150 | ||
151 | #ifdef CONFIG_X86_32 | ||
152 | struct tlb_state { | 151 | struct tlb_state { |
153 | struct mm_struct *active_mm; | 152 | struct mm_struct *active_mm; |
154 | int state; | 153 | int state; |
155 | char __cacheline_padding[L1_CACHE_BYTES-8]; | ||
156 | }; | 154 | }; |
157 | DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); | 155 | DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); |
158 | 156 | ||
159 | void reset_lazy_tlbstate(void); | ||
160 | #else | ||
161 | static inline void reset_lazy_tlbstate(void) | 157 | static inline void reset_lazy_tlbstate(void) |
162 | { | 158 | { |
159 | percpu_write(cpu_tlbstate.state, 0); | ||
160 | percpu_write(cpu_tlbstate.active_mm, &init_mm); | ||
163 | } | 161 | } |
164 | #endif | ||
165 | 162 | ||
166 | #endif /* SMP */ | 163 | #endif /* SMP */ |
167 | 164 | ||
168 | #ifndef CONFIG_PARAVIRT | 165 | #ifndef CONFIG_PARAVIRT |
169 | #define flush_tlb_others(mask, mm, va) native_flush_tlb_others(&mask, mm, va) | 166 | #define flush_tlb_others(mask, mm, va) native_flush_tlb_others(mask, mm, va) |
170 | #endif | 167 | #endif |
171 | 168 | ||
172 | static inline void flush_tlb_kernel_range(unsigned long start, | 169 | static inline void flush_tlb_kernel_range(unsigned long start, |
@@ -175,4 +172,6 @@ static inline void flush_tlb_kernel_range(unsigned long start, | |||
175 | flush_tlb_all(); | 172 | flush_tlb_all(); |
176 | } | 173 | } |
177 | 174 | ||
175 | extern void zap_low_mappings(void); | ||
176 | |||
178 | #endif /* _ASM_X86_TLBFLUSH_H */ | 177 | #endif /* _ASM_X86_TLBFLUSH_H */ |
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 4e2f2e0aab27..77cfb2cfb386 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -74,6 +74,8 @@ static inline const struct cpumask *cpumask_of_node(int node) | |||
74 | return &node_to_cpumask_map[node]; | 74 | return &node_to_cpumask_map[node]; |
75 | } | 75 | } |
76 | 76 | ||
77 | static inline void setup_node_to_cpumask_map(void) { } | ||
78 | |||
77 | #else /* CONFIG_X86_64 */ | 79 | #else /* CONFIG_X86_64 */ |
78 | 80 | ||
79 | /* Mappings between node number and cpus on that node. */ | 81 | /* Mappings between node number and cpus on that node. */ |
@@ -83,7 +85,8 @@ extern cpumask_t *node_to_cpumask_map; | |||
83 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | 85 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); |
84 | 86 | ||
85 | /* Returns the number of the current Node. */ | 87 | /* Returns the number of the current Node. */ |
86 | #define numa_node_id() read_pda(nodenumber) | 88 | DECLARE_PER_CPU(int, node_number); |
89 | #define numa_node_id() percpu_read(node_number) | ||
87 | 90 | ||
88 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 91 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
89 | extern int cpu_to_node(int cpu); | 92 | extern int cpu_to_node(int cpu); |
@@ -102,10 +105,7 @@ static inline int cpu_to_node(int cpu) | |||
102 | /* Same function but used if called before per_cpu areas are setup */ | 105 | /* Same function but used if called before per_cpu areas are setup */ |
103 | static inline int early_cpu_to_node(int cpu) | 106 | static inline int early_cpu_to_node(int cpu) |
104 | { | 107 | { |
105 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) | 108 | return early_per_cpu(x86_cpu_to_node_map, cpu); |
106 | return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu]; | ||
107 | |||
108 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
109 | } | 109 | } |
110 | 110 | ||
111 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ | 111 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ |
@@ -122,6 +122,8 @@ static inline cpumask_t node_to_cpumask(int node) | |||
122 | 122 | ||
123 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 123 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
124 | 124 | ||
125 | extern void setup_node_to_cpumask_map(void); | ||
126 | |||
125 | /* | 127 | /* |
126 | * Replace default node_to_cpumask_ptr with optimized version | 128 | * Replace default node_to_cpumask_ptr with optimized version |
127 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | 129 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" |
@@ -192,9 +194,20 @@ extern int __node_distance(int, int); | |||
192 | 194 | ||
193 | #else /* !CONFIG_NUMA */ | 195 | #else /* !CONFIG_NUMA */ |
194 | 196 | ||
195 | #define numa_node_id() 0 | 197 | static inline int numa_node_id(void) |
196 | #define cpu_to_node(cpu) 0 | 198 | { |
197 | #define early_cpu_to_node(cpu) 0 | 199 | return 0; |
200 | } | ||
201 | |||
202 | static inline int cpu_to_node(int cpu) | ||
203 | { | ||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static inline int early_cpu_to_node(int cpu) | ||
208 | { | ||
209 | return 0; | ||
210 | } | ||
198 | 211 | ||
199 | static inline const cpumask_t *cpumask_of_node(int node) | 212 | static inline const cpumask_t *cpumask_of_node(int node) |
200 | { | 213 | { |
@@ -209,6 +222,8 @@ static inline int node_to_first_cpu(int node) | |||
209 | return first_cpu(cpu_online_map); | 222 | return first_cpu(cpu_online_map); |
210 | } | 223 | } |
211 | 224 | ||
225 | static inline void setup_node_to_cpumask_map(void) { } | ||
226 | |||
212 | /* | 227 | /* |
213 | * Replace default node_to_cpumask_ptr with optimized version | 228 | * Replace default node_to_cpumask_ptr with optimized version |
214 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | 229 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" |
diff --git a/arch/x86/include/asm/trampoline.h b/arch/x86/include/asm/trampoline.h index 780ba0ab94f9..90f06c25221d 100644 --- a/arch/x86/include/asm/trampoline.h +++ b/arch/x86/include/asm/trampoline.h | |||
@@ -13,6 +13,7 @@ extern unsigned char *trampoline_base; | |||
13 | 13 | ||
14 | extern unsigned long init_rsp; | 14 | extern unsigned long init_rsp; |
15 | extern unsigned long initial_code; | 15 | extern unsigned long initial_code; |
16 | extern unsigned long initial_gs; | ||
16 | 17 | ||
17 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) | 18 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) |
18 | #define TRAMPOLINE_BASE 0x6000 | 19 | #define TRAMPOLINE_BASE 0x6000 |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 4340055b7559..0ec6de4bcb0b 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -121,7 +121,7 @@ extern int __get_user_bad(void); | |||
121 | 121 | ||
122 | #define __get_user_x(size, ret, x, ptr) \ | 122 | #define __get_user_x(size, ret, x, ptr) \ |
123 | asm volatile("call __get_user_" #size \ | 123 | asm volatile("call __get_user_" #size \ |
124 | : "=a" (ret),"=d" (x) \ | 124 | : "=a" (ret), "=d" (x) \ |
125 | : "0" (ptr)) \ | 125 | : "0" (ptr)) \ |
126 | 126 | ||
127 | /* Careful: we have to cast the result to the type of the pointer | 127 | /* Careful: we have to cast the result to the type of the pointer |
@@ -181,12 +181,12 @@ extern int __get_user_bad(void); | |||
181 | 181 | ||
182 | #define __put_user_x(size, x, ptr, __ret_pu) \ | 182 | #define __put_user_x(size, x, ptr, __ret_pu) \ |
183 | asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ | 183 | asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ |
184 | :"0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | 184 | : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
185 | 185 | ||
186 | 186 | ||
187 | 187 | ||
188 | #ifdef CONFIG_X86_32 | 188 | #ifdef CONFIG_X86_32 |
189 | #define __put_user_u64(x, addr, err) \ | 189 | #define __put_user_asm_u64(x, addr, err) \ |
190 | asm volatile("1: movl %%eax,0(%2)\n" \ | 190 | asm volatile("1: movl %%eax,0(%2)\n" \ |
191 | "2: movl %%edx,4(%2)\n" \ | 191 | "2: movl %%edx,4(%2)\n" \ |
192 | "3:\n" \ | 192 | "3:\n" \ |
@@ -199,12 +199,22 @@ extern int __get_user_bad(void); | |||
199 | : "=r" (err) \ | 199 | : "=r" (err) \ |
200 | : "A" (x), "r" (addr), "i" (-EFAULT), "0" (err)) | 200 | : "A" (x), "r" (addr), "i" (-EFAULT), "0" (err)) |
201 | 201 | ||
202 | #define __put_user_asm_ex_u64(x, addr) \ | ||
203 | asm volatile("1: movl %%eax,0(%1)\n" \ | ||
204 | "2: movl %%edx,4(%1)\n" \ | ||
205 | "3:\n" \ | ||
206 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
207 | _ASM_EXTABLE(2b, 3b - 2b) \ | ||
208 | : : "A" (x), "r" (addr)) | ||
209 | |||
202 | #define __put_user_x8(x, ptr, __ret_pu) \ | 210 | #define __put_user_x8(x, ptr, __ret_pu) \ |
203 | asm volatile("call __put_user_8" : "=a" (__ret_pu) \ | 211 | asm volatile("call __put_user_8" : "=a" (__ret_pu) \ |
204 | : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | 212 | : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
205 | #else | 213 | #else |
206 | #define __put_user_u64(x, ptr, retval) \ | 214 | #define __put_user_asm_u64(x, ptr, retval) \ |
207 | __put_user_asm(x, ptr, retval, "q", "", "Zr", -EFAULT) | 215 | __put_user_asm(x, ptr, retval, "q", "", "Zr", -EFAULT) |
216 | #define __put_user_asm_ex_u64(x, addr) \ | ||
217 | __put_user_asm_ex(x, addr, "q", "", "Zr") | ||
208 | #define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu) | 218 | #define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu) |
209 | #endif | 219 | #endif |
210 | 220 | ||
@@ -276,10 +286,31 @@ do { \ | |||
276 | __put_user_asm(x, ptr, retval, "w", "w", "ir", errret); \ | 286 | __put_user_asm(x, ptr, retval, "w", "w", "ir", errret); \ |
277 | break; \ | 287 | break; \ |
278 | case 4: \ | 288 | case 4: \ |
279 | __put_user_asm(x, ptr, retval, "l", "k", "ir", errret);\ | 289 | __put_user_asm(x, ptr, retval, "l", "k", "ir", errret); \ |
280 | break; \ | 290 | break; \ |
281 | case 8: \ | 291 | case 8: \ |
282 | __put_user_u64((__typeof__(*ptr))(x), ptr, retval); \ | 292 | __put_user_asm_u64((__typeof__(*ptr))(x), ptr, retval); \ |
293 | break; \ | ||
294 | default: \ | ||
295 | __put_user_bad(); \ | ||
296 | } \ | ||
297 | } while (0) | ||
298 | |||
299 | #define __put_user_size_ex(x, ptr, size) \ | ||
300 | do { \ | ||
301 | __chk_user_ptr(ptr); \ | ||
302 | switch (size) { \ | ||
303 | case 1: \ | ||
304 | __put_user_asm_ex(x, ptr, "b", "b", "iq"); \ | ||
305 | break; \ | ||
306 | case 2: \ | ||
307 | __put_user_asm_ex(x, ptr, "w", "w", "ir"); \ | ||
308 | break; \ | ||
309 | case 4: \ | ||
310 | __put_user_asm_ex(x, ptr, "l", "k", "ir"); \ | ||
311 | break; \ | ||
312 | case 8: \ | ||
313 | __put_user_asm_ex_u64((__typeof__(*ptr))(x), ptr); \ | ||
283 | break; \ | 314 | break; \ |
284 | default: \ | 315 | default: \ |
285 | __put_user_bad(); \ | 316 | __put_user_bad(); \ |
@@ -311,9 +342,12 @@ do { \ | |||
311 | 342 | ||
312 | #ifdef CONFIG_X86_32 | 343 | #ifdef CONFIG_X86_32 |
313 | #define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() | 344 | #define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() |
345 | #define __get_user_asm_ex_u64(x, ptr) (x) = __get_user_bad() | ||
314 | #else | 346 | #else |
315 | #define __get_user_asm_u64(x, ptr, retval, errret) \ | 347 | #define __get_user_asm_u64(x, ptr, retval, errret) \ |
316 | __get_user_asm(x, ptr, retval, "q", "", "=r", errret) | 348 | __get_user_asm(x, ptr, retval, "q", "", "=r", errret) |
349 | #define __get_user_asm_ex_u64(x, ptr) \ | ||
350 | __get_user_asm_ex(x, ptr, "q", "", "=r") | ||
317 | #endif | 351 | #endif |
318 | 352 | ||
319 | #define __get_user_size(x, ptr, size, retval, errret) \ | 353 | #define __get_user_size(x, ptr, size, retval, errret) \ |
@@ -350,6 +384,33 @@ do { \ | |||
350 | : "=r" (err), ltype(x) \ | 384 | : "=r" (err), ltype(x) \ |
351 | : "m" (__m(addr)), "i" (errret), "0" (err)) | 385 | : "m" (__m(addr)), "i" (errret), "0" (err)) |
352 | 386 | ||
387 | #define __get_user_size_ex(x, ptr, size) \ | ||
388 | do { \ | ||
389 | __chk_user_ptr(ptr); \ | ||
390 | switch (size) { \ | ||
391 | case 1: \ | ||
392 | __get_user_asm_ex(x, ptr, "b", "b", "=q"); \ | ||
393 | break; \ | ||
394 | case 2: \ | ||
395 | __get_user_asm_ex(x, ptr, "w", "w", "=r"); \ | ||
396 | break; \ | ||
397 | case 4: \ | ||
398 | __get_user_asm_ex(x, ptr, "l", "k", "=r"); \ | ||
399 | break; \ | ||
400 | case 8: \ | ||
401 | __get_user_asm_ex_u64(x, ptr); \ | ||
402 | break; \ | ||
403 | default: \ | ||
404 | (x) = __get_user_bad(); \ | ||
405 | } \ | ||
406 | } while (0) | ||
407 | |||
408 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ | ||
409 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ | ||
410 | "2:\n" \ | ||
411 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
412 | : ltype(x) : "m" (__m(addr))) | ||
413 | |||
353 | #define __put_user_nocheck(x, ptr, size) \ | 414 | #define __put_user_nocheck(x, ptr, size) \ |
354 | ({ \ | 415 | ({ \ |
355 | int __pu_err; \ | 416 | int __pu_err; \ |
@@ -385,6 +446,26 @@ struct __large_struct { unsigned long buf[100]; }; | |||
385 | _ASM_EXTABLE(1b, 3b) \ | 446 | _ASM_EXTABLE(1b, 3b) \ |
386 | : "=r"(err) \ | 447 | : "=r"(err) \ |
387 | : ltype(x), "m" (__m(addr)), "i" (errret), "0" (err)) | 448 | : ltype(x), "m" (__m(addr)), "i" (errret), "0" (err)) |
449 | |||
450 | #define __put_user_asm_ex(x, addr, itype, rtype, ltype) \ | ||
451 | asm volatile("1: mov"itype" %"rtype"0,%1\n" \ | ||
452 | "2:\n" \ | ||
453 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
454 | : : ltype(x), "m" (__m(addr))) | ||
455 | |||
456 | /* | ||
457 | * uaccess_try and catch | ||
458 | */ | ||
459 | #define uaccess_try do { \ | ||
460 | int prev_err = current_thread_info()->uaccess_err; \ | ||
461 | current_thread_info()->uaccess_err = 0; \ | ||
462 | barrier(); | ||
463 | |||
464 | #define uaccess_catch(err) \ | ||
465 | (err) |= current_thread_info()->uaccess_err; \ | ||
466 | current_thread_info()->uaccess_err = prev_err; \ | ||
467 | } while (0) | ||
468 | |||
388 | /** | 469 | /** |
389 | * __get_user: - Get a simple variable from user space, with less checking. | 470 | * __get_user: - Get a simple variable from user space, with less checking. |
390 | * @x: Variable to store result. | 471 | * @x: Variable to store result. |
@@ -408,6 +489,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
408 | 489 | ||
409 | #define __get_user(x, ptr) \ | 490 | #define __get_user(x, ptr) \ |
410 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) | 491 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) |
492 | |||
411 | /** | 493 | /** |
412 | * __put_user: - Write a simple value into user space, with less checking. | 494 | * __put_user: - Write a simple value into user space, with less checking. |
413 | * @x: Value to copy to user space. | 495 | * @x: Value to copy to user space. |
@@ -435,6 +517,27 @@ struct __large_struct { unsigned long buf[100]; }; | |||
435 | #define __put_user_unaligned __put_user | 517 | #define __put_user_unaligned __put_user |
436 | 518 | ||
437 | /* | 519 | /* |
520 | * {get|put}_user_try and catch | ||
521 | * | ||
522 | * get_user_try { | ||
523 | * get_user_ex(...); | ||
524 | * } get_user_catch(err) | ||
525 | */ | ||
526 | #define get_user_try uaccess_try | ||
527 | #define get_user_catch(err) uaccess_catch(err) | ||
528 | #define put_user_try uaccess_try | ||
529 | #define put_user_catch(err) uaccess_catch(err) | ||
530 | |||
531 | #define get_user_ex(x, ptr) do { \ | ||
532 | unsigned long __gue_val; \ | ||
533 | __get_user_size_ex((__gue_val), (ptr), (sizeof(*(ptr)))); \ | ||
534 | (x) = (__force __typeof__(*(ptr)))__gue_val; \ | ||
535 | } while (0) | ||
536 | |||
537 | #define put_user_ex(x, ptr) \ | ||
538 | __put_user_size_ex((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) | ||
539 | |||
540 | /* | ||
438 | * movsl can be slow when source and dest are not both 8-byte aligned | 541 | * movsl can be slow when source and dest are not both 8-byte aligned |
439 | */ | 542 | */ |
440 | #ifdef CONFIG_X86_INTEL_USERCOPY | 543 | #ifdef CONFIG_X86_INTEL_USERCOPY |
diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h new file mode 100644 index 000000000000..8ac1d7e312f3 --- /dev/null +++ b/arch/x86/include/asm/uv/uv.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _ASM_X86_UV_UV_H | ||
2 | #define _ASM_X86_UV_UV_H | ||
3 | |||
4 | enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; | ||
5 | |||
6 | #ifdef CONFIG_X86_UV | ||
7 | |||
8 | extern enum uv_system_type get_uv_system_type(void); | ||
9 | extern int is_uv_system(void); | ||
10 | extern void uv_cpu_init(void); | ||
11 | extern void uv_system_init(void); | ||
12 | extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip); | ||
13 | extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, | ||
14 | struct mm_struct *mm, | ||
15 | unsigned long va, | ||
16 | unsigned int cpu); | ||
17 | |||
18 | #else /* X86_UV */ | ||
19 | |||
20 | static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; } | ||
21 | static inline int is_uv_system(void) { return 0; } | ||
22 | static inline void uv_cpu_init(void) { } | ||
23 | static inline void uv_system_init(void) { } | ||
24 | static inline int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip) | ||
25 | { return 1; } | ||
26 | static inline const struct cpumask * | ||
27 | uv_flush_tlb_others(const struct cpumask *cpumask, struct mm_struct *mm, | ||
28 | unsigned long va, unsigned int cpu) | ||
29 | { return cpumask; } | ||
30 | |||
31 | #endif /* X86_UV */ | ||
32 | |||
33 | #endif /* _ASM_X86_UV_UV_H */ | ||
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h index 50423c7b56b2..9b0e61bf7a88 100644 --- a/arch/x86/include/asm/uv/uv_bau.h +++ b/arch/x86/include/asm/uv/uv_bau.h | |||
@@ -325,7 +325,6 @@ static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits) | |||
325 | #define cpubit_isset(cpu, bau_local_cpumask) \ | 325 | #define cpubit_isset(cpu, bau_local_cpumask) \ |
326 | test_bit((cpu), (bau_local_cpumask).bits) | 326 | test_bit((cpu), (bau_local_cpumask).bits) |
327 | 327 | ||
328 | extern int uv_flush_tlb_others(cpumask_t *, struct mm_struct *, unsigned long); | ||
329 | extern void uv_bau_message_intr1(void); | 328 | extern void uv_bau_message_intr1(void); |
330 | extern void uv_bau_timeout_intr1(void); | 329 | extern void uv_bau_timeout_intr1(void); |
331 | 330 | ||
diff --git a/arch/x86/include/asm/voyager.h b/arch/x86/include/asm/voyager.h index b3e647307625..c1635d43616f 100644 --- a/arch/x86/include/asm/voyager.h +++ b/arch/x86/include/asm/voyager.h | |||
@@ -527,3 +527,45 @@ extern void voyager_smp_intr_init(void); | |||
527 | #define VOYAGER_PSI_SUBREAD 2 | 527 | #define VOYAGER_PSI_SUBREAD 2 |
528 | #define VOYAGER_PSI_SUBWRITE 3 | 528 | #define VOYAGER_PSI_SUBWRITE 3 |
529 | extern void voyager_cat_psi(__u8, __u16, __u8 *); | 529 | extern void voyager_cat_psi(__u8, __u16, __u8 *); |
530 | |||
531 | /* These define the CPIs we use in linux */ | ||
532 | #define VIC_CPI_LEVEL0 0 | ||
533 | #define VIC_CPI_LEVEL1 1 | ||
534 | /* now the fake CPIs */ | ||
535 | #define VIC_TIMER_CPI 2 | ||
536 | #define VIC_INVALIDATE_CPI 3 | ||
537 | #define VIC_RESCHEDULE_CPI 4 | ||
538 | #define VIC_ENABLE_IRQ_CPI 5 | ||
539 | #define VIC_CALL_FUNCTION_CPI 6 | ||
540 | #define VIC_CALL_FUNCTION_SINGLE_CPI 7 | ||
541 | |||
542 | /* Now the QIC CPIs: Since we don't need the two initial levels, | ||
543 | * these are 2 less than the VIC CPIs */ | ||
544 | #define QIC_CPI_OFFSET 1 | ||
545 | #define QIC_TIMER_CPI (VIC_TIMER_CPI - QIC_CPI_OFFSET) | ||
546 | #define QIC_INVALIDATE_CPI (VIC_INVALIDATE_CPI - QIC_CPI_OFFSET) | ||
547 | #define QIC_RESCHEDULE_CPI (VIC_RESCHEDULE_CPI - QIC_CPI_OFFSET) | ||
548 | #define QIC_ENABLE_IRQ_CPI (VIC_ENABLE_IRQ_CPI - QIC_CPI_OFFSET) | ||
549 | #define QIC_CALL_FUNCTION_CPI (VIC_CALL_FUNCTION_CPI - QIC_CPI_OFFSET) | ||
550 | #define QIC_CALL_FUNCTION_SINGLE_CPI (VIC_CALL_FUNCTION_SINGLE_CPI - QIC_CPI_OFFSET) | ||
551 | |||
552 | #define VIC_START_FAKE_CPI VIC_TIMER_CPI | ||
553 | #define VIC_END_FAKE_CPI VIC_CALL_FUNCTION_SINGLE_CPI | ||
554 | |||
555 | /* this is the SYS_INT CPI. */ | ||
556 | #define VIC_SYS_INT 8 | ||
557 | #define VIC_CMN_INT 15 | ||
558 | |||
559 | /* This is the boot CPI for alternate processors. It gets overwritten | ||
560 | * by the above once the system has activated all available processors */ | ||
561 | #define VIC_CPU_BOOT_CPI VIC_CPI_LEVEL0 | ||
562 | #define VIC_CPU_BOOT_ERRATA_CPI (VIC_CPI_LEVEL0 + 8) | ||
563 | |||
564 | extern asmlinkage void vic_cpi_interrupt(void); | ||
565 | extern asmlinkage void vic_sys_interrupt(void); | ||
566 | extern asmlinkage void vic_cmn_interrupt(void); | ||
567 | extern asmlinkage void qic_timer_interrupt(void); | ||
568 | extern asmlinkage void qic_invalidate_interrupt(void); | ||
569 | extern asmlinkage void qic_reschedule_interrupt(void); | ||
570 | extern asmlinkage void qic_enable_irq_interrupt(void); | ||
571 | extern asmlinkage void qic_call_function_interrupt(void); | ||