From owner-svn-src-stable@FreeBSD.ORG Tue Jan 3 17:19:57 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4A53106564A; Tue, 3 Jan 2012 17:19:57 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2CF58FC08; Tue, 3 Jan 2012 17:19:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03HJvrJ033807; Tue, 3 Jan 2012 17:19:57 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03HJv7e033805; Tue, 3 Jan 2012 17:19:57 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031719.q03HJv7e033805@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 17:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229399 - stable/7/sys/dev/hwpmc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 17:19:57 -0000 Author: fabient Date: Tue Jan 3 17:19:57 2012 New Revision: 229399 URL: http://svn.freebsd.org/changeset/base/229399 Log: MFC r228438: There's a small set of events on Nehalem, that are not supported in processors with CPUID signature 06_1AH, 06_1EH, and 06_1FH. Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:17:30 2012 (r229398) +++ stable/7/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:19:57 2012 (r229399) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define CORE_CPUID_REQUEST 0xA @@ -1553,7 +1554,7 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - int n; + int n, model; enum pmc_event ev; struct iap_event_descr *ie; uint32_t c, caps, config, cpuflag, evsel, mask; @@ -1573,6 +1574,16 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_architectural_event_is_unsupported(ev)) return (EOPNOTSUPP); + /* + * A small number of events are not supported in all the + * processors based on a given microarchitecture. + */ + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); + if (core_cputype == PMC_CPU_INTEL_COREI7 && model != 0x2E) + return (EINVAL); + } + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0)