Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * CPU feature definitions for module loading, used by
0004  * module_cpu_feature_match(), see asm/cputable.h for powerpc CPU features.
0005  *
0006  * Copyright 2016 Alastair D'Silva, IBM Corporation.
0007  */
0008 
0009 #ifndef __ASM_POWERPC_CPUFEATURE_H
0010 #define __ASM_POWERPC_CPUFEATURE_H
0011 
0012 #include <asm/cputable.h>
0013 
0014 /* Keep these in step with powerpc/include/asm/cputable.h */
0015 #define MAX_CPU_FEATURES (2 * 32)
0016 
0017 /*
0018  * Currently we don't have a need for any of the feature bits defined in
0019  * cpu_user_features. When we do, they should be defined such as:
0020  *
0021  * #define PPC_MODULE_FEATURE_32 (ilog2(PPC_FEATURE_32))
0022  */
0023 
0024 #define PPC_MODULE_FEATURE_VEC_CRYPTO           (32 + ilog2(PPC_FEATURE2_VEC_CRYPTO))
0025 
0026 #define cpu_feature(x)      (x)
0027 
0028 static inline bool cpu_have_feature(unsigned int num)
0029 {
0030     if (num < 32)
0031         return !!(cur_cpu_spec->cpu_user_features & 1UL << num);
0032     else
0033         return !!(cur_cpu_spec->cpu_user_features2 & 1UL << (num - 32));
0034 }
0035 
0036 #endif /* __ASM_POWERPC_CPUFEATURE_H */