Skip to content

Commit 9bbf0b5

Browse files
paulusmackmpe
authored andcommitted
powerpc: Free up CPU feature bits on 64-bit machines
This moves all the CPU feature bits that are only used on 32-bit machines to the top 20 bits of the CPU feature word and arranges for them to be defined only in 32-bit builds. The features that are common to 32-bit and 64-bit machines are moved to bits 0-11 of the CPU feature word. This means that for 64-bit platforms, bits 44-63 can now be used for new features that only exist on 64-bit machines. (These bit numbers are counting from the right, i.e. the LSB is bit 0.) Because CPU_FTR_L3_DISABLE_NAP moved from the low 16 bits to the high 16 bits, we have to adjust some assembly code. Also, CPU_FTR_EMB_HV moved from the high 16 bits to the low 16 bits. Note that CPU_FTR_REAL_LE only applies to 64-bit chips, because only 64-bit chips (POWER6, 7, 8, 9) have a true little-endian mode that is a CPU execution mode as opposed to being a page attribute. With this we now have 20 free CPU feature bits on 64-bit machines. Signed-off-by: Paul Mackerras <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent dd0efb3 commit 9bbf0b5

File tree

3 files changed

+73
-64
lines changed

3 files changed

+73
-64
lines changed

arch/powerpc/include/asm/cputable.h

Lines changed: 71 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -131,40 +131,48 @@ static inline void cpu_feature_keys_init(void) { }
131131

132132
/* CPU kernel features */
133133

134-
/* Retain the 32b definitions all use bottom half of word */
134+
/* Definitions for features that we have on both 32-bit and 64-bit chips */
135135
#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x00000001)
136-
#define CPU_FTR_L2CR ASM_CONST(0x00000002)
137-
#define CPU_FTR_SPEC7450 ASM_CONST(0x00000004)
138-
#define CPU_FTR_ALTIVEC ASM_CONST(0x00000008)
139-
#define CPU_FTR_TAU ASM_CONST(0x00000010)
140-
#define CPU_FTR_CAN_DOZE ASM_CONST(0x00000020)
141-
#define CPU_FTR_USE_RTC ASM_CONST(0x00000040)
142-
#define CPU_FTR_601 ASM_CONST(0x00000100)
143-
#define CPU_FTR_DBELL ASM_CONST(0x00000200)
144-
#define CPU_FTR_CAN_NAP ASM_CONST(0x00000400)
145-
#define CPU_FTR_L3CR ASM_CONST(0x00000800)
146-
#define CPU_FTR_L3_DISABLE_NAP ASM_CONST(0x00001000)
147-
#define CPU_FTR_NAP_DISABLE_L2_PR ASM_CONST(0x00002000)
148-
#define CPU_FTR_DUAL_PLL_750FX ASM_CONST(0x00004000)
149-
#define CPU_FTR_NO_DPM ASM_CONST(0x00008000)
150-
#define CPU_FTR_476_DD2 ASM_CONST(0x00010000)
151-
#define CPU_FTR_NEED_COHERENT ASM_CONST(0x00020000)
152-
#define CPU_FTR_NO_BTIC ASM_CONST(0x00040000)
153-
#define CPU_FTR_DEBUG_LVL_EXC ASM_CONST(0x00080000)
154-
#define CPU_FTR_NODSISRALIGN ASM_CONST(0x00100000)
155-
#define CPU_FTR_PPC_LE ASM_CONST(0x00200000)
156-
#define CPU_FTR_REAL_LE ASM_CONST(0x00400000)
157-
#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x00800000)
158-
#define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x01000000)
159-
#define CPU_FTR_SPE ASM_CONST(0x02000000)
160-
#define CPU_FTR_NEED_PAIRED_STWCX ASM_CONST(0x04000000)
161-
#define CPU_FTR_LWSYNC ASM_CONST(0x08000000)
162-
#define CPU_FTR_NOEXECUTE ASM_CONST(0x10000000)
163-
#define CPU_FTR_INDEXED_DCR ASM_CONST(0x20000000)
164-
#define CPU_FTR_EMB_HV ASM_CONST(0x40000000)
136+
#define CPU_FTR_ALTIVEC ASM_CONST(0x00000002)
137+
#define CPU_FTR_DBELL ASM_CONST(0x00000004)
138+
#define CPU_FTR_CAN_NAP ASM_CONST(0x00000008)
139+
#define CPU_FTR_DEBUG_LVL_EXC ASM_CONST(0x00000010)
140+
#define CPU_FTR_NODSISRALIGN ASM_CONST(0x00000020)
141+
#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x00000040)
142+
#define CPU_FTR_LWSYNC ASM_CONST(0x00000080)
143+
#define CPU_FTR_NOEXECUTE ASM_CONST(0x00000100)
144+
#define CPU_FTR_EMB_HV ASM_CONST(0x00000200)
145+
146+
/* Definitions for features that only exist on 32-bit chips */
147+
#ifdef CONFIG_PPC32
148+
#define CPU_FTR_601 ASM_CONST(0x00001000)
149+
#define CPU_FTR_L2CR ASM_CONST(0x00002000)
150+
#define CPU_FTR_SPEC7450 ASM_CONST(0x00004000)
151+
#define CPU_FTR_TAU ASM_CONST(0x00008000)
152+
#define CPU_FTR_CAN_DOZE ASM_CONST(0x00010000)
153+
#define CPU_FTR_USE_RTC ASM_CONST(0x00020000)
154+
#define CPU_FTR_L3CR ASM_CONST(0x00040000)
155+
#define CPU_FTR_L3_DISABLE_NAP ASM_CONST(0x00080000)
156+
#define CPU_FTR_NAP_DISABLE_L2_PR ASM_CONST(0x00100000)
157+
#define CPU_FTR_DUAL_PLL_750FX ASM_CONST(0x00200000)
158+
#define CPU_FTR_NO_DPM ASM_CONST(0x00400000)
159+
#define CPU_FTR_476_DD2 ASM_CONST(0x00800000)
160+
#define CPU_FTR_NEED_COHERENT ASM_CONST(0x01000000)
161+
#define CPU_FTR_NO_BTIC ASM_CONST(0x02000000)
162+
#define CPU_FTR_PPC_LE ASM_CONST(0x04000000)
163+
#define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x08000000)
164+
#define CPU_FTR_SPE ASM_CONST(0x10000000)
165+
#define CPU_FTR_NEED_PAIRED_STWCX ASM_CONST(0x20000000)
166+
#define CPU_FTR_INDEXED_DCR ASM_CONST(0x40000000)
167+
168+
#else /* CONFIG_PPC32 */
169+
/* Define these to 0 for the sake of tests in common code */
170+
#define CPU_FTR_601 (0)
171+
#define CPU_FTR_PPC_LE (0)
172+
#endif
165173

166174
/*
167-
* Add the 64-bit processor unique features in the top half of the word;
175+
* Definitions for the 64-bit processor unique features;
168176
* on 32-bit, make the names available but defined to be 0.
169177
*/
170178
#ifdef __powerpc64__
@@ -173,37 +181,38 @@ static inline void cpu_feature_keys_init(void) { }
173181
#define LONG_ASM_CONST(x) 0
174182
#endif
175183

176-
#define CPU_FTR_HVMODE LONG_ASM_CONST(0x0000000100000000)
177-
#define CPU_FTR_ARCH_201 LONG_ASM_CONST(0x0000000200000000)
178-
#define CPU_FTR_ARCH_206 LONG_ASM_CONST(0x0000000400000000)
179-
#define CPU_FTR_ARCH_207S LONG_ASM_CONST(0x0000000800000000)
180-
#define CPU_FTR_ARCH_300 LONG_ASM_CONST(0x0000001000000000)
181-
#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000002000000000)
182-
#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000004000000000)
183-
#define CPU_FTR_SMT LONG_ASM_CONST(0x0000008000000000)
184-
#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000010000000000)
185-
#define CPU_FTR_PURR LONG_ASM_CONST(0x0000020000000000)
186-
#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000040000000000)
187-
#define CPU_FTR_SPURR LONG_ASM_CONST(0x0000080000000000)
188-
#define CPU_FTR_DSCR LONG_ASM_CONST(0x0000100000000000)
189-
#define CPU_FTR_VSX LONG_ASM_CONST(0x0000200000000000)
190-
#define CPU_FTR_SAO LONG_ASM_CONST(0x0000400000000000)
191-
#define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0000800000000000)
192-
#define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0001000000000000)
193-
#define CPU_FTR_ASYM_SMT LONG_ASM_CONST(0x0002000000000000)
194-
#define CPU_FTR_STCX_CHECKS_ADDRESS LONG_ASM_CONST(0x0004000000000000)
195-
#define CPU_FTR_POPCNTB LONG_ASM_CONST(0x0008000000000000)
196-
#define CPU_FTR_POPCNTD LONG_ASM_CONST(0x0010000000000000)
197-
#define CPU_FTR_PKEY LONG_ASM_CONST(0x0020000000000000)
198-
#define CPU_FTR_VMX_COPY LONG_ASM_CONST(0x0040000000000000)
199-
#define CPU_FTR_TM LONG_ASM_CONST(0x0080000000000000)
200-
#define CPU_FTR_CFAR LONG_ASM_CONST(0x0100000000000000)
201-
#define CPU_FTR_HAS_PPR LONG_ASM_CONST(0x0200000000000000)
202-
#define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000)
203-
#define CPU_FTR_DABRX LONG_ASM_CONST(0x0800000000000000)
204-
#define CPU_FTR_PMAO_BUG LONG_ASM_CONST(0x1000000000000000)
205-
#define CPU_FTR_POWER9_DD1 LONG_ASM_CONST(0x4000000000000000)
206-
#define CPU_FTR_POWER9_DD2_1 LONG_ASM_CONST(0x8000000000000000)
184+
#define CPU_FTR_REAL_LE LONG_ASM_CONST(0x0000000000001000)
185+
#define CPU_FTR_HVMODE LONG_ASM_CONST(0x0000000000002000)
186+
#define CPU_FTR_ARCH_201 LONG_ASM_CONST(0x0000000000004000)
187+
#define CPU_FTR_ARCH_206 LONG_ASM_CONST(0x0000000000008000)
188+
#define CPU_FTR_ARCH_207S LONG_ASM_CONST(0x0000000000010000)
189+
#define CPU_FTR_ARCH_300 LONG_ASM_CONST(0x0000000000020000)
190+
#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000000000040000)
191+
#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000000000080000)
192+
#define CPU_FTR_SMT LONG_ASM_CONST(0x0000000000100000)
193+
#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000000000200000)
194+
#define CPU_FTR_PURR LONG_ASM_CONST(0x0000000000400000)
195+
#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000000000800000)
196+
#define CPU_FTR_SPURR LONG_ASM_CONST(0x0000000001000000)
197+
#define CPU_FTR_DSCR LONG_ASM_CONST(0x0000000002000000)
198+
#define CPU_FTR_VSX LONG_ASM_CONST(0x0000000004000000)
199+
#define CPU_FTR_SAO LONG_ASM_CONST(0x0000000008000000)
200+
#define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0000000010000000)
201+
#define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0000000020000000)
202+
#define CPU_FTR_ASYM_SMT LONG_ASM_CONST(0x0000000040000000)
203+
#define CPU_FTR_STCX_CHECKS_ADDRESS LONG_ASM_CONST(0x0000000080000000)
204+
#define CPU_FTR_POPCNTB LONG_ASM_CONST(0x0000000100000000)
205+
#define CPU_FTR_POPCNTD LONG_ASM_CONST(0x0000000200000000)
206+
#define CPU_FTR_PKEY LONG_ASM_CONST(0x0000000400000000)
207+
#define CPU_FTR_VMX_COPY LONG_ASM_CONST(0x0000000800000000)
208+
#define CPU_FTR_TM LONG_ASM_CONST(0x0000001000000000)
209+
#define CPU_FTR_CFAR LONG_ASM_CONST(0x0000002000000000)
210+
#define CPU_FTR_HAS_PPR LONG_ASM_CONST(0x0000004000000000)
211+
#define CPU_FTR_DAWR LONG_ASM_CONST(0x0000008000000000)
212+
#define CPU_FTR_DABRX LONG_ASM_CONST(0x0000010000000000)
213+
#define CPU_FTR_PMAO_BUG LONG_ASM_CONST(0x0000020000000000)
214+
#define CPU_FTR_POWER9_DD1 LONG_ASM_CONST(0x0000040000000000)
215+
#define CPU_FTR_POWER9_DD2_1 LONG_ASM_CONST(0x0000080000000000)
207216

208217
#ifndef __ASSEMBLY__
209218

arch/powerpc/kernel/cpu_setup_6xx.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ BEGIN_FTR_SECTION
226226
beq 1f
227227
END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
228228
lwz r6,CPU_SPEC_FEATURES(r4)
229-
andi. r0,r6,CPU_FTR_L3_DISABLE_NAP
229+
andis. r0,r6,CPU_FTR_L3_DISABLE_NAP@h
230230
beq 1f
231231
li r7,CPU_FTR_CAN_NAP
232232
andc r6,r6,r7

arch/powerpc/kernel/cpu_setup_fsl_booke.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ _GLOBAL(__setup_cpu_e5500)
162162
* the feature on the primary core, avoid doing it on the
163163
* secondary core.
164164
*/
165-
andis. r6, r3, CPU_FTR_EMB_HV@h
165+
andi. r6, r3, CPU_FTR_EMB_HV
166166
beq 2f
167167
rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV
168168
stw r3, CPU_SPEC_FEATURES(r4)

0 commit comments

Comments
 (0)