
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ICA1GK -------------------------------- The v6.6's implementation of arm64 cpuinfo loops through online CPUs completely within seq_show(), which isn't compatible with how bpf iter works. Fortunately, commit 7bb797757bf5 ("arm64/cpuinfo: only show one cpu's info in c_show()") of v6.16 refines this part of code and meets our requirement. Create the bpf iter target for cpuinfo interface and place all the code at a new file, where CPUs are iterated via seq_{start,show,next}(), while keeping a native_c_show() borrowed from the aforementioned commit. Signed-off-by: GONG Ruiqi <gongruiqi1@huawei.com> --- arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/bpf-rvi.c | 167 ++++++++++++++++++++++++++++++++++ arch/arm64/kernel/cpuinfo.c | 128 +------------------------- arch/arm64/kernel/hwcap_str.h | 131 ++++++++++++++++++++++++++ 4 files changed, 300 insertions(+), 127 deletions(-) create mode 100644 arch/arm64/kernel/bpf-rvi.c create mode 100644 arch/arm64/kernel/hwcap_str.h diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 4ce58887302a..87a7be72c95a 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -83,6 +83,7 @@ obj-$(CONFIG_UNWIND_PATCH_PAC_INTO_SCS) += patch-scs.o obj-$(CONFIG_IPI_AS_NMI) += ipi_nmi.o obj-$(CONFIG_HISI_VIRTCCA_GUEST) += virtcca_cvm_guest.o virtcca_cvm_tsi.o obj-$(CONFIG_HISI_VIRTCCA_HOST) += virtcca_cvm_host.o +obj-$(CONFIG_BPF_RVI) += bpf-rvi.o CFLAGS_patch-scs.o += -mbranch-protection=none # Force dependency (vdso*-wrap.S includes vdso.so through incbin) diff --git a/arch/arm64/kernel/bpf-rvi.c b/arch/arm64/kernel/bpf-rvi.c new file mode 100644 index 000000000000..c6590704e3a6 --- /dev/null +++ b/arch/arm64/kernel/bpf-rvi.c @@ -0,0 +1,167 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright (c) 2025 Huawei Technologies Co., Ltd */ +#include <asm/cpu.h> +#include <asm/cputype.h> + +#include <linux/bpf.h> +#include <linux/btf_ids.h> +#include <linux/cpuset.h> +#include <linux/pid_namespace.h> + +#include "hwcap_str.h" + +static int native_c_show(struct seq_file *m, void *v) +{ + int j; + int cpu = m->index; + bool aarch32 = personality(current->personality) == PER_LINUX32; + struct cpuinfo_arm64 *cpuinfo = v; + u32 midr = cpuinfo->reg_midr; + + /* + * glibc reads /proc/cpuinfo to determine the number of + * online processors, looking for lines beginning with + * "processor". Give glibc what it expects. + */ + seq_printf(m, "processor\t: %ld\n", cpu); + if (aarch32) + seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n", + MIDR_REVISION(midr), COMPAT_ELF_PLATFORM); + + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", + loops_per_jiffy / (500000UL/HZ), + loops_per_jiffy / (5000UL/HZ) % 100); + + /* + * Dump out the common processor features in a single line. + * Userspace should read the hwcaps with getauxval(AT_HWCAP) + * rather than attempting to parse this, but there's a body of + * software which does already (at least for 32-bit). + */ + seq_puts(m, "Features\t:"); + if (aarch32) { +#ifdef CONFIG_AARCH32_EL0 + for (j = 0; j < ARRAY_SIZE(compat_hwcap_str); j++) { + if (a32_elf_hwcap & (1 << j)) { + /* + * Warn once if any feature should not + * have been present on arm64 platform. + */ + if (WARN_ON_ONCE(!compat_hwcap_str[j])) + continue; + + seq_printf(m, " %s", compat_hwcap_str[j]); + } + } + + for (j = 0; j < ARRAY_SIZE(compat_hwcap2_str); j++) + if (a32_elf_hwcap2 & (1 << j)) + seq_printf(m, " %s", compat_hwcap2_str[j]); +#endif /* CONFIG_AARCH32_EL0 */ + } else { + for (j = 0; j < ARRAY_SIZE(hwcap_str); j++) + if (cpu_have_feature(j)) + seq_printf(m, " %s", hwcap_str[j]); + } + seq_puts(m, "\n"); + + seq_printf(m, "CPU implementer\t: 0x%02x\n", MIDR_IMPLEMENTOR(midr)); + seq_printf(m, "CPU architecture: 8\n"); + seq_printf(m, "CPU variant\t: 0x%x\n", MIDR_VARIANT(midr)); + seq_printf(m, "CPU part\t: 0x%03x\n", MIDR_PARTNUM(midr)); + seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr)); + + return 0; +} + +static void bpf_c_stop(struct seq_file *m, void *v) +{ +} + +struct cpuinfo_arm64_seq_priv { + cpumask_t allowed_mask; +}; + +static void *bpf_c_start(struct seq_file *m, loff_t *pos) +{ + struct cpuinfo_arm64_seq_priv *priv = m->private; + struct task_struct *reaper = get_current_level1_reaper(); + + task_effective_cpumask(reaper ?: current, &priv->allowed_mask); + if (reaper) + put_task_struct(reaper); + + /* + * DO NOT use cpumask_first() here: sys_read may start from somewhere in + * the middle of the file, and *pos may contain a value from the last + * read. + */ + *pos = cpumask_next(*pos - 1, &priv->allowed_mask); + return *pos < nr_cpu_ids ? &per_cpu(cpu_data, *pos) : NULL; +} + +static void *bpf_c_next(struct seq_file *m, void *v, loff_t *pos) +{ + struct cpuinfo_arm64_seq_priv *priv = m->private; + + *pos = cpumask_next(*pos, &priv->allowed_mask); + return *pos < nr_cpu_ids ? &per_cpu(cpu_data, *pos) : NULL; +} + +struct bpf_iter__cpuinfo_arm64 { + __bpf_md_ptr(struct bpf_iter_meta *, meta); + __bpf_md_ptr(struct cpuinfo_arm64 *, cpuinfo); +}; + +static int bpf_c_show(struct seq_file *m, void *v) +{ + struct bpf_iter__cpuinfo_arm64 ctx; + struct bpf_iter_meta meta; + struct bpf_prog *prog; + + meta.seq = m; + prog = bpf_iter_get_info(&meta, false); + if (!prog) + return native_c_show(m, v); + + ctx.meta = &meta; + ctx.cpuinfo = (struct cpuinfo_arm64 *)v; + return bpf_iter_run_prog(prog, &ctx); +} + +static const struct seq_operations bpf_cpuinfo_op = { + .start = bpf_c_start, + .next = bpf_c_next, + .stop = bpf_c_stop, + .show = bpf_c_show +}; + +DEFINE_BPF_ITER_FUNC(cpuinfo_arm64, struct bpf_iter_meta *meta, + struct cpuinfo_arm64 *cpuinfo) + +BTF_ID_LIST(btf_cpuinfo_arm64_id) +BTF_ID(struct, cpuinfo_arm64) + +static const struct bpf_iter_seq_info cpuinfo_arm64_seq_info = { + .seq_ops = &bpf_cpuinfo_op, + .init_seq_private = NULL, + .fini_seq_private = NULL, + .seq_priv_size = sizeof(struct cpuinfo_arm64_seq_priv), +}; + +static struct bpf_iter_reg cpuinfo_arm64_reg_info = { + .target = "cpuinfo_arm64", + .ctx_arg_info_size = 1, + .ctx_arg_info = { + { offsetof(struct bpf_iter__cpuinfo_arm64, cpuinfo), + PTR_TO_BTF_ID }, + }, + .seq_info = &cpuinfo_arm64_seq_info, +}; + +static int __init cpuinfo_iter_init(void) +{ + cpuinfo_arm64_reg_info.ctx_arg_info[0].btf_id = *btf_cpuinfo_arm64_id; + return bpf_iter_reg_target(&cpuinfo_arm64_reg_info); +} +late_initcall(cpuinfo_iter_init); diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index dade66047478..eca636492f7d 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -49,132 +49,7 @@ static inline const char *icache_policy_str(int l1ip) unsigned long __icache_flags; -static const char *const hwcap_str[] = { - [KERNEL_HWCAP_FP] = "fp", - [KERNEL_HWCAP_ASIMD] = "asimd", - [KERNEL_HWCAP_EVTSTRM] = "evtstrm", - [KERNEL_HWCAP_AES] = "aes", - [KERNEL_HWCAP_PMULL] = "pmull", - [KERNEL_HWCAP_SHA1] = "sha1", - [KERNEL_HWCAP_SHA2] = "sha2", - [KERNEL_HWCAP_CRC32] = "crc32", - [KERNEL_HWCAP_ATOMICS] = "atomics", - [KERNEL_HWCAP_FPHP] = "fphp", - [KERNEL_HWCAP_ASIMDHP] = "asimdhp", - [KERNEL_HWCAP_CPUID] = "cpuid", - [KERNEL_HWCAP_ASIMDRDM] = "asimdrdm", - [KERNEL_HWCAP_JSCVT] = "jscvt", - [KERNEL_HWCAP_FCMA] = "fcma", - [KERNEL_HWCAP_LRCPC] = "lrcpc", - [KERNEL_HWCAP_DCPOP] = "dcpop", - [KERNEL_HWCAP_SHA3] = "sha3", - [KERNEL_HWCAP_SM3] = "sm3", - [KERNEL_HWCAP_SM4] = "sm4", - [KERNEL_HWCAP_ASIMDDP] = "asimddp", - [KERNEL_HWCAP_SHA512] = "sha512", - [KERNEL_HWCAP_SVE] = "sve", - [KERNEL_HWCAP_ASIMDFHM] = "asimdfhm", - [KERNEL_HWCAP_DIT] = "dit", - [KERNEL_HWCAP_USCAT] = "uscat", - [KERNEL_HWCAP_ILRCPC] = "ilrcpc", - [KERNEL_HWCAP_FLAGM] = "flagm", - [KERNEL_HWCAP_SSBS] = "ssbs", - [KERNEL_HWCAP_SB] = "sb", - [KERNEL_HWCAP_PACA] = "paca", - [KERNEL_HWCAP_PACG] = "pacg", - [KERNEL_HWCAP_LS64] = "ls64", - [KERNEL_HWCAP_LS64_V] = "ls64_v", - [KERNEL_HWCAP_DCPODP] = "dcpodp", - [KERNEL_HWCAP_SVE2] = "sve2", - [KERNEL_HWCAP_SVEAES] = "sveaes", - [KERNEL_HWCAP_SVEPMULL] = "svepmull", - [KERNEL_HWCAP_SVEBITPERM] = "svebitperm", - [KERNEL_HWCAP_SVESHA3] = "svesha3", - [KERNEL_HWCAP_SVESM4] = "svesm4", - [KERNEL_HWCAP_FLAGM2] = "flagm2", - [KERNEL_HWCAP_FRINT] = "frint", - [KERNEL_HWCAP_SVEI8MM] = "svei8mm", - [KERNEL_HWCAP_SVEF32MM] = "svef32mm", - [KERNEL_HWCAP_SVEF64MM] = "svef64mm", - [KERNEL_HWCAP_SVEBF16] = "svebf16", - [KERNEL_HWCAP_I8MM] = "i8mm", - [KERNEL_HWCAP_BF16] = "bf16", - [KERNEL_HWCAP_DGH] = "dgh", - [KERNEL_HWCAP_RNG] = "rng", - [KERNEL_HWCAP_BTI] = "bti", - [KERNEL_HWCAP_MTE] = "mte", - [KERNEL_HWCAP_ECV] = "ecv", - [KERNEL_HWCAP_AFP] = "afp", - [KERNEL_HWCAP_RPRES] = "rpres", - [KERNEL_HWCAP_MTE3] = "mte3", - [KERNEL_HWCAP_SME] = "sme", - [KERNEL_HWCAP_SME_I16I64] = "smei16i64", - [KERNEL_HWCAP_SME_F64F64] = "smef64f64", - [KERNEL_HWCAP_SME_I8I32] = "smei8i32", - [KERNEL_HWCAP_SME_F16F32] = "smef16f32", - [KERNEL_HWCAP_SME_B16F32] = "smeb16f32", - [KERNEL_HWCAP_SME_F32F32] = "smef32f32", - [KERNEL_HWCAP_SME_FA64] = "smefa64", - [KERNEL_HWCAP_WFXT] = "wfxt", - [KERNEL_HWCAP_EBF16] = "ebf16", - [KERNEL_HWCAP_SVE_EBF16] = "sveebf16", - [KERNEL_HWCAP_CSSC] = "cssc", - [KERNEL_HWCAP_RPRFM] = "rprfm", - [KERNEL_HWCAP_SVE2P1] = "sve2p1", - [KERNEL_HWCAP_SME2] = "sme2", - [KERNEL_HWCAP_SME2P1] = "sme2p1", - [KERNEL_HWCAP_SME_I16I32] = "smei16i32", - [KERNEL_HWCAP_SME_BI32I32] = "smebi32i32", - [KERNEL_HWCAP_SME_B16B16] = "smeb16b16", - [KERNEL_HWCAP_SME_F16F16] = "smef16f16", - [KERNEL_HWCAP_MOPS] = "mops", - [KERNEL_HWCAP_HBC] = "hbc", -}; - -#ifdef CONFIG_AARCH32_EL0 -#define COMPAT_KERNEL_HWCAP(x) const_ilog2(COMPAT_HWCAP_ ## x) -static const char *const compat_hwcap_str[] = { - [COMPAT_KERNEL_HWCAP(SWP)] = "swp", - [COMPAT_KERNEL_HWCAP(HALF)] = "half", - [COMPAT_KERNEL_HWCAP(THUMB)] = "thumb", - [COMPAT_KERNEL_HWCAP(26BIT)] = NULL, /* Not possible on arm64 */ - [COMPAT_KERNEL_HWCAP(FAST_MULT)] = "fastmult", - [COMPAT_KERNEL_HWCAP(FPA)] = NULL, /* Not possible on arm64 */ - [COMPAT_KERNEL_HWCAP(VFP)] = "vfp", - [COMPAT_KERNEL_HWCAP(EDSP)] = "edsp", - [COMPAT_KERNEL_HWCAP(JAVA)] = NULL, /* Not possible on arm64 */ - [COMPAT_KERNEL_HWCAP(IWMMXT)] = NULL, /* Not possible on arm64 */ - [COMPAT_KERNEL_HWCAP(CRUNCH)] = NULL, /* Not possible on arm64 */ - [COMPAT_KERNEL_HWCAP(THUMBEE)] = NULL, /* Not possible on arm64 */ - [COMPAT_KERNEL_HWCAP(NEON)] = "neon", - [COMPAT_KERNEL_HWCAP(VFPv3)] = "vfpv3", - [COMPAT_KERNEL_HWCAP(VFPV3D16)] = NULL, /* Not possible on arm64 */ - [COMPAT_KERNEL_HWCAP(TLS)] = "tls", - [COMPAT_KERNEL_HWCAP(VFPv4)] = "vfpv4", - [COMPAT_KERNEL_HWCAP(IDIVA)] = "idiva", - [COMPAT_KERNEL_HWCAP(IDIVT)] = "idivt", - [COMPAT_KERNEL_HWCAP(VFPD32)] = NULL, /* Not possible on arm64 */ - [COMPAT_KERNEL_HWCAP(LPAE)] = "lpae", - [COMPAT_KERNEL_HWCAP(EVTSTRM)] = "evtstrm", - [COMPAT_KERNEL_HWCAP(FPHP)] = "fphp", - [COMPAT_KERNEL_HWCAP(ASIMDHP)] = "asimdhp", - [COMPAT_KERNEL_HWCAP(ASIMDDP)] = "asimddp", - [COMPAT_KERNEL_HWCAP(ASIMDFHM)] = "asimdfhm", - [COMPAT_KERNEL_HWCAP(ASIMDBF16)] = "asimdbf16", - [COMPAT_KERNEL_HWCAP(I8MM)] = "i8mm", -}; - -#define COMPAT_KERNEL_HWCAP2(x) const_ilog2(COMPAT_HWCAP2_ ## x) -static const char *const compat_hwcap2_str[] = { - [COMPAT_KERNEL_HWCAP2(AES)] = "aes", - [COMPAT_KERNEL_HWCAP2(PMULL)] = "pmull", - [COMPAT_KERNEL_HWCAP2(SHA1)] = "sha1", - [COMPAT_KERNEL_HWCAP2(SHA2)] = "sha2", - [COMPAT_KERNEL_HWCAP2(CRC32)] = "crc32", - [COMPAT_KERNEL_HWCAP2(SB)] = "sb", - [COMPAT_KERNEL_HWCAP2(SSBS)] = "ssbs", -}; -#endif /* CONFIG_AARCH32_EL0 */ +#include "hwcap_str.h" static int c_show(struct seq_file *m, void *v) { @@ -265,7 +140,6 @@ const struct seq_operations cpuinfo_op = { .show = c_show }; - static struct kobj_type cpuregs_kobj_type = { .sysfs_ops = &kobj_sysfs_ops, }; diff --git a/arch/arm64/kernel/hwcap_str.h b/arch/arm64/kernel/hwcap_str.h new file mode 100644 index 000000000000..e53a2c10b0c1 --- /dev/null +++ b/arch/arm64/kernel/hwcap_str.h @@ -0,0 +1,131 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (c) 2025 Huawei Technologies Co., Ltd */ +#include <asm/hwcap.h> + +static const char *const hwcap_str[] = { + [KERNEL_HWCAP_FP] = "fp", + [KERNEL_HWCAP_ASIMD] = "asimd", + [KERNEL_HWCAP_EVTSTRM] = "evtstrm", + [KERNEL_HWCAP_AES] = "aes", + [KERNEL_HWCAP_PMULL] = "pmull", + [KERNEL_HWCAP_SHA1] = "sha1", + [KERNEL_HWCAP_SHA2] = "sha2", + [KERNEL_HWCAP_CRC32] = "crc32", + [KERNEL_HWCAP_ATOMICS] = "atomics", + [KERNEL_HWCAP_FPHP] = "fphp", + [KERNEL_HWCAP_ASIMDHP] = "asimdhp", + [KERNEL_HWCAP_CPUID] = "cpuid", + [KERNEL_HWCAP_ASIMDRDM] = "asimdrdm", + [KERNEL_HWCAP_JSCVT] = "jscvt", + [KERNEL_HWCAP_FCMA] = "fcma", + [KERNEL_HWCAP_LRCPC] = "lrcpc", + [KERNEL_HWCAP_DCPOP] = "dcpop", + [KERNEL_HWCAP_SHA3] = "sha3", + [KERNEL_HWCAP_SM3] = "sm3", + [KERNEL_HWCAP_SM4] = "sm4", + [KERNEL_HWCAP_ASIMDDP] = "asimddp", + [KERNEL_HWCAP_SHA512] = "sha512", + [KERNEL_HWCAP_SVE] = "sve", + [KERNEL_HWCAP_ASIMDFHM] = "asimdfhm", + [KERNEL_HWCAP_DIT] = "dit", + [KERNEL_HWCAP_USCAT] = "uscat", + [KERNEL_HWCAP_ILRCPC] = "ilrcpc", + [KERNEL_HWCAP_FLAGM] = "flagm", + [KERNEL_HWCAP_SSBS] = "ssbs", + [KERNEL_HWCAP_SB] = "sb", + [KERNEL_HWCAP_PACA] = "paca", + [KERNEL_HWCAP_PACG] = "pacg", + [KERNEL_HWCAP_LS64] = "ls64", + [KERNEL_HWCAP_LS64_V] = "ls64_v", + [KERNEL_HWCAP_DCPODP] = "dcpodp", + [KERNEL_HWCAP_SVE2] = "sve2", + [KERNEL_HWCAP_SVEAES] = "sveaes", + [KERNEL_HWCAP_SVEPMULL] = "svepmull", + [KERNEL_HWCAP_SVEBITPERM] = "svebitperm", + [KERNEL_HWCAP_SVESHA3] = "svesha3", + [KERNEL_HWCAP_SVESM4] = "svesm4", + [KERNEL_HWCAP_FLAGM2] = "flagm2", + [KERNEL_HWCAP_FRINT] = "frint", + [KERNEL_HWCAP_SVEI8MM] = "svei8mm", + [KERNEL_HWCAP_SVEF32MM] = "svef32mm", + [KERNEL_HWCAP_SVEF64MM] = "svef64mm", + [KERNEL_HWCAP_SVEBF16] = "svebf16", + [KERNEL_HWCAP_I8MM] = "i8mm", + [KERNEL_HWCAP_BF16] = "bf16", + [KERNEL_HWCAP_DGH] = "dgh", + [KERNEL_HWCAP_RNG] = "rng", + [KERNEL_HWCAP_BTI] = "bti", + [KERNEL_HWCAP_MTE] = "mte", + [KERNEL_HWCAP_ECV] = "ecv", + [KERNEL_HWCAP_AFP] = "afp", + [KERNEL_HWCAP_RPRES] = "rpres", + [KERNEL_HWCAP_MTE3] = "mte3", + [KERNEL_HWCAP_SME] = "sme", + [KERNEL_HWCAP_SME_I16I64] = "smei16i64", + [KERNEL_HWCAP_SME_F64F64] = "smef64f64", + [KERNEL_HWCAP_SME_I8I32] = "smei8i32", + [KERNEL_HWCAP_SME_F16F32] = "smef16f32", + [KERNEL_HWCAP_SME_B16F32] = "smeb16f32", + [KERNEL_HWCAP_SME_F32F32] = "smef32f32", + [KERNEL_HWCAP_SME_FA64] = "smefa64", + [KERNEL_HWCAP_WFXT] = "wfxt", + [KERNEL_HWCAP_EBF16] = "ebf16", + [KERNEL_HWCAP_SVE_EBF16] = "sveebf16", + [KERNEL_HWCAP_CSSC] = "cssc", + [KERNEL_HWCAP_RPRFM] = "rprfm", + [KERNEL_HWCAP_SVE2P1] = "sve2p1", + [KERNEL_HWCAP_SME2] = "sme2", + [KERNEL_HWCAP_SME2P1] = "sme2p1", + [KERNEL_HWCAP_SME_I16I32] = "smei16i32", + [KERNEL_HWCAP_SME_BI32I32] = "smebi32i32", + [KERNEL_HWCAP_SME_B16B16] = "smeb16b16", + [KERNEL_HWCAP_SME_F16F16] = "smef16f16", + [KERNEL_HWCAP_MOPS] = "mops", + [KERNEL_HWCAP_HBC] = "hbc", +}; + +#ifdef CONFIG_AARCH32_EL0 +#define COMPAT_KERNEL_HWCAP(x) const_ilog2(COMPAT_HWCAP_ ## x) +static const char *const compat_hwcap_str[] = { + [COMPAT_KERNEL_HWCAP(SWP)] = "swp", + [COMPAT_KERNEL_HWCAP(HALF)] = "half", + [COMPAT_KERNEL_HWCAP(THUMB)] = "thumb", + [COMPAT_KERNEL_HWCAP(26BIT)] = NULL, /* Not possible on arm64 */ + [COMPAT_KERNEL_HWCAP(FAST_MULT)] = "fastmult", + [COMPAT_KERNEL_HWCAP(FPA)] = NULL, /* Not possible on arm64 */ + [COMPAT_KERNEL_HWCAP(VFP)] = "vfp", + [COMPAT_KERNEL_HWCAP(EDSP)] = "edsp", + [COMPAT_KERNEL_HWCAP(JAVA)] = NULL, /* Not possible on arm64 */ + [COMPAT_KERNEL_HWCAP(IWMMXT)] = NULL, /* Not possible on arm64 */ + [COMPAT_KERNEL_HWCAP(CRUNCH)] = NULL, /* Not possible on arm64 */ + [COMPAT_KERNEL_HWCAP(THUMBEE)] = NULL, /* Not possible on arm64 */ + [COMPAT_KERNEL_HWCAP(NEON)] = "neon", + [COMPAT_KERNEL_HWCAP(VFPv3)] = "vfpv3", + [COMPAT_KERNEL_HWCAP(VFPV3D16)] = NULL, /* Not possible on arm64 */ + [COMPAT_KERNEL_HWCAP(TLS)] = "tls", + [COMPAT_KERNEL_HWCAP(VFPv4)] = "vfpv4", + [COMPAT_KERNEL_HWCAP(IDIVA)] = "idiva", + [COMPAT_KERNEL_HWCAP(IDIVT)] = "idivt", + [COMPAT_KERNEL_HWCAP(VFPD32)] = NULL, /* Not possible on arm64 */ + [COMPAT_KERNEL_HWCAP(LPAE)] = "lpae", + [COMPAT_KERNEL_HWCAP(EVTSTRM)] = "evtstrm", + [COMPAT_KERNEL_HWCAP(FPHP)] = "fphp", + [COMPAT_KERNEL_HWCAP(ASIMDHP)] = "asimdhp", + [COMPAT_KERNEL_HWCAP(ASIMDDP)] = "asimddp", + [COMPAT_KERNEL_HWCAP(ASIMDFHM)] = "asimdfhm", + [COMPAT_KERNEL_HWCAP(ASIMDBF16)] = "asimdbf16", + [COMPAT_KERNEL_HWCAP(I8MM)] = "i8mm", +}; + +#define COMPAT_KERNEL_HWCAP2(x) const_ilog2(COMPAT_HWCAP2_ ## x) +static const char *const compat_hwcap2_str[] = { + [COMPAT_KERNEL_HWCAP2(AES)] = "aes", + [COMPAT_KERNEL_HWCAP2(PMULL)] = "pmull", + [COMPAT_KERNEL_HWCAP2(SHA1)] = "sha1", + [COMPAT_KERNEL_HWCAP2(SHA2)] = "sha2", + [COMPAT_KERNEL_HWCAP2(CRC32)] = "crc32", + [COMPAT_KERNEL_HWCAP2(SB)] = "sb", + [COMPAT_KERNEL_HWCAP2(SSBS)] = "ssbs", +}; +#endif /* CONFIG_AARCH32_EL0 */ + -- 2.25.1