18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Module interface for CPU features
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2015
68c2ecf20Sopenharmony_ci * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __ASM_S390_CPUFEATURE_H
108c2ecf20Sopenharmony_ci#define __ASM_S390_CPUFEATURE_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/elf.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* Hardware features on Linux on z Systems are indicated by facility bits that
158c2ecf20Sopenharmony_ci * are mapped to the so-called machine flags.  Particular machine flags are
168c2ecf20Sopenharmony_ci * then used to define ELF hardware capabilities; most notably hardware flags
178c2ecf20Sopenharmony_ci * that are essential for user space / glibc.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * Restrict the set of exposed CPU features to ELF hardware capabilities for
208c2ecf20Sopenharmony_ci * now.  Additional machine flags can be indicated by values larger than
218c2ecf20Sopenharmony_ci * MAX_ELF_HWCAP_FEATURES.
228c2ecf20Sopenharmony_ci */
238c2ecf20Sopenharmony_ci#define MAX_ELF_HWCAP_FEATURES	(8 * sizeof(elf_hwcap))
248c2ecf20Sopenharmony_ci#define MAX_CPU_FEATURES	MAX_ELF_HWCAP_FEATURES
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define cpu_feature(feat)	ilog2(HWCAP_S390_ ## feat)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciint cpu_have_feature(unsigned int nr);
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#endif /* __ASM_S390_CPUFEATURE_H */
31