Drop x86 MD package/core/smt IDs and use MI.
This commit is contained in:
parent
c216f5fe0e
commit
da7cf0ef2f
|
@ -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 @@ struct cpu_info {
|
|||
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 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.4 2010/04/18 23:47:51 jym Exp $")
|
|||
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 @@ x86_cpu_topology(struct cpu_info *ci)
|
|||
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 @@ x86_cpu_topology(struct cpu_info *ci)
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ tprof_pmi_start_cpu(void *arg1, void *arg2)
|
|||
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 @@ tprof_pmi_stop_cpu(void *arg1, void *arg2)
|
|||
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 @@ tprof_pmi_nmi(const struct trapframe *tf, void *dummy)
|
|||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue