Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86 Drop x86 MD package/core/smt IDs and use MI.



details:   https://anonhg.NetBSD.org/src/rev/080887b05b74
branches:  trunk
changeset: 754712:080887b05b74
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sun May 09 20:32:41 2010 +0000

description:
Drop x86 MD package/core/smt IDs and use MI.

diffstat:

 sys/arch/x86/include/cpu.h      |   5 +----
 sys/arch/x86/x86/cpu_topology.c |  18 +++++++++---------
 sys/arch/x86/x86/tprof_pmi.c    |  28 +++++++++++++++-------------
 3 files changed, 25 insertions(+), 26 deletions(-)

diffs (151 lines):

diff -r 9ecc5dab7b10 -r 080887b05b74 sys/arch/x86/include/cpu.h
--- a/sys/arch/x86/include/cpu.h        Sun May 09 20:18:40 2010 +0000
+++ b/sys/arch/x86/include/cpu.h        Sun May 09 20:32:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.21 2010/04/18 23:47:51 jym Exp $     */
+/*     $NetBSD: cpu.h,v 1.22 2010/05/09 20:32:41 rmind Exp $   */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -95,9 +95,6 @@
        cpuid_t ci_cpuid;               /* our CPU ID */
        int     ci_cpumask;             /* (1 << CPU ID) */
        uint32_t ci_initapicid;         /* our intitial APIC ID */
-       uint8_t ci_packageid;
-       uint8_t ci_coreid;
-       uint8_t ci_smtid;
        struct cpu_data ci_data;        /* MI per-cpu data */
 
        /*
diff -r 9ecc5dab7b10 -r 080887b05b74 sys/arch/x86/x86/cpu_topology.c
--- a/sys/arch/x86/x86/cpu_topology.c   Sun May 09 20:18:40 2010 +0000
+++ b/sys/arch/x86/x86/cpu_topology.c   Sun May 09 20:32:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_topology.c,v 1.4 2010/04/18 23:47:51 jym Exp $     */
+/*     $NetBSD: cpu_topology.c,v 1.5 2010/05/09 20:32:41 rmind Exp $   */
 
 /*-
  * Copyright (c) 2009 Mindaugas Rasiukevicius <rmind at NetBSD org>,
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.4 2010/04/18 23:47:51 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.5 2010/05/09 20:32:41 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -51,7 +51,7 @@
 void
 x86_cpu_topology(struct cpu_info *ci)
 {
-       u_int lp_max;           /* Logical processors per package */
+       u_int lp_max;           /* Logical processors per package (node) */
        u_int core_max;         /* Core per package */
        int n, cpu_family, apic_id, smt_bits, core_bits = 0;
        uint32_t descs[4], lextmode;
@@ -60,9 +60,9 @@
        cpu_family = CPUID2FAMILY(ci->ci_signature);
 
        /* Initial values. */
-       ci->ci_packageid = apic_id;
-       ci->ci_coreid = 0;
-       ci->ci_smtid = 0;
+       ci->ci_node_id = apic_id;
+       ci->ci_core_id = 0;
+       ci->ci_smt_id = 0;
 
        switch (cpu_vendor) {
        case CPUVENDOR_INTEL:
@@ -161,14 +161,14 @@
        }
 
        if (smt_bits + core_bits) {
-               ci->ci_packageid = apic_id >> (smt_bits + core_bits);
+               ci->ci_node_id = apic_id >> (smt_bits + core_bits);
        }
        if (core_bits) {
                u_int core_mask = __BITS(smt_bits, smt_bits + core_bits - 1);
-               ci->ci_coreid = __SHIFTOUT(apic_id, core_mask);
+               ci->ci_core_id = __SHIFTOUT(apic_id, core_mask);
        }
        if (smt_bits) {
                u_int smt_mask = __BITS(0, smt_bits - 1);
-               ci->ci_smtid = __SHIFTOUT(apic_id, smt_mask);
+               ci->ci_smt_id = __SHIFTOUT(apic_id, smt_mask);
        }
 }
diff -r 9ecc5dab7b10 -r 080887b05b74 sys/arch/x86/x86/tprof_pmi.c
--- a/sys/arch/x86/x86/tprof_pmi.c      Sun May 09 20:18:40 2010 +0000
+++ b/sys/arch/x86/x86/tprof_pmi.c      Sun May 09 20:32:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tprof_pmi.c,v 1.10 2009/03/26 00:30:10 dyoung Exp $    */
+/*     $NetBSD: tprof_pmi.c,v 1.11 2010/05/09 20:32:41 rmind Exp $     */
 
 /*-
  * Copyright (c)2008,2009 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tprof_pmi.c,v 1.10 2009/03/26 00:30:10 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_pmi.c,v 1.11 2010/05/09 20:32:41 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -114,17 +114,18 @@
        uint64_t cccr;
        uint64_t escr;
 
-       if (ci->ci_smtid >= 2) {
-               printf("%s: ignoring %s smtid=%u",
-                   __func__, device_xname(ci->ci_dev), ci->ci_smtid);
+       if (ci->ci_smt_id >= 2) {
+               printf("%s: ignoring %s smt id=%u",
+                   __func__, device_xname(ci->ci_dev),
+                   (u_int)ci->ci_smt_id);
                return;
        }
-       msr = &msrs[ci->ci_smtid];
+       msr = &msrs[ci->ci_smt_id];
        escr = __SHIFTIN(escr_event_mask, ESCR_EVENT_MASK) |
            __SHIFTIN(escr_event_select, ESCR_EVENT_SELECT);
        cccr = CCCR_ENABLE | __SHIFTIN(cccr_escr_select, CCCR_ESCR_SELECT) |
            CCCR_MUST_BE_SET;
-       if (ci->ci_smtid == 0) {
+       if (ci->ci_smt_id == 0) {
                escr |= ESCR_T0_OS;
                cccr |= CCCR_OVF_PMI_T0;
        } else {
@@ -145,12 +146,13 @@
        struct cpu_info * const ci = curcpu();
        const struct msrs *msr;
 
-       if (ci->ci_smtid >= 2) {
-               printf("%s: ignoring %s smtid=%u",
-                   __func__, device_xname(ci->ci_dev), ci->ci_smtid);
+       if (ci->ci_smt_id >= 2) {
+               printf("%s: ignoring %s smt id=%u",
+                   __func__, device_xname(ci->ci_dev),
+                   (u_int)ci->ci_smt_id);
                return;
        }
-       msr = &msrs[ci->ci_smtid];
+       msr = &msrs[ci->ci_smt_id];
 
        wrmsr(msr->msr_escr, 0);
        wrmsr(msr->msr_cccr, 0);
@@ -168,11 +170,11 @@
 
        KASSERT(dummy == NULL);
 
-       if (ci->ci_smtid >= 2) {
+       if (ci->ci_smt_id >= 2) {
                /* not ours */
                return 0;
        }
-       msr = &msrs[ci->ci_smtid];
+       msr = &msrs[ci->ci_smt_id];
 
        /* check if it's for us */
        cccr = rdmsr(msr->msr_cccr);



Home | Main Index | Thread Index | Old Index