git: 7ab03740ae87 - main - linprocfs: Decode more CPU flags in cpuinfo
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Jun 2022 07:39:06 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=7ab03740ae87f23250f2a0f0d5991e9989ddddfe commit 7ab03740ae87f23250f2a0f0d5991e9989ddddfe Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-06-29 07:37:30 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-29 07:37:30 +0000 linprocfs: Decode more CPU flags in cpuinfo Differential revision: https://reviews.freebsd.org/D35556 MFC after: 2 weeks --- sys/compat/linprocfs/linprocfs.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index e1796a359ce0..c0c987696c8f 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -202,6 +202,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) uint64_t freq; size_t size; u_int cache_size[4]; + u_int regs[4] = { 0 }; int fqmhz, fqkhz; int i, j; @@ -264,6 +265,33 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) /* 28 */ "avx512cd", "sha_ni", "avx512bw", "avx512vl" }; + static char *cpu_stdext_feature2_names[] = { + /* 0 */ "prefetchwt1", "avx512vbmi", "umip", "pku", + /* 4 */ "ospke", "waitpkg", "avx512_vbmi2", "", + /* 8 */ "gfni", "vaes", "vpclmulqdq", "avx512_vnni", + /* 12 */ "avx512_bitalg", "", "avx512_vpopcntdq", "", + /* 16 */ "", "", "", "", + /* 20 */ "", "", "rdpid", "", + /* 24 */ "", "cldemote", "", "movdiri", + /* 28 */ "movdir64b", "enqcmd", "sgx_lc", "" + }; + + static char *cpu_stdext_feature3_names[] = { + /* 0 */ "", "", "avx512_4vnniw", "avx512_4fmaps", + /* 4 */ "fsrm", "", "", "", + /* 8 */ "avx512_vp2intersect", "", "md_clear", "", + /* 12 */ "", "", "", "", + /* 16 */ "", "", "pconfig", "", + /* 20 */ "", "", "", "", + /* 24 */ "", "", "ibrs", "stibp", + /* 28 */ "flush_l1d", "arch_capabilities", "core_capabilities", "ssbd" + }; + + static char *cpu_stdext_feature_l1_names[] = { + /* 0 */ "xsaveopt", "xsavec", "xgetbv1", "xsaves", + /* 4 */ "xfd" + }; + static char *power_flags[] = { "ts", "fid", "vid", "ttp", "tm", "stc", @@ -351,6 +379,24 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) cpu_stdext_feature_names[j]); if (tsc_is_invariant) sbuf_cat(sb, " constant_tsc"); + for (j = 0; j < nitems(cpu_stdext_feature2_names); j++) + if (cpu_stdext_feature2 & (1 << j) && + cpu_stdext_feature2_names[j][0] != '\0') + sbuf_printf(sb, " %s", + cpu_stdext_feature2_names[j]); + for (j = 0; j < nitems(cpu_stdext_feature3_names); j++) + if (cpu_stdext_feature3 & (1 << j) && + cpu_stdext_feature3_names[j][0] != '\0') + sbuf_printf(sb, " %s", + cpu_stdext_feature3_names[j]); + if ((cpu_feature2 & CPUID2_XSAVE) != 0) { + cpuid_count(0xd, 0x1, regs); + for (j = 0; j < nitems(cpu_stdext_feature_l1_names); j++) + if (regs[0] & (1 << j) && + cpu_stdext_feature_l1_names[j][0] != '\0') + sbuf_printf(sb, " %s", + cpu_stdext_feature_l1_names[j]); + } sbuf_cat(sb, "\n"); sbuf_printf(sb, "bugs\t\t: %s\n"