aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linprocfs/linprocfs.c
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2022-06-29 07:37:30 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2022-07-13 11:48:27 +0000
commit9736c1988439b3d362549f5cd31bb2d1b4240783 (patch)
tree9d746d3e4beea029e9ded70ac864e50dfd88c9a1 /sys/compat/linprocfs/linprocfs.c
parentf56ea6b7d0e1729be715b57fcef6aaff8d50e90e (diff)
linprocfs: Decode more CPU flags in cpuinfo
Differential revision: https://reviews.freebsd.org/D35556 MFC after: 2 weeks (cherry picked from commit 7ab03740ae87f23250f2a0f0d5991e9989ddddfe)
Diffstat (limited to 'sys/compat/linprocfs/linprocfs.c')
-rw-r--r--sys/compat/linprocfs/linprocfs.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index a0985d339e43..2bf52ecdc985 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"