From patchwork Mon Nov 14 14:40:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mao Jinlong X-Patchwork-Id: 1611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2183400wru; Mon, 14 Nov 2022 06:44:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf56Ep4pyCUnPyP9NDFEUD6uT4Mj8Z/a2J/bY9l7jVQqZRdRZM5R8yDjw0s9qiSJ4QZ1I4hD X-Received: by 2002:a17:902:a508:b0:17f:7ed1:7da5 with SMTP id s8-20020a170902a50800b0017f7ed17da5mr14075078plq.101.1668437076110; Mon, 14 Nov 2022 06:44:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668437076; cv=none; d=google.com; s=arc-20160816; b=BV0D4ScXUx0r5KRfdZk0XGuGU38LVM6OlkLOa43fNff//9M+w5NNReR2Af1iL0uL2b /DLCrneHBNMjgCeXtb3D7ZZZb/6CHGv5K4/mCSLVGvEt59Z7k6aTqFeTlXjN+9hhlCDW DxG/niuT/iUL6Zt7hH5bTFJxNsc7So/wei0T6ekmHkQb271UJ+DhMH4vy9YZIWWXq1fD 6H6y7seDge6a0/EyrnKTEfdsMdcX66DJTWB+4c9zWreMlhYDEH0Y2PeFgxEYgqK+cJJh DUX3w1wBXtm/cuIbP+pOKw3s38GHo8gclZ1oy1HzM7SIykHsCoxOBlFXYSAnd0m0lah+ c0ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=7Sd5zn8zeXsyzei9F1nr7XxTnf+6sLmPm8zD+kQO6Ts=; b=VKqDxedC4gO2H8/qxthw0ilp8xTY6+fh6p0C56MzHakWgcTzjk/t+aXsOl3sswg1Pa QIBruAfVKKIuupqgV7HnRd69TIF2OIaC9gfI4qRL0KyTRgVznzgolh6r60GbKZ2h24od 6I8ZBQw+25T4nL6e1u/YnYTluWmZZAT5/RbJcZIiTd366D67glg4SRqbwx7nYmudVf5a P5QaNryJik0fC+ER0tQ4SE2va7FX4nFuTAo1UZcvsTO0/slfvDVuKBTl/hoyWuE8zZH6 1HgqgqMLaJ0revPEc6il9/W5vnou+oCSB2sFAiLkmjH1AZm/g2yv4OkVlJO2Tvcmqhrx aqRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jBIFY7Ck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr13-20020a17090b4b8d00b00213997a5fe6si11445022pjb.113.2022.11.14.06.44.21; Mon, 14 Nov 2022 06:44:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jBIFY7Ck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237149AbiKNOmA (ORCPT + 99 others); Mon, 14 Nov 2022 09:42:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237035AbiKNOlR (ORCPT ); Mon, 14 Nov 2022 09:41:17 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD222C67A; Mon, 14 Nov 2022 06:41:11 -0800 (PST) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AEEJPtQ032494; Mon, 14 Nov 2022 14:40:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=7Sd5zn8zeXsyzei9F1nr7XxTnf+6sLmPm8zD+kQO6Ts=; b=jBIFY7CkoMa57sXdtIGbJVB87xKcxNW8/HQiujWj+weNk0VjOJesc5GFqB7lmKM1bEAd 7fF1A8+Lcmwi36XaKx3Pt05NJrkTYBE6HPc5uBLW158c5IVV5AGOEcXqo7pH4W8s5LID ViAj1VyMtmTUBrWSgI+2jvEpjQqxkOl73vte7TmfVrwLezLNRFpvxSpMDIRqL8AjqK4P PYJ/aRSMI12Q1poRauFifvsUPfcAeE/ucTHRRyzQZ45wrSCsITVoiQZHfTBree8bHFDS moKHacjODQMHya+g7YmTDy7fUcX4suRTvbNwnOQ6p2pA1RkjROnbnyYExZOv3YUAUy1C 1Q== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kug7s98b8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Nov 2022 14:40:50 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2AEEenZu009543 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Nov 2022 14:40:49 GMT Received: from jinlmao-gv.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Mon, 14 Nov 2022 06:40:44 -0800 From: Mao Jinlong To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Konrad Dybcio , Mike Leach CC: Mao Jinlong , Leo Yan , "Greg Kroah-Hartman" , , , , Tingwei Zhang , Yuanfang Zhang , Tao Zhang , Trilok Soni , Hao Zhang , , Bjorn Andersson Subject: [PATCH v15 0/8] Coresight: Add support for TPDM and TPDA Date: Mon, 14 Nov 2022 22:40:19 +0800 Message-ID: <20221114144027.14365-1-quic_jinlmao@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: IhvlFOvR7v25HKc5SNA-4GGwXcbdV_iS X-Proofpoint-ORIG-GUID: IhvlFOvR7v25HKc5SNA-4GGwXcbdV_iS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-14_12,2022-11-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211140104 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749483075505763533?= X-GMAIL-MSGID: =?utf-8?q?1749483075505763533?= This series adds support for the trace performance monitoring and diagnostics hardware (TPDM and TPDA). It is composed of two major elements. a) Changes for original coresight framework to support for TPDM and TPDA. b) Add driver code for TPDM and TPDA. Introduction of changes for original coresight framework Support TPDM as new coresight source. Since only STM and ETM are supported as coresight source originally. TPDM is a newly added coresight source. We need to change the original way of saving coresight path to support more types source for coresight driver. The following patch is to add support more coresight sources. coresight: core: Use IDR for non-cpu bound sources' paths. Introduction of TPDM and TPDA TPDM - The trace performance monitoring and diagnostics monitor or TPDM in short serves as data collection component for various dataset types specified in the QPMDA(Qualcomm performance monitoring and diagnostics architecture) spec. The primary use case of the TPDM is to collect data from different data sources and send it to a TPDA for packetization, timestamping and funneling. Coresight: Add coresight TPDM source driver dt-bindings: arm: Adds CoreSight TPDM hardware definitions coresight-tpdm: Add DSB dataset support coresight-tpdm: Add integration test support TPDA - The trace performance monitoring and diagnostics aggregator or TPDA in short serves as an arbitration and packetization engine for the performance monitoring and diagnostics network as specified in the QPMDA (Qualcomm performance monitoring and diagnostics architecture) specification. The primary use case of the TPDA is to provide packetization, funneling and timestamping of Monitor data as specified in the QPMDA specification. The following patch is to add driver for TPDA. Coresight: Add TPDA link driver dt-bindings: arm: Adds CoreSight TPDA hardware definitions The last patch of this series is a device tree modification, which add the TPDM and TPDA configuration to device tree for validating. ARM: dts: msm: Add tpdm mm/prng for sm8250 Once this series patches are applied properly, the tpdm and tpda nodes should be observed at the coresight path /sys/bus/coresight/devices e.g. /sys/bus/coresight/devices # ls -l | grep tpd tpda0 -> ../../../devices/platform/soc@0/6004000.tpda/tpda0 tpdm0 -> ../../../devices/platform/soc@0/6c08000.mm.tpdm/tpdm0 We can use the commands are similar to the below to validate TPDMs. Enable coresight sink first. echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink echo 1 > /sys/bus/coresight/devices/tpdm0/enable_source echo 1 > /sys/bus/coresight/devices/tpdm0/integration_test echo 2 > /sys/bus/coresight/devices/tpdm0/integration_test The test data will be collected in the coresight sink which is enabled. If rwp register of the sink is keeping updating when do integration_test (by cat tmc_etf0/mgmt/rwp), it means there is data generated from TPDM to sink. There must be a tpda between tpdm and the sink. When there are some other trace event hw components in the same HW block with tpdm, tpdm and these hw components will connect to the coresight funnel. When there is only tpdm trace hw in the HW block, tpdm will connect to tpda directly. +---------------+ +-------------+ | tpdm@6c08000 | |tpdm@684C000 | +-------|-------+ +------|------+ | | +-------|-------+ | | funnel@6c0b000| | +-------|-------+ | | | +-------|-------+ | |funnel@6c2d000 | | +-------|-------+ | | | | +---------------+ | +----- tpda@6004000 -----------+ +-------|-------+ | +-------|-------+ |funnel@6005000 | +---------------+ This patch series depends on patch series: "[v5,00/14] coresight: Add new API to allocate trace source ID values" https://patchwork.kernel.org/project/linux-arm-kernel/cover/20221101163103.17921-1-mike.leach@linaro.org/ "arm64: dts: qcom: sm8250: Add coresight components" https://patchwork.kernel.org/project/linux-arm-msm/patch/20221114091251.13939-1-quic_jinlmao@quicinc.com/ Changes from V14: 1. coresight-tpda: Add more comments in trace id function. 2. qcom,coresight-tpdm.yaml: Add more comments in description. 3. Push "arm64: dts: qcom: sm8250: Add coresight components" out this series. Mao Jinlong (8): coresight: core: Use IDR for non-cpu bound sources' paths. Coresight: Add coresight TPDM source driver dt-bindings: arm: Adds CoreSight TPDM hardware coresight-tpdm: Add DSB dataset support coresight-tpdm: Add integration test support Coresight: Add TPDA link driver dt-bindings: arm: Adds CoreSight TPDA hardware definitions arm64: dts: qcom: sm8250: Add tpdm mm/prng .../testing/sysfs-bus-coresight-devices-tpdm | 13 + .../bindings/arm/qcom,coresight-tpda.yaml | 129 +++++++++ .../bindings/arm/qcom,coresight-tpdm.yaml | 93 +++++++ MAINTAINERS | 1 + arch/arm64/boot/dts/qcom/sm8250.dtsi | 173 ++++++++++++ drivers/hwtracing/coresight/Kconfig | 23 ++ drivers/hwtracing/coresight/Makefile | 2 + drivers/hwtracing/coresight/coresight-core.c | 42 ++- drivers/hwtracing/coresight/coresight-tpda.c | 211 ++++++++++++++ drivers/hwtracing/coresight/coresight-tpda.h | 35 +++ drivers/hwtracing/coresight/coresight-tpdm.c | 259 ++++++++++++++++++ drivers/hwtracing/coresight/coresight-tpdm.h | 62 +++++ include/linux/coresight.h | 1 + 13 files changed, 1032 insertions(+), 12 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml create mode 100644 drivers/hwtracing/coresight/coresight-tpda.c create mode 100644 drivers/hwtracing/coresight/coresight-tpda.h create mode 100644 drivers/hwtracing/coresight/coresight-tpdm.c create mode 100644 drivers/hwtracing/coresight/coresight-tpdm.h