diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-13 13:35:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-13 13:35:48 -0400 |
commit | c029b55af7d6b02b993e8a5add78d062da7a3940 (patch) | |
tree | eda9177a8d42324927424b3c42a99606ac6a4080 | |
parent | 96054569190bdec375fe824e48ca1f4e3b53dd36 (diff) | |
parent | 417484d47e115774745ef025bce712a102b6f86f (diff) |
Merge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86, asm: Use a lower case name for the end macro in atomic64_386_32.S
x86, asm: Refactor atomic64_386_32.S to support old binutils and be cleaner
x86: Document __phys_reloc_hide() usage in __pa_symbol()
x86, apic: Map the local apic when parsing the MP table.
-rw-r--r-- | arch/x86/include/asm/page.h | 7 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/mpparse.c | 16 | ||||
-rw-r--r-- | arch/x86/lib/atomic64_386_32.S | 238 |
4 files changed, 154 insertions, 109 deletions
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h index 625c3f0e741a..8ca82839288a 100644 --- a/arch/x86/include/asm/page.h +++ b/arch/x86/include/asm/page.h | |||
@@ -37,6 +37,13 @@ static inline void copy_user_page(void *to, void *from, unsigned long vaddr, | |||
37 | #define __pa_nodebug(x) __phys_addr_nodebug((unsigned long)(x)) | 37 | #define __pa_nodebug(x) __phys_addr_nodebug((unsigned long)(x)) |
38 | /* __pa_symbol should be used for C visible symbols. | 38 | /* __pa_symbol should be used for C visible symbols. |
39 | This seems to be the official gcc blessed way to do such arithmetic. */ | 39 | This seems to be the official gcc blessed way to do such arithmetic. */ |
40 | /* | ||
41 | * We need __phys_reloc_hide() here because gcc may assume that there is no | ||
42 | * overflow during __pa() calculation and can optimize it unexpectedly. | ||
43 | * Newer versions of gcc provide -fno-strict-overflow switch to handle this | ||
44 | * case properly. Once all supported versions of gcc understand it, we can | ||
45 | * remove this Voodoo magic stuff. (i.e. once gcc3.x is deprecated) | ||
46 | */ | ||
40 | #define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x))) | 47 | #define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x))) |
41 | 48 | ||
42 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | 49 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 980508c79082..e3b534cda49a 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1606,7 +1606,7 @@ void __init init_apic_mappings(void) | |||
1606 | * acpi lapic path already maps that address in | 1606 | * acpi lapic path already maps that address in |
1607 | * acpi_register_lapic_address() | 1607 | * acpi_register_lapic_address() |
1608 | */ | 1608 | */ |
1609 | if (!acpi_lapic) | 1609 | if (!acpi_lapic && !smp_found_config) |
1610 | set_fixmap_nocache(FIX_APIC_BASE, apic_phys); | 1610 | set_fixmap_nocache(FIX_APIC_BASE, apic_phys); |
1611 | 1611 | ||
1612 | apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n", | 1612 | apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n", |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index d86dbf7e54be..d7b6f7fb4fec 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -274,6 +274,18 @@ static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt) | |||
274 | 274 | ||
275 | void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { } | 275 | void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { } |
276 | 276 | ||
277 | static void __init smp_register_lapic_address(unsigned long address) | ||
278 | { | ||
279 | mp_lapic_addr = address; | ||
280 | |||
281 | set_fixmap_nocache(FIX_APIC_BASE, address); | ||
282 | if (boot_cpu_physical_apicid == -1U) { | ||
283 | boot_cpu_physical_apicid = read_apic_id(); | ||
284 | apic_version[boot_cpu_physical_apicid] = | ||
285 | GET_APIC_VERSION(apic_read(APIC_LVR)); | ||
286 | } | ||
287 | } | ||
288 | |||
277 | static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early) | 289 | static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early) |
278 | { | 290 | { |
279 | char str[16]; | 291 | char str[16]; |
@@ -295,6 +307,10 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early) | |||
295 | if (early) | 307 | if (early) |
296 | return 1; | 308 | return 1; |
297 | 309 | ||
310 | /* Initialize the lapic mapping */ | ||
311 | if (!acpi_lapic) | ||
312 | smp_register_lapic_address(mpc->lapic); | ||
313 | |||
298 | if (mpc->oemptr) | 314 | if (mpc->oemptr) |
299 | x86_init.mpparse.smp_read_mpc_oem(mpc); | 315 | x86_init.mpparse.smp_read_mpc_oem(mpc); |
300 | 316 | ||
diff --git a/arch/x86/lib/atomic64_386_32.S b/arch/x86/lib/atomic64_386_32.S index 4a5979aa6883..2cda60a06e65 100644 --- a/arch/x86/lib/atomic64_386_32.S +++ b/arch/x86/lib/atomic64_386_32.S | |||
@@ -25,150 +25,172 @@ | |||
25 | CFI_ADJUST_CFA_OFFSET -4 | 25 | CFI_ADJUST_CFA_OFFSET -4 |
26 | .endm | 26 | .endm |
27 | 27 | ||
28 | .macro BEGIN func reg | 28 | #define BEGIN(op) \ |
29 | $v = \reg | 29 | .macro endp; \ |
30 | 30 | CFI_ENDPROC; \ | |
31 | ENTRY(atomic64_\func\()_386) | 31 | ENDPROC(atomic64_##op##_386); \ |
32 | CFI_STARTPROC | 32 | .purgem endp; \ |
33 | LOCK $v | 33 | .endm; \ |
34 | 34 | ENTRY(atomic64_##op##_386); \ | |
35 | .macro RETURN | 35 | CFI_STARTPROC; \ |
36 | UNLOCK $v | 36 | LOCK v; |
37 | |||
38 | #define ENDP endp | ||
39 | |||
40 | #define RET \ | ||
41 | UNLOCK v; \ | ||
37 | ret | 42 | ret |
38 | .endm | ||
39 | |||
40 | .macro END_ | ||
41 | CFI_ENDPROC | ||
42 | ENDPROC(atomic64_\func\()_386) | ||
43 | .purgem RETURN | ||
44 | .purgem END_ | ||
45 | .purgem END | ||
46 | .endm | ||
47 | |||
48 | .macro END | ||
49 | RETURN | ||
50 | END_ | ||
51 | .endm | ||
52 | .endm | ||
53 | 43 | ||
54 | BEGIN read %ecx | 44 | #define RET_ENDP \ |
55 | movl ($v), %eax | 45 | RET; \ |
56 | movl 4($v), %edx | 46 | ENDP |
57 | END | 47 | |
58 | 48 | #define v %ecx | |
59 | BEGIN set %esi | 49 | BEGIN(read) |
60 | movl %ebx, ($v) | 50 | movl (v), %eax |
61 | movl %ecx, 4($v) | 51 | movl 4(v), %edx |
62 | END | 52 | RET_ENDP |
63 | 53 | #undef v | |
64 | BEGIN xchg %esi | 54 | |
65 | movl ($v), %eax | 55 | #define v %esi |
66 | movl 4($v), %edx | 56 | BEGIN(set) |
67 | movl %ebx, ($v) | 57 | movl %ebx, (v) |
68 | movl %ecx, 4($v) | 58 | movl %ecx, 4(v) |
69 | END | 59 | RET_ENDP |
70 | 60 | #undef v | |
71 | BEGIN add %ecx | 61 | |
72 | addl %eax, ($v) | 62 | #define v %esi |
73 | adcl %edx, 4($v) | 63 | BEGIN(xchg) |
74 | END | 64 | movl (v), %eax |
75 | 65 | movl 4(v), %edx | |
76 | BEGIN add_return %ecx | 66 | movl %ebx, (v) |
77 | addl ($v), %eax | 67 | movl %ecx, 4(v) |
78 | adcl 4($v), %edx | 68 | RET_ENDP |
79 | movl %eax, ($v) | 69 | #undef v |
80 | movl %edx, 4($v) | 70 | |
81 | END | 71 | #define v %ecx |
82 | 72 | BEGIN(add) | |
83 | BEGIN sub %ecx | 73 | addl %eax, (v) |
84 | subl %eax, ($v) | 74 | adcl %edx, 4(v) |
85 | sbbl %edx, 4($v) | 75 | RET_ENDP |
86 | END | 76 | #undef v |
87 | 77 | ||
88 | BEGIN sub_return %ecx | 78 | #define v %ecx |
79 | BEGIN(add_return) | ||
80 | addl (v), %eax | ||
81 | adcl 4(v), %edx | ||
82 | movl %eax, (v) | ||
83 | movl %edx, 4(v) | ||
84 | RET_ENDP | ||
85 | #undef v | ||
86 | |||
87 | #define v %ecx | ||
88 | BEGIN(sub) | ||
89 | subl %eax, (v) | ||
90 | sbbl %edx, 4(v) | ||
91 | RET_ENDP | ||
92 | #undef v | ||
93 | |||
94 | #define v %ecx | ||
95 | BEGIN(sub_return) | ||
89 | negl %edx | 96 | negl %edx |
90 | negl %eax | 97 | negl %eax |
91 | sbbl $0, %edx | 98 | sbbl $0, %edx |
92 | addl ($v), %eax | 99 | addl (v), %eax |
93 | adcl 4($v), %edx | 100 | adcl 4(v), %edx |
94 | movl %eax, ($v) | 101 | movl %eax, (v) |
95 | movl %edx, 4($v) | 102 | movl %edx, 4(v) |
96 | END | 103 | RET_ENDP |
97 | 104 | #undef v | |
98 | BEGIN inc %esi | 105 | |
99 | addl $1, ($v) | 106 | #define v %esi |
100 | adcl $0, 4($v) | 107 | BEGIN(inc) |
101 | END | 108 | addl $1, (v) |
102 | 109 | adcl $0, 4(v) | |
103 | BEGIN inc_return %esi | 110 | RET_ENDP |
104 | movl ($v), %eax | 111 | #undef v |
105 | movl 4($v), %edx | 112 | |
113 | #define v %esi | ||
114 | BEGIN(inc_return) | ||
115 | movl (v), %eax | ||
116 | movl 4(v), %edx | ||
106 | addl $1, %eax | 117 | addl $1, %eax |
107 | adcl $0, %edx | 118 | adcl $0, %edx |
108 | movl %eax, ($v) | 119 | movl %eax, (v) |
109 | movl %edx, 4($v) | 120 | movl %edx, 4(v) |
110 | END | 121 | RET_ENDP |
111 | 122 | #undef v | |
112 | BEGIN dec %esi | 123 | |
113 | subl $1, ($v) | 124 | #define v %esi |
114 | sbbl $0, 4($v) | 125 | BEGIN(dec) |
115 | END | 126 | subl $1, (v) |
116 | 127 | sbbl $0, 4(v) | |
117 | BEGIN dec_return %esi | 128 | RET_ENDP |
118 | movl ($v), %eax | 129 | #undef v |
119 | movl 4($v), %edx | 130 | |
131 | #define v %esi | ||
132 | BEGIN(dec_return) | ||
133 | movl (v), %eax | ||
134 | movl 4(v), %edx | ||
120 | subl $1, %eax | 135 | subl $1, %eax |
121 | sbbl $0, %edx | 136 | sbbl $0, %edx |
122 | movl %eax, ($v) | 137 | movl %eax, (v) |
123 | movl %edx, 4($v) | 138 | movl %edx, 4(v) |
124 | END | 139 | RET_ENDP |
140 | #undef v | ||
125 | 141 | ||
126 | BEGIN add_unless %ecx | 142 | #define v %ecx |
143 | BEGIN(add_unless) | ||
127 | addl %eax, %esi | 144 | addl %eax, %esi |
128 | adcl %edx, %edi | 145 | adcl %edx, %edi |
129 | addl ($v), %eax | 146 | addl (v), %eax |
130 | adcl 4($v), %edx | 147 | adcl 4(v), %edx |
131 | cmpl %eax, %esi | 148 | cmpl %eax, %esi |
132 | je 3f | 149 | je 3f |
133 | 1: | 150 | 1: |
134 | movl %eax, ($v) | 151 | movl %eax, (v) |
135 | movl %edx, 4($v) | 152 | movl %edx, 4(v) |
136 | movl $1, %eax | 153 | movl $1, %eax |
137 | 2: | 154 | 2: |
138 | RETURN | 155 | RET |
139 | 3: | 156 | 3: |
140 | cmpl %edx, %edi | 157 | cmpl %edx, %edi |
141 | jne 1b | 158 | jne 1b |
142 | xorl %eax, %eax | 159 | xorl %eax, %eax |
143 | jmp 2b | 160 | jmp 2b |
144 | END_ | 161 | ENDP |
162 | #undef v | ||
145 | 163 | ||
146 | BEGIN inc_not_zero %esi | 164 | #define v %esi |
147 | movl ($v), %eax | 165 | BEGIN(inc_not_zero) |
148 | movl 4($v), %edx | 166 | movl (v), %eax |
167 | movl 4(v), %edx | ||
149 | testl %eax, %eax | 168 | testl %eax, %eax |
150 | je 3f | 169 | je 3f |
151 | 1: | 170 | 1: |
152 | addl $1, %eax | 171 | addl $1, %eax |
153 | adcl $0, %edx | 172 | adcl $0, %edx |
154 | movl %eax, ($v) | 173 | movl %eax, (v) |
155 | movl %edx, 4($v) | 174 | movl %edx, 4(v) |
156 | movl $1, %eax | 175 | movl $1, %eax |
157 | 2: | 176 | 2: |
158 | RETURN | 177 | RET |
159 | 3: | 178 | 3: |
160 | testl %edx, %edx | 179 | testl %edx, %edx |
161 | jne 1b | 180 | jne 1b |
162 | jmp 2b | 181 | jmp 2b |
163 | END_ | 182 | ENDP |
183 | #undef v | ||
164 | 184 | ||
165 | BEGIN dec_if_positive %esi | 185 | #define v %esi |
166 | movl ($v), %eax | 186 | BEGIN(dec_if_positive) |
167 | movl 4($v), %edx | 187 | movl (v), %eax |
188 | movl 4(v), %edx | ||
168 | subl $1, %eax | 189 | subl $1, %eax |
169 | sbbl $0, %edx | 190 | sbbl $0, %edx |
170 | js 1f | 191 | js 1f |
171 | movl %eax, ($v) | 192 | movl %eax, (v) |
172 | movl %edx, 4($v) | 193 | movl %edx, 4(v) |
173 | 1: | 194 | 1: |
174 | END | 195 | RET_ENDP |
196 | #undef v | ||