Module Name: src
Committed By: rmind
Date: Sun May 9 20:32:41 UTC 2010
Modified Files:
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/x86: cpu_topology.c tprof_pmi.c
Log Message:
Drop x86 MD package/core/smt IDs and use MI.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/cpu_topology.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x86/x86/tprof_pmi.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/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.21 src/sys/arch/x86/include/cpu.h:1.22
--- src/sys/arch/x86/include/cpu.h:1.21 Sun Apr 18 23:47:51 2010
+++ src/sys/arch/x86/include/cpu.h Sun May 9 20:32:41 2010
@@ -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 */
/*
Index: src/sys/arch/x86/x86/cpu_topology.c
diff -u src/sys/arch/x86/x86/cpu_topology.c:1.4 src/sys/arch/x86/x86/cpu_topology.c:1.5
--- src/sys/arch/x86/x86/cpu_topology.c:1.4 Sun Apr 18 23:47:51 2010
+++ src/sys/arch/x86/x86/cpu_topology.c Sun May 9 20:32:41 2010
@@ -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);
}
}
Index: src/sys/arch/x86/x86/tprof_pmi.c
diff -u src/sys/arch/x86/x86/tprof_pmi.c:1.10 src/sys/arch/x86/x86/tprof_pmi.c:1.11
--- src/sys/arch/x86/x86/tprof_pmi.c:1.10 Thu Mar 26 00:30:10 2009
+++ src/sys/arch/x86/x86/tprof_pmi.c Sun May 9 20:32:41 2010
@@ -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);