From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE454C32772 for ; Tue, 23 Aug 2022 09:15:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XHMSaS692RxNEAsL4mX/Ys5rkVo/vB2bgeqsKsslcMk=; b=hqPlqS0YpX8f87 ev16lgTurgxiHRXWIesFEEBqsgYcwmB9lL7glBLonIeA9yN59WCcIaWvBICfAVckdT6qW631ACCPi thgYOQuHc71CxQf51IEqMg5/fjWUl9YbzUtXBh090iokDKkPlTC1RvVQxtgsaicFh12c+RWtuO28b g+97Nm3yfFmaENAq0PiLsiSvhHVxK/f5jZPyUOsoV8FNBKsdnIgQqX87FY6x7ThbLsSKNYjfFmk26 rMu+pBuRc3o+oR9gUdLNrzkm2cJaYUH00ABZZBggprV2MimZxg71LF3ydFhsX1P0OfDA9oBhZ/xw4 3XOoUlADu9Nf9bWXO5Xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQPzN-004MKM-4k; Tue, 23 Aug 2022 09:14:26 +0000 Received: from desiato.infradead.org ([90.155.92.199]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQPvn-004KWN-Bk for linux-arm-kernel@bombadil.infradead.org; Tue, 23 Aug 2022 09:10:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=References:In-Reply-To:Message-Id:Date :Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=00nZRcZGH0Ch9kf2FG017OBarf3WrFRyr4+E06yZjt4=; b=qTvH30satGj/IF3IWINo3BvI/i 0Q/ejB7MkrhKDKhT53/OtBRjwcHs8VnKvcZ/CeM4e3QgPJ1tRKkmODwngkH1q5yrBwd0ltEY4XsDu lkenuKPr+kIbwRiS4BZyGDnZYRTi6VdRmWHnXOTsdp7vTKtTXaANOWWYJrj1dajdBrSENTXdcwL5M pU1Eh9BKWf8nmZUvYptNDTJ3g44fEWSq8lUVfdnWRr7JUJ1SfCs3vpb7jB0Wl033nmYSx01f9aIoT lLJZHiewEGSJahQprmjUq/trZHLrp9llzdgfBy78zSUpy/GvEcw1DMmSSpYfavPj2u/z/KgAVqOb1 1nsg75Nw==; Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQPvY-005L2k-LI for linux-arm-kernel@lists.infradead.org; Tue, 23 Aug 2022 09:10:36 +0000 Received: by mail-wm1-x331.google.com with SMTP id m3-20020a05600c3b0300b003a5e0557150so505393wms.0 for ; Tue, 23 Aug 2022 02:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc; bh=00nZRcZGH0Ch9kf2FG017OBarf3WrFRyr4+E06yZjt4=; b=HpDVHm11YxrrBB9xsaNFKAhRf3RMEuMDCYt/ZksGm4V2FqeiOg0HxpYQNLjepXXUvO T0A/Qs6JxvhXH/RbxYObI7rbn9urv4ibf+Q6OouveJTkDLkw1dqZvezYIEP/BH+a7tiW nyjMap+JtyCGZLy32XdhzDJNETOf86ByMkQHNE2veSJ5EPGcGd3TuMXEOLAbDDqN5Su8 sGVWBhu3VFMUdQ1jZbSukiV8AszKnOsbo/tK9GNopSYAIi6KTWfceIOHgsdsah7WmIsJ ChRmUoT4AjQQZPDDV/rCCqWQjLO4CbKVzIPIlvidTtvJdXcMrL4G+BNNAahfjU14mXcx viRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc; bh=00nZRcZGH0Ch9kf2FG017OBarf3WrFRyr4+E06yZjt4=; b=lR9Je74AwUZXr5e0bOgFcLq9Wxxn4NFjpHQb7JK3WDGzyoiwZvkv0Suj37cFDreC2G kJXrNf/7wLMNzu8SvUsBP1ez+C+TsnsLVAMD6NrUcOanK3xX4V8MTWgjfjEcaupBkPLd 9QGIOSTYuBtNvDCJ+qLC33FYjukbzLbO5hykz6kDdrHsbSOka1XECtpj3Z/rk5rShWex kFCNzngv/G98I9m0KgrsEXChAavd5YsF7Yae29oNbxMuUC8h+ebCorAohra7EeT/HmnG pLutqxyErzss4pEH4BnzyZleuG7p3KacRsN3vMYPKYf3tdddjQxWSC7iiLO8lwte7qBZ upaA== X-Gm-Message-State: ACgBeo25HhoAelXMIlHiGKgK0GaW46u+p1UDvzKcx4STLubX/vEE3o3C UEu5xBueDi5syDcevuvV7R3DJA== X-Google-Smtp-Source: AA6agR4IyoYCMb8Rm017id592w1HTMLhZsUXS8pSrQLfOj5pTWDvOcRMSxJATztL4ntF4BhAcHH6Aw== X-Received: by 2002:a7b:ca4c:0:b0:3a5:bbf1:9e3e with SMTP id m12-20020a7bca4c000000b003a5bbf19e3emr1545407wml.5.1661245826465; Tue, 23 Aug 2022 02:10:26 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6809:2201:4553:cf11:6cff:b293]) by smtp.gmail.com with ESMTPSA id w6-20020adfde86000000b002253d162491sm10760721wrl.52.2022.08.23.02.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 02:10:26 -0700 (PDT) From: Mike Leach To: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: mathieu.poirier@linaro.org, suzuki.poulose@arm.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-perf-users@vger.kernel.org, leo.yan@linaro.org, quic_jinlmao@quicinc.com, Mike Leach Subject: [PATCH v4 12/13] coresight: events: PERF_RECORD_AUX_OUTPUT_HW_ID used for Trace ID Date: Tue, 23 Aug 2022 10:10:08 +0100 Message-Id: <20220823091009.14121-13-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220823091009.14121-1-mike.leach@linaro.org> References: <20220823091009.14121-1-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220823_101034_191351_A886424C X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the perf_report_aux_output_id() call to output the CoreSight trace ID and associated CPU as a PERF_RECORD_AUX_OUTPUT_HW_ID record in the perf.data file. Signed-off-by: Mike Leach --- drivers/hwtracing/coresight/coresight-etm-perf.c | 7 +++++++ include/linux/coresight-pmu.h | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 6166f716a6ac..59a2ad95c1dc 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -4,6 +4,7 @@ * Author: Mathieu Poirier */ +#include #include #include #include @@ -448,6 +449,7 @@ static void etm_event_start(struct perf_event *event, int flags) struct perf_output_handle *handle = &ctxt->handle; struct coresight_device *sink, *csdev = per_cpu(csdev_src, cpu); struct list_head *path; + u64 hw_id; if (!csdev) goto fail; @@ -493,6 +495,11 @@ static void etm_event_start(struct perf_event *event, int flags) if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF)) goto fail_disable_path; + /* output cpu / trace ID in perf record */ + hw_id = FIELD_PREP(CS_AUX_HW_ID_VERSION_MASK, CS_AUX_HW_ID_CURR_VERSION) | + FIELD_PREP(CS_AUX_HW_ID_TRACE_ID_MASK, coresight_trace_id_read_cpu_id(cpu)); + perf_report_aux_output_id(event, hw_id); + out: /* Tell the perf core the event is alive */ event->hw.state = 0; diff --git a/include/linux/coresight-pmu.h b/include/linux/coresight-pmu.h index 99bc3cc6bf2d..9aafafff219a 100644 --- a/include/linux/coresight-pmu.h +++ b/include/linux/coresight-pmu.h @@ -7,6 +7,8 @@ #ifndef _LINUX_CORESIGHT_PMU_H #define _LINUX_CORESIGHT_PMU_H +#include + #define CORESIGHT_ETM_PMU_NAME "cs_etm" /* @@ -44,4 +46,16 @@ #define ETM4_CFG_BIT_RETSTK 12 #define ETM4_CFG_BIT_VMID_OPT 15 +/* + * Interpretation of the PERF_RECORD_AUX_OUTPUT_HW_ID payload. + * Used to associate a CPU with the CoreSight Trace ID. + * [07:00] - Trace ID - uses 8 bits to make value easy to read in file. + * [59:08] - Unused (SBZ) + * [63:60] - Version + */ +#define CS_AUX_HW_ID_TRACE_ID_MASK GENMASK_ULL(7, 0) +#define CS_AUX_HW_ID_VERSION_MASK GENMASK_ULL(63, 60) + +#define CS_AUX_HW_ID_CURR_VERSION 0 + #endif -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65D32C52D79 for ; Tue, 23 Aug 2022 10:53:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356798AbiHWKwJ (ORCPT ); Tue, 23 Aug 2022 06:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355774AbiHWKoS (ORCPT ); Tue, 23 Aug 2022 06:44:18 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC62AB07C for ; Tue, 23 Aug 2022 02:10:28 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id z14-20020a7bc7ce000000b003a5db0388a8so389218wmk.1 for ; Tue, 23 Aug 2022 02:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc; bh=00nZRcZGH0Ch9kf2FG017OBarf3WrFRyr4+E06yZjt4=; b=HpDVHm11YxrrBB9xsaNFKAhRf3RMEuMDCYt/ZksGm4V2FqeiOg0HxpYQNLjepXXUvO T0A/Qs6JxvhXH/RbxYObI7rbn9urv4ibf+Q6OouveJTkDLkw1dqZvezYIEP/BH+a7tiW nyjMap+JtyCGZLy32XdhzDJNETOf86ByMkQHNE2veSJ5EPGcGd3TuMXEOLAbDDqN5Su8 sGVWBhu3VFMUdQ1jZbSukiV8AszKnOsbo/tK9GNopSYAIi6KTWfceIOHgsdsah7WmIsJ ChRmUoT4AjQQZPDDV/rCCqWQjLO4CbKVzIPIlvidTtvJdXcMrL4G+BNNAahfjU14mXcx viRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc; bh=00nZRcZGH0Ch9kf2FG017OBarf3WrFRyr4+E06yZjt4=; b=mTMPIuuUKxAfhBdttmdjCby7M75/cfcbDMnK+frkmtij5tpxLDPXVqr+Hk4mfoxQpQ 6uPvjjZN+r9LmC7FaRnPR6Sry6yAP4qfWEe2sVW91WrUFysZN7MkQQIpO+2GpOz7hZDC p701M2MmNFL3SLLiVf0i1bCrG58xON//Ti70REB16pD2q0jOkG1JiAQpst81TEVEjcF4 5OhqgooUQaVzG7d6KLCA64rYBT/umUxzkE7Sfvmkpe9vsN7/K3N9lISrSYkGjd1kEPvl vhmkyls2RXNh7DO9td7iqaGtvPjzmlUUt0sh+IMfBJDxptumq/JbQFZakbZEHwULhM3V 0naw== X-Gm-Message-State: ACgBeo0zkv1ijU7OikHcBFP1QSj3Gj52NfDXgKddlbCLgAO9pakDkyKh yyKEwJVSfbLLLe6+MC41GHK4RQ== X-Google-Smtp-Source: AA6agR4IyoYCMb8Rm017id592w1HTMLhZsUXS8pSrQLfOj5pTWDvOcRMSxJATztL4ntF4BhAcHH6Aw== X-Received: by 2002:a7b:ca4c:0:b0:3a5:bbf1:9e3e with SMTP id m12-20020a7bca4c000000b003a5bbf19e3emr1545407wml.5.1661245826465; Tue, 23 Aug 2022 02:10:26 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6809:2201:4553:cf11:6cff:b293]) by smtp.gmail.com with ESMTPSA id w6-20020adfde86000000b002253d162491sm10760721wrl.52.2022.08.23.02.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 02:10:26 -0700 (PDT) From: Mike Leach To: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: mathieu.poirier@linaro.org, suzuki.poulose@arm.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-perf-users@vger.kernel.org, leo.yan@linaro.org, quic_jinlmao@quicinc.com, Mike Leach Subject: [PATCH v4 12/13] coresight: events: PERF_RECORD_AUX_OUTPUT_HW_ID used for Trace ID Date: Tue, 23 Aug 2022 10:10:08 +0100 Message-Id: <20220823091009.14121-13-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220823091009.14121-1-mike.leach@linaro.org> References: <20220823091009.14121-1-mike.leach@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the perf_report_aux_output_id() call to output the CoreSight trace ID and associated CPU as a PERF_RECORD_AUX_OUTPUT_HW_ID record in the perf.data file. Signed-off-by: Mike Leach --- drivers/hwtracing/coresight/coresight-etm-perf.c | 7 +++++++ include/linux/coresight-pmu.h | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 6166f716a6ac..59a2ad95c1dc 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -4,6 +4,7 @@ * Author: Mathieu Poirier */ +#include #include #include #include @@ -448,6 +449,7 @@ static void etm_event_start(struct perf_event *event, int flags) struct perf_output_handle *handle = &ctxt->handle; struct coresight_device *sink, *csdev = per_cpu(csdev_src, cpu); struct list_head *path; + u64 hw_id; if (!csdev) goto fail; @@ -493,6 +495,11 @@ static void etm_event_start(struct perf_event *event, int flags) if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF)) goto fail_disable_path; + /* output cpu / trace ID in perf record */ + hw_id = FIELD_PREP(CS_AUX_HW_ID_VERSION_MASK, CS_AUX_HW_ID_CURR_VERSION) | + FIELD_PREP(CS_AUX_HW_ID_TRACE_ID_MASK, coresight_trace_id_read_cpu_id(cpu)); + perf_report_aux_output_id(event, hw_id); + out: /* Tell the perf core the event is alive */ event->hw.state = 0; diff --git a/include/linux/coresight-pmu.h b/include/linux/coresight-pmu.h index 99bc3cc6bf2d..9aafafff219a 100644 --- a/include/linux/coresight-pmu.h +++ b/include/linux/coresight-pmu.h @@ -7,6 +7,8 @@ #ifndef _LINUX_CORESIGHT_PMU_H #define _LINUX_CORESIGHT_PMU_H +#include + #define CORESIGHT_ETM_PMU_NAME "cs_etm" /* @@ -44,4 +46,16 @@ #define ETM4_CFG_BIT_RETSTK 12 #define ETM4_CFG_BIT_VMID_OPT 15 +/* + * Interpretation of the PERF_RECORD_AUX_OUTPUT_HW_ID payload. + * Used to associate a CPU with the CoreSight Trace ID. + * [07:00] - Trace ID - uses 8 bits to make value easy to read in file. + * [59:08] - Unused (SBZ) + * [63:60] - Version + */ +#define CS_AUX_HW_ID_TRACE_ID_MASK GENMASK_ULL(7, 0) +#define CS_AUX_HW_ID_VERSION_MASK GENMASK_ULL(63, 60) + +#define CS_AUX_HW_ID_CURR_VERSION 0 + #endif -- 2.17.1