Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp717489rdb; Fri, 2 Feb 2024 01:34:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsPO6u8kDI5Y9fZZiqc5p1ohUbueVpkp/i5X1SKiUuIBVcRvZ/+KMSCh/x0642dcXcBjn/ X-Received: by 2002:a05:620a:394a:b0:783:f79f:440f with SMTP id qs10-20020a05620a394a00b00783f79f440fmr6016144qkn.55.1706866455435; Fri, 02 Feb 2024 01:34:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706866455; cv=pass; d=google.com; s=arc-20160816; b=Dqd9iPHdP0bOGBIo5hGiSNqPtRp0/eGAZ47RyfR5WYwgY6xBDyCuoy5HEJs9rlzM04 XKHUKqX/fazE6loP7no4jn9NBushykLSgzAt+cCd9+IoDkrgwEj7Fu6kChFQEMAJWiiW j0kdaP+4p6uNEJtW5bo2r+naEgZEJ/pLxS2ihVQ7y+HxQY5KtDDI7/O+QbX90F/HdnIU xLJdOZYhj+QNeq1hdHowXY/v15dYuuNjWxHmC/7L3oBh6QBZ57mxyEcAhABoO/T+SyzU U1hb4OFyJgNZgxNF+TfMWm6patHblAwDaCxaoKVllkdpCF9LDreO84l7zhNajFzQrozm jdAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=21eLVw0b3OBdDLuJGuE55w+11E0jpUkfx/WD472nR4A=; fh=Sohwqs99Zu9eNRvbpuAqdLHpOMbeAh4SRu/ewVB03tY=; b=Q6ClyRtAlXuz4itOJ/0f9nU+fm0BSIEXOG82RSxVRpiSpSaiWPPKBFtAJ2hrnzBY0t 1U2kuJ+bwAh/q66H+5s74435Z8aCx9OT46lcz/08V6A9veM50cr5E3m60R7SPoYxySMI NOZj1EbVW5ZHE4iGCHvhkMKpkuWD/ZwA+ZgJCwKiYIIQP0yaUkm+KsYT+oElagskFXeo Qqn/L+j+pz2RlG6tEXFmc3n88NRWDmiXLpeHzwqWiKBhE+WI8aaHQW6VKSfOas0SS6lk rjw326zZu5dv8gGh1fNm4XRU/My0+8p2qYvSWdRPtN4Q71WnJvT6ta3RwxtgRN3Lhqfa W6cw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CHLuHQ2H; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-49584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCX204bVUsiwAemCnor6oa7uC0fyVwSO3KsoGaW79c/VoYiKN7d9e0Kv8BIpL1cmzaZCDAavFgDxQ5fF9G1BwS1XsLRXim7yo8kd9jhLbg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v20-20020a05620a091400b007832f29a421si1527670qkv.361.2024.02.02.01.34.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 01:34:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CHLuHQ2H; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-49584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 25E591C2543B for ; Fri, 2 Feb 2024 09:34:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED34277F3C; Fri, 2 Feb 2024 09:33:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="CHLuHQ2H" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9688A5FDC7; Fri, 2 Feb 2024 09:33:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706866424; cv=none; b=XdR8H4qvKbCE0sS+otH5J388HvR4WDZAEEL1dbECt7SOBM+aQCpw3dZR+xCpg/Xt5OyiXqylbXAYmzrgmK3RXyQp2OEcA/c1psX30KySigHGxG8FzJ0lgbrWJorHSGhgzjtqmWiNugHMHCU3D0TVBUCX/hXHL1acEP1c7WIZkos= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706866424; c=relaxed/simple; bh=A4C0/xN0BwGx14Fo5yv+iobyB3/ptjFpAlY+mwkb0qo=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=PVef0R7OkI5VW6Mv4MOt8M/ZSXkpCU3MMFqcdLWY5TYgZQskBun11MGauVX5l75O9Y5rbeEo7L/xXfqcFLP23zTghaoPNKheF1xfAw+cjfn205RMEMdJ+LQfuqD7gBfTuWRAbvlMnqvTwIf6VuObgFi04Z2FIs164+456vLQyBc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=CHLuHQ2H; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4129JXLh012731; Fri, 2 Feb 2024 09:33:16 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 :content-transfer-encoding; s=qcppdkim1; bh=21eLVw0b3OBdDLuJGuE5 5w+11E0jpUkfx/WD472nR4A=; b=CHLuHQ2HAfLtuUZhwA1FPiL0o7ieM+T2SaWY WfMTk3y+jIw/fO/uL614729/tpRSjbmyypQRIPSmdPamrZXafia7tAlY1kyiR1mb Stp5o723XDr6Y++QBp3d/7ZGEchy8Gpij8LVq89wpBTjiBJ7kyGvqUG/vhE78LgM pWAU/K7W2AVDMu4JrIMYDNIwJJ+6tmyfcV+jkg2pDoq4IQ70OC2TBYY2UfdIPfSc x+dqMD1lfSgwp7yuHStgxWkuh0bkQAbrMagT3M/CUEUVzGWT8sx8BVYcBI31f/Va kX5nzUcUa3ox8aK5m3Z5wjdPW051X8wfwEyOR/4NeiuhbCRfEA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w0ptyh0sb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Feb 2024 09:33:16 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4129XF8W011377 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Feb 2024 09:33:15 GMT Received: from taozha-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 2 Feb 2024 01:33:10 -0800 From: Tao Zhang To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski CC: Tao Zhang , Jinlong Mao , Leo Yan , Greg Kroah-Hartman , , , , , Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Song Chai , , Subject: [PATCH v6 00/10] Add support to configure TPDM CMB subunit Date: Fri, 2 Feb 2024 17:32:34 +0800 Message-ID: <1706866364-19861-1-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 3lnHmW6JnCgL10kO9L1vyCAvxIsnS9LO X-Proofpoint-GUID: 3lnHmW6JnCgL10kO9L1vyCAvxIsnS9LO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-02_04,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 suspectscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402020069 Introduction of TPDM CMB(Continuous Multi Bit) subunit CMB subunit is responsible for creating a dataset element, and is also optionally responsible for packing it to fit multiple elements on a single ATB transfer if possible in the configuration. The TPDM Core Datapath requests timestamps be stored by the TPDA and then delivering ATB sized data (depending on ATB width and element size, this could be smaller or larger than a dataset element) to the ATB Mast FSM. The CMB makes trace elements in two modes. In ?continuous? mode, every valid data cycle creates an element. In ?trace on change? mode, when valid data changes on the bus, a trace element is created. In continuous mode, all cycles where this condition is true create trace elements. In trace on change mode, a data element is only when the previously sampled input is different from the current sampled input. The CMB subunit must be configured prior to enablement. This series adds support for TPDM to configure the configure CMB subunit. Once this series patches are applied properly, the new tpdm nodes for should be observed at the tpdm path /sys/bus/coresight/devices/tpdm* which supports CMB subunit. e.g. root@qemuarm64:/sys/devices/platform/soc@0/684c000.tpdm/tpdm0# ls -l -rw-r--r-- 1 root root 4096 Jan 1 00:00 cmb_mode drwxr-xr-x 2 root root 0 Jan 1 00:00 cmb_msr drwxr-xr-x 2 root root 0 Jan 1 00:00 cmb_patt drwxr-xr-x 2 root root 0 Jan 1 00:00 cmb_trig_patt -rw-r--r-- 1 root root 4096 Jan 1 00:00 cmb_trig_ts -rw-r--r-- 1 root root 4096 Jan 1 00:00 cmb_ts_all drwxr-xr-x 2 root root 0 Jan 1 00:00 connections drwxr-xr-x 2 root root 0 Jan 1 00:00 dsb_edge drwxr-xr-x 2 root root 0 Jan 1 00:00 dsb_msr drwxr-xr-x 2 root root 0 Jan 1 00:00 dsb_patt drwxr-xr-x 2 root root 0 Jan 1 00:00 dsb_trig_patt -rw-r--r-- 1 root root 4096 Jan 1 00:00 enable_source --w------- 1 root root 4096 Jan 1 00:00 integration_test drwxr-xr-x 2 root root 0 Ja? 1 00:00 power --w------- 1 root root 4096 Jan 1 00:00 reset_dataset lrwxrwxrwx 1 root root 0 Apr 5 2021 subsystem -> ../../../../../bus/coresight -rw-r--r-- 1 root root 4096 Apr 5 2021 uevent -r--r--r-- 1 root root 4096 Jan 1 00:00 waiting_for_supplier We can use the commands are similar to the below to configure the TPDMs which support CMB subunit. Enable coresight sink first. echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink echo 1 > /sys/bus/coresight/devices/tpdm0/reset_dataset echo 1 > /sys/bus/coresight/devices/tpdm0/cmb_mode echo 1 > /sys/bus/coresight/devices/tpdm0/cmb_patt/enable_ts echo 0xFFFFFFFF > /sys/bus/coresight/devices/tpdm0/cmb_patt/tpmr0 echo 0 > /sys/bus/coresight/devices/tpdm0/cmb_trig_ts echo 0xFFFFFFFF > /sys/bus/coresight/devices/tpdm0/cmb_trig_patt/xpr1 echo 1 > /sys/bus/coresight/devices/tpdm0/enable_source codelinaro link: https://git.codelinaro.org/clo/linux-kernel/coresight/-/commits/tpdm-cmb-v6 Changes in V6: 1. Clear all the relevant fields before setting them in the function "tpda_set_element_size". In patch#5. -- Suzuki K Poulose 2. Leave a space after/before '/*' & '*/'. In patch#7 #8. -- Suzuki K Poulose Changes in V5: 1. Return directly to refine the process of "tpdm_enable_dsb" and "tpdm_disable_dsb" if the TPDM does not support DSB dataset. -- Suzuki K Poulose 2. Change the new property name from "qcom,cmb-element-size" to "qcom,cmb-element-bits". And update the property name to the new tpdm example which supports the CMB dataset. -- Krzysztof 3. Drop unnecessary () around the drvdata member access in patch#5. -- Suzuki K Poulose 4. Replace the error code "-EEXIST" with the port number in detecting multiple TPDMs on one input port. In patch#5. -- Suzuki K Poulose 5. Due to the modification of the new property name, the searched property name was changed from "qcom,cmb-element-size" to "qcom,cmb-element-bits". In patch#5. 6. Replace the judgement "tpdm_has_cmb_dataset(drvdata)" with "drvdata->cmb" in the function "tpdm_reset_datasets". In patch#6. -- Suzuki K Poulose 7. Drop unnecessary () around kstrtoul() in the function "cmb_mode_store". In patch#6. -- Suzuki K Poulose 8. Update the date and the kernel version in the Document. -- Suzuki K Poulose 9. Initialize the return value to "-EINVAL" and remove the unnecessary code in the function "enable_ts_show". In patch#8. -- Suzuki K Poulose 10. Replace spin lock/unlock with guard(spinlock). In patch#8. -- Suzuki K Poulose 11. Drop _rw from the macro "tpdm_patt_enable_ts_rw". In patch#8. -- Suzuki K Poulose Changes in V4: 1. Replace spin lock/unlock to avoid forgetting to unlock when the function exits. -- Suzuki K Poulose 2. Move the helper "tpdm_has_dsb_dataset" to the header file. -- Suzuki K Poulose 3. Fix the incorrect property of the sample in the documents. -- James Clark 4. Clear the dsb/cmb element size directly in the clear helper. -- Suzuki K Poulose 5. Correct the comment of "tpdm_read_element_size". -- Suzuki K Poulose 6. Call the helper "tpdm_has_dsb/cmb_dataset" in TPDA driver to check what dataset the TPDM supports. -- Suzuki K Poulose 7. Refine the dsb/cmb dataset support check in enable/disable functions. -- Suzuki K Poulose 8. Get rid of redundant code in function "set_cmb_tier". -- Suzuki K Poulose 9. Since one SysFs file should follow "one value", use "dev_ext_attribute" to instead of the previous "enable_ts" Sysfs file approach. -- Suzuki K Poulose 10. Change the kernel version to 6.9 for the MSR related SysFs file. -- James Clark 11. Refine the function "tpdm_simple_dataset_store". -- Suzuki K Poulose Changes in V3: 1. Add 8-bit support to the description in the TPDM devicetree document. -- Rob Herring 2. Change how the result is produced in "tpdm_read_element_size". -- James Clark 3. Calling "tpdm_clear_element_size" at the beginning of "tpda_enable_port". -- James Clark 4. Use "dsb_esize" and "cmb_esize" to determine whether multiple TPDMs are detected on a TPDA input port in "tpda_get_element_size". -- James Clark 5. Modify the judgment logic in "tpda_enable_port". -- James Clark 6. Add more description of "cmb_mode" to TPDM SysFS document. -- James Clark Changes in V2: 1. Optimizate and modify this patch series based on the patch series "Add support to configure TPDM CMB subunit". 2. Modify the functions that read the element size of DSB/CMB in TPDA driver. Tao Zhang (10): coresight-tpdm: Optimize the store function of tpdm simple dataset coresight-tpdm: Optimize the useage of tpdm_has_dsb_dataset dt-bindings: arm: qcom,coresight-tpdm: Add support for CMB element size coresight-tpdm: Add CMB dataset support coresight-tpda: Add support to configure CMB element coresight-tpdm: Add support to configure CMB coresight-tpdm: Add pattern registers support for CMB coresight-tpdm: Add timestamp control register support for the CMB dt-bindings: arm: qcom,coresight-tpdm: Add support for TPDM CMB MSR register coresight-tpdm: Add msr register support for CMB .../testing/sysfs-bus-coresight-devices-tpdm | 87 ++++ .../bindings/arm/qcom,coresight-tpdm.yaml | 35 ++ drivers/hwtracing/coresight/coresight-tpda.c | 125 +++-- drivers/hwtracing/coresight/coresight-tpda.h | 6 + drivers/hwtracing/coresight/coresight-tpdm.c | 455 ++++++++++++++++-- drivers/hwtracing/coresight/coresight-tpdm.h | 113 +++++ 6 files changed, 729 insertions(+), 92 deletions(-) -- 2.17.1