xref: /OK3568_Linux_fs/kernel/arch/s390/include/asm/cpufeature.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Module interface for CPU features
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright IBM Corp. 2015
6*4882a593Smuzhiyun  * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef __ASM_S390_CPUFEATURE_H
10*4882a593Smuzhiyun #define __ASM_S390_CPUFEATURE_H
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <asm/elf.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /* Hardware features on Linux on z Systems are indicated by facility bits that
15*4882a593Smuzhiyun  * are mapped to the so-called machine flags.  Particular machine flags are
16*4882a593Smuzhiyun  * then used to define ELF hardware capabilities; most notably hardware flags
17*4882a593Smuzhiyun  * that are essential for user space / glibc.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * Restrict the set of exposed CPU features to ELF hardware capabilities for
20*4882a593Smuzhiyun  * now.  Additional machine flags can be indicated by values larger than
21*4882a593Smuzhiyun  * MAX_ELF_HWCAP_FEATURES.
22*4882a593Smuzhiyun  */
23*4882a593Smuzhiyun #define MAX_ELF_HWCAP_FEATURES	(8 * sizeof(elf_hwcap))
24*4882a593Smuzhiyun #define MAX_CPU_FEATURES	MAX_ELF_HWCAP_FEATURES
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #define cpu_feature(feat)	ilog2(HWCAP_S390_ ## feat)
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun int cpu_have_feature(unsigned int nr);
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #endif /* __ASM_S390_CPUFEATURE_H */
31