Skip to content

Commit

Permalink
powerpc/mm: Add early_[cpu|mmu]_has_feature()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Ellerman committed Aug 1, 2016
1 parent bab4c8d commit a141cca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
7 changes: 6 additions & 1 deletion arch/powerpc/include/asm/cputable.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,17 @@ enum {
};
#endif /* __powerpc64__ */

static inline bool cpu_has_feature(unsigned long feature)
static inline bool early_cpu_has_feature(unsigned long feature)
{
return !!((CPU_FTRS_ALWAYS & feature) ||
(CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature));
}

static inline bool cpu_has_feature(unsigned long feature)
{
return early_cpu_has_feature(feature);
}

#define HBP_NUM 1

#endif /* !__ASSEMBLY__ */
Expand Down
17 changes: 16 additions & 1 deletion arch/powerpc/include/asm/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,16 @@ enum {
0,
};

static inline bool mmu_has_feature(unsigned long feature)
static inline bool early_mmu_has_feature(unsigned long feature)
{
return !!(MMU_FTRS_POSSIBLE & cur_cpu_spec->mmu_features & feature);
}

static inline bool mmu_has_feature(unsigned long feature)
{
return early_mmu_has_feature(feature);
}

static inline void mmu_clear_feature(unsigned long feature)
{
cur_cpu_spec->mmu_features &= ~feature;
Expand Down Expand Up @@ -168,11 +173,21 @@ static inline bool radix_enabled(void)
{
return mmu_has_feature(MMU_FTR_TYPE_RADIX);
}

static inline bool early_radix_enabled(void)
{
return early_mmu_has_feature(MMU_FTR_TYPE_RADIX);
}
#else
static inline bool radix_enabled(void)
{
return false;
}

static inline bool early_radix_enabled(void)
{
return false;
}
#endif

#endif /* !__ASSEMBLY__ */
Expand Down

0 comments on commit a141cca

Please sign in to comment.