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