Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/arch/x86/x86 Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/e6e2865e92f6
branches:  netbsd-8
changeset: 851143:e6e2865e92f6
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 21 15:11:52 2017 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #367):
        sys/arch/x86/x86/procfs_machdep.c: revision 1.20
        sys/arch/x86/x86/procfs_machdep.c: revision 1.17
        sys/arch/x86/x86/procfs_machdep.c: revision 1.18
  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)
- Use per cpu ci->ci_max_cupid instead of global "cpuid_level" variable.
- Print AMD specific cpuid leafs:
         0x80000008 ebx
        0x8000000a edx
        0x80000007 ebx
  Fix the location of AMD's smca(Scalable MCA) bit. Thanks Yasushi Oshima for
finding this bug.

diffstat:

 sys/arch/x86/x86/procfs_machdep.c |  77 ++++++++++++++++++++++++++++++--------
 1 files changed, 61 insertions(+), 16 deletions(-)

diffs (155 lines):

diff -r 7473f17bf81e -r e6e2865e92f6 sys/arch/x86/x86/procfs_machdep.c
--- a/sys/arch/x86/x86/procfs_machdep.c Tue Nov 21 15:06:27 2017 +0000
+++ b/sys/arch/x86/x86/procfs_machdep.c Tue Nov 21 15:11:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_machdep.c,v 1.15.2.1 2017/08/31 11:34:54 martin Exp $ */
+/*     $NetBSD: procfs_machdep.c,v 1.15.2.2 2017/11/21 15:11:52 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.1 2017/08/31 11:34:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.2 2017/11/21 15:11:52 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,6 +55,8 @@
 #include <machine/cpu.h>
 #include <machine/reg.h>
 #include <machine/specialreg.h>
+#include <x86/cputypes.h>
+#include <x86/cpuvar.h>
 
 /*
  *  The feature table. The order is the same as Linux's
@@ -106,11 +108,11 @@
        "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 +133,7 @@
        "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 +167,9 @@
        { /* (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 */
@@ -176,7 +179,7 @@
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
        { /* (17) 0x80000007 ebx */
-       "overflow_recov", "succor", "smca", NULL, NULL, NULL, NULL, NULL,
+       "overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
@@ -248,6 +251,7 @@
 {
        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,18 +282,59 @@
            left);
        diff = last - *left;
 
-       /* (10) 0x0000000d eax */
-       /* (11) 0x0000000f(ecx=0) edx */
-       /* (12) 0x0000000f(ecx=1) edx */
-       /* (13) 0x80000008 ebx */
-       /* (14) 0x00000006 eax */
-       /* (15) 0x8000000a edx */
+       if (ci->ci_max_cpuid >= 0x0d) {
+               x86_cpuid2(0x0d, 1, descs);
+               procfs_getonefeatreg(descs[0], x86_features[10], p + diff,
+                   left);
+               diff = last - *left;
+       }
+
+       if (ci->ci_max_cpuid >= 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;
+       }
+
+       if ((cpu_vendor == CPUVENDOR_AMD)
+           && (ci->ci_max_ext_cpuid >= 0x80000008)) {
+               x86_cpuid(0x80000008, descs);
+               procfs_getonefeatreg(descs[1], x86_features[13], p + diff,
+                   left);
+               diff = last - *left;
+       }
+
+       if (ci->ci_max_cpuid >= 0x06) {
+               x86_cpuid(0x06, descs);
+               procfs_getonefeatreg(descs[0], x86_features[14], p + diff,
+                   left);
+               diff = last - *left;
+       }
+
+       if ((cpu_vendor == CPUVENDOR_AMD)
+           && (ci->ci_max_ext_cpuid >= 0x8000000a)) {
+               x86_cpuid(0x8000000a, descs);
+               procfs_getonefeatreg(descs[3], x86_features[15], p + diff,
+                   left);
+               diff = last - *left;
+       }
 
        procfs_getonefeatreg(ci->ci_feat_val[6], x86_features[16], p + diff,
            left);
        diff = last - *left;
 
-       /* (17) 0x80000007 ebx */
+       if ((cpu_vendor == CPUVENDOR_AMD)
+           && (ci->ci_max_ext_cpuid >= 0x80000007)) {
+               x86_cpuid(0x80000007, descs);
+               procfs_getonefeatreg(descs[1], x86_features[17], p + diff,
+                   left);
+               diff = last - *left;
+       }
 
        return 0; /* XXX */
 }
@@ -385,7 +430,7 @@
            i386_fpu_fdivbug ? "yes" : "no",    /* an old pentium */
 #endif
            i386_fpu_present ? "yes" : "no",    /* not a 486SX */
-           cpuid_level,
+           ci->ci_max_cpuid,
            (rcr0() & CR0_WP) ? "yes" : "no",
            featurebuf,
            ci->ci_cflush_lsize



Home | Main Index | Thread Index | Old Index