diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-07-11 15:18:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 13:55:54 -0400 |
commit | ec481536b15eb0520d8f0204b0294480050fe1f8 (patch) | |
tree | 3f959a26ca58477734ea1e4d5370b2d3a33a1680 /include/asm-x86_64/alternative.h | |
parent | f8c09377d754f35a135454181b869ab527cc0757 (diff) |
Unify the CPU features vectors between i386 and x86-64
Unify the handling of the CPU features vectors between i386 and x86-64.
This also adopts the collapsing of features which are required at
compile-time into constant tests from x86-64 to i386.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-x86_64/alternative.h')
-rw-r--r-- | include/asm-x86_64/alternative.h | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/include/asm-x86_64/alternative.h b/include/asm-x86_64/alternative.h index a09427640764..eea7aecfac78 100644 --- a/include/asm-x86_64/alternative.h +++ b/include/asm-x86_64/alternative.h | |||
@@ -5,6 +5,41 @@ | |||
5 | 5 | ||
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/stddef.h> | 7 | #include <linux/stddef.h> |
8 | |||
9 | /* | ||
10 | * Alternative inline assembly for SMP. | ||
11 | * | ||
12 | * The LOCK_PREFIX macro defined here replaces the LOCK and | ||
13 | * LOCK_PREFIX macros used everywhere in the source tree. | ||
14 | * | ||
15 | * SMP alternatives use the same data structures as the other | ||
16 | * alternatives and the X86_FEATURE_UP flag to indicate the case of a | ||
17 | * UP system running a SMP kernel. The existing apply_alternatives() | ||
18 | * works fine for patching a SMP kernel for UP. | ||
19 | * | ||
20 | * The SMP alternative tables can be kept after boot and contain both | ||
21 | * UP and SMP versions of the instructions to allow switching back to | ||
22 | * SMP at runtime, when hotplugging in a new CPU, which is especially | ||
23 | * useful in virtualized environments. | ||
24 | * | ||
25 | * The very common lock prefix is handled as special case in a | ||
26 | * separate table which is a pure address list without replacement ptr | ||
27 | * and size information. That keeps the table sizes small. | ||
28 | */ | ||
29 | |||
30 | #ifdef CONFIG_SMP | ||
31 | #define LOCK_PREFIX \ | ||
32 | ".section .smp_locks,\"a\"\n" \ | ||
33 | " .align 8\n" \ | ||
34 | " .quad 661f\n" /* address */ \ | ||
35 | ".previous\n" \ | ||
36 | "661:\n\tlock; " | ||
37 | |||
38 | #else /* ! CONFIG_SMP */ | ||
39 | #define LOCK_PREFIX "" | ||
40 | #endif | ||
41 | |||
42 | /* This must be included *after* the definition of LOCK_PREFIX */ | ||
8 | #include <asm/cpufeature.h> | 43 | #include <asm/cpufeature.h> |
9 | 44 | ||
10 | struct alt_instr { | 45 | struct alt_instr { |
@@ -108,39 +143,6 @@ static inline void alternatives_smp_switch(int smp) {} | |||
108 | */ | 143 | */ |
109 | #define ASM_OUTPUT2(a, b) a, b | 144 | #define ASM_OUTPUT2(a, b) a, b |
110 | 145 | ||
111 | /* | ||
112 | * Alternative inline assembly for SMP. | ||
113 | * | ||
114 | * The LOCK_PREFIX macro defined here replaces the LOCK and | ||
115 | * LOCK_PREFIX macros used everywhere in the source tree. | ||
116 | * | ||
117 | * SMP alternatives use the same data structures as the other | ||
118 | * alternatives and the X86_FEATURE_UP flag to indicate the case of a | ||
119 | * UP system running a SMP kernel. The existing apply_alternatives() | ||
120 | * works fine for patching a SMP kernel for UP. | ||
121 | * | ||
122 | * The SMP alternative tables can be kept after boot and contain both | ||
123 | * UP and SMP versions of the instructions to allow switching back to | ||
124 | * SMP at runtime, when hotplugging in a new CPU, which is especially | ||
125 | * useful in virtualized environments. | ||
126 | * | ||
127 | * The very common lock prefix is handled as special case in a | ||
128 | * separate table which is a pure address list without replacement ptr | ||
129 | * and size information. That keeps the table sizes small. | ||
130 | */ | ||
131 | |||
132 | #ifdef CONFIG_SMP | ||
133 | #define LOCK_PREFIX \ | ||
134 | ".section .smp_locks,\"a\"\n" \ | ||
135 | " .align 8\n" \ | ||
136 | " .quad 661f\n" /* address */ \ | ||
137 | ".previous\n" \ | ||
138 | "661:\n\tlock; " | ||
139 | |||
140 | #else /* ! CONFIG_SMP */ | ||
141 | #define LOCK_PREFIX "" | ||
142 | #endif | ||
143 | |||
144 | struct paravirt_patch; | 146 | struct paravirt_patch; |
145 | #ifdef CONFIG_PARAVIRT | 147 | #ifdef CONFIG_PARAVIRT |
146 | void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end); | 148 | void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end); |