From patchwork Fri Nov 13 18:45:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 7613931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3C2909F2F7 for ; Fri, 13 Nov 2015 18:57:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 408A820648 for ; Fri, 13 Nov 2015 18:57:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3FA4920544 for ; Fri, 13 Nov 2015 18:57:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZxJVG-0007Ni-3M; Fri, 13 Nov 2015 18:55:18 +0000 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZxJNR-0006YS-I9 for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2015 18:47:16 +0000 Received: by pabfh17 with SMTP id fh17so107898465pab.0 for ; Fri, 13 Nov 2015 10:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MBxP4UDRjEL9+saWFeh8QRp+ODbcpQIN0Qc/RiIBOv8=; b=UTE23IWP120jMDAxagIdADYmJE8MjFG6s8FMGGR40wcr4yCKMDv7FkJkoeba3YrDpQ HbdwfcVI9T2OOxioo628wBGzaFym1IWKC3DAqGwZyxXoUWmmrwmssX9XMLiL87fJ0NQY aLuNzUjbVB9jCOiuOD2jn+ndHB30QwrE3B1/RgNgeOhqiCA2s9pZWkCsx+eTEgJEJ02w tzACJZzXBQApPQ7SOpyznV8A1BQQv6shOFzOnKsOtI1+bOGCltAO53UH/8AU+iM2kVq/ 3zUMFmJ/6bMix/CXugntGVBywtlm42H6/uhZ1Hdqzys82+k8hwAKQIzqevW9vjG+P4vA vN4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MBxP4UDRjEL9+saWFeh8QRp+ODbcpQIN0Qc/RiIBOv8=; b=iOl/FrC8hFP8VFsk427TypqK4pmy9RYHJmIXkhGMryoOqczutljNHmWwAouFJl/X+d mLviTYUb5r1EVbMLldezjbdWkiruLwAVz71IsFC0rPfU+AsDUbHOYuLV6uRQCfCJMVNz PlY/nHGsvpraFreYC0HAAs0p8A+RIRctKfc9bR4bhBi6K2PT4jA/LBNaLFKA3YNwbcrE DI30J/V2C9PHikr+U6ZdaQHae2FYNoKYdLGWntHBtulw94nB4jvWzeJdR1yIibkFh+vp QPC7EpXHdttCsJ2Tg2QLr+NLdGTrBw827GDpsu7CYtnOzV1XlBXMPRAOBxcBkNcpAW0y 8GDw== X-Gm-Message-State: ALoCoQlbBVaaMfHHzB/v+9FFKqzIyYhJUT7X4zXHu5nwZgIuwRziDb4ga00A8nfRXbL6tOa8sIN6 X-Received: by 10.66.101.40 with SMTP id fd8mr26262532pab.91.1447440415921; Fri, 13 Nov 2015 10:46:55 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [184.64.168.246]) by smtp.gmail.com with ESMTPSA id xi7sm21737967pbc.56.2015.11.13.10.46.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Nov 2015 10:46:55 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl, alexander.shishkin@linux.intel.com, acme@kernel.org, mingo@redhat.com, corbet@lwn.net, nicolas.pitre@linaro.org Subject: [PATCH V4 25/26] perf tools: making coresight PMU listable Date: Fri, 13 Nov 2015 11:45:16 -0700 Message-Id: <1447440317-1977-26-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447440317-1977-1-git-send-email-mathieu.poirier@linaro.org> References: <1447440317-1977-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151113_104713_912246_AC608579 X-CRM114-Status: GOOD ( 16.89 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: al.grant@arm.com, mathieu.poirier@linaro.org, pawel.moll@arm.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, fainelli@broadcom.com, adrian.hunter@intel.com, tor@ti.com, mike.leach@arm.com, zhang.chunyan@linaro.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Adding the required mechanic allowing 'perf list pmu' to discover coresight ETM/PTM tracers. Signed-off-by: Mathieu Poirier --- MAINTAINERS | 1 + tools/perf/arch/arm/util/Build | 2 ++ tools/perf/arch/arm/util/pmu.c | 34 ++++++++++++++++++++++++++++++++++ tools/perf/config/Makefile | 17 ++++++++++++----- 4 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 tools/perf/arch/arm/util/pmu.c diff --git a/MAINTAINERS b/MAINTAINERS index 994a7aeb4a2d..d73f35aeaf3b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -999,6 +999,7 @@ F: drivers/hwtracing/coresight/* F: Documentation/trace/coresight.txt F: Documentation/devicetree/bindings/arm/coresight.txt F: Documentation/ABI/testing/sysfs-bus-coresight-devices-* +F: tools/perf/arch/arm/util/pmu.c ARM/CORGI MACHINE SUPPORT M: Richard Purdie diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index d22e3d07de3d..66ab0b05549c 100644 --- a/tools/perf/arch/arm/util/Build +++ b/tools/perf/arch/arm/util/Build @@ -2,3 +2,5 @@ libperf-$(CONFIG_DWARF) += dwarf-regs.o libperf-$(CONFIG_LIBUNWIND) += unwind-libunwind.o libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o + +libperf-$(CONFIG_AUXTRACE) += pmu.o diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c new file mode 100644 index 000000000000..af9fb666b44f --- /dev/null +++ b/tools/perf/arch/arm/util/pmu.c @@ -0,0 +1,34 @@ +/* + * Copyright(C) 2015 Linaro Limited. All rights reserved. + * Author: Mathieu Poirier + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include +#include +#include + +#include "../../util/pmu.h" + +struct perf_event_attr +*perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) +{ +#ifdef HAVE_AUXTRACE_SUPPORT + if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) { + /* add ETM default config here */ + pmu->selectable = true; + } +#endif + return NULL; +} diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 38a08539f4bf..64bdb82b3337 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -626,12 +626,19 @@ ifdef LIBBABELTRACE endif ifndef NO_AUXTRACE - ifeq ($(feature-get_cpuid), 0) - msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); - NO_AUXTRACE := 1 + ifeq ($(ARCH),x86) + ifeq ($(feature-get_cpuid), 0) + msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); + NO_AUXTRACE := 1 + else + $(call detected,CONFIG_AUXTRACE) + CFLAGS += -DHAVE_AUXTRACE_SUPPORT + endif else - $(call detected,CONFIG_AUXTRACE) - CFLAGS += -DHAVE_AUXTRACE_SUPPORT + ifeq ($(ARCH),$(filter $(ARCH), arm arm64)) + $(call detected,CONFIG_AUXTRACE) + CFLAGS += -DHAVE_AUXTRACE_SUPPORT + endif endif endif