Module Name: src
Committed By: msaitoh
Date: Thu Sep 28 10:59:38 UTC 2017
Modified Files:
src/sys/arch/x86/x86: procfs_machdep.c
Log Message:
Print the following cpuid bits:
0x0000000d:1 eax (xsaveopt, xsavec, xgetbv1, xsaves)
0x0000000f:0 edx (cqm_llc)
0x0000000f:1 edx (cqm_occup_llc)
0x00000006 eax (dtherm, ida, arat, pln, pts, hwp, hwp_notify,
hwp_act_window, hwp_epp, hwp_pkg_req)
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/x86/procfs_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.16 src/sys/arch/x86/x86/procfs_machdep.c:1.17
--- src/sys/arch/x86/x86/procfs_machdep.c:1.16 Mon Aug 28 07:03:47 2017
+++ src/sys/arch/x86/x86/procfs_machdep.c Thu Sep 28 10:59:38 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_machdep.c,v 1.16 2017/08/28 07:03:47 msaitoh Exp $ */
+/* $NetBSD: procfs_machdep.c,v 1.17 2017/09/28 10:59:38 msaitoh Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.16 2017/08/28 07:03:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.17 2017/09/28 10:59:38 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -106,11 +106,11 @@ static const char * const x86_features[]
"fma4", "tce", NULL, "nodeid_msr",
NULL, "tbm", "topoext", "perfctr_core",
"perfctr_nb", NULL, "bpext", "ptsc",
- "perfctr_l2", "mwaitx", NULL, NULL},
+ "perfctr_llc", "mwaitx", NULL, NULL},
{ /* (7) Linux mapping */
NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm",
- "hw_pstate", "proc_feedback", NULL, NULL,
+ "hw_pstate", "proc_feedback", "sme", NULL,
NULL, NULL, NULL, "intel_pt",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
@@ -131,7 +131,7 @@ static const char * const x86_features[]
"clwb", NULL, "avx512pf", "avx512er",
"avx512cd", "sha_ni", "avx512bw", "avx512vl"},
- { /* (10) 0x0000000d eax */
+ { /* (10) 0x0000000d:1 eax */
"xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -165,8 +165,9 @@ static const char * const x86_features[]
{ /* (15) 0x8000000a edx */
"npt", "lbrv", "svm_lock", "nrip_save",
"tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists",
- NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL,
+ "v_vmsave_vmload",
+ "vgif", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{ /* (16) 0x00000007:0 ecx */
@@ -248,6 +249,7 @@ procfs_getonecpufeatures(struct cpu_info
{
size_t last = *left;
size_t diff;
+ u_int descs[4];
procfs_getonefeatreg(ci->ci_feat_val[0], x86_features[0], p, left);
diff = last - *left;
@@ -278,11 +280,34 @@ procfs_getonecpufeatures(struct cpu_info
left);
diff = last - *left;
- /* (10) 0x0000000d eax */
- /* (11) 0x0000000f(ecx=0) edx */
- /* (12) 0x0000000f(ecx=1) edx */
+ if (cpuid_level >= 0x0d) {
+ x86_cpuid2(0x0d, 1, descs);
+ procfs_getonefeatreg(descs[0], x86_features[10], p + diff,
+ left);
+ diff = last - *left;
+ }
+
+ if (cpuid_level >= 0x0f) {
+ x86_cpuid2(0x0f, 0, descs);
+ procfs_getonefeatreg(descs[3], x86_features[11], p + diff,
+ left);
+ diff = last - *left;
+
+ x86_cpuid2(0x0f, 1, descs);
+ procfs_getonefeatreg(descs[3], x86_features[12], p + diff,
+ left);
+ diff = last - *left;
+ }
+
/* (13) 0x80000008 ebx */
- /* (14) 0x00000006 eax */
+
+ if (cpuid_level >= 0x06) {
+ x86_cpuid(0x06, descs);
+ procfs_getonefeatreg(descs[0], x86_features[14], p + diff,
+ left);
+ diff = last - *left;
+ }
+
/* (15) 0x8000000a edx */
procfs_getonefeatreg(ci->ci_feat_val[6], x86_features[16], p + diff,