diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2009-12-23 23:16:54 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2009-12-23 23:16:54 +0000 |
commit | f7db53a9d138b86810b2eec364678ab67ad0ba30 (patch) | |
tree | 1507605c16579edd0e3cdad97219adbea0eb689e /lib/libpmc | |
parent | d4cee572d1358ddf0158d0bd1caeef07c0304584 (diff) | |
download | FreeBSD-src-f7db53a9d138b86810b2eec364678ab67ad0ba30.zip FreeBSD-src-f7db53a9d138b86810b2eec364678ab67ad0ba30.tar.gz |
Intel XScale hwpmc(4) support.
This brings hwpmc(4) support for 2nd and 3rd generation XScale cores.
Right now it's enabled by default to make sure we test this a bit.
When the time comes it can be disabled by default.
Tested on Gateworks boards.
A man page is coming.
Obtained from: //depot/user/rpaulo/xscalepmc/...
Diffstat (limited to 'lib/libpmc')
-rw-r--r-- | lib/libpmc/Makefile | 2 | ||||
-rw-r--r-- | lib/libpmc/libpmc.c | 45 | ||||
-rw-r--r-- | lib/libpmc/pmc.xscale.3 | 39 |
3 files changed, 86 insertions, 0 deletions
diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index d307b49..6fcee91 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -35,6 +35,8 @@ MAN+= pmc.p4.3 MAN+= pmc.p5.3 MAN+= pmc.p6.3 MAN+= pmc.tsc.3 +.elif ${MACHINE_ARCH} == "arm" && ${CPUTYPE} == "xscale" +MAN+= pmc.xscale.3 .endif MLINKS+= \ diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index ecc697d..a4cce1f 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -69,6 +69,10 @@ static int p6_allocate_pmc(enum pmc_event _pe, char *_ctrspec, static int tsc_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); #endif +#if defined(__XSCALE__) +static int xscale_allocate_pmc(enum pmc_event _pe, char *_ctrspec, + struct pmc_op_pmcallocate *_pmc_config); +#endif #define PMC_CALL(cmd, params) \ syscall(pmc_syscall, PMC_OP_##cmd, (params)) @@ -132,6 +136,7 @@ PMC_CLASSDEP_TABLE(k8, K8); PMC_CLASSDEP_TABLE(p4, P4); PMC_CLASSDEP_TABLE(p5, P5); PMC_CLASSDEP_TABLE(p6, P6); +PMC_CLASSDEP_TABLE(xscale, XSCALE); #undef __PMC_EV_ALIAS #define __PMC_EV_ALIAS(N,CODE) { N, PMC_EV_##CODE }, @@ -176,6 +181,7 @@ PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); +PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); static const struct pmc_event_descr tsc_event_table[] = { @@ -216,6 +222,9 @@ PMC_CLASS_TABLE_DESC(p6, P6, p6, p6); #if defined(__i386__) || defined(__amd64__) PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc); #endif +#if defined(__XSCALE__) +PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale); +#endif #undef PMC_CLASS_TABLE_DESC @@ -2008,6 +2017,29 @@ tsc_allocate_pmc(enum pmc_event pe, char *ctrspec, } #endif +#if defined(__XSCALE__) + +static struct pmc_event_alias xscale_aliases[] = { + EV_ALIAS("branches", "BRANCH_RETIRED"), + EV_ALIAS("branch-mispredicts", "BRANCH_MISPRED"), + EV_ALIAS("dc-misses", "DC_MISS"), + EV_ALIAS("ic-misses", "IC_MISS"), + EV_ALIAS("instructions", "INSTR_RETIRED"), + EV_ALIAS(NULL, NULL) +}; +static int +xscale_allocate_pmc(enum pmc_event pe, char *ctrspec __unused, + struct pmc_op_pmcallocate *pmc_config __unused) +{ + switch (pe) { + default: + break; + } + + return (0); +} +#endif + /* * Match an event name `name' with its canonical form. * @@ -2335,6 +2367,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, ev = p6_event_table; count = PMC_EVENT_TABLE_SIZE(p6); break; + case PMC_CLASS_XSCALE: + ev = xscale_event_table; + count = PMC_EVENT_TABLE_SIZE(xscale); + break; default: errno = EINVAL; return (-1); @@ -2520,6 +2556,12 @@ pmc_init(void) pmc_class_table[n] = &p4_class_table_descr; break; #endif +#if defined(__XSCALE__) + case PMC_CPU_INTEL_XSCALE: + PMC_MDEP_INIT(xscale); + pmc_class_table[n] = &xscale_class_table_descr; + break; +#endif default: @@ -2635,6 +2677,9 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu) } else if (pe >= PMC_EV_P6_FIRST && pe <= PMC_EV_P6_LAST) { ev = p6_event_table; evfence = p6_event_table + PMC_EVENT_TABLE_SIZE(p6); + } else if (pe >= PMC_EV_XSCALE_FIRST && pe <= PMC_EV_XSCALE_LAST) { + ev = xscale_event_table; + evfence = xscale_event_table + PMC_EVENT_TABLE_SIZE(xscale); } else if (pe == PMC_EV_TSC_TSC) { ev = tsc_event_table; evfence = tsc_event_table + PMC_EVENT_TABLE_SIZE(tsc); diff --git a/lib/libpmc/pmc.xscale.3 b/lib/libpmc/pmc.xscale.3 new file mode 100644 index 0000000..fc9d16e --- /dev/null +++ b/lib/libpmc/pmc.xscale.3 @@ -0,0 +1,39 @@ +.\" Copyright (c) 2009 Rui Paulo. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" This software is provided by Joseph Koshy ``as is'' and +.\" any express or implied warranties, including, but not limited to, the +.\" implied warranties of merchantability and fitness for a particular purpose +.\" are disclaimed. in no event shall Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd December 23, 2009 +.Os +.Dt PMC.XSCALE 3 +.Sh NAME +.Nm pmc.xscale +.Nd measurement events for +.Tn Intel +.Tn XScale +family CPUs +.Sh LIBRARY +.Lb libpmc +.Sh SYNOPSIS +.In pmc.h +.Sh DESCRIPTION |