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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A25CFC433EF for ; Mon, 6 Sep 2021 17:34:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8104160C51 for ; Mon, 6 Sep 2021 17:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244112AbhIFRf5 (ORCPT ); Mon, 6 Sep 2021 13:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243961AbhIFRfy (ORCPT ); Mon, 6 Sep 2021 13:35:54 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEAEDC061575 for ; Mon, 6 Sep 2021 10:34:49 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id q68so7409502pga.9 for ; Mon, 06 Sep 2021 10:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RuRsrItRCGT33aYjZwAQREkMqMsFsdvg/GueZb9ps7I=; b=vcFjoHW65IWgE3KC0gEzK22XqS4AxNg6lQi0ysKg1IajszNCwpKV5jRUgP+K5p2/lF yIjG/v1CjRg03rP4bga02idTRx9kxUfNMn0GEdH8RejhqF8m9khWA+hA9Nok/1SFAtmF fAjzB0zG0ie6C3QKig354VkTP3VB91zrZJ7Q6tDEWh04emMTjbp9vqtxHKMXal1tex40 2waOPSvq9Bf57uhjooWymtOn+txRPFXfpodn+5f4xIjIJLO1qfzY1HGRSG+pdgteE8PJ voCeWpWeK95rjJsEFQuPd6cX3GDY+S05HXfmUPZ0lv7uhhSbBrFHRHcNKss+1vchYACX IUFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RuRsrItRCGT33aYjZwAQREkMqMsFsdvg/GueZb9ps7I=; b=r8PkBU99Lq2onnjzhVgDbGGKHHXlWD1o6x0BMQZt0UJHnAXSqElY/Vvf7NP/swMnOG XpESNkiRO+t/lPwFpyPXTcx66G6AsazxfegskJJAoetYyqcVY/x2m4A4L7lNws7ryznE mIb1nXoN0RLtlMDax8PGSLoZXnixE8NcheeI8Ds7p/SGYredrL9Y/TAxCUS4VevigqW2 44QiNxI+BkoilQm9iZiNexmSciEVUjEK3DlW0V9X1r8m/1xXgUYMrkaofUdtyifhnP/Q L8/bbji3XmjcwIZidZis1+JVvcBcVoH4xpKpjdIaljEcUbUYcvP1sP+ahXSZfQPpiwsG 6MEA== X-Gm-Message-State: AOAM531DPFHs87A9BNihGuIyv0/ZowwV1lImEnX/btkRX5wMIVl96tHL FsqAMAo6YURCeGOohnF/UXbCCg== X-Google-Smtp-Source: ABdhPJzJCBpqjPtwkmX3tl1rocoW+R1yAATRVKI1430lo6bJNJOVCc2UIFEo4TSKUc4qhmSW9NGCDQ== X-Received: by 2002:a63:9752:: with SMTP id d18mr13089145pgo.320.1630949689266; Mon, 06 Sep 2021 10:34:49 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id v23sm8017125pff.155.2021.09.06.10.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 10:34:48 -0700 (PDT) Date: Mon, 6 Sep 2021 11:34:46 -0600 From: Mathieu Poirier To: Qi Liu Cc: suzuki.poulose@arm.com, mike.leach@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com Subject: Re: [PATCH 1/2] Documentation: tracing: Documentation for ultrasoc SMB drivers Message-ID: <20210906173446.GD1228692@p14s> References: <20210719111737.47891-1-liuqi115@huawei.com> <20210719111737.47891-2-liuqi115@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210719111737.47891-2-liuqi115@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 19, 2021 at 07:17:36PM +0800, Qi Liu wrote: > Ultrasoc trace module is a system level solution for tracing, and SMB > is the component in trace module to store trace message. This patch > brings in a documentation for ultrasoc SMB driver and simple introduces > how to use ultrasoc SMB by sysfs interface and perf interface. > > Signed-off-by: Qi Liu > --- > .../trace/coresight/ultrasoc-trace.rst | 193 ++++++++++++++++++ > 1 file changed, 193 insertions(+) > create mode 100644 Documentation/trace/coresight/ultrasoc-trace.rst > > diff --git a/Documentation/trace/coresight/ultrasoc-trace.rst b/Documentation/trace/coresight/ultrasoc-trace.rst > new file mode 100644 > index 000000000000..dee133e27bf3 > --- /dev/null > +++ b/Documentation/trace/coresight/ultrasoc-trace.rst > @@ -0,0 +1,193 @@ > +======================================================= > +Siemens Embedded Analytics - HW Assisted Tracing on SoC > +======================================================= > + :Author: Jonathan Zhou > + Qi Liu > + :Date: July 8th, 2021 > + > +Introduction > +------------ > + > +This document is concerned with the Siemens Embedded Analytics Framework, > +using for tracing of multiple type SoC. As this module is developed by > +Ultrasoc technology, which is acquired by Siemens, we still use "Ultrasoc" > +to name document and structures. > + > +System Memory Buffer is an important component in this Analytics Framework, > +it provides a way to buffer and store messages in system memory. It provides > +a capability to store messages received on its input message interface to an > +area of system memory. > + > +A typical Siemens trace system would look like the following diagram: > + @@@@@@@@@@@@@ > + @ CPU @ > + @@@@@@@@@@@@@ > + ############# > + # Coresight # > + # ETM # > + ####### > + ### > + # > + | > + * > + ******************************* > + *** AMBA Advanced Trace Bus (ATB) *** > + ***************^*************** > + =============== | > + === FUNNEL ==<--- | > + ======= > + | > + * > + @@@@@@@ > + @ TRC @ > + @@@@@ > + @@@ > + @ > + | > + * > + ************************************** ******************* > + ************************ Message BUS *************************** > + ******************^************************^**************** > + | | > + @@@@@@@@@@@@@@@@@@ | @@@@@@@@@@@@ > + @ Message Engine @ | @ JTAG COM @ > + @@@@@@@@@@@@@@@@@@ | @@@@@@@@@@ > + | |---> @@@@@@@@ > + | @@@@@@ > + @@@@@@@ | > + @ SMB @ JTAG > + @@@@@ > + @@@ > + @ > + | > + | > + * > + *************************************************************** > + **************************** AMBA AXI **************************** > + ***************************************************************** > + > +Acronyms > +--------------------------- > + > +Acronyms: > + > +SMB: System Memory Buffer > +TRC: Trace receiver > + > +Framework and implementation > +------------------------------ > + > +SMB is implemented as platform device, each SCCL has one SMB device. > + > +As TRC receives data from coresight ETM device, SMB can use the following API > +to register into coresight framework as a sink device: > +.. c:function:: struct coresight_device *coresight_register(struct coresight_desc *desc); > +.. c:function:: void coresight_unregister(struct coresight_device *csdev); > + > +Then users can get trace data by this path: ETM->funnel->SMB. > +More information about coresight framework can be found in > +Documention/trace/coresight/coresight.rst. > + > +If everything goes well, the relationship of Embedded Analytics devices will be > +described under the sysfs:: > + > + $# ls /sys/bus/platform/devices/ > + :00 > + $# ls /sys/bus/coresight/devices/ > + etm0 etm14 etm2 etm25 etm30 etm8 funnel4 > + etm1 etm15 etm20 etm26 etm31 etm9 funnel5 > + etm10 etm16 etm21 etm27 etm4 funnel0 funnel6 > + etm11 etm17 etm22 etm28 etm5 funnel1 funnel7 > + etm12 etm18 etm23 etm29 etm6 funnel2 sink_smb0 > + etm13 etm19 etm24 etm3 etm7 funnel3 > + $# ls -l /sys/bus/coresight/devices/funnel0/connections/ > + in:0 -> ../../../../system/cpu/cpu0/ARMHC500:00/etm0 > + in:1 -> ../../../../system/cpu/cpu1/ARMHC500:01/etm1 > + in:2 -> ../../../../system/cpu/cpu2/ARMHC500:02/etm2 > + in:3 -> ../../../../system/cpu/cpu3/ARMHC500:03/etm3 > + nr_links > + out:0 -> ../../../HISI0391:00/HISI03A1:00/sink_smb0 > + $# ls -l /sys/bus/coresight/devices/sink_smb0/connections/ > + in:101 -> ../../../../ARMHC9FE:05/funnel5 > + in:114 -> ../../../../ARMHC9FE:07/funnel7 > + in:121 -> ../../../../ARMHC9FE:03/funnel3 > + in:39 -> ../../../../ARMHC9FE:00/funnel0 > + in:51 -> ../../../../ARMHC9FE:04/funnel4 > + in:61 -> ../../../../ARMHC9FE:06/funnel6 > + in:68 -> ../../../../ARMHC9FE:02/funnel2 > + in:89 -> ../../../../ARMHC9FE:01/funnel1 > + nr_links > + > +How to use the Embedded Analytics trace module > +----------------------------------------------- > + > +There are two ways to use the Embedded Analytics trace module: > + > +1. interacting directly with the devices using the sysFS interface. > +2. using the perf cmd line tools. > + > +1) Using the sysFS interface: > + > +Before trace collection can start, a coresight sink needs to be identified. > +There is no limit on the amount of sinks (nor sources) that can be enabled at > +any given moment. As a generic operation, all device pertaining to the sink > +class will have an "active" entry in sysfs:: > + > + $# ls /sys/bus/coresight/devices/ > + etm0 etm14 etm2 etm25 etm30 etm8 funnel4 > + etm1 etm15 etm20 etm26 etm31 etm9 funnel5 > + etm10 etm16 etm21 etm27 etm4 funnel0 funnel6 > + etm11 etm17 etm22 etm28 etm5 funnel1 funnel7 > + etm12 etm18 etm23 etm29 etm6 funnel2 sink_smb0 > + etm13 etm19 etm24 etm3 etm7 funnel3 > + $# ls /sys/bus/coresight/devices/sink_smb0 > + connections enable_sink firmware_node power subsystem uevent > + $# echo 1 > /sys/bus/coresight/devices/sink_smb0/enable_sink > + $# cat /sys/bus/coresight/devices/sink_smb0/enable_sink > + 1 > + > +When start trace collection, etm devices corresponding to the enabled sink > +should be selected:: > + > + $# echo 1 > /sys/bus/coresight/devices/etm0/enable_source > + $# cat /sys/bus/coresight/devices/etm0/enable_source > + 1 > + $# cat /sys/bus/platform/devices/:00/com_status > + com-type : DOWN-ONLY > + service status : stopped > + interrupt status : 0x00000003 > + write point : 0x5437f400 <----- The write pointer is moving > + > +Trace collection is stopped the same way:: > + > + $# echo 0 > /sys/bus/coresight/devices/etm0/enable_source > + $# echo 0 > /sys/bus/coresight/devices/sink_smb0/enable_sink > + > +The content of the SMB buffer can be harvested directly from /dev:: > + > + $# dd if=/dev/sink_smb0 of=~/cstrace.bin > + 5233+0 records in > + 5233+0 records out > + 2679296 bytes (2.7 MB) copied, 0.0131708 s, 203 MB/s > + > + root:/sys/bus/coresight/devices# > + > +The file cstrace.bin can be decompressed using "ptm2human". > + > +2) Using perf framework: > + > +As SMB device has been registered with coresight framework, perf tool can be > +used to control Embedded Analytics trace collection, and the method is similar > +to using perf to do coresight trace collection. > + > +The only thing to note is, list of cpus should be correspond to the specified > +sink device. > + > +Example usage of perf:: > + > + $# ./perf list pmu > + cs_etm// [Kernel PMU event] > + $# ./perf record -e cs_etm/@sink_smb0/ -C 0 --per-thread sleep 2s > + [ perf record: Woken up 2 times to write data ] > + [ perf record: Captured and wrote 0.288 MB perf.data ] > + $# ./perf report This IP block works like any other sink device and as such I don't really see a need for this documentation - especially since it is mostly conveying the same information already present in coresight.rst. Thanks, Mathieu > -- > 2.17.1 > 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 X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 824BEC433F5 for ; Mon, 6 Sep 2021 17:36:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4ABF36101C for ; Mon, 6 Sep 2021 17:36:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4ABF36101C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ip8adrVTgJg1BTjC3nHBRny5CsvmramPneB7QdpXxbo=; b=aNFRv4bsJL/AcC 9RTdQSovPDYGo61YcVC4LrAg/adOYiXDPJXvdOnmlf9t9ZB51QlXKedQciSP87g8656oKW2gIolpI 1EBiy7JfTqXhR3VKVyhZRI7UPhGoI6X7qQKISjLo0+fhD0Lfsqvv2LTHq3SCxGjCDDXKfuBcrWDdJ k1OA7z/Jt0U4X/lvfl1biiTENQ9L2J7ZlPJwUuyLE1UiKPloKZ/ANk9qKaCWeEKjvS0BYU/K6Pp8n TUT2gtLBMj4dumm4U3SwqmxYXwoEzTu40RB1vVauIyLNHVRmbS5PWfmlBhxzNDrWC7WdIqvVSbsYO 9C4hNZaypfVP+akSYStA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNIWP-001SHB-Hw; Mon, 06 Sep 2021 17:35:05 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNIWA-001SDZ-E3 for linux-arm-kernel@lists.infradead.org; Mon, 06 Sep 2021 17:34:52 +0000 Received: by mail-pg1-x530.google.com with SMTP id w7so7393015pgk.13 for ; Mon, 06 Sep 2021 10:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RuRsrItRCGT33aYjZwAQREkMqMsFsdvg/GueZb9ps7I=; b=vcFjoHW65IWgE3KC0gEzK22XqS4AxNg6lQi0ysKg1IajszNCwpKV5jRUgP+K5p2/lF yIjG/v1CjRg03rP4bga02idTRx9kxUfNMn0GEdH8RejhqF8m9khWA+hA9Nok/1SFAtmF fAjzB0zG0ie6C3QKig354VkTP3VB91zrZJ7Q6tDEWh04emMTjbp9vqtxHKMXal1tex40 2waOPSvq9Bf57uhjooWymtOn+txRPFXfpodn+5f4xIjIJLO1qfzY1HGRSG+pdgteE8PJ voCeWpWeK95rjJsEFQuPd6cX3GDY+S05HXfmUPZ0lv7uhhSbBrFHRHcNKss+1vchYACX IUFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RuRsrItRCGT33aYjZwAQREkMqMsFsdvg/GueZb9ps7I=; b=YSAPU1zLlCmFNTyAb9/w14w6yB+U01gb5sWG3R/ozNH0nqYdob+cwLj1ilx84eMUqp gN1wi7lJZiOojYhvs1Lnzqq9SRSt4InvnIEtlvy5wypKvS/quujC4I5MrOH8DZTvZ/qo ZF5vThYMObFQ3/vBg6AqRTlqwX8SYGbsKRukU2dtMGGOAfbMMM6E+h4Yu6bFS/MFgDIH N4hQ1fbqs4XBfXNoNymRPM3kECrQD3r+2KKH4q0irB+tiXHa6Q76vur0z91FORD14n3k knZMYdE5MvPtqvC8b345G/07myZxxin1kwn7A20BKedSzidsAa9NVFqMO0PaQmn4da3u /G2A== X-Gm-Message-State: AOAM532Fmo8TPG3NFElAA/KAe7UCMwkkgpWrtaHpsqLqgsCM2mtI5Yc9 ZomYWVJKEQlp9RAjlDbEcF0+fA== X-Google-Smtp-Source: ABdhPJzJCBpqjPtwkmX3tl1rocoW+R1yAATRVKI1430lo6bJNJOVCc2UIFEo4TSKUc4qhmSW9NGCDQ== X-Received: by 2002:a63:9752:: with SMTP id d18mr13089145pgo.320.1630949689266; Mon, 06 Sep 2021 10:34:49 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id v23sm8017125pff.155.2021.09.06.10.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 10:34:48 -0700 (PDT) Date: Mon, 6 Sep 2021 11:34:46 -0600 From: Mathieu Poirier To: Qi Liu Cc: suzuki.poulose@arm.com, mike.leach@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com Subject: Re: [PATCH 1/2] Documentation: tracing: Documentation for ultrasoc SMB drivers Message-ID: <20210906173446.GD1228692@p14s> References: <20210719111737.47891-1-liuqi115@huawei.com> <20210719111737.47891-2-liuqi115@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210719111737.47891-2-liuqi115@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210906_103450_532532_EA7E3CF1 X-CRM114-Status: GOOD ( 34.35 ) 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: , 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 On Mon, Jul 19, 2021 at 07:17:36PM +0800, Qi Liu wrote: > Ultrasoc trace module is a system level solution for tracing, and SMB > is the component in trace module to store trace message. This patch > brings in a documentation for ultrasoc SMB driver and simple introduces > how to use ultrasoc SMB by sysfs interface and perf interface. > > Signed-off-by: Qi Liu > --- > .../trace/coresight/ultrasoc-trace.rst | 193 ++++++++++++++++++ > 1 file changed, 193 insertions(+) > create mode 100644 Documentation/trace/coresight/ultrasoc-trace.rst > > diff --git a/Documentation/trace/coresight/ultrasoc-trace.rst b/Documentation/trace/coresight/ultrasoc-trace.rst > new file mode 100644 > index 000000000000..dee133e27bf3 > --- /dev/null > +++ b/Documentation/trace/coresight/ultrasoc-trace.rst > @@ -0,0 +1,193 @@ > +======================================================= > +Siemens Embedded Analytics - HW Assisted Tracing on SoC > +======================================================= > + :Author: Jonathan Zhou > + Qi Liu > + :Date: July 8th, 2021 > + > +Introduction > +------------ > + > +This document is concerned with the Siemens Embedded Analytics Framework, > +using for tracing of multiple type SoC. As this module is developed by > +Ultrasoc technology, which is acquired by Siemens, we still use "Ultrasoc" > +to name document and structures. > + > +System Memory Buffer is an important component in this Analytics Framework, > +it provides a way to buffer and store messages in system memory. It provides > +a capability to store messages received on its input message interface to an > +area of system memory. > + > +A typical Siemens trace system would look like the following diagram: > + @@@@@@@@@@@@@ > + @ CPU @ > + @@@@@@@@@@@@@ > + ############# > + # Coresight # > + # ETM # > + ####### > + ### > + # > + | > + * > + ******************************* > + *** AMBA Advanced Trace Bus (ATB) *** > + ***************^*************** > + =============== | > + === FUNNEL ==<--- | > + ======= > + | > + * > + @@@@@@@ > + @ TRC @ > + @@@@@ > + @@@ > + @ > + | > + * > + ************************************** ******************* > + ************************ Message BUS *************************** > + ******************^************************^**************** > + | | > + @@@@@@@@@@@@@@@@@@ | @@@@@@@@@@@@ > + @ Message Engine @ | @ JTAG COM @ > + @@@@@@@@@@@@@@@@@@ | @@@@@@@@@@ > + | |---> @@@@@@@@ > + | @@@@@@ > + @@@@@@@ | > + @ SMB @ JTAG > + @@@@@ > + @@@ > + @ > + | > + | > + * > + *************************************************************** > + **************************** AMBA AXI **************************** > + ***************************************************************** > + > +Acronyms > +--------------------------- > + > +Acronyms: > + > +SMB: System Memory Buffer > +TRC: Trace receiver > + > +Framework and implementation > +------------------------------ > + > +SMB is implemented as platform device, each SCCL has one SMB device. > + > +As TRC receives data from coresight ETM device, SMB can use the following API > +to register into coresight framework as a sink device: > +.. c:function:: struct coresight_device *coresight_register(struct coresight_desc *desc); > +.. c:function:: void coresight_unregister(struct coresight_device *csdev); > + > +Then users can get trace data by this path: ETM->funnel->SMB. > +More information about coresight framework can be found in > +Documention/trace/coresight/coresight.rst. > + > +If everything goes well, the relationship of Embedded Analytics devices will be > +described under the sysfs:: > + > + $# ls /sys/bus/platform/devices/ > + :00 > + $# ls /sys/bus/coresight/devices/ > + etm0 etm14 etm2 etm25 etm30 etm8 funnel4 > + etm1 etm15 etm20 etm26 etm31 etm9 funnel5 > + etm10 etm16 etm21 etm27 etm4 funnel0 funnel6 > + etm11 etm17 etm22 etm28 etm5 funnel1 funnel7 > + etm12 etm18 etm23 etm29 etm6 funnel2 sink_smb0 > + etm13 etm19 etm24 etm3 etm7 funnel3 > + $# ls -l /sys/bus/coresight/devices/funnel0/connections/ > + in:0 -> ../../../../system/cpu/cpu0/ARMHC500:00/etm0 > + in:1 -> ../../../../system/cpu/cpu1/ARMHC500:01/etm1 > + in:2 -> ../../../../system/cpu/cpu2/ARMHC500:02/etm2 > + in:3 -> ../../../../system/cpu/cpu3/ARMHC500:03/etm3 > + nr_links > + out:0 -> ../../../HISI0391:00/HISI03A1:00/sink_smb0 > + $# ls -l /sys/bus/coresight/devices/sink_smb0/connections/ > + in:101 -> ../../../../ARMHC9FE:05/funnel5 > + in:114 -> ../../../../ARMHC9FE:07/funnel7 > + in:121 -> ../../../../ARMHC9FE:03/funnel3 > + in:39 -> ../../../../ARMHC9FE:00/funnel0 > + in:51 -> ../../../../ARMHC9FE:04/funnel4 > + in:61 -> ../../../../ARMHC9FE:06/funnel6 > + in:68 -> ../../../../ARMHC9FE:02/funnel2 > + in:89 -> ../../../../ARMHC9FE:01/funnel1 > + nr_links > + > +How to use the Embedded Analytics trace module > +----------------------------------------------- > + > +There are two ways to use the Embedded Analytics trace module: > + > +1. interacting directly with the devices using the sysFS interface. > +2. using the perf cmd line tools. > + > +1) Using the sysFS interface: > + > +Before trace collection can start, a coresight sink needs to be identified. > +There is no limit on the amount of sinks (nor sources) that can be enabled at > +any given moment. As a generic operation, all device pertaining to the sink > +class will have an "active" entry in sysfs:: > + > + $# ls /sys/bus/coresight/devices/ > + etm0 etm14 etm2 etm25 etm30 etm8 funnel4 > + etm1 etm15 etm20 etm26 etm31 etm9 funnel5 > + etm10 etm16 etm21 etm27 etm4 funnel0 funnel6 > + etm11 etm17 etm22 etm28 etm5 funnel1 funnel7 > + etm12 etm18 etm23 etm29 etm6 funnel2 sink_smb0 > + etm13 etm19 etm24 etm3 etm7 funnel3 > + $# ls /sys/bus/coresight/devices/sink_smb0 > + connections enable_sink firmware_node power subsystem uevent > + $# echo 1 > /sys/bus/coresight/devices/sink_smb0/enable_sink > + $# cat /sys/bus/coresight/devices/sink_smb0/enable_sink > + 1 > + > +When start trace collection, etm devices corresponding to the enabled sink > +should be selected:: > + > + $# echo 1 > /sys/bus/coresight/devices/etm0/enable_source > + $# cat /sys/bus/coresight/devices/etm0/enable_source > + 1 > + $# cat /sys/bus/platform/devices/:00/com_status > + com-type : DOWN-ONLY > + service status : stopped > + interrupt status : 0x00000003 > + write point : 0x5437f400 <----- The write pointer is moving > + > +Trace collection is stopped the same way:: > + > + $# echo 0 > /sys/bus/coresight/devices/etm0/enable_source > + $# echo 0 > /sys/bus/coresight/devices/sink_smb0/enable_sink > + > +The content of the SMB buffer can be harvested directly from /dev:: > + > + $# dd if=/dev/sink_smb0 of=~/cstrace.bin > + 5233+0 records in > + 5233+0 records out > + 2679296 bytes (2.7 MB) copied, 0.0131708 s, 203 MB/s > + > + root:/sys/bus/coresight/devices# > + > +The file cstrace.bin can be decompressed using "ptm2human". > + > +2) Using perf framework: > + > +As SMB device has been registered with coresight framework, perf tool can be > +used to control Embedded Analytics trace collection, and the method is similar > +to using perf to do coresight trace collection. > + > +The only thing to note is, list of cpus should be correspond to the specified > +sink device. > + > +Example usage of perf:: > + > + $# ./perf list pmu > + cs_etm// [Kernel PMU event] > + $# ./perf record -e cs_etm/@sink_smb0/ -C 0 --per-thread sleep 2s > + [ perf record: Woken up 2 times to write data ] > + [ perf record: Captured and wrote 0.288 MB perf.data ] > + $# ./perf report This IP block works like any other sink device and as such I don't really see a need for this documentation - especially since it is mostly conveying the same information already present in coresight.rst. Thanks, Mathieu > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel