From patchwork Tue Dec 4 20:39:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 152863 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp8511700ljp; Tue, 4 Dec 2018 12:39:13 -0800 (PST) X-Google-Smtp-Source: AFSGD/XOxdbcDR5QQzfRKZ07DwF9Mz82qjzt3lifA/MKvv5dwufOZyASo+m05oQUyAlMs0Jp36Sa X-Received: by 2002:a62:1c06:: with SMTP id c6mr21093660pfc.157.1543955953031; Tue, 04 Dec 2018 12:39:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543955953; cv=none; d=google.com; s=arc-20160816; b=rB35vUEiXvr8EpPohZMSA3mXf3ku5kPSFzvhLd7VT8VwoXC5U8jxHhsL+PdJWREFRr 4vTrOVjPZXxKrhkUEXaF0l690pcHV7OftUp9NDhjj8xmcZ3tMnwdrBl4FzpAoFfZVuVr vRQhS7GcDVyprdY3LACsnYDrmafKSPieZeKoUIIEkfPZax0ALmvlzV51z7zKAnx6bXZg DP5QELHCzdlpsAmwDNT/4jvY0c5pPPbDo5qjg7zrZ4WOKK95FgTrfU+l4nH/pKVMy6Gb vq4GKlTT+NQz53Y8CRl/LveIQ9EB2wSe7/Qnb66G/3EPR7xmvCKOKVUoBHq9eOij4YMd zm+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=n6NuaXTvDWIetVmFktrRRwuNkHydvvOOmRq+K+4VF1M=; b=u2gt8Wi/Pp2nbXPJoOjHcqKgK2Xr02Ac9i9XfdNYK1lGHoTI8YVAxCz6pj7YCpKFim 7WpXIFvXpy7LQnqumlyhSrmy62xbPE150QOnodYLWdTBUxof5xYIalXu+VR2M0ZpzFGp JnYP8W3Y6P2gZ/pgGh0g3vjAK4kgSRCbJHvsFDe0VKlETyEODVhTGIm16tay8Eyrt7kc WuEQOTpoYgH4NeWpNzoiViPwhTAo6WSceD+IYWKWHxbcG+ajWeZ6MCsurCfLLzTiL5+8 0fC5jBGi2blY2oaPg9oViKbRW+R216YgdGaSW0D7f34fcLwTL6/q1s75D9alu4omLhMH odMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WXuf8ZHg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g184si18580061pfb.288.2018.12.04.12.39.12; Tue, 04 Dec 2018 12:39:13 -0800 (PST) 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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WXuf8ZHg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726372AbeLDUjL (ORCPT + 31 others); Tue, 4 Dec 2018 15:39:11 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:45301 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbeLDUjI (ORCPT ); Tue, 4 Dec 2018 15:39:08 -0500 Received: by mail-pg1-f195.google.com with SMTP id y4so7880773pgc.12 for ; Tue, 04 Dec 2018 12:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n6NuaXTvDWIetVmFktrRRwuNkHydvvOOmRq+K+4VF1M=; b=WXuf8ZHgfXM8hFipNJqrnlBcTvAYQRbWJD2GjJ5MIM7fMqDI0QYHkKoH+/DcNC709E vhp/zGQPEQ3P1t9f/7s1dShvlZRqVS3pjoRceA3RG1w3NzympRlAmlFXd9MNmOnvnWwY yIAPJVMeSwKwxkv+GxVs22kvCaTfnuZ4kGtZk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n6NuaXTvDWIetVmFktrRRwuNkHydvvOOmRq+K+4VF1M=; b=KWDeaHGMU6WenhP0TbdFbLN6C/SyMSIaVOeCfoJzevx4sEFq4379wgqUNSiFI5Ca8L HwqUGoVpfhhwSMhjgSh1pyUG4Tld4zvP95REsHIY6edw1p86Pn9DGdlioSg0hsXu0SQ2 UFdyTTb6TMe1A1JnSF47ulQStjKgBQjwqmoc4A04WEcxIeq5QLVQcIfgV7gtALSC9hdQ pbk7jElA1xZPZgcxg34p8rk5iSi71WhHxhVq70M8IDVtksNfUaz1laiHVQqKIdwe9mz8 aL/r2PcbCv7hJ3vSi0bxM0nR5O5tpowM+NqEqAc/cvuR2qOiTfVBQsI6bQ6O37ClespG MreQ== X-Gm-Message-State: AA+aEWZC9Goq9AFlnHuhMszZ0wp/uMQAyX3JbR+b5CFBHVLEqKMsnl0R UciklBONGOlgyrrS8YOoMD/zFg== X-Received: by 2002:a62:8949:: with SMTP id v70mr20951469pfd.85.1543955947701; Tue, 04 Dec 2018 12:39:07 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id r76sm29783274pfb.69.2018.12.04.12.39.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Dec 2018 12:39:07 -0800 (PST) From: Mathieu Poirier To: acme@kernel.org Cc: peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 1/3] perf tools: Add configuration for ETMv3 trace protocol Date: Tue, 4 Dec 2018 13:39:02 -0700 Message-Id: <1543955944-10042-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543955944-10042-1-git-send-email-mathieu.poirier@linaro.org> References: <1543955944-10042-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch deals with the proper initialisation of configuration parameters for the ETMv3 trace protocol in order to properly handle packets generated by tracers following this specification. Signed-off-by: Mathieu Poirier --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 8 ++++ tools/perf/util/cs-etm.c | 54 ++++++++++++++++++------- 2 files changed, 48 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h index 612b5755f742..c0c67c919093 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h @@ -43,6 +43,13 @@ struct cs_etm_queue; typedef u32 (*cs_etm_mem_cb_type)(struct cs_etm_queue *, u64, size_t, u8 *); +struct cs_etmv3_trace_params { + u32 reg_ctrl; + u32 reg_trc_id; + u32 reg_ccer; + u32 reg_idr; +}; + struct cs_etmv4_trace_params { u32 reg_idr0; u32 reg_idr1; @@ -55,6 +62,7 @@ struct cs_etmv4_trace_params { struct cs_etm_trace_params { int protocol; union { + struct cs_etmv3_trace_params etmv3; struct cs_etmv4_trace_params etmv4; }; }; diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 73430b73570d..830e9136ad7c 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -122,15 +122,28 @@ static void cs_etm__dump_event(struct cs_etm_auxtrace *etm, /* Use metadata to fill in trace parameters for trace decoder */ t_params = zalloc(sizeof(*t_params) * etm->num_cpu); for (i = 0; i < etm->num_cpu; i++) { - t_params[i].protocol = CS_ETM_PROTO_ETMV4i; - t_params[i].etmv4.reg_idr0 = etm->metadata[i][CS_ETMV4_TRCIDR0]; - t_params[i].etmv4.reg_idr1 = etm->metadata[i][CS_ETMV4_TRCIDR1]; - t_params[i].etmv4.reg_idr2 = etm->metadata[i][CS_ETMV4_TRCIDR2]; - t_params[i].etmv4.reg_idr8 = etm->metadata[i][CS_ETMV4_TRCIDR8]; - t_params[i].etmv4.reg_configr = + if (etm->metadata[i][CS_ETM_MAGIC] == __perf_cs_etmv3_magic) { + t_params[i].protocol = CS_ETM_PROTO_ETMV3; + t_params[i].etmv3.reg_ctrl = + etm->metadata[i][CS_ETM_ETMCR]; + t_params[i].etmv3.reg_trc_id = + etm->metadata[i][CS_ETM_ETMTRACEIDR]; + } else if (etm->metadata[i][CS_ETM_MAGIC] == + __perf_cs_etmv4_magic) { + t_params[i].protocol = CS_ETM_PROTO_ETMV4i; + t_params[i].etmv4.reg_idr0 = + etm->metadata[i][CS_ETMV4_TRCIDR0]; + t_params[i].etmv4.reg_idr1 = + etm->metadata[i][CS_ETMV4_TRCIDR1]; + t_params[i].etmv4.reg_idr2 = + etm->metadata[i][CS_ETMV4_TRCIDR2]; + t_params[i].etmv4.reg_idr8 = + etm->metadata[i][CS_ETMV4_TRCIDR8]; + t_params[i].etmv4.reg_configr = etm->metadata[i][CS_ETMV4_TRCCONFIGR]; - t_params[i].etmv4.reg_traceidr = + t_params[i].etmv4.reg_traceidr = etm->metadata[i][CS_ETMV4_TRCTRACEIDR]; + } } /* Set decoder parameters to simply print the trace packets */ @@ -360,15 +373,28 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm, goto out_free; for (i = 0; i < etm->num_cpu; i++) { - t_params[i].protocol = CS_ETM_PROTO_ETMV4i; - t_params[i].etmv4.reg_idr0 = etm->metadata[i][CS_ETMV4_TRCIDR0]; - t_params[i].etmv4.reg_idr1 = etm->metadata[i][CS_ETMV4_TRCIDR1]; - t_params[i].etmv4.reg_idr2 = etm->metadata[i][CS_ETMV4_TRCIDR2]; - t_params[i].etmv4.reg_idr8 = etm->metadata[i][CS_ETMV4_TRCIDR8]; - t_params[i].etmv4.reg_configr = + if (etm->metadata[i][CS_ETM_MAGIC] == __perf_cs_etmv3_magic) { + t_params[i].protocol = CS_ETM_PROTO_ETMV3; + t_params[i].etmv3.reg_ctrl = + etm->metadata[i][CS_ETM_ETMCR]; + t_params[i].etmv3.reg_trc_id = + etm->metadata[i][CS_ETM_ETMTRACEIDR]; + } else if (etm->metadata[i][CS_ETM_MAGIC] == + __perf_cs_etmv4_magic) { + t_params[i].protocol = CS_ETM_PROTO_ETMV4i; + t_params[i].etmv4.reg_idr0 = + etm->metadata[i][CS_ETMV4_TRCIDR0]; + t_params[i].etmv4.reg_idr1 = + etm->metadata[i][CS_ETMV4_TRCIDR1]; + t_params[i].etmv4.reg_idr2 = + etm->metadata[i][CS_ETMV4_TRCIDR2]; + t_params[i].etmv4.reg_idr8 = + etm->metadata[i][CS_ETMV4_TRCIDR8]; + t_params[i].etmv4.reg_configr = etm->metadata[i][CS_ETMV4_TRCCONFIGR]; - t_params[i].etmv4.reg_traceidr = + t_params[i].etmv4.reg_traceidr = etm->metadata[i][CS_ETMV4_TRCTRACEIDR]; + } } /* Set decoder parameters to simply print the trace packets */