From patchwork Sun Oct 18 18:24:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 55194 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f70.google.com (mail-lf0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id B1FD022FFA for ; Sun, 18 Oct 2015 18:27:00 +0000 (UTC) Received: by lffz202 with SMTP id z202sf4509422lff.3 for ; Sun, 18 Oct 2015 11:26:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=caYH19DF+k1meVOMm3ZuedeD6RArv3xLjpsgFFLXmJA=; b=Z/ncZAXlCSDZQ2cmSJenRuC0d5NUZsV9jy3WxR/mrSJl9/qdpEIlW5PlZRCum8WlV0 j6UNBBcZsFCdO3+Zs9d3xctjsqCTOMWWXU9UoGMCPZKL83yW5xbuWHkC/jPp5yF/K9MQ uy7giPnjc/gXFfIk7YYnXP1dbiMtRvGyqZLU7lQ7T0j2vTqlOYyN8qhIPU1tQ915eq55 xZu6IQ9fXpaAYxtZ2tXFoY0xPxhRADSZ+99lp699/noU9x6nUYiVsOBI/SzMihGBlK2s UPgtaHCd3E1pCNii8Bd4CsNIuMLnS8bto7KJlDYHAwnBT3f0VuX1c+/98WVr/XniA99R GToQ== X-Gm-Message-State: ALoCoQmw2HALuOz0DjFfKfOvo9D9jRTH8NFCyA451FBq5tbiEZ95oUYjvPzplJxI/qI0uw2BaT/b X-Received: by 10.112.144.105 with SMTP id sl9mr794504lbb.3.1445192819190; Sun, 18 Oct 2015 11:26:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.212.195 with SMTP id l186ls316385lfg.67.gmail; Sun, 18 Oct 2015 11:26:59 -0700 (PDT) X-Received: by 10.112.163.99 with SMTP id yh3mr12690908lbb.121.1445192819026; Sun, 18 Oct 2015 11:26:59 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id e141si4603317lfe.84.2015.10.18.11.26.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 11:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbbpp2 with SMTP id pp2so99709245lbb.0 for ; Sun, 18 Oct 2015 11:26:58 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr12483335lbb.112.1445192818898; Sun, 18 Oct 2015 11:26:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1078168lbq; Sun, 18 Oct 2015 11:26:57 -0700 (PDT) X-Received: by 10.67.1.73 with SMTP id be9mr29778890pad.35.1445192816718; Sun, 18 Oct 2015 11:26:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gy9si46472779pbc.83.2015.10.18.11.26.56; Sun, 18 Oct 2015 11:26:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752686AbbJRS0Z (ORCPT + 28 others); Sun, 18 Oct 2015 14:26:25 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33046 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752558AbbJRS0U (ORCPT ); Sun, 18 Oct 2015 14:26:20 -0400 Received: by pabrc13 with SMTP id rc13so167573368pab.0 for ; Sun, 18 Oct 2015 11:26:20 -0700 (PDT) X-Received: by 10.66.255.66 with SMTP id ao2mr29554048pad.55.1445192780366; Sun, 18 Oct 2015 11:26:20 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [184.64.168.246]) by smtp.gmail.com with ESMTPSA id hq1sm20402076pbb.43.2015.10.18.11.26.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Oct 2015 11:26:19 -0700 (PDT) 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 Cc: adrian.hunter@intel.com, zhang.chunyan@linaro.org, mike.leach@arm.com, tor@ti.com, al.grant@arm.com, pawel.moll@arm.com, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org Subject: [PATCH V2 28/30] perf tools: making coresight PMU listable Date: Sun, 18 Oct 2015 12:24:45 -0600 Message-Id: <1445192687-24112-29-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445192687-24112-1-git-send-email-mathieu.poirier@linaro.org> References: <1445192687-24112-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Adding the required mechanic allowing 'perf list pmu' to discover coresight ETM/PTM tracers. Signed-off-by: Mathieu Poirier --- tools/perf/arch/arm/util/Build | 2 ++ tools/perf/arch/arm/util/pmu.c | 18 ++++++++++++++++++ tools/perf/builtin-inject.c | 2 +- tools/perf/builtin-record.c | 2 +- tools/perf/config/Makefile | 20 ++++++++++++++------ tools/perf/util/auxtrace.h | 2 +- 6 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 tools/perf/arch/arm/util/pmu.c diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index d22e3d07de3d..371a3bf12297 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_ARM) += 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..2870a4e04e48 --- /dev/null +++ b/tools/perf/arch/arm/util/pmu.c @@ -0,0 +1,18 @@ +#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_ARM + if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) { + /* add ETM default config here */ + pmu->selectable = true; + } +#endif + return NULL; +} diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index c19e034b4023..a567cd628156 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -95,7 +95,7 @@ static int perf_event__repipe_attr(struct perf_tool *tool, return perf_event__repipe_synth(tool, event); } -#ifdef HAVE_AUXTRACE_SUPPORT_X86 +#if defined(HAVE_AUXTRACE_SUPPORT_X86) || defined(HAVE_AUXTRACE_SUPPORT_ARM) static int copy_bytes(struct perf_inject *inject, int fd, off_t size) { diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 39cbbdb07891..f37f890f676e 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -141,7 +141,7 @@ static void record__sig_exit(void) raise(signr); } -#ifdef HAVE_AUXTRACE_SUPPORT_X86 +#if defined(HAVE_AUXTRACE_SUPPORT_X86) || defined(HAVE_AUXTRACE_SUPPORT_ARM) static int record__process_auxtrace(struct perf_tool *tool, union perf_event *event, void *data1, diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 5fd4843c691d..62fa7596b507 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -626,13 +626,21 @@ 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) + $(call detected,CONFIG_AUXTRACE_X86) + CFLAGS += -DHAVE_AUXTRACE_SUPPORT_X86 + endif else - $(call detected,CONFIG_AUXTRACE) - $(call detected,CONFIG_AUXTRACE_X86) - CFLAGS += -DHAVE_AUXTRACE_SUPPORT_X86 + ifeq ($(ARCH),$(filter $(ARCH), arm arm64)) + $(call detected,CONFIG_AUXTRACE) + $(call detected,CONFIG_AUXTRACE_ARM) + CFLAGS += -DHAVE_AUXTRACE_SUPPORT_ARM + endif endif endif diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index b9ac99fb5a17..ed1c940be883 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h @@ -309,7 +309,7 @@ struct auxtrace_record { unsigned int alignment; }; -#ifdef HAVE_AUXTRACE_SUPPORT_X86 +#if defined(HAVE_AUXTRACE_SUPPORT_X86) || defined(HAVE_AUXTRACE_SUPPORT_ARM) /* * In snapshot mode the mmapped page is read-only which makes using