diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2016-07-27 06:48:36 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-07-31 21:15:00 -0400 |
commit | a141cca3892bb391d17a73dae917ad51d40ff69a (patch) | |
tree | 63a5057ac076031298f8da2499a5ba7301cfcf1d /arch/powerpc | |
parent | bab4c8de6289b4615c21ddf0400397d03ce1863c (diff) |
powerpc/mm: Add early_[cpu|mmu]_has_feature()
In later patches, we will be switching CPU and MMU feature checks to
use static keys.
For checks in early boot before jump label is initialized we need a
variant of [cpu|mmu]_has_feature() that doesn't use jump labels.
So create those called, unimaginatively, early_[cpu|mmu]_has_feature().
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/cputable.h | 7 | ||||
-rw-r--r-- | arch/powerpc/include/asm/mmu.h | 17 |
2 files changed, 22 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index 7bb87017d9db..3d8dc9a7831d 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h | |||
@@ -577,12 +577,17 @@ enum { | |||
577 | }; | 577 | }; |
578 | #endif /* __powerpc64__ */ | 578 | #endif /* __powerpc64__ */ |
579 | 579 | ||
580 | static inline bool cpu_has_feature(unsigned long feature) | 580 | static inline bool early_cpu_has_feature(unsigned long feature) |
581 | { | 581 | { |
582 | return !!((CPU_FTRS_ALWAYS & feature) || | 582 | return !!((CPU_FTRS_ALWAYS & feature) || |
583 | (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature)); | 583 | (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature)); |
584 | } | 584 | } |
585 | 585 | ||
586 | static inline bool cpu_has_feature(unsigned long feature) | ||
587 | { | ||
588 | return early_cpu_has_feature(feature); | ||
589 | } | ||
590 | |||
586 | #define HBP_NUM 1 | 591 | #define HBP_NUM 1 |
587 | 592 | ||
588 | #endif /* !__ASSEMBLY__ */ | 593 | #endif /* !__ASSEMBLY__ */ |
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index f413b3213a3b..08b4c06604d6 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h | |||
@@ -135,11 +135,16 @@ enum { | |||
135 | 0, | 135 | 0, |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static inline bool mmu_has_feature(unsigned long feature) | 138 | static inline bool early_mmu_has_feature(unsigned long feature) |
139 | { | 139 | { |
140 | return !!(MMU_FTRS_POSSIBLE & cur_cpu_spec->mmu_features & feature); | 140 | return !!(MMU_FTRS_POSSIBLE & cur_cpu_spec->mmu_features & feature); |
141 | } | 141 | } |
142 | 142 | ||
143 | static inline bool mmu_has_feature(unsigned long feature) | ||
144 | { | ||
145 | return early_mmu_has_feature(feature); | ||
146 | } | ||
147 | |||
143 | static inline void mmu_clear_feature(unsigned long feature) | 148 | static inline void mmu_clear_feature(unsigned long feature) |
144 | { | 149 | { |
145 | cur_cpu_spec->mmu_features &= ~feature; | 150 | cur_cpu_spec->mmu_features &= ~feature; |
@@ -168,11 +173,21 @@ static inline bool radix_enabled(void) | |||
168 | { | 173 | { |
169 | return mmu_has_feature(MMU_FTR_TYPE_RADIX); | 174 | return mmu_has_feature(MMU_FTR_TYPE_RADIX); |
170 | } | 175 | } |
176 | |||
177 | static inline bool early_radix_enabled(void) | ||
178 | { | ||
179 | return early_mmu_has_feature(MMU_FTR_TYPE_RADIX); | ||
180 | } | ||
171 | #else | 181 | #else |
172 | static inline bool radix_enabled(void) | 182 | static inline bool radix_enabled(void) |
173 | { | 183 | { |
174 | return false; | 184 | return false; |
175 | } | 185 | } |
186 | |||
187 | static inline bool early_radix_enabled(void) | ||
188 | { | ||
189 | return false; | ||
190 | } | ||
176 | #endif | 191 | #endif |
177 | 192 | ||
178 | #endif /* !__ASSEMBLY__ */ | 193 | #endif /* !__ASSEMBLY__ */ |