From nobody Mon Feb 9 06:05:51 2026 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 7EB4531354F for ; Mon, 26 Jan 2026 07:48:39 +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=1769413720; cv=none; b=D1lq61/ikL4kLxWA1vTc7nMI5QQla0NU2CU9bXny5cO21flgmcgz5OjZN4EMn3B4HrfGrToF4c+Vr0Omg72B0FNoEusRi53ccVbo5/xbj2jP5FPcWdZe9iSIXN1NqXR7FTEDFSv1RI2lCWhn/rPElthuvCrSvFOogrYDuSDCAJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413720; c=relaxed/simple; bh=nzaF2yP3ATiqQC37LSxmXVL9MqWLOY4wwOUNTmvz/UA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ua4H9EvTIVTgzhGSjle35fGfN1+QT8jbq3+7DfHf55RPN9jPSAtl0cVvRrCQuD6JkZsgru14wH5TmvctHS8O4CkpAOhUwhf/hgrqbYI1pbUAOfFbodqVa5Fgj9qN8nrcT+qnfKcewxkK8YbIyLoGSbx5H+SBTkmPlpekKcEHa/A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=d/Yev7/c; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=czKFTNxO; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="d/Yev7/c"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="czKFTNxO" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60Q40lBh1361526 for ; Mon, 26 Jan 2026 07:48:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= V/JNJXfM7FDohbLniT/dm0wA/+qShrtEurl8w70+rXY=; b=d/Yev7/cZxugBpeD 9l2PwbnzFBbmG9ZLhBNgadDdH10geyFaOaaA3puQgI6ldvBa5XTtKrHUwL+yAcp6 3wsVUYsLTeLNPJebWQ0Bzj5HZGcE9u8fEw2uKRN7NPFbcCg3y8WOFfox15d+eC8y xmBE0+b1pE+Xzx4CRriZUjIJY0oJHgL250B2BBjKUtz2Mzy2yLpYCF8lvhOj56om daYTpSZa7whHC2BG+UD3IqIDn6/nkzwhnozBbj06uHdudayUURJYQgySFM+xSgI4 viJBH6BDDwkvfGzXoiC3TgOD6BefHXtXNi+V/NqDhNbT6abzXKFotrXh388T3DAN 24YyKA== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bx0v30ed9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 07:48:38 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-81f8c209cfbso2158972b3a.2 for ; Sun, 25 Jan 2026 23:48:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769413718; x=1770018518; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=V/JNJXfM7FDohbLniT/dm0wA/+qShrtEurl8w70+rXY=; b=czKFTNxOFSHOo8HVglEaCw5uB13rswrlxmiISk/ThlgUNH2UrTItH/yxFKfLS7LDnV xux+oaTUydtQaX/+FVAiYG1p4F3uHfP2k733/HfexsbbVddbz3Tgg8xRld9QHGNRyzy0 WclPgpAWtMapYfQwJYC/2UmXNinClhnjGtxbix/EWzix/5yi4t6favIM+P+caKwRW29W EtuhU1vqw9o+8nGxGqie4mdH6OmYpHHwq1M22epa1ft/l7ueA2+IPLogwhOMZrhwWga/ 0lZqa5ZxOM8gEfPA/pnoptO0qK8DHvo5K0pEfL6WgVXqQoObTxiyvlEC22SRJpCS1vdP FE3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769413718; x=1770018518; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=V/JNJXfM7FDohbLniT/dm0wA/+qShrtEurl8w70+rXY=; b=T3VQOLyy3hDggILzZ7oiUiZ0jq5Hsg3B50lv63aOZ9Wcyr2RpXA1NbovbAis8/NoGt afZ3JT1bq6Fb4SFhwygfQFoPYANrjsD8iWlPmhNdyQsBIgUIhBxGnejUK6pJCdZN4dRa dMCpgQZsQd/9+5ZLqiE1rymr4q/5f086rvGMswu23ch67JFmPuj/+MIDGSzzlrFDUkzV 7TEx/f7ulU4pC/C1dXV9hXBJH1k6s/8cJTUPhPL3BrbLcgvXOFd9+tDpK1ImDjP6GHrG Usmm4DwmmzJFFQMN3Ts56uOhYMAluC4KViQzWQ2jVIu7tMJGviVoRZy/V/NSPlSwdS8p s3vg== X-Forwarded-Encrypted: i=1; AJvYcCXXgpnMAGfC1fmCsfxTai8ADbm8oBIjREbHMQ+1CC+oZDxEBi1/TUWUR1kt4kBChiFT40BzTQhtWK7lIds=@vger.kernel.org X-Gm-Message-State: AOJu0YwKdf9sW01Ljp7jkbo80VxnOSek851zNEMoqzikkA6BEKAHLznW N7B6DAJwylZEm76DKyRCcDenf0J75RkvWaKdzSzDl8KUzkQvIp2xs8GLLLNUlMgUPItWdUDROJI xr//rBICRl1J+nlraZ3Y5efLI0WmSg7CW2GTLfzDGiBK+Kw7ZECcJw+H3CJyUSwB0TAA= X-Gm-Gg: AZuq6aL8sdq2MpA+zBJNN/xvbMnYb56LP8HlIo5JMZdaFQAT26wHPWceAkANRGxMGHy QoyIAwx36zx+3KOgOfUbt3tTV3qa6zNEzWGPqxhLppeOya72zennTPudoCYsz4s2J9dt0DBCuzt VGVmJot4ohIKfjGK7K3GSecWtWHBXAbzGB5yiHk+/h6W81ZM5Na2a9AkKlMy2LGmAGUUCxBbqHS gdphRf7IPCPAECpjOBx2r0J3ILq5qpwdzMLu6V8MLD8hGZKCYJO1lOS/dPCmBJgh4d9E8HXHPSh F/HU/lmwxuXGXur2p8dGJYiRPz2mOqUexCSHcKHVdggzEY2rN9b+wxMVoh6A6QDBrdpHPRlxWOW Qvs6kizafI9+/4dRNXnkmSYWw287yxKmoCD/GwsEXxSNXoi3ZWjkPegchDNghtqCs5ugFJ+qGi5 Bx X-Received: by 2002:a05:6a00:1390:b0:81f:d605:9c9c with SMTP id d2e1a72fcca58-823411dab8fmr3255316b3a.11.1769413718106; Sun, 25 Jan 2026 23:48:38 -0800 (PST) X-Received: by 2002:a05:6a00:1390:b0:81f:d605:9c9c with SMTP id d2e1a72fcca58-823411dab8fmr3255298b3a.11.1769413717635; Sun, 25 Jan 2026 23:48:37 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8234fd9a5a7sm1223418b3a.63.2026.01.25.23.48.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 23:48:37 -0800 (PST) From: Jie Gan Date: Mon, 26 Jan 2026 15:47:53 +0800 Subject: [PATCH v11 1/8] coresight: core: Refactoring ctcu_get_active_port and make it generic 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: quoted-printable Message-Id: <20260126-enable-byte-cntr-for-ctcu-v11-1-c0af66ba15cf@oss.qualcomm.com> References: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> In-Reply-To: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Mike Leach X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769413705; l=3771; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=nzaF2yP3ATiqQC37LSxmXVL9MqWLOY4wwOUNTmvz/UA=; b=QeNbIgWPyFTfJk6iiSTrgbTwJU7oQXHAfz8GJngUGE8I+62rS3Ry99tFlTq72CFoIJnUMEUWn fp1jRqH4RBnBIyft11AyYgm6eQ0pe8pAFdmlSi1v9yz/z2yUYLsxanu X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDA2NiBTYWx0ZWRfX78YeHQcScPeG xzLtp+mJaOGf6YSf040XcZplDAS4kEQeWk3F90cbNtOpdgYija08vDIc9R87jhQUFSPkmt5Aid/ AhImBPppdgfLanSbmpkbtCZ6hPfkbb2beXwHVbmVTpm8/8ZQUl3lbp1m3zOTZqwNk/guCC80Wx9 tZDxblSjPhLE1pH/5cvTUC6+YAEyMhiXbkrwinswV8Cujbw/IuICcBHuf1mFcmECynv6sHnbz4E 7Hwnt2/QhlikDHkkQrSsN6JcmPCh37zm1d/oPkoZmKdqsjTvF+slKO7T1Kn3mKd0S75I3HGghRq J1/D5hPSgpZY6IQtrVm0LXR2Rpu8VhnAxI4oRjUhjDW7odNRAYJZY4Ma5p2UQGx9UFMQO8iQbbc ie87iQzf927sz1LfbfdRxGrC7x5/hIg4X6HxnFpCoN+1v1DMdvPggfTJu2WPcmlyUcdFFoILKC+ 993o1MUk97NIQXEc3zw== X-Proofpoint-GUID: QdnJz5u16kFaczEcbMd9drA1eObLcwAK X-Proofpoint-ORIG-GUID: QdnJz5u16kFaczEcbMd9drA1eObLcwAK X-Authority-Analysis: v=2.4 cv=JYyxbEKV c=1 sm=1 tr=0 ts=69771c56 cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=qQZ2XtAyJf2dEkEvaVsA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_02,2026-01-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 clxscore=1015 impostorscore=0 phishscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260066 Remove ctcu_get_active_port from CTCU module and add it to the core framework. The port number is crucial for the CTCU device to identify which ETR it serves. With the port number we can correctly get required parameters of the CTCU device in TMC module. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-core.c | 24 +++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-ctcu-core.c | 19 +----------------- drivers/hwtracing/coresight/coresight-priv.h | 2 ++ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index c660cf8adb1c..5f55f0c510e4 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -585,6 +585,30 @@ struct coresight_device *coresight_get_sink(struct cor= esight_path *path) } EXPORT_SYMBOL_GPL(coresight_get_sink); =20 +/** + * coresight_get_in_port: Find the input port number at @remote where the = @csdev + * device is connected to. + * + * @csdev: csdev of the device. + * @remote: csdev of the remote device which is connected to @csdev. + * + * Return: port number upon success or -EINVAL for fail. + */ +int coresight_get_in_port(struct coresight_device *csdev, + struct coresight_device *remote) +{ + struct coresight_platform_data *pdata =3D remote->pdata; + int i; + + for (i =3D 0; i < pdata->nr_inconns; ++i) { + if (pdata->in_conns[i]->src_dev =3D=3D csdev) + return pdata->in_conns[i]->dest_port; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(coresight_get_in_port); + u32 coresight_get_sink_id(struct coresight_device *csdev) { if (!csdev->ea) diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hw= tracing/coresight/coresight-ctcu-core.c index abed15eb72b4..78be783b3cb2 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c @@ -118,23 +118,6 @@ static int __ctcu_set_etr_traceid(struct coresight_dev= ice *csdev, u8 traceid, in return 0; } =20 -/* - * Searching the sink device from helper's view in case there are multiple= helper devices - * connected to the sink device. - */ -static int ctcu_get_active_port(struct coresight_device *sink, struct core= sight_device *helper) -{ - struct coresight_platform_data *pdata =3D helper->pdata; - int i; - - for (i =3D 0; i < pdata->nr_inconns; ++i) { - if (pdata->in_conns[i]->src_dev =3D=3D sink) - return pdata->in_conns[i]->dest_port; - } - - return -EINVAL; -} - static int ctcu_set_etr_traceid(struct coresight_device *csdev, struct cor= esight_path *path, bool enable) { @@ -147,7 +130,7 @@ static int ctcu_set_etr_traceid(struct coresight_device= *csdev, struct coresight return -EINVAL; } =20 - port_num =3D ctcu_get_active_port(sink, csdev); + port_num =3D coresight_get_in_port(sink, csdev); if (port_num < 0) return -EINVAL; =20 diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtraci= ng/coresight/coresight-priv.h index fd896ac07942..cbf80b83e5ce 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -155,6 +155,8 @@ void coresight_remove_links(struct coresight_device *or= ig, u32 coresight_get_sink_id(struct coresight_device *csdev); void coresight_path_assign_trace_id(struct coresight_path *path, enum cs_mode mode); +int coresight_get_in_port(struct coresight_device *csdev, + struct coresight_device *remote); =20 #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) int etm_readl_cp14(u32 off, unsigned int *val); --=20 2.34.1 From nobody Mon Feb 9 06:05:51 2026 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 8130430EF96 for ; Mon, 26 Jan 2026 07:48:45 +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=1769413726; cv=none; b=nPlW51Rchmteu9596uWPdcPZZm+/QHDfl8cAHp8tR90kvBCmJFLr0lgmX4BILRxFLFV5f+8OxR4xfSshRC7sXZwBniHNG2D3J1jQR/eTIFXyNWUEjx4iKlReAado3coF+rShUzx/AUDzirAqwTpHvx+t5am/Z1UuRM7fF5XmtFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413726; c=relaxed/simple; bh=iOBlKE7wcNNqdQg697EHs/307n7EmzHjJxd5G5rMLIU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NLboEs6gzrErgJIn2j1L2DDdYlYtmxf6j2QNqnmgc+8kXHObXYCRkuc6iJTCPV+5JQmvofnvREC8Dn+KuBv546TFN+34A8ozrxR81wCrmkGW2L6KD0CHPxlSK47SXR3wZmGcdDw4htloBmXDGvnSV849NPtMo/ZlwuXcvikwMXU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=bhd012yn; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=hFOi9W05; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="bhd012yn"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="hFOi9W05" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60Q7Rofi193629 for ; Mon, 26 Jan 2026 07:48:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=bhd012ynFFUsIiZ7 hUldVPgyTc9JXLZcVbVAJjrszmwTXRySM/0XxmeDq1hxIEpcQb8zuWjCXul9Gxkp 8k6m1m1H796IzkBN0VVgCiclhxz5gV4p5fTci9bBDg18haTMJGruyByGC08aSJDj YOxB4pxwMn/+9E6/hH3y+RNbJJnaPV7bNcB/fMkHMlQqpg4l9bxJAQTPzl/IIEPJ 1BoMpUfgL6nzY57mCYL51xK+4FRoY3wsg8uAAaOPW8ZY2pHpU8JaxKBRAFjCi+4h tVmTNsGl86F8TQWmKhDSsGlut9Pc0ROCmgZuh5ItiSYS8KjUOl3tvDfpTNRokTKo BacvJg== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bvq9f3s2m-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 07:48:44 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-c6136af8e06so2388706a12.1 for ; Sun, 25 Jan 2026 23:48:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769413724; x=1770018524; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=hFOi9W05m1B21wJzUN0raufFmyd5vBxUl+oem8BmDGn2WDGlCxMNECp0SNi7rHCYpX P6VcfX6F2zf9l+iB/LkqbOBoUIKmPVchlT1HdL0+wXECyRfv/KxQzJuQbQPQjgRhmRZP c2HYCzyjF4FqtL63lMXqtWGtplUyqNtnkUaYLTgsVQ3UPNLQ+fd6Dmchmvf0vyDY6oA0 9u+4jpFB7F2TZpL+60YmifKkhbChAqiuKK5vxwjzCGIm1lxFBeUuJyqa+eeypPsMHyXe PThLpGIRqPhqCDuvQOCsvvdvmL61QyO+WquLgANhB7Yq3w+LXycQch2bSaQksVbYG+sN VPLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769413724; x=1770018524; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=OrzVrLcaixzVQHrJ5YtdMWhRSMqSOjTo3rT3ixcIjYeiMAZXE1fSRrSIzYL+Mwwwni aBcBBJ1hA1Yk+0nV1pJXiyze17GxvhHcqnN88BMbUw5bq8zzN8I9HDzBW6/3oswDfua3 6UYGRNveaByymPv6B/qkwBfK4IRYySwSPN+qoVZRwDWi2qlng+cOtITL6MGQ3HPiztuX kObVuZgt9lI7kBp2ORPrMxpV2ecG12Ns4kIPEIVvRlCWZWmXkdU4ydcz+1XOPt84+2ML 7PAY0CTZZgt3ojrLuxnxm6Y1bCKK20TV0gn7aug8mzb/W4fOAUtGbfBa+EvQWFX7vuCf 5RPA== X-Forwarded-Encrypted: i=1; AJvYcCVo/ZO/6FYQqLJlk8Dg/T6SnfHNv8OjcwleSi6wZ30dhfvLEc426XDsQcVQppxRodTbMNKhQbF0UmF0t3c=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8674WwNDlgiaS/VCHd9kM2PDHIkmE29jlc71XPwg80qOYLqmh qVD8Di7t2jsSF+z+tLvpXxPdwJUHh11qoUZZPljYuKXU10I+KKvsM/xm5FsrG9bU7FtjM/AXtnl NuoPQ3BxoOIob5lJjZ8WiMv6qgAl05T/sB3aB5j7/F/H7XIW7SQ8maczNgCw+vLqwOCw= X-Gm-Gg: AZuq6aIjAxtUDaQDzgECMDPHQfc9KS66vg+IMDj44PzjQXDoOEvTNfGMlX9JqZntph7 Krw+wJSl/oK6STwR8DD5uhyNSIAZUPT7zxjbt9n44uR5LK9ezn5kOMOX3decG+WioA0EGJ04jH0 OfoeUySN4lCsY4URigDojALbPUO1STjp+siOhZKkhQCoPlTnzCG81GMKUYRooweggOaWh3KH0Mv Wt7pjUCmfk/ryW92I9BRjfrUgw5BcK0kpHIYW2eL8herQQlXKxbKSF/4X/YmA7Jkna/A0dsFxuo XhCaGoZ6F6THCNM6a6L5BFyiiGNnRT5t0oELP9DcROGovOB2nMXaBeX7oicG3iU9fuCZLM0nUou ndKRr6MeDMXqnZZflbM/U5TB9VZiqhICM9eGSkh9+lZaI2LhSnj6Mv56i/RcMvK+F7yKD2exRsV nb X-Received: by 2002:a05:6a00:3e02:b0:81f:4999:ae46 with SMTP id d2e1a72fcca58-823412be9afmr3126541b3a.48.1769413724053; Sun, 25 Jan 2026 23:48:44 -0800 (PST) X-Received: by 2002:a05:6a00:3e02:b0:81f:4999:ae46 with SMTP id d2e1a72fcca58-823412be9afmr3126506b3a.48.1769413723357; Sun, 25 Jan 2026 23:48:43 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8234fd9a5a7sm1223418b3a.63.2026.01.25.23.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 23:48:42 -0800 (PST) From: Jie Gan Date: Mon, 26 Jan 2026 15:47:54 +0800 Subject: [PATCH v11 2/8] coresight: tmc: add create/clean functions for etr_buf_list 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: quoted-printable Message-Id: <20260126-enable-byte-cntr-for-ctcu-v11-2-c0af66ba15cf@oss.qualcomm.com> References: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> In-Reply-To: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Mike Leach X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769413705; l=6192; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=iOBlKE7wcNNqdQg697EHs/307n7EmzHjJxd5G5rMLIU=; b=ru4rBEls9TKgFexG6YSC8o9GwR+E4SQnSYPxvf6VcG/iS6eyoEXXLZhgwyRXMkXb125QZPGn9 aHQY+jERHp8BxfLZ/nFr4OGARDp8ZygOuKu0thZkz2N8lCOlOxxrhqy X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=YLGSCBGx c=1 sm=1 tr=0 ts=69771c5c cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=AScg1gZdVb1XvqdcXssA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: wRuCN_CWoeOTAAusqiPOxLfIFjkK8E3f X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDA2NiBTYWx0ZWRfX7/SkuLXQ8TEu q2f2Q2F23uDfqDhC5ArGtJLfTBiohG7Ro4LhVL4vqSs24S9UsHJ3A7EOFCk63j+zCIQDrqf1gth RezRNpksVwTi8qGDklGu+QkWUrRfQ+rSs4lHHcMvgZxZm6xOpby6SjmcYr56liMJTv8adi54eCW ASLaPpFPD6CzMHm2d9EhMmZSUTnAckIy8LK4dU1RvQ3pw42/7PL8VodrU8/fV22WbXMl4Cd23AJ DAgTKmclaoYa+kTmCSV1dnsyPAIwaYopAONEYoCfTRMN0DE7WjKPxZYsZ5XneMBEjKaK/VF3kxR YpkSYKTtUPz2oAqkrRT/RUmy0cu4ic96jrgonG1iVrBMxtI+YcIetMv2RtAH8H4bRXwhfiCWKDB NjbGQgflJp94QFDaN0i021FmHIKK5CGN9eruSFiwW55XeAXu5vKeyR5StaarKCTnGboug4sOTqd 2b59TFiKDI8LMYZEYGQ== X-Proofpoint-ORIG-GUID: wRuCN_CWoeOTAAusqiPOxLfIFjkK8E3f X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_02,2026-01-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 phishscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260066 Introduce functions for creating and inserting or removing the etr_buf_node to/from the etr_buf_list. The byte-cntr functionality requires two etr_buf to receive trace data. The active etr_buf collects the trace data from source device, while the byte-cntr reading function accesses the deactivated etr_buf after is has been filled and synced, transferring data to the userspace. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 1 + drivers/hwtracing/coresight/coresight-tmc-etr.c | 94 ++++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-tmc.h | 19 +++++ 3 files changed, 114 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 36599c431be6..1ea255ffa67c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -840,6 +840,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list =3D &etr_devs; + INIT_LIST_HEAD(&drvdata->etr_buf_list); break; case TMC_CONFIG_TYPE_ETF: desc.groups =3D coresight_etf_groups; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index e0d83ee01b77..cbbb15648fb7 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1919,6 +1919,100 @@ const struct coresight_ops tmc_etr_cs_ops =3D { .panic_ops =3D &tmc_etr_sync_ops, }; =20 +/** + * tmc_clean_etr_buf_list - clean the etr_buf_list. + * @drvdata: driver data of the TMC device. + * + * Remove the allocated node from the list and free the extra buffer. + */ +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata) +{ + struct etr_buf_node *nd, *next; + + list_for_each_entry_safe(nd, next, &drvdata->etr_buf_list, node) { + if (nd->sysfs_buf =3D=3D drvdata->sysfs_buf) { + if (coresight_get_mode(drvdata->csdev) =3D=3D CS_MODE_DISABLED) { + drvdata->sysfs_buf =3D NULL; + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + } + list_del(&nd->node); + kfree(nd); + } else { + /* Free allocated buffers which are not utilized by ETR */ + list_del(&nd->node); + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + kfree(nd); + } + } +} +EXPORT_SYMBOL_GPL(tmc_clean_etr_buf_list); + +/** + * tmc_create_etr_buf_list - create a list to manage the etr_buf_node. + * @drvdata: driver data of the TMC device. + * @num_nodes: number of nodes want to create with the list. + * + * Return 0 upon success and return the error number if fail. + */ +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes) +{ + struct etr_buf_node *new_node; + struct etr_buf *sysfs_buf; + int i =3D 0, ret =3D 0; + + /* We dont need a list if there is only one node */ + if (num_nodes < 2) + return -EINVAL; + + /* We expect that sysfs_buf in drvdata has already been allocated. */ + if (drvdata->sysfs_buf) { + /* Directly insert the allocated sysfs_buf into the list first */ + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) + return PTR_ERR(new_node); + + new_node->sysfs_buf =3D drvdata->sysfs_buf; + new_node->is_free =3D false; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + while (i < num_nodes) { + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) { + ret =3D PTR_ERR(new_node); + break; + } + + sysfs_buf =3D tmc_alloc_etr_buf(drvdata, drvdata->size, 0, cpu_to_node(0= ), NULL); + if (IS_ERR(sysfs_buf)) { + kfree(new_node); + ret =3D PTR_ERR(sysfs_buf); + break; + } + + /* We dont have a available sysfs_buf in drvdata, setup one */ + if (!drvdata->sysfs_buf) { + drvdata->sysfs_buf =3D sysfs_buf; + new_node->is_free =3D false; + } else + new_node->is_free =3D true; + + new_node->sysfs_buf =3D sysfs_buf; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + /* Clean the list if there is an error */ + if (ret) + tmc_clean_etr_buf_list(drvdata); + + return ret; +} +EXPORT_SYMBOL_GPL(tmc_create_etr_buf_list); + int tmc_read_prepare_etr(struct tmc_drvdata *drvdata) { int ret =3D 0; diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 95473d131032..9b3c4e6f0a5e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -208,6 +208,19 @@ struct tmc_resrv_buf { s64 len; }; =20 +/** + * @sysfs_buf: Allocated sysfs_buf. + * @is_free: Indicates whether the buffer is free to choose. + * @pos: Position of the buffer. + * @node: Node in etr_buf_list. + */ +struct etr_buf_node { + struct etr_buf *sysfs_buf; + bool is_free; + loff_t pos; + struct list_head node; +}; + /** * struct tmc_drvdata - specifics associated to an TMC component * @atclk: optional clock for the core parts of the TMC. @@ -243,6 +256,8 @@ struct tmc_resrv_buf { * (after crash) by default. * @crash_mdata: Reserved memory for storing tmc crash metadata. * Used by ETR/ETF. + * @etr_buf_list: List that is used to manage allocated etr_buf. + * @reading_node: Available buffer_node for byte-cntr reading. */ struct tmc_drvdata { struct clk *atclk; @@ -273,6 +288,8 @@ struct tmc_drvdata { struct etr_buf *perf_buf; struct tmc_resrv_buf resrv_buf; struct tmc_resrv_buf crash_mdata; + struct list_head etr_buf_list; + struct etr_buf_node *reading_node; }; =20 struct etr_buf_operations { @@ -445,5 +462,7 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, enum cs_mode mode, struct coresight_path *path); extern const struct attribute_group coresight_etr_group; +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); =20 #endif --=20 2.34.1 From nobody Mon Feb 9 06:05:51 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 4FC07313E19 for ; Mon, 26 Jan 2026 07:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413732; cv=none; b=IeiQdxlp90q+2rnzOvpOwNXkMjcOjn1Cvod+/JvFlqt0MiaUpNBfrjnSUB1Df3jEv570y9msVfNjjd1k0bXnQ9KQIZh1QNycl3eBwH/Swe5iUdhQicnA75lOiPaOLEnTIhhsz/D+LBb/e0spzZXZIKWru9WPSKjccpk0FhIA4Hk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413732; c=relaxed/simple; bh=CwCT5/x9boKhb1Ajkz+foUdUOzmm0/q81QDotkFpGzA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n8uRfFe+an3SCZ43+Z7w03FLTqcNUE1XuPLYg35QqQaaE/buccWlUCp8a1S7OPksLoRcAzgMdVh9x/c+OsY1dYbqWQ+Tocvtc1LSv4yEnnFINlBZ0lrODvA2/LN5PlptpQlztFqeZnNbdCTeshSzvEEKnY7QMy+9f+hDuAjiyPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=n9e7xKdy; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IJdaXQF2; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="n9e7xKdy"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IJdaXQF2" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60PKNtZT354539 for ; Mon, 26 Jan 2026 07:48:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 51VyzH5MVWt5pCU+WtqPfgt9gr9jXVE/0KTTZNnKYmU=; b=n9e7xKdyqtsIO5rG F4lPB2ij4lSriSmuqoaPJzSerq7syILRisxT3UKxfXDEzC5afCP789G/fSDqFNNp gTdJBgXF1wRI9Pnr+UTUEPka+sceJqVShAzl3JzdAswghULQuH//3hdIkI2E0Nf7 5w2wVqhdWYKwcStLfTLtjEQQPNA22H0fnYcUelOmYq8s8e5M465hYafXbdA1/Vh1 m8x8f1mtRs1Ecna9+wv/dCLmNQOX8+uSI8Z8gXwY+PvC7BbDoLsr3YQcTnVIg36x piUO+cBvP+gcOewQ5EeDYg1QLkoicKhsQF50NK00TT3RSG254QsjXsojsZ0jMhn3 iERnmA== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bvq9qksmm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 07:48:50 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-8234ea73bdeso625688b3a.0 for ; Sun, 25 Jan 2026 23:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769413729; x=1770018529; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=51VyzH5MVWt5pCU+WtqPfgt9gr9jXVE/0KTTZNnKYmU=; b=IJdaXQF2CRE9nQKDdTYJ+dsGny5avJ2lOrD5B2UJptsthQQqWT7IwXUEh8fCqorqRy mmqddQVaIyHHgzyhHUxJe4yZ5IJya9VH6i9Lf5S0tspphxDbxiXAIpcl+s0m9OmhPOyz lAei1QoZ+n6o2hkSp5Hjl/FghmFpdTAa5PcxQqxeODljQLYvw7DhPXayyI8vG3Si2fto cSxEVBw1yW+TknH8RoBpRv7UA2pk/EWmZH6HeL5lAHyH5kMZoeR0ssmkIWTdczcyNOMQ luvsec1SysYX2QV+QxQao6FshLS+C7E11dlokeGepSOaiX8UDyVoaYezzMisWQLamfhx /prQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769413729; x=1770018529; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=51VyzH5MVWt5pCU+WtqPfgt9gr9jXVE/0KTTZNnKYmU=; b=SSvd/hSfWMf+VZK0SEVhA4fNX2NPR6yvUZ+I91jNPxA3Wua3pCH63Ucl/X/6O1LmmH AeIV9VQ1MpOHiQXu7RLJOAm4triT9B+f8fSS6n43I4dLB3MRmMRhm3/UpeHTrPBuhF2V lIapGKU0iZqkii3fyMTpeuPJqAC+Ds3m6MEBCPslzS6hon/g+C72aOpNnvmIHU9UqJG3 /Q5LuXJyNw8NqFvgGNXoFgDxKvCeCQbhp7hZF6xBvLeMBgijihfjTgviQKYKTyMKAnqO CQSzh2f6rc4+9QnjY82thCg1506ROBQQoN/fcK3BAahnHGYfYpDo3BpEQfB2O6QXt6Fd Q6dA== X-Forwarded-Encrypted: i=1; AJvYcCW/HWKK/lB1DDrA5kUugxiERw4mA4ABHQPnMM7oYQ2wSOU7ieXBe9Y625yrBjEYP4qSE81qVn9c9R+DLLc=@vger.kernel.org X-Gm-Message-State: AOJu0YyKal8kRBFhN7GJRXJBE2LYyaoUaX0QEceM/FbLBR9cKfEaTkCG mQIEF20DL8qXaNlIY9hxHFUa4JMfzEgS1Mm9sauRfOrsrAnOebPPz4qwMGq3xwjxLJB9WUrhs2z ojtjZ6ixvcUklR8ArpIy9PocWS/mtYTPomI/MkgfqIGPc4LYRZBsOyg/HkzU4nlpOwCk= X-Gm-Gg: AZuq6aLgTV874xOTdvSaSI2JEfdReWSFo1uuBHHeuW+7HNDHYq9kBOJ6qGoDNcHQNfV UgUIWNr6ZiILysXJop1vzQcrsaeh3W3ubf9d6h8oGMg1NIFOPZA3b16xIcblbaS32Rurh5uHBmE xvEgr7yb5aUaDuZ6lEKGXPO+TGetZYA2xFVXb3+09K3mPqYFU+ALHtVuFjvnGL0nFLg/Df03Vrc 5MnU55ADV+ER6i91ePtEHgHmqGaAMPP2Z4IDNYUDodzf5+acnZWMx0VAeaQxKFQb+DI/vvZeTZz xhHS2EK+Z5hC2G/BdKTPAgUS0ju6Qg9Vgr5lemS49peTJZ9ume9gdqnRNGNLjHezDzc4Q5RwmJ9 0JAf2RSoWBiA0XoRKgn0i0lexpU5WBQwtPYoHgsA56Nru30rmqZn/xgRy9c1FzLezdMAlRJT29O tJ X-Received: by 2002:a05:6a00:9284:b0:81f:de60:39b0 with SMTP id d2e1a72fcca58-823411da07dmr2830788b3a.13.1769413729084; Sun, 25 Jan 2026 23:48:49 -0800 (PST) X-Received: by 2002:a05:6a00:9284:b0:81f:de60:39b0 with SMTP id d2e1a72fcca58-823411da07dmr2830765b3a.13.1769413728607; Sun, 25 Jan 2026 23:48:48 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8234fd9a5a7sm1223418b3a.63.2026.01.25.23.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 23:48:48 -0800 (PST) From: Jie Gan Date: Mon, 26 Jan 2026 15:47:55 +0800 Subject: [PATCH v11 3/8] coresight: tmc: Introduce tmc_sysfs_ops to wrap sysfs read operations 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: quoted-printable Message-Id: <20260126-enable-byte-cntr-for-ctcu-v11-3-c0af66ba15cf@oss.qualcomm.com> References: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> In-Reply-To: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Mike Leach X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769413705; l=5212; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=CwCT5/x9boKhb1Ajkz+foUdUOzmm0/q81QDotkFpGzA=; b=Cl4fdo7nxRQLBIImPb2gA1ya8QZK0sZl7WyCD5lomXVdSWJdGJRffVnzjr6VcolRhx6x5UUn2 FRFHQSMSYPKBcaC84Macjr8SUm23SdXP0xXOEqDLRd0hp/VoYoJ9J3W X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: SjnO4uFdP4EHng7XureeE3vYrpuRdN3K X-Proofpoint-GUID: SjnO4uFdP4EHng7XureeE3vYrpuRdN3K X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDA2NiBTYWx0ZWRfX6xFXuBttfjpU he+KBUA8d6s7u7UDRhZrrSm5dcrBUzz4BUTdBUST7ETBaAOjAUM9DAhJdOgRpBs9bafNhnFzCrq 2H4UYfHJdbj6+mB+0CoAteU0lBxVpwjTBRsvD6Coqm0Osfkk2O+S8g2yJocEDDFRY1LyN0+wnTl F5C/EnlAgrfrAMgLs63QTRuIHD4uyXZKXRU/XNNDRG74FNiqqIR83h5Z0rKUmVUWhFNdgSpfZDc RQtcWF5Cuq5vy1+rJHe/HMxudcWYKZERiUY923rKPTnxAaazPsMHdIM9y6Ti3RadqEfPVBQmYNT oQX69CLu5W10MeReEYCtfrSS1WtWRBxAkHS6QQRM1uaTgwu42QjvUczXWKPvqZ7ZIMNlnv+5qHH QD3cuTgEoTXO6TWm11TGNWcz3uzgFZ+z8PZrNJhN764hk8K2hwjkOMKQTkZqOAeIvTJiPFkqUZA gM5Ai0Ivm4H3i8HoaNw== X-Authority-Analysis: v=2.4 cv=TsTrRTXh c=1 sm=1 tr=0 ts=69771c62 cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=ia3uihG--C1vaqsH_ucA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_02,2026-01-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 phishscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260066 Introduce tmc_sysfs_ops as a wrapper, wrap sysfs read operations, for readi= ng trace data from the TMC buffer. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 51 ++++++++++----------= ---- drivers/hwtracing/coresight/coresight-tmc.h | 15 +++++++ 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 1ea255ffa67c..32ca2ec994de 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -232,17 +232,10 @@ static int tmc_read_prepare(struct tmc_drvdata *drvda= ta) { int ret =3D 0; =20 - switch (drvdata->config_type) { - case TMC_CONFIG_TYPE_ETB: - case TMC_CONFIG_TYPE_ETF: - ret =3D tmc_read_prepare_etb(drvdata); - break; - case TMC_CONFIG_TYPE_ETR: - ret =3D tmc_read_prepare_etr(drvdata); - break; - default: + if (drvdata->sysfs_ops) + ret =3D drvdata->sysfs_ops->read_prepare(drvdata); + else ret =3D -EINVAL; - } =20 if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read start\n"); @@ -254,17 +247,10 @@ static int tmc_read_unprepare(struct tmc_drvdata *drv= data) { int ret =3D 0; =20 - switch (drvdata->config_type) { - case TMC_CONFIG_TYPE_ETB: - case TMC_CONFIG_TYPE_ETF: - ret =3D tmc_read_unprepare_etb(drvdata); - break; - case TMC_CONFIG_TYPE_ETR: - ret =3D tmc_read_unprepare_etr(drvdata); - break; - default: + if (drvdata->sysfs_ops) + ret =3D drvdata->sysfs_ops->read_unprepare(drvdata); + else ret =3D -EINVAL; - } =20 if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read end\n"); @@ -291,15 +277,7 @@ static int tmc_open(struct inode *inode, struct file *= file) static ssize_t tmc_get_sysfs_trace(struct tmc_drvdata *drvdata, loff_t pos= , size_t len, char **bufpp) { - switch (drvdata->config_type) { - case TMC_CONFIG_TYPE_ETB: - case TMC_CONFIG_TYPE_ETF: - return tmc_etb_get_sysfs_trace(drvdata, pos, len, bufpp); - case TMC_CONFIG_TYPE_ETR: - return tmc_etr_get_sysfs_trace(drvdata, pos, len, bufpp); - } - - return -EINVAL; + return drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); } =20 static ssize_t tmc_read(struct file *file, char __user *data, size_t len, @@ -769,6 +747,18 @@ static void register_crash_dev_interface(struct tmc_dr= vdata *drvdata, "Valid crash tracedata found\n"); } =20 +static const struct tmc_sysfs_ops etb_sysfs_ops =3D { + .read_prepare =3D tmc_read_prepare_etb, + .read_unprepare =3D tmc_read_unprepare_etb, + .get_trace_data =3D tmc_etb_get_sysfs_trace, +}; + +static const struct tmc_sysfs_ops etr_sysfs_ops =3D { + .read_prepare =3D tmc_read_prepare_etr, + .read_unprepare =3D tmc_read_unprepare_etr, + .get_trace_data =3D tmc_etr_get_sysfs_trace, +}; + static int __tmc_probe(struct device *dev, struct resource *res) { int ret =3D 0; @@ -828,6 +818,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) desc.subtype.sink_subtype =3D CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc.ops =3D &tmc_etb_cs_ops; dev_list =3D &etb_devs; + drvdata->sysfs_ops =3D &etb_sysfs_ops; break; case TMC_CONFIG_TYPE_ETR: desc.groups =3D coresight_etr_groups; @@ -841,6 +832,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) mutex_init(&drvdata->idr_mutex); dev_list =3D &etr_devs; INIT_LIST_HEAD(&drvdata->etr_buf_list); + drvdata->sysfs_ops =3D &etr_sysfs_ops; break; case TMC_CONFIG_TYPE_ETF: desc.groups =3D coresight_etf_groups; @@ -849,6 +841,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) desc.subtype.link_subtype =3D CORESIGHT_DEV_SUBTYPE_LINK_FIFO; desc.ops =3D &tmc_etf_cs_ops; dev_list =3D &etf_devs; + drvdata->sysfs_ops =3D &etb_sysfs_ops; break; default: pr_err("%s: Unsupported TMC config\n", desc.name); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 9b3c4e6f0a5e..c780f6d5dede 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -258,6 +258,7 @@ struct etr_buf_node { * Used by ETR/ETF. * @etr_buf_list: List that is used to manage allocated etr_buf. * @reading_node: Available buffer_node for byte-cntr reading. + * @sysfs_ops: Read operations for sysfs mode. */ struct tmc_drvdata { struct clk *atclk; @@ -290,6 +291,20 @@ struct tmc_drvdata { struct tmc_resrv_buf crash_mdata; struct list_head etr_buf_list; struct etr_buf_node *reading_node; + const struct tmc_sysfs_ops *sysfs_ops; +}; + +/** + * struct tmc_sysfs_ops - read operations for TMC and its helper devices + * @read_prepare: prepare operation. + * @read_unprepare: unprepare operation. + * @get_trace_data: read operation. + */ +struct tmc_sysfs_ops { + int (*read_prepare)(struct tmc_drvdata *drvdata); + int (*read_unprepare)(struct tmc_drvdata *drvdata); + ssize_t (*get_trace_data)(struct tmc_drvdata *drvdata, loff_t pos, + size_t len, char **bufpp); }; =20 struct etr_buf_operations { --=20 2.34.1 From nobody Mon Feb 9 06:05:51 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 57AB5313E2E for ; Mon, 26 Jan 2026 07:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413738; cv=none; b=jo4QAPwlLDSNF5IlF4SxHGf/+h/R3sc7JXzHZyrk/a8xHa+33U6SwfINuUz8r6hR3yRc7/JilRPHncPAMALWjXvVleI1AnrbK0m7CYT9G/wwXYbiIWBsXxS88ce4KBMyyy2ELtc2GUaqQ3bFwIl53r9hSLhZJIASmSEcmditwNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413738; c=relaxed/simple; bh=fYWi6it3rCCr65Id+LeC8mkX1SDe4sDJPpCZSTfEuGI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dZmcEG9VSjmiXV18/N9dO/Jk8uFgiyDel6fr64pJ70pNuW3d4V9bA8X63zfEVwpWhiQPwrhgejwur2hhCNmWgFxFI3U+U+hbTBlc66qTstI/Br8V3ahlvFhInxpBJYECpcSRytfA7lRASbI8zbRUPwyMBWShOARmDvOXWrGBQhY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=GrO8H3fh; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Q7TzqVdy; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="GrO8H3fh"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Q7TzqVdy" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60PIr3PE3858096 for ; Mon, 26 Jan 2026 07:48:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 4gIye7UQNPbdPhV/Q1vWHhs/KIv3bebvvJhc2HVhooY=; b=GrO8H3fht2IipknQ sSKyAl4IYQHxY1pMQQDatJPvob3JTF3HImBr4ENW1yC2sXQvP6lzZsC2Gx9aaMQP pkHVjwQg0iBU6Q7Gl8KVU+VfDXn3nMF/GZ4ZiW+rjhKMhkC5ZSindFIf0dpiF9M5 jzBDt18AejB1L6MkudfIr9Ky+IaR/Ze+aMumJfIMGdtV4mLkgrG8FcJGA9ohIlUY WHscgldAL7WDUmyTY1WvnnL2/w4GZ3tVRCyx+eI55O/ZOsjzeInNsu+g363lbIAd UwoYhcec6B9tR7/QzKoPql/WC6tmi905gd66h7BoF15wnvNrdAhiV4NO9u+OJvfM owMHUQ== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bvq6xus1j-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 07:48:56 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-82323cc7594so1002441b3a.2 for ; Sun, 25 Jan 2026 23:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769413734; x=1770018534; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4gIye7UQNPbdPhV/Q1vWHhs/KIv3bebvvJhc2HVhooY=; b=Q7TzqVdyydfy9M0h8XrRNWPfU1I2GTBLamtXs1zWMMid4qDvDd5chMMA6fDKZKy9QT 9rzN9PncmgNQnlf26lmQsEZcjHIK83vS7yk/Jplmu7yTP7ZxPy2r0SB8JbAlR9kqJzIm Z4/nmCr0UQ4F8Ze5gFIO32VX1pGBrvoVSVgRgs0B0xWqpIqTvo5mIDHuuSLGEqIZKa20 tA1tSayFVK5VupMFYCQEgvETCgmg6dk8FEZ4CZSSD5x14YsILoBTAZipHCTUbdcml/1H 06c+VFIgGkTV1SdLmnMZwLlZTJJfxyS0plV+LHAHbEidaGFQxjEwNBrDoABGCeFIHU3A exlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769413734; x=1770018534; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4gIye7UQNPbdPhV/Q1vWHhs/KIv3bebvvJhc2HVhooY=; b=UxZbkyfpQxgLKOWhmOgDnmQGdURTdswAvVso9g134zX3OfAI8F4+k+p++ysmCZN23W F35qDW6mjiKTOtHsyLRcBa/CjNYIRMWnrCoL31YLI3YCqF51W6To6Hd1MHCi78urKhCW GFFoFiaE9YAma0T6j3SMXoWZyhP0t0hhWV2CmIGQSEqeoGtjZ9NsZ1cNF9lRvBZA9q2y Xr68GMIZBvgm8FVtFTANds8xztvM7MOEwHuW4fJjgq5pVeq3/j4zJTZoxdVulrsVhQ8C TiwTA5ix0+D/SJOJdeffy0jn9nwvEV5AUI7VcDxZ+M3/0JZTD7Y8KftKPj12NIpY8PE3 XdSQ== X-Forwarded-Encrypted: i=1; AJvYcCV+JDf3lLruVCtRYVc3Xye6fRFk2Rc72AYkb2CgNT5bC+T1qBfTdqOrQVFmwiUMs0vqCRKqZu9UQjKegM8=@vger.kernel.org X-Gm-Message-State: AOJu0YwfnG0oZjVg01rgka7xBvyXrDidPD2o7qC8QSZ66Wl1lEVhnWPn 8mi64lJNnqAVS3XiMRoAW0nQ/gdgwCtwimOKMUsokegQZglv9MHMz0dT9oJYRp5J5Lp+76o0EFb Uy+I5ZLv5phxsCWRTtw1u+7UyZJ8WrDoIkYsiJLCPGJSlOW8wl6yrN4zCG7Asw7qx+hU= X-Gm-Gg: AZuq6aJAgudaj4WEok8fqKah4EAprqLVirUD1G6Relo2Ody/icQ0N/CsqjUVsYAq9bQ hItGSkk4O9kc118GrJjX4MnoDDABz6zo2g64Ll5fMNlJoEAQ6K4VObCCCmEyVZn5GFOmP/UuFKC uP6mgKo3F+N3f3KGj76E2QM7OwkeYsX3iU3n0kmiEhy3HqAYkuTruKUY9G8gtz0cE2TcxUmntPf OsYK7MKj/qHtKO47OLifWCLs3ZLfOJ22U5Q82+wjNgOFYNBulnot0IvytktBRHOHKo4XreaHxek OjEpPf6dynXuhiSd6lURcZleO2g7hJCZWFpFA4cm357I1naAflyFkNMdyteN0HuYQ9GtFt/o91M Yxm0sCAjb6fwVJy2qy9pH7xLn601psreFZtHq7mTvwBPazxrHfmtlDzYhapMpOf5btTtFVbXUdE 1G X-Received: by 2002:a05:6a00:8d94:b0:81f:995d:6cb with SMTP id d2e1a72fcca58-823412d9289mr3296083b3a.36.1769413733965; Sun, 25 Jan 2026 23:48:53 -0800 (PST) X-Received: by 2002:a05:6a00:8d94:b0:81f:995d:6cb with SMTP id d2e1a72fcca58-823412d9289mr3296055b3a.36.1769413733496; Sun, 25 Jan 2026 23:48:53 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8234fd9a5a7sm1223418b3a.63.2026.01.25.23.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 23:48:53 -0800 (PST) From: Jie Gan Date: Mon, 26 Jan 2026 15:47:56 +0800 Subject: [PATCH v11 4/8] coresight: etr: refactor the tmc_etr_get_catu_device function 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: quoted-printable Message-Id: <20260126-enable-byte-cntr-for-ctcu-v11-4-c0af66ba15cf@oss.qualcomm.com> References: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> In-Reply-To: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769413705; l=4412; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=fYWi6it3rCCr65Id+LeC8mkX1SDe4sDJPpCZSTfEuGI=; b=UJnXSFL79huFwDQeeINc5HmqIQvIG4Wua9f5RXCBnj2KI8WFg7dFFU3bzJbZunIagSjnxh6Bo WobJdmWoxbXDUSqzioewnFE2oO4k9VVDYNQElrobh6S6ekOCGvUzSVu X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: MVWb4z7KDqXvh9fZk5UivUZxjovAvG-I X-Proofpoint-ORIG-GUID: MVWb4z7KDqXvh9fZk5UivUZxjovAvG-I X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDA2NiBTYWx0ZWRfX7o9RHLLj5jWA qjXLuUdW2FKElzApXuaW3BhjcHKSuq9lM8Fiwb9EqbuVAOYE8O/aOBZpAk3e2QC4zlhh/CuU7G7 mgcqXuW2KWk8fBb2aIogW8niHMO+uwsMCTsWeoZkP9wN1K20+NANLVQdTf4uPFOcZrv9Uow0I4X pBjrFiw8rJup8OxXKJamReEfZcGbKQgTVL8f+w4P3IH7NGdcT4mDPf0bXEO/MEyKbOsNqYqef/f a5lkW95D9lMLTC11kmQvkdlrkvAEXOq6iEtK30AcRrHrH7WDrFyRiQz8jHNiWao25NVR9ZZiTt4 0AFqXYMcSAJgnUnAePACZA/H2aCDVw68kw4jaj/JGV9Da6EXT9snPEiHTJEe68/Ms6sUL50Ybx/ uAXX7kLKDGjddtYbzgmaFKO1Dl0cXrPyiSErSiqPMOmJXItMochB448dvGheLvuP7+uNgywDhya u2JZPqpJ9D+5jS3uJhw== X-Authority-Analysis: v=2.4 cv=Htd72kTS c=1 sm=1 tr=0 ts=69771c68 cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=-ozbsww5GKt6_lkPIaMA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_02,2026-01-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 adultscore=0 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260066 Refactor tmc_etr_get_catu_device to retrieve the helper device connected to the TMC ETR based on helper_subtype. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-catu.c | 3 ++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 32 ++++++++++++++++-----= ---- drivers/hwtracing/coresight/coresight-tmc.h | 3 ++- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtraci= ng/coresight/coresight-catu.c index 69b36bae97ab..d3972619cc96 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -334,7 +334,8 @@ static int catu_alloc_etr_buf(struct tmc_drvdata *tmc_d= rvdata, struct tmc_sg_table *catu_table; struct catu_etr_buf *catu_buf; =20 - csdev =3D tmc_etr_get_catu_device(tmc_drvdata); + csdev =3D tmc_etr_get_helper_device(tmc_drvdata, + CORESIGHT_DEV_SUBTYPE_HELPER_CATU); if (!csdev) return -ENODEV; catu_buf =3D kzalloc(sizeof(*catu_buf), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index cbbb15648fb7..16a4562533d5 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -844,28 +844,37 @@ static const struct etr_buf_operations etr_sg_buf_ops= =3D { }; =20 /* - * TMC ETR could be connected to a CATU device, which can provide address - * translation service. This is represented by the Output port of the TMC - * (ETR) connected to the input port of the CATU. + * TMC ETR could be connected to the helper device, which can provide addr= ess + * translation service(CATU) or data filter function(CTCU). This is repres= ented + * by the Output port of the TMC (ETR) connected to the input port of the = helper. * - * Returns : coresight_device ptr for the CATU device if a CATU is found. + * @drvdata : drvdata of the TMC device + * @subtype : helper_subtype of the helper device + * + * Returns : coresight_device ptr for the helper device if a helper is fou= nd. * : NULL otherwise. */ struct coresight_device * -tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) +tmc_etr_get_helper_device(struct tmc_drvdata *drvdata, + enum coresight_dev_subtype_helper subtype) { struct coresight_device *etr =3D drvdata->csdev; - union coresight_dev_subtype catu_subtype =3D { - .helper_subtype =3D CORESIGHT_DEV_SUBTYPE_HELPER_CATU + union coresight_dev_subtype helper_subtype =3D { + .helper_subtype =3D subtype }; =20 - if (!IS_ENABLED(CONFIG_CORESIGHT_CATU)) + + if (subtype =3D=3D CORESIGHT_DEV_SUBTYPE_HELPER_CATU && + !IS_ENABLED(CONFIG_CORESIGHT_CATU)) + return NULL; + else if (subtype =3D=3D CORESIGHT_DEV_SUBTYPE_HELPER_CTCU && + !IS_ENABLED(CONFIG_CORESIGHT_CTCU)) return NULL; =20 return coresight_find_output_type(etr->pdata, CORESIGHT_DEV_TYPE_HELPER, - catu_subtype); + helper_subtype); } -EXPORT_SYMBOL_GPL(tmc_etr_get_catu_device); +EXPORT_SYMBOL_GPL(tmc_etr_get_helper_device); =20 static const struct etr_buf_operations *etr_buf_ops[] =3D { [ETR_MODE_FLAT] =3D &etr_flat_buf_ops, @@ -913,7 +922,8 @@ static void get_etr_buf_hw(struct device *dev, struct e= tr_buf_hw *buf_hw) =20 buf_hw->has_iommu =3D iommu_get_domain_for_dev(dev->parent); buf_hw->has_etr_sg =3D tmc_etr_has_cap(drvdata, TMC_ETR_SG); - buf_hw->has_catu =3D !!tmc_etr_get_catu_device(drvdata); + buf_hw->has_catu =3D !!tmc_etr_get_helper_device(drvdata, + CORESIGHT_DEV_SUBTYPE_HELPER_CATU); buf_hw->has_resrv =3D tmc_has_reserved_buffer(drvdata); } =20 diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index c780f6d5dede..e573503f2edf 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -469,7 +469,8 @@ static inline uint32_t find_crash_tracedata_crc(struct = tmc_drvdata *drvdata, return crc32_le(0, (void *)drvdata->resrv_buf.vaddr, crc_size); } =20 -struct coresight_device *tmc_etr_get_catu_device(struct tmc_drvdata *drvda= ta); +struct coresight_device *tmc_etr_get_helper_device(struct tmc_drvdata *drv= data, + enum coresight_dev_subtype_helper subtype); =20 void tmc_etr_set_catu_ops(const struct etr_buf_operations *catu); void tmc_etr_remove_catu_ops(void); --=20 2.34.1 From nobody Mon Feb 9 06:05:51 2026 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 97F04312807 for ; Mon, 26 Jan 2026 07:49:00 +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=1769413741; cv=none; b=H7t7s6tIz/+faqDYgo7K2hIrAtqG9W8DorqXCYGcv2nLcZJ9AJARql46NaOut9bWMDkZcZyciQ2ENK804ijBO8QVHncS+nY/gJWCUSM9szFbNVNu7neqZTj460Fn+87N/elAHSwxIsnA4Zz+ROtgJgNC28eK/VByCTkOkzeMxMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413741; c=relaxed/simple; bh=D10EnaHvzxc5IcCAThb9a/AzzqWooUS88J0GgYqXhUw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QnABos2yyWPLKFhPc9CgbMVWd4h/4oGbaDGtH1PD0Nw3nDIMRgO64dcP47HZWjFLLSN5MbQGNx08CpaekJN7zvb2dGEbtFHtrlRgNj00NNdbAvvsicM4lfFKEZn2Ym+VMwdemk29IoiiQb2fSHYdiZbN0qPL3G3lHWPO4jqRphw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=JvG6i0KJ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=FXgGiYaM; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="JvG6i0KJ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="FXgGiYaM" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60PKGgTv924060 for ; Mon, 26 Jan 2026 07:49:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=JvG6i0KJu000BHx/ yJ4pRSOGXpc4R3PDb0wcJb9DpXylFMn1TRFMq+UbwF+vDkDaVwUmu0wpye/Nud5R a2YeecFgDit2EAjZpQRzJUItgEZ3sP93fIAtNqK1aPgEwHEdgXWNEjLvP7BSxnFJ lZSEPgUY9IOrDh+rai265rJCYxTZ8war2AEMMfdzozvtS8vuYjvU+B/skAd2Kp3f k5z3JlRLmAKcj9Q0D3uuZ8MxdUSQFmnqOrcDG/uq+wN0DX8yv9uE2kOZrPROg+y1 mnoG60jfiI/yfr6YjSt0pt2b5rgTPsnvyKRGk5LqwWTNfzevmS65V06JmLKvkPgp jS37aA== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bvq6uus66-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 07:48:59 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-81c68fef4d4so8158723b3a.2 for ; Sun, 25 Jan 2026 23:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769413739; x=1770018539; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=FXgGiYaMDiTnJsPPIAVvawuwRxz6AGzLtrdfNHZdkpz06ncif0K+BTyM8QqT52QXVf fVDyw0ITObIyg6/YyNysqXO8XAqcBnEyk9a9LbLD19D9KOZjIEIc6t+KsUNY7RImLyQj w77722GLB5pyHttC6/O0IvUAMXed989uAkV/Iqpc72zw6jjqAQlMa4o7zu7BLOsPSeYz tSNOV0B9czJpCZipdMU5G5RKCvwDuIQ6/vaJ3SiQMLukAk2NsZK45vrM0QInxws9EKhd PruUbPJ4z/HnxJRrtrQ+cT7akjFrWjefF//11Rw6OYaX9bQdpi4/pqck9LmuXr9ZuzvR seHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769413739; x=1770018539; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=hPFOCoK8nu3bUxAopZtZJIGEI/QMH0hMqVGVNsbw3rj8bIca1RlGq8+ZdEW4AfCK4I sv016QuGnoM2PMg+gamrG2Cf0ODxTiGKP/S7QIr9A9EcIDB0gX5yFcNiNVRnRSeh5ceZ 6sE9HVIqaylPqq7TqMW9nBGvkR7qA3fES7SGB2txcj9x5GQoP9B3DQiVkBfFr3x82YmK 1C+k5gah9o+sgtYiAkNpD5IiC8cPCtoCHJhk/eZzKfhw0JWnhOkOujkYADMd+GNhmoF9 /65iR9aj8p/MkG/Q0uun0xfxoueXm4bEGi2XXPK0R8sm19hpGI+6+wYvFogbm3J/9E27 CXCA== X-Forwarded-Encrypted: i=1; AJvYcCU4p1z+HRKQVb92slKLyvMfL1H1tcAYBPYSpumwiJv6ol0gGCN1jV0M4C4uS0iLbf/Bbpj/EOVYU9QsmO0=@vger.kernel.org X-Gm-Message-State: AOJu0YwIO+ZXqO2P2BKslo5OLPTYLUCsZaE3qpHhk+E5ETEwI1XD43HY gNXoPcVfySik4xs+RwM94ERUM6/np5NgxNWvxgnL1RlqoWqKapNXq9/ML6aFw+EoeHfQv1WTirh 8q1rj+cLKr6kdpkzc5auuHZEdhbADWL8FOMTx6XHvE6faYPa4Lp1ic5TeNdujiCIF+8o= X-Gm-Gg: AZuq6aLmk5Q17CUCFelfjlRz4Hh7G0Fi2e25Eknp+ZQD4FypjWCabcs6p/a/QxBtCJd KsQExg6+ModyaRfCYMIqDU9DfwDaqJkG84wja5p54yFFaDWTxsAQxIAg2q43zQm5j85Z9X1DP// J70s3Cblj4OdMnByeqijvfUogLZfPlsnZwnF6Lij8TETbhGTGr0OQbutp6W+FiyfYth9lkDLJgh nC9FhySqpmpH3CZC3+yPfXqhvOjjL1CG1y8Gbb4m9jPc324UPcMehY1wsAUBFmkou9/LdG3tmy+ FSR0xFUVxyO7K+uArk0aZONKOMVuBMycRET7+jBvzkYV4yXz+Ya+gyt0ijxjnWfte6UcuookWEq XFnSJMUAyQ0Z384pYSNIFzd54S75Ha18bTqSagN7AFYdcPkHfCgxMqSaPnb5dMisf3unf+PGPak qg X-Received: by 2002:a05:6a00:2294:b0:81f:4566:cce6 with SMTP id d2e1a72fcca58-8234121c8e5mr3573556b3a.28.1769413739257; Sun, 25 Jan 2026 23:48:59 -0800 (PST) X-Received: by 2002:a05:6a00:2294:b0:81f:4566:cce6 with SMTP id d2e1a72fcca58-8234121c8e5mr3573535b3a.28.1769413738792; Sun, 25 Jan 2026 23:48:58 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8234fd9a5a7sm1223418b3a.63.2026.01.25.23.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 23:48:58 -0800 (PST) From: Jie Gan Date: Mon, 26 Jan 2026 15:47:57 +0800 Subject: [PATCH v11 5/8] dt-bindings: arm: add an interrupt property for Coresight CTCU 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: quoted-printable Message-Id: <20260126-enable-byte-cntr-for-ctcu-v11-5-c0af66ba15cf@oss.qualcomm.com> References: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> In-Reply-To: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Mike Leach , Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769413706; l=1751; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=D10EnaHvzxc5IcCAThb9a/AzzqWooUS88J0GgYqXhUw=; b=CwJwXgXX7zGGBu6bOdUjbp0ej8SuneGsyvWe7mye7VP9EezB/SML38TmlJ9XLKhPIjJm4m9om rpFo04y2Zv7CFR1BoUf8tb60tXJFaMNUOZS8w2ILqThhNhX1QRTID2/ X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDA2NiBTYWx0ZWRfX1ge3+YymHPaU 8PRjqWq1/QwCG9B+4y+RNdn2la+LOd9WmcOISp21ZUQVHfrtwz0//lL5zF+EvyF+ZikNz1JnjjW TjShhT8ecultB4q/3DEOBg0JFtJeGuxl2iS44B8KNJ3uCgjAeXb+HJYlrPodBU01yY74PC8KMdv XTWMP/LIXNYkwBLgFwrAmmnM8/qGQ0RjagqjMLQQkFIL8k8Sqx6LPwo4EGrr4bocpJk/UzTc4zY Q/PGbDwHjOryaBaMfeDOKINBED6+4xJBEU4ZIJ2o+Z3YTuT2uKVhhjoEwBuSOP4j+c9vQD/Cmqk GuJ24d0QiCJAku/ehQH3iBB2FEy75WvNuzaj2KGqDoJnqLIMHL1S/6HvA47QqhGJtWLM55oxr8e 2YOHnz0mU5zOqs+ZnhNqRT6xLDY2vXrUhJBnyDe90shkrN1GOE5r8NF6oXBCCm6COeR+aJwyFuh iDPAiHFiGPXe0GFTfwA== X-Authority-Analysis: v=2.4 cv=UqRu9uwB c=1 sm=1 tr=0 ts=69771c6b cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=gSyxy6DGYGa4b6s9XCEA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: wTr2sZXrBl7hL9W-MHHGC8VtFCC0lABZ X-Proofpoint-GUID: wTr2sZXrBl7hL9W-MHHGC8VtFCC0lABZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_02,2026-01-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260066 Add an interrupt property to CTCU device. The interrupt will be triggered when the data size in the ETR buffer exceeds the threshold of the BYTECNTRVAL register. Programming a threshold in the BYTECNTRVAL register of CTCU device will enable the interrupt. Acked-by: Krzysztof Kozlowski Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml | 10 ++++++= ++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml= b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml index c969c16c21ef..ac27a8b89085 100644 --- a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml @@ -39,6 +39,11 @@ properties: items: - const: apb =20 + interrupts: + items: + - description: Interrupt for the ETR device connected to in-port0. + - description: Interrupt for the ETR device connected to in-port1. + label: description: Description of a coresight device. @@ -60,6 +65,8 @@ additionalProperties: false =20 examples: - | + #include + ctcu@1001000 { compatible =3D "qcom,sa8775p-ctcu"; reg =3D <0x1001000 0x1000>; @@ -67,6 +74,9 @@ examples: clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1 From nobody Mon Feb 9 06:05:51 2026 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 63D403161B2 for ; Mon, 26 Jan 2026 07:49:06 +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=1769413748; cv=none; b=eoTmzhhyfAXdN+ai13EvTW3Uk24VYi+3N+EOMI7/o3dduIGgtRejaeEYg3NTeJOWS2b/7qFapG5WLzV5vqdwHSJwpqTJ0GIOzmq+JBg6Rc976xc6tJ0x5xKh3KY5xQyZ6g8MUlJNubvBipWhXZEHv7jE08sV7fWnD47yPzPnjqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413748; c=relaxed/simple; bh=xzqdSPBAEVu2XuY0Z0p0utIRPR+C30+3Y+5WVeKlafc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dd13ClOobLFuAZG4bS+8qSUObd8F5JNJPDIgVn5uh8YlRzuvT92bOpR//8Q+gdLsHqfMVLDuf9TMCUE0h5cqem6e9Pzqyjr9oTjV2yCsBzBFb9/ZnvUFod8huXGLzup48JR9qEcZSZG2xxF5XJLxbUwk+zf7QnU7yn0KZSJgQas= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=dTmgQJUH; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=elxXdZsa; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="dTmgQJUH"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="elxXdZsa" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60PKGgTx924060 for ; Mon, 26 Jan 2026 07:49:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= iS1Q3bbgP6zP+2h61Ps1365k5onJqNTm1Xh6Q3L4SxA=; b=dTmgQJUH4pDsu+5d AM/nLlSCRsOYzLEOefczSnz3YmAlskXIBrurxrVd8P8dGIbTyN4Z7C0XhgW4D/Xj CI/JSny5vxpnxbaGBVogu+P+RlxQAKVqJsTuP3LtNkoph1ZSsu0sj5MjIf5Lu2Oh Eb1E6yONgcchr6J3vryiy9nFO/JuIAJ9DCofb/TkWvFAgq5SuyRWrD9L3/zngCoM yKsBG4ONrP4qP852Gc2LIxlx9MCpSgAEpE/QynB4gMjCb3LOvdBz1Uam2rvBMvLK tOHQvH9DiZSyYOlqbzXvCfrRSO+zO5R0izmPuzNzmqlrd0D+gMk87EjhV4lbQAKm tO9qvA== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bvq6uus6f-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 07:49:05 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-81c68fef4d4so8158840b3a.2 for ; Sun, 25 Jan 2026 23:49:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769413745; x=1770018545; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iS1Q3bbgP6zP+2h61Ps1365k5onJqNTm1Xh6Q3L4SxA=; b=elxXdZsayqzuD12IBfFEfvh+6FS4fGoXtd5A6/ffQRTWgLYX6Ka+Yvyug7pb8WlDev Ku+7yKXun05lnguYt2dAkoABeFgTMqdVkm0h51ZTlY/g47D3eCb9111bH85cr8xImDCi Lxms7aq3dZhLcviJlT/Jxknq+nUARSQa68jFJgldI5s3Au/zpGS1miUTKbV2mJsy3/IS 571iTSczoYNKhPDcZR6kqng17SYZAmqzJ8VMtcT7uJstiUOa0pSvrJvOz6asNyh9yeGu 1I+IzfWQNHkipInHlJutapq5Bt4vVK4JK4VAj8701EL2rW8nQVNCytlLIamycq+efBVY zJpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769413745; x=1770018545; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=iS1Q3bbgP6zP+2h61Ps1365k5onJqNTm1Xh6Q3L4SxA=; b=LZniPqZ2Ytorfgy23AD//sg0X4wk9HdxkbfRQ2l4vXRytOH/mooxfBiqJS1Pkm4MgL 5ffNjyQrAa7qM0hY4SNw94b9K99qm1hWBPm/ueF9vNU2A7wFkrWoZEEEEBpCrFxGAYou c522x7x0T1F+ia2uFEpKRnOKvPnUCtrSNgCywYaB3SeEoVkfU7U4rrBgMx7PhEsNi0qk lQDC+P34/znAd3Zgol0XgYOyj63x94RBv7XuDKlvn8SoetVwd+Y7TBMrUYzQzO2B7A30 m5gysYouFZzI+6+2e0l4k9L8Izi8QG43t+Cw/9mMbU6acf1PdwVtjKcDaCc5TUOBce2e SQ2g== X-Forwarded-Encrypted: i=1; AJvYcCW1/ANp+kylVD6mukjIfxFASPpLVCciyEiXyGfyWVDb0buQ/RFIKMqxopwSfBrH4irH3hfQWPCX74wnrdQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yzf8wGVuJgiO0i8moCmmcwvSB47AjRqR0QQ7nlw1fLZqstOEiNY VRtdCS8Gvh7wC73/VXlllCNmCU54eywP2Vj8dYT9uZPSc7vfvlknz7DCLjkT2LJdkfAjcMNLFra +9ChrhwKkG7u4wdmOf6T+l4GwesQFSKebba37jy+2S8bab0FVbmPv8Lxqsf6KiCajbB4= X-Gm-Gg: AZuq6aJyjqugX9EfPi5R/boRZhR2T1XnT0ak8FxcdUoK654kMJH5cl26biihOanRRh3 bWgXz+P7S9sCk6tCLqoJutIoYqKXD3uWSt8bVpgkusChlPXUUc37ilWBHdx+3MpLgtX3iJU6GLk 2kcvFM0jJUkg9ZZddfub9GsYJag8wKfAq/JdCh3zXUz2AM9OwUh1EI+WI3oiei7BqAdNJWEYZHV a1BJXYDPrUQuLuXGWrVBObAB4Z0fXyqSAW6kHxIEgOAht3zEPE+TS02Zo3aJU25TNGsp8vD67tG bqBd/9R7OxQV7/vQjRKjsRFvRg2lb7qeh052AGOZl6ho3biIkPL3HIcFZ48wcb1fQoCpa5h6fSX uckY7Et/lsSeW/oE+ywuiX+smoNE9muG52oM9WL2stGapWBQZrUrVpW1FjeQtssgYRSxlJqAKAm ek X-Received: by 2002:a05:6a00:3a1b:b0:81f:9b09:ad02 with SMTP id d2e1a72fcca58-823411b9b5fmr3870925b3a.1.1769413744596; Sun, 25 Jan 2026 23:49:04 -0800 (PST) X-Received: by 2002:a05:6a00:3a1b:b0:81f:9b09:ad02 with SMTP id d2e1a72fcca58-823411b9b5fmr3870898b3a.1.1769413743954; Sun, 25 Jan 2026 23:49:03 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8234fd9a5a7sm1223418b3a.63.2026.01.25.23.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 23:49:03 -0800 (PST) From: Jie Gan Date: Mon, 26 Jan 2026 15:47:58 +0800 Subject: [PATCH v11 6/8] coresight: ctcu: enable byte-cntr for TMC ETR devices 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: quoted-printable Message-Id: <20260126-enable-byte-cntr-for-ctcu-v11-6-c0af66ba15cf@oss.qualcomm.com> References: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> In-Reply-To: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769413706; l=24589; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=xzqdSPBAEVu2XuY0Z0p0utIRPR+C30+3Y+5WVeKlafc=; b=31oiQhqYVt/IYA+PY4D4yXx/nQczxdRvC892h9V8SwR0wekipz4F7fIeu6MwgfcqrDWZFnu5o vYlfFT5IdQLC0/p7T09eredpGVHHYUU/+eMpqUrnw7dXLbW1124EUpN X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDA2NiBTYWx0ZWRfX9ZJyMC/0bA6H WnmMXg6ZICUfluXLuk9WltGCXw8GZIcd1OBOOjhK7dv+SUIwja0XjqEJsJ6K+TTS3GSPsGDrVyu Py4IVWS+ystGsK/AJgoZ+hiiYkgCS1Twux4VQN6vBYSFB6tAIWJxiv0uny5MghzTV16LoIIIAPw iKbJ5nlXujDdiKJvEKtMApC34k5dh6vTO2E3FG/hctT52m+xsE1bm+hChTX1pTh/kPI9rBsNBpP 3d9x8SdZK26DDjO+r63Ni3HBGaPAr+JNMckitDNhMVjAPK/gnGqXIJTgknMMcsep45LeVK6bnMU yhgUDMXLyOpuUGDISqTtkm5k3dDk2V3OLHYkqzmJ7M69qfqaG6hiGwTqU1jzs5EAd9GhoQa/gDN cm1WJTGP3PwyIZYysVFE2BWGH32vKnRmvWtzuFqZn7cTzd0OUdstlURfsYRHMpS0h7xMYforsXk pLpFqF4aiAlKpZP5vXA== X-Authority-Analysis: v=2.4 cv=UqRu9uwB c=1 sm=1 tr=0 ts=69771c71 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=TrPPj8Ph-2G9coJyck8A:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-ORIG-GUID: 5PyUjj0a4UjAhA-ohJXnbbu_SzIrC94R X-Proofpoint-GUID: 5PyUjj0a4UjAhA-ohJXnbbu_SzIrC94R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_02,2026-01-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260066 The byte-cntr function provided by the CTCU device is used to transfer data from the ETR buffer to the userspace. An interrupt is triggered if the data size exceeds the threshold set in the BYTECNTRVAL register. The interrupt handler counts the number of triggered interruptions and the read function will read the data from the synced ETR buffer. Switching the sysfs_buf when current buffer is full or the timeout is triggered and resets rrp and rwp registers after switched the buffer. The synced buffer will become available for reading after the switch. Signed-off-by: Jie Gan --- .../ABI/testing/sysfs-bus-coresight-devices-ctcu | 8 + drivers/hwtracing/coresight/Makefile | 2 +- .../hwtracing/coresight/coresight-ctcu-byte-cntr.c | 366 +++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-ctcu-core.c | 103 +++++- drivers/hwtracing/coresight/coresight-ctcu.h | 77 ++++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 18 + drivers/hwtracing/coresight/coresight-tmc.h | 1 + 7 files changed, 562 insertions(+), 13 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-ctcu b/D= ocumentation/ABI/testing/sysfs-bus-coresight-devices-ctcu new file mode 100644 index 000000000000..3a6c358badb9 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-ctcu @@ -0,0 +1,8 @@ +What: /sys/bus/coresight/devices//irq_threshold[0:1] +Date: January 2026 +KernelVersion: 6.20 +Contact: Tingwei Zhang ; Jinlong Ma= o ; Jie Gan +Description: + (RW) Configure the byte-cntr IRQ register for the specified ETR device + based on its port number. An interrupt is generated when the data size + exceeds the value set in the IRQ register. diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/cores= ight/Makefile index ab16d06783a5..821a1b06b20c 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -55,5 +55,5 @@ coresight-cti-y :=3D coresight-cti-core.o coresight-cti-p= latform.o \ obj-$(CONFIG_ULTRASOC_SMB) +=3D ultrasoc-smb.o obj-$(CONFIG_CORESIGHT_DUMMY) +=3D coresight-dummy.o obj-$(CONFIG_CORESIGHT_CTCU) +=3D coresight-ctcu.o -coresight-ctcu-y :=3D coresight-ctcu-core.o +coresight-ctcu-y :=3D coresight-ctcu-core.o coresight-ctcu-byte-cntr.o obj-$(CONFIG_CORESIGHT_KUNIT_TESTS) +=3D coresight-kunit-tests.o diff --git a/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c b/drive= rs/hwtracing/coresight/coresight-ctcu-byte-cntr.c new file mode 100644 index 000000000000..c6853c27bc86 --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c @@ -0,0 +1,366 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#include +#include +#include +#include +#include +#include + +#include "coresight-ctcu.h" +#include "coresight-priv.h" +#include "coresight-tmc.h" + +static irqreturn_t byte_cntr_handler(int irq, void *data) +{ + struct ctcu_byte_cntr *byte_cntr_data =3D (struct ctcu_byte_cntr *)data; + + atomic_inc(&byte_cntr_data->irq_cnt); + wake_up(&byte_cntr_data->wq); + + return IRQ_HANDLED; +} + +static void ctcu_reset_sysfs_buf(struct tmc_drvdata *drvdata) +{ + u32 sts; + + CS_UNLOCK(drvdata->base); + tmc_write_rrp(drvdata, drvdata->sysfs_buf->hwaddr); + tmc_write_rwp(drvdata, drvdata->sysfs_buf->hwaddr); + sts =3D readl_relaxed(drvdata->base + TMC_STS) & ~TMC_STS_FULL; + writel_relaxed(sts, drvdata->base + TMC_STS); + CS_LOCK(drvdata->base); +} + +static void ctcu_cfg_byte_cntr_reg(struct tmc_drvdata *drvdata, u32 val, u= 32 offset) +{ + struct ctcu_drvdata *ctcu_drvdata; + struct coresight_device *helper; + + helper =3D tmc_etr_get_helper_device(drvdata, CORESIGHT_DEV_SUBTYPE_HELPE= R_CTCU); + if (!helper) + return; + + ctcu_drvdata =3D dev_get_drvdata(helper->dev.parent); + /* A one value for IRQCTRL register represents 8 bytes */ + ctcu_program_register(ctcu_drvdata, val / 8, offset); +} + +static struct ctcu_byte_cntr *ctcu_get_byte_cntr_data(struct tmc_drvdata *= drvdata) +{ + struct ctcu_byte_cntr *byte_cntr_data; + struct ctcu_drvdata *ctcu_drvdata; + struct coresight_device *helper; + int port; + + helper =3D tmc_etr_get_helper_device(drvdata, CORESIGHT_DEV_SUBTYPE_HELPE= R_CTCU); + if (!helper) + return NULL; + + port =3D coresight_get_in_port(drvdata->csdev, helper); + if (port < 0) + return NULL; + + ctcu_drvdata =3D dev_get_drvdata(helper->dev.parent); + byte_cntr_data =3D &ctcu_drvdata->byte_cntr_data[port]; + return byte_cntr_data; +} + +static bool ctcu_byte_cntr_switch_buffer(struct tmc_drvdata *drvdata, + struct ctcu_byte_cntr *byte_cntr_data) +{ + struct etr_buf_node *nd, *next, *curr_node, *picked_node; + struct etr_buf *curr_buf =3D drvdata->sysfs_buf; + bool found_free_buf =3D false; + + if (WARN_ON(!drvdata || !byte_cntr_data)) + return found_free_buf; + + /* Stop the ETR before we start the switch */ + if (coresight_get_mode(drvdata->csdev) !=3D CS_MODE_DISABLED) + tmc_etr_enable_disable_hw(drvdata, false); + + list_for_each_entry_safe(nd, next, &drvdata->etr_buf_list, node) { + /* curr_buf is free for next round */ + if (nd->sysfs_buf =3D=3D curr_buf) { + nd->is_free =3D true; + curr_node =3D nd; + } + + if (!found_free_buf && nd->is_free && nd->sysfs_buf !=3D curr_buf) { + picked_node =3D nd; + found_free_buf =3D true; + } + } + + if (found_free_buf) { + curr_node->pos =3D 0; + drvdata->reading_node =3D curr_node; + drvdata->sysfs_buf =3D picked_node->sysfs_buf; + drvdata->etr_buf =3D picked_node->sysfs_buf; + picked_node->is_free =3D false; + /* Reset irq_cnt for next etr_buf */ + atomic_set(&byte_cntr_data->irq_cnt, 0); + /* Reset rrp and rwp when the system has switched the buffer*/ + ctcu_reset_sysfs_buf(drvdata); + /* Restart the ETR when we find a free buffer */ + if (coresight_get_mode(drvdata->csdev) !=3D CS_MODE_DISABLED) + tmc_etr_enable_disable_hw(drvdata, true); + } + + return found_free_buf; +} + +/* + * ctcu_byte_cntr_get_data() - reads data from the deactivated and filled = buffer. + * The byte-cntr reading work reads data from the deactivated and filled b= uffer. + * The read operation waits for a buffer to become available, either fille= d or + * upon timeout, and then reads trace data from the synced buffer. + */ +static ssize_t ctcu_byte_cntr_get_data(struct tmc_drvdata *drvdata, loff_t= pos, + size_t len, char **bufpp) +{ + struct etr_buf *sysfs_buf =3D drvdata->sysfs_buf; + struct device *dev =3D &drvdata->csdev->dev; + ssize_t actual, size =3D sysfs_buf->size; + struct ctcu_byte_cntr *byte_cntr_data; + size_t thresh_val; + atomic_t *irq_cnt; + int ret; + + byte_cntr_data =3D ctcu_get_byte_cntr_data(drvdata); + if (!byte_cntr_data) + return -EINVAL; + + thresh_val =3D byte_cntr_data->thresh_val; + irq_cnt =3D &byte_cntr_data->irq_cnt; + +wait_buffer: + if (!byte_cntr_data->reading_buf) { + ret =3D wait_event_interruptible_timeout(byte_cntr_data->wq, + ((atomic_read(irq_cnt) + 1) * thresh_val >=3D size) || + !byte_cntr_data->enable, + BYTE_CNTR_TIMEOUT); + if (ret < 0) + return ret; + /* + * The current etr_buf is almost full or timeout is triggered, + * so switch the buffer and mark the switched buffer as reading. + */ + if (byte_cntr_data->enable) { + if (!ctcu_byte_cntr_switch_buffer(drvdata, byte_cntr_data)) { + dev_err(dev, "Switch buffer failed for byte-cntr\n"); + return -EINVAL; + } + + byte_cntr_data->reading_buf =3D true; + } else { + /* + * TMC-ETR has been disabled, so directly reads data from + * the drvdata->sysfs_buf. + */ + actual =3D drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); + if (actual > 0) { + byte_cntr_data->total_size +=3D actual; + return actual; + } + + /* Exit byte-cntr reading */ + return 0; + } + } + + /* Check the status of current etr_buf*/ + if ((atomic_read(irq_cnt) + 1) * thresh_val >=3D size) + /* + * Unlikely to find a free buffer to switch, so just disable + * the ETR for a while. + */ + if (!ctcu_byte_cntr_switch_buffer(drvdata, byte_cntr_data)) + dev_warn(dev, "No available buffer to store data, disable ETR\n"); + + pos =3D drvdata->reading_node->pos; + actual =3D drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); + if (actual <=3D 0) { + /* Reset flags upon reading is finished or failed */ + byte_cntr_data->reading_buf =3D false; + drvdata->reading_node =3D NULL; + + /* + * Nothing in the buffer, waiting for the next buffer + * to be filled. + */ + if (actual =3D=3D 0) + goto wait_buffer; + } else + byte_cntr_data->total_size +=3D actual; + + return actual; +} + +static int ctcu_read_prepare_byte_cntr(struct tmc_drvdata *drvdata) +{ + struct ctcu_byte_cntr *byte_cntr_data; + unsigned long flags; + int ret =3D 0; + + /* config types are set a boot time and never change */ + if (WARN_ON_ONCE(drvdata->config_type !=3D TMC_CONFIG_TYPE_ETR)) + return -EINVAL; + + /* + * Byte counter reading should start only after the TMC-ETR has been + * enabled, which implies that the sysfs_buf has already been setup + * in drvdata. + */ + if (!drvdata->sysfs_buf) + return -EINVAL; + + byte_cntr_data =3D ctcu_get_byte_cntr_data(drvdata); + if (!byte_cntr_data) + return -EINVAL; + + /* + * The threshold value must not exceed the buffer size. + * A margin should be maintained between the two values to account + * for the time gap between the interrupt and buffer switching. + */ + if (byte_cntr_data->thresh_val + SZ_16K >=3D drvdata->size) { + dev_err(&drvdata->csdev->dev, "The threshold value is too large\n"); + return -EINVAL; + } + + raw_spin_lock_irqsave(&drvdata->spinlock, flags); + if (byte_cntr_data->reading) { + ret =3D -EBUSY; + goto out_unlock; + } + + byte_cntr_data->reading =3D true; + raw_spin_unlock_irqrestore(&drvdata->spinlock, flags); + /* Setup an available etr_buf_list for byte-cntr */ + ret =3D tmc_create_etr_buf_list(drvdata, 2); + if (ret) + goto out; + + raw_spin_lock_irqsave(&drvdata->spinlock, flags); + atomic_set(&byte_cntr_data->irq_cnt, 0); + /* Configure the byte-cntr register to enable IRQ */ + ctcu_cfg_byte_cntr_reg(drvdata, byte_cntr_data->thresh_val, + byte_cntr_data->irq_ctrl_offset); + enable_irq_wake(byte_cntr_data->irq); + byte_cntr_data->total_size =3D 0; + +out_unlock: + raw_spin_unlock_irqrestore(&drvdata->spinlock, flags); + +out: + return ret; +} + +static int ctcu_read_unprepare_byte_cntr(struct tmc_drvdata *drvdata) +{ + struct device *dev =3D &drvdata->csdev->dev; + struct ctcu_byte_cntr *byte_cntr_data; + unsigned long flags; + + byte_cntr_data =3D ctcu_get_byte_cntr_data(drvdata); + if (!byte_cntr_data) + return -EINVAL; + + raw_spin_lock_irqsave(&drvdata->spinlock, flags); + /* Configure the byte-cntr register to disable IRQ */ + ctcu_cfg_byte_cntr_reg(drvdata, 0, byte_cntr_data->irq_ctrl_offset); + disable_irq_wake(byte_cntr_data->irq); + byte_cntr_data->reading =3D false; + byte_cntr_data->reading_buf =3D false; + drvdata->reading_node =3D NULL; + raw_spin_unlock_irqrestore(&drvdata->spinlock, flags); + dev_dbg(dev, "send data total size:%llu bytes\n", byte_cntr_data->total_s= ize); + tmc_clean_etr_buf_list(drvdata); + + return 0; +} + +static const struct tmc_sysfs_ops byte_cntr_sysfs_ops =3D { + .read_prepare =3D ctcu_read_prepare_byte_cntr, + .read_unprepare =3D ctcu_read_unprepare_byte_cntr, + .get_trace_data =3D ctcu_byte_cntr_get_data, +}; + +/* Start the byte-cntr function when the path is enabled. */ +void ctcu_byte_cntr_start(struct coresight_device *csdev, struct coresight= _path *path) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); + struct coresight_device *sink =3D coresight_get_sink(path); + struct ctcu_byte_cntr *byte_cntr_data; + int port_num; + + if (!sink) + return; + + port_num =3D coresight_get_in_port(sink, csdev); + if (port_num < 0) + return; + + byte_cntr_data =3D &drvdata->byte_cntr_data[port_num]; + /* Don't start byte-cntr function when threshold is not set. */ + if (!byte_cntr_data->thresh_val || byte_cntr_data->enable) + return; + + guard(raw_spinlock_irqsave)(&byte_cntr_data->spin_lock); + byte_cntr_data->enable =3D true; + byte_cntr_data->reading_buf =3D false; +} + +/* Stop the byte-cntr function when the path is disabled. */ +void ctcu_byte_cntr_stop(struct coresight_device *csdev, struct coresight_= path *path) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); + struct coresight_device *sink =3D coresight_get_sink(path); + struct ctcu_byte_cntr *byte_cntr_data; + int port_num; + + if (!sink || coresight_get_mode(sink) =3D=3D CS_MODE_SYSFS) + return; + + port_num =3D coresight_get_in_port(sink, csdev); + if (port_num < 0) + return; + + byte_cntr_data =3D &drvdata->byte_cntr_data[port_num]; + guard(raw_spinlock_irqsave)(&byte_cntr_data->spin_lock); + byte_cntr_data->enable =3D false; +} + +void ctcu_byte_cntr_init(struct device *dev, struct ctcu_drvdata *drvdata,= int etr_num) +{ + struct ctcu_byte_cntr *byte_cntr_data; + struct device_node *nd =3D dev->of_node; + int irq_num, ret, i; + + drvdata->byte_cntr_sysfs_ops =3D &byte_cntr_sysfs_ops; + for (i =3D 0; i < etr_num; i++) { + byte_cntr_data =3D &drvdata->byte_cntr_data[i]; + irq_num =3D of_irq_get(nd, i); + if (irq_num < 0) { + dev_err(dev, "Failed to get IRQ from DT for port%d\n", i); + continue; + } + + ret =3D devm_request_irq(dev, irq_num, byte_cntr_handler, + IRQF_TRIGGER_RISING | IRQF_SHARED, + dev_name(dev), byte_cntr_data); + if (ret) { + dev_err(dev, "Failed to register IRQ for port%d\n", i); + continue; + } + + byte_cntr_data->irq =3D irq_num; + init_waitqueue_head(&byte_cntr_data->wq); + } +} diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hw= tracing/coresight/coresight-ctcu-core.c index 78be783b3cb2..0e5cadaac350 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c @@ -15,6 +15,7 @@ #include #include #include +#include =20 #include "coresight-ctcu.h" #include "coresight-priv.h" @@ -45,17 +46,21 @@ DEFINE_CORESIGHT_DEVLIST(ctcu_devs, "ctcu"); =20 #define CTCU_ATID_REG_BIT(traceid) (traceid % 32) #define CTCU_ATID_REG_SIZE 0x10 +#define CTCU_ETR0_IRQCTRL 0x6c +#define CTCU_ETR1_IRQCTRL 0x70 #define CTCU_ETR0_ATID0 0xf8 #define CTCU_ETR1_ATID0 0x108 =20 static const struct ctcu_etr_config sa8775p_etr_cfgs[] =3D { { - .atid_offset =3D CTCU_ETR0_ATID0, - .port_num =3D 0, + .atid_offset =3D CTCU_ETR0_ATID0, + .irq_ctrl_offset =3D CTCU_ETR0_IRQCTRL, + .port_num =3D 0, }, { - .atid_offset =3D CTCU_ETR1_ATID0, - .port_num =3D 1, + .atid_offset =3D CTCU_ETR1_ATID0, + .irq_ctrl_offset =3D CTCU_ETR1_IRQCTRL, + .port_num =3D 1, }, }; =20 @@ -64,6 +69,88 @@ static const struct ctcu_config sa8775p_cfgs =3D { .num_etr_config =3D ARRAY_SIZE(sa8775p_etr_cfgs), }; =20 +void ctcu_program_register(struct ctcu_drvdata *drvdata, u32 val, u32 offs= et) +{ + CS_UNLOCK(drvdata->base); + ctcu_writel(drvdata, val, offset); + CS_LOCK(drvdata->base); +} + +static ssize_t irq_threshold_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct ctcu_byte_cntr_irq_attribute *irq_attr =3D + container_of(attr, struct ctcu_byte_cntr_irq_attribute, attr); + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + u8 port =3D irq_attr->port; + + if (!drvdata->byte_cntr_data[port].irq_ctrl_offset) + return -EINVAL; + + return sysfs_emit(buf, "%u\n", + (unsigned int)drvdata->byte_cntr_data[port].thresh_val); +} + +static ssize_t irq_threshold_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t size) +{ + struct ctcu_byte_cntr_irq_attribute *irq_attr =3D + container_of(attr, struct ctcu_byte_cntr_irq_attribute, attr); + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + u8 port =3D irq_attr->port; + unsigned long val; + + if (kstrtoul(buf, 0, &val)) + return -EINVAL; + + /* Threshold 0 disables the interruption. */ + guard(raw_spinlock_irqsave)(&drvdata->spin_lock); + /* A small threshold will result in a large number of interruptions */ + if (val && val < SZ_4K) + return -EINVAL; + + if (drvdata->byte_cntr_data[port].irq_ctrl_offset) + drvdata->byte_cntr_data[port].thresh_val =3D val; + + return size; +} + +static umode_t irq_threshold_is_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + struct device_attribute *dev_attr =3D + container_of(attr, struct device_attribute, attr); + struct ctcu_byte_cntr_irq_attribute *irq_attr =3D + container_of(dev_attr, struct ctcu_byte_cntr_irq_attribute, attr); + struct device *dev =3D kobj_to_dev(kobj); + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + u8 port =3D irq_attr->port; + + if (drvdata && drvdata->byte_cntr_data[port].irq_ctrl_offset) + return attr->mode; + + return 0; +} + +static struct attribute *ctcu_attrs[] =3D { + ctcu_byte_cntr_irq_rw(0), + ctcu_byte_cntr_irq_rw(1), + NULL, +}; + +static struct attribute_group ctcu_attr_grp =3D { + .attrs =3D ctcu_attrs, + .is_visible =3D irq_threshold_is_visible, +}; + +static const struct attribute_group *ctcu_attr_grps[] =3D { + &ctcu_attr_grp, + NULL, +}; + static void ctcu_program_atid_register(struct ctcu_drvdata *drvdata, u32 r= eg_offset, u8 bit, bool enable) { @@ -142,11 +229,15 @@ static int ctcu_set_etr_traceid(struct coresight_devi= ce *csdev, struct coresight static int ctcu_enable(struct coresight_device *csdev, enum cs_mode mode, struct coresight_path *path) { + ctcu_byte_cntr_start(csdev, path); + return ctcu_set_etr_traceid(csdev, path, true); } =20 static int ctcu_disable(struct coresight_device *csdev, struct coresight_p= ath *path) { + ctcu_byte_cntr_stop(csdev, path); + return ctcu_set_etr_traceid(csdev, path, false); } =20 @@ -197,7 +288,10 @@ static int ctcu_probe(struct platform_device *pdev) for (i =3D 0; i < cfgs->num_etr_config; i++) { etr_cfg =3D &cfgs->etr_cfgs[i]; drvdata->atid_offset[i] =3D etr_cfg->atid_offset; + drvdata->byte_cntr_data[i].irq_ctrl_offset =3D + etr_cfg->irq_ctrl_offset; } + ctcu_byte_cntr_init(dev, drvdata, cfgs->num_etr_config); } } =20 @@ -209,6 +303,7 @@ static int ctcu_probe(struct platform_device *pdev) desc.subtype.helper_subtype =3D CORESIGHT_DEV_SUBTYPE_HELPER_CTCU; desc.pdata =3D pdata; desc.dev =3D dev; + desc.groups =3D ctcu_attr_grps; desc.ops =3D &ctcu_ops; desc.access =3D CSDEV_ACCESS_IOMEM(base); =20 diff --git a/drivers/hwtracing/coresight/coresight-ctcu.h b/drivers/hwtraci= ng/coresight/coresight-ctcu.h index e9594c38dd91..bc833482c8bc 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu.h +++ b/drivers/hwtracing/coresight/coresight-ctcu.h @@ -5,19 +5,26 @@ =20 #ifndef _CORESIGHT_CTCU_H #define _CORESIGHT_CTCU_H + +#include #include "coresight-trace-id.h" =20 /* Maximum number of supported ETR devices for a single CTCU. */ #define ETR_MAX_NUM 2 =20 +#define BYTE_CNTR_TIMEOUT (5 * HZ) + /** * struct ctcu_etr_config * @atid_offset: offset to the ATID0 Register. - * @port_num: in-port number of CTCU device that connected to ETR. + * @port_num: in-port number of the CTCU device that connected to ETR. + * @irq_ctrl_offset: offset to the BYTECNTRVAL register. + * @irq_name: IRQ name in dt node. */ struct ctcu_etr_config { const u32 atid_offset; const u32 port_num; + const u32 irq_ctrl_offset; }; =20 struct ctcu_config { @@ -25,15 +32,69 @@ struct ctcu_config { int num_etr_config; }; =20 -struct ctcu_drvdata { - void __iomem *base; - struct clk *apb_clk; - struct device *dev; - struct coresight_device *csdev; +/** + * struct ctcu_byte_cntr + * @enable: indicates that byte_cntr function is enabled or not. + * @reading: indicates that byte-cntr reading is started. + * @reading_buf: indicates that byte-cntr is reading data from the buffer. + * @thresh_val: threshold to trigger a interruption. + * @total_size: total size of transferred data. + * @irq: allocated number of the IRQ. + * @irq_cnt: IRQ count number for triggered interruptions. + * @wq: waitqueue for reading data from ETR buffer. + * @spin_lock: spinlock of byte_cntr_data. + * @irq_ctrl_offset: offset to the BYTECNTVAL Register. + */ +struct ctcu_byte_cntr { + bool enable; + bool reading; + bool reading_buf; + u32 thresh_val; + u64 total_size; + int irq; + atomic_t irq_cnt; + wait_queue_head_t wq; raw_spinlock_t spin_lock; - u32 atid_offset[ETR_MAX_NUM]; + u32 irq_ctrl_offset; +}; + +struct ctcu_drvdata { + void __iomem *base; + struct clk *apb_clk; + struct device *dev; + struct coresight_device *csdev; + struct ctcu_byte_cntr byte_cntr_data[ETR_MAX_NUM]; + raw_spinlock_t spin_lock; + u32 atid_offset[ETR_MAX_NUM]; /* refcnt for each traceid of each sink */ - u8 traceid_refcnt[ETR_MAX_NUM][CORESIGHT_TRACE_ID_RES_TOP]; + u8 traceid_refcnt[ETR_MAX_NUM][CORESIGHT_TRACE_ID_RES_TOP]; + const struct tmc_sysfs_ops *byte_cntr_sysfs_ops; }; =20 +/** + * struct ctcu_irq_thresh_attribute + * @attr: The device attribute. + * @idx: port number. + */ +struct ctcu_byte_cntr_irq_attribute { + struct device_attribute attr; + u8 port; +}; + +#define ctcu_byte_cntr_irq_rw(port) \ + (&((struct ctcu_byte_cntr_irq_attribute[]) { \ + { \ + __ATTR(irq_threshold##port, 0644, irq_threshold_show, \ + irq_threshold_store), \ + port, \ + } \ + })[0].attr.attr) + +void ctcu_program_register(struct ctcu_drvdata *drvdata, u32 val, u32 offs= et); + +/* Byte-cntr functions */ +void ctcu_byte_cntr_start(struct coresight_device *csdev, struct coresight= _path *path); +void ctcu_byte_cntr_stop(struct coresight_device *csdev, struct coresight_= path *path); +void ctcu_byte_cntr_init(struct device *dev, struct ctcu_drvdata *drvdata,= int port_num); + #endif diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index 16a4562533d5..417ac536af5c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1173,6 +1173,10 @@ ssize_t tmc_etr_get_sysfs_trace(struct tmc_drvdata *= drvdata, ssize_t actual =3D len; struct etr_buf *etr_buf =3D drvdata->sysfs_buf; =20 + /* Reading the buffer from the buf_node if it exists*/ + if (drvdata->reading_node) + etr_buf =3D drvdata->reading_node->sysfs_buf; + if (pos + actual > etr_buf->len) actual =3D etr_buf->len - pos; if (actual <=3D 0) @@ -1236,6 +1240,20 @@ static void __tmc_etr_disable_hw(struct tmc_drvdata = *drvdata) =20 } =20 +/** + * tmc_etr_enable_disable_hw - enable/disable the ETR hw. + * @drvdata: drvdata of the TMC device. + * @enable: indicates enable/disable. + */ +void tmc_etr_enable_disable_hw(struct tmc_drvdata *drvdata, bool enable) +{ + if (enable) + __tmc_etr_enable_hw(drvdata); + else + __tmc_etr_disable_hw(drvdata); +} +EXPORT_SYMBOL_GPL(tmc_etr_enable_disable_hw); + void tmc_etr_disable_hw(struct tmc_drvdata *drvdata) { __tmc_etr_disable_hw(drvdata); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index e573503f2edf..dbd4ab295b83 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -480,5 +480,6 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, extern const struct attribute_group coresight_etr_group; void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); +void tmc_etr_enable_disable_hw(struct tmc_drvdata *drvdata, bool enable); =20 #endif --=20 2.34.1 From nobody Mon Feb 9 06:05:51 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 95FF9314A7F for ; Mon, 26 Jan 2026 07:49:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413752; cv=none; b=OropKPfK5sYEW9RCrihT27pHiFQpzZRe8af5/wLBS7YMpvNAMYS3Ax/le9/l4UrfwXv4yxDdJe92RzF/wuFqDGT6wypw1thJTTQYs8FRrpNCiiI5fwlNfOmvQ6xIVQR4S6NQ8i6mG+iwvodDkNU+gg6zmrEbpMmnXAkA/oRP8XY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413752; c=relaxed/simple; bh=Zq2mruMCQX8VD0/KR6WxLvO+aI5t0vieYiFx2QbIddc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GtN9JoR0xZmqyGPvVgI3tOWDaf9EF0NmKHIh37yb9T6pYLdGBN3V+CHed2JrhrrWVnbDvanf2QYjo4b9TQt0VeQK9ObcUUDmmq7vSHsveVgkIObRzoVRhg/XsT/mY+JgCKqQHVx3dCDoz8w2+kK4vdSwZVAIjEhzo1WPeKJ1/PY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=HM1B5MUY; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=S+Fzrmi/; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="HM1B5MUY"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="S+Fzrmi/" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60PKvsot422780 for ; Mon, 26 Jan 2026 07:49:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 6+SnHnfj2p+IHMVC+5k2qLRm9He+t+szYkvobbU2XVA=; b=HM1B5MUY0Q950VMK VIZO47ru5JVvnUXecOaghnBiDR6XdnVMitYQTWCqHWjzCFGhqQ40kUyKOUd2dnxU ZRPviZAd3q/gJczRAeNTypbhFEJENvC3wU4xCuBr9xz/y/45LWjn8z10A7ral6QP ER0+8j4NEghp6gyXr5JrG6V2gsUPAHnN0aTwj6rssNAsgsmHCFKlx4jk+rmW+LHF e+OCOZXWRQT+IZDLuzwzm6YV/sApO4Y1U9ek3wcnNqM88MmHRzYwVebE+EdxH/ta o9jZP1V5XQMx3Je76N9bEmBIjc8C12XevQfMKyy4QqPPgVRaimub4yIDdf51XifO n9Tkag== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bvq9qksng-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 07:49:10 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-8230d2a470eso1607731b3a.2 for ; Sun, 25 Jan 2026 23:49:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769413749; x=1770018549; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6+SnHnfj2p+IHMVC+5k2qLRm9He+t+szYkvobbU2XVA=; b=S+Fzrmi/tprmtNk8cPF+473y1979dC4fZ+XNTVHlJ82v4jX6GgN70bBhwIZn0Y2OG+ gaT5aD52kUzladf5uT3YxcKPxfK/9ff0J+Lbbfi4SL373r0MfkYkXup7pEN/2clkyWp2 roM3riranSrwQ6fjxZjF+2mLRcAQOevy7hAsoXH3CvAUIeE+2QXS0JBDUkFbFDWFaR7H 5O8hdBHX/FdYjSAFR8zYX/17ikFAok4JZlblKI9H0dkZwhrv4qda496OrJde12EW4FqD ZbMab+9eeQScQvVNu2eaxw/atON7HfwZKGol2Czg5S6wkcBMJuozznC+8mBlW0mwZC6s SsxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769413749; x=1770018549; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6+SnHnfj2p+IHMVC+5k2qLRm9He+t+szYkvobbU2XVA=; b=Q2iCBCFqgrKaQMc/g4AoJ00GB2EluL/HcLoIV73k+Xqd1chT1yMRqmxNPXYF4UHe5m XNN5UAqynXX+iZS03GcvXPEn9EX4J3t73dd1KwIO1YFhWX9PdQsKT7DhXcVtP+duwuwj qSL8msiciPxiQ8tBJMMPO6CSfyGsY7dnkMIkK3KDpnZR/b+fLgE29lVODYKAQ2/5xIIb 3qTfwjQ5f9omPA1vDm0y+/UGakPkzzXiUoXa0nObKzV6nHn/Wa9NVe5U6gfJP+EEc0Qb e6DRCIEv0uI1pM9Q9aYh2gz7CoYMr+VUAa9vvkyOzoEmSyqNblfCPqzf9vg8BB1CShsK ccgQ== X-Forwarded-Encrypted: i=1; AJvYcCUz3BQqqISec0QT0uZm2qQ2qFQXF7TO/aZTEQeettJp1D09bEhbV6438QN8YSfxrlJ7HuK2rMSjCY8graI=@vger.kernel.org X-Gm-Message-State: AOJu0YwKZlufZCVxYV+1l+I8g2rzGnL52zOFRwgnvzDZOpoJXFqco6JI 3TEhe6BZMVJ7+vqpwdjXK93F06MTvO8NrSnAUN8v1IZvnpB/gr7B+xxdLsOCakj4VKxk5MxQMKL BF8RWojRuZ4YIQSQFxcSoQBhRzcjr+rtWYYXNUJyqlliZ1YMAVm0oLEr8o9JYnITQyC4= X-Gm-Gg: AZuq6aIXVb4hgw5mO5axpvywuP7sBx3jl5yLkEMSfjj0rlJvhucIqW81VqzVGAmeG3s vcw8jecm3NPw4WVaxf2VIJI6EL8Dw1eENFcy1GExYSxagvS2yAY6xFAreKXCYpk5hNzr9KLsEkS EdZot1cmZWprUynIhloT3rp37qHFm89yeEbyhSNbADlDWpg2AXKDdVZncnBeWgV50JsE8ec4W7l l5kIVfTbsKcg/WiAiSUDhSaGEcCN/FL2Kz45AFozdigaCcnevpUG3tBVewYs9M1hOOJtGZEbqmy WosQnnEj6X7wEDGR4NSIruii4CFgVO0Sk0U7QNvTYJAK/sWcaYeauH9YulzAxaK47rR4MN9c8X9 DVPQJiGIVazHR1gWNH7pL1ZMtoGHcgLEBn5IFqZzYp7YbZJRm05Tk5B8VzNw9BrmtOobCkNHkcn CT X-Received: by 2002:a05:6a00:140d:b0:7e8:4587:e8ca with SMTP id d2e1a72fcca58-823412d8c6bmr3477816b3a.61.1769413749259; Sun, 25 Jan 2026 23:49:09 -0800 (PST) X-Received: by 2002:a05:6a00:140d:b0:7e8:4587:e8ca with SMTP id d2e1a72fcca58-823412d8c6bmr3477792b3a.61.1769413748784; Sun, 25 Jan 2026 23:49:08 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8234fd9a5a7sm1223418b3a.63.2026.01.25.23.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 23:49:08 -0800 (PST) From: Jie Gan Date: Mon, 26 Jan 2026 15:47:59 +0800 Subject: [PATCH v11 7/8] coresight: tmc: integrate byte-cntr's sysfs_ops with tmc sysfs file_ops 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: quoted-printable Message-Id: <20260126-enable-byte-cntr-for-ctcu-v11-7-c0af66ba15cf@oss.qualcomm.com> References: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> In-Reply-To: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769413706; l=3512; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=Zq2mruMCQX8VD0/KR6WxLvO+aI5t0vieYiFx2QbIddc=; b=hBgYC9yibRbm3RvEmsxoddJOyjOdnOOeiOlaGWemCh4SAiGZ7YN1/RnoRQ627k51zzyRArlxy xpymxY6V/8lCsLL8zWgBSfDqjMbqHE912Z9W6U5eiRBxx1vlbMvqxTl X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: g5RmhFXS96xpQekJm81JGEI1l86kk8Kr X-Proofpoint-GUID: g5RmhFXS96xpQekJm81JGEI1l86kk8Kr X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDA2NiBTYWx0ZWRfX/pycpXP3SwgE jDIClSAmkKctJ9CG9MrBtGGzEwzNARtWG+NTMxHy9f7QXOT/SQ88RJ0N/H4IUwLlWYNJMmcRLKg ipEmCtFdFdRgFTYZbEHhJej8CQlD+sf2YiMfZsmgBkEw6s3ublnPQdI5QUY4A2Jj+gH/42JK6RY Rn3MjNQKHlRruylqmI5h/sQzvy8ZVhQgyLBuCveYQJM6E+2R19TLgGcgPnX/RDfjLcbQkxi5Kfr xMD4a1aH/HUVgWt2FmD5nRU/orBsdYMdFKT3/KE/q68Qka/rJQCBAJQmS9S99X0pLspCQ2fLq6K 6SgbdLNdKbSQzGJnSemJ0C2ZxkA5u98BdXHV/scrEiu4/nb8mRU4BEl2h8X84sNoTguog19BaiC h9+5ySnnMv+SBBMV4T3wtSz+GXhvPZX6XDDZosiW6POXNKhtmOADR4KJ8TWhrvYNU7gHjLPWVXJ yuVOXFt8e3dijlW/tAA== X-Authority-Analysis: v=2.4 cv=TsTrRTXh c=1 sm=1 tr=0 ts=69771c76 cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=i2GxayCjj04of9N-vEoA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_02,2026-01-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 phishscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260066 Add code logic to invoke byte-cntr's tmc_sysfs_ops if the byte-cntr is enabled. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 53 ++++++++++++++++++++= +++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 32ca2ec994de..95c74405ce05 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -31,6 +31,7 @@ =20 #include "coresight-priv.h" #include "coresight-tmc.h" +#include "coresight-ctcu.h" =20 DEFINE_CORESIGHT_DEVLIST(etb_devs, "tmc_etb"); DEFINE_CORESIGHT_DEVLIST(etf_devs, "tmc_etf"); @@ -228,15 +229,47 @@ static int tmc_prepare_crashdata(struct tmc_drvdata *= drvdata) return 0; } =20 +/* Return the byte-cntr's tmc_sysfs_ops if in using */ +static const struct tmc_sysfs_ops *tmc_get_byte_cntr_sysfs_ops(struct tmc_= drvdata *drvdata) +{ + struct ctcu_byte_cntr *byte_cntr_data; + struct ctcu_drvdata *ctcu_drvdata; + struct coresight_device *helper; + int port; + + helper =3D tmc_etr_get_helper_device(drvdata, CORESIGHT_DEV_SUBTYPE_HELPE= R_CTCU); + if (!helper) + return NULL; + + port =3D coresight_get_in_port(drvdata->csdev, helper); + if (port < 0) + return NULL; + + ctcu_drvdata =3D dev_get_drvdata(helper->dev.parent); + byte_cntr_data =3D &ctcu_drvdata->byte_cntr_data[port]; + if (byte_cntr_data && byte_cntr_data->thresh_val) + return ctcu_drvdata->byte_cntr_sysfs_ops; + + return NULL; +} + static int tmc_read_prepare(struct tmc_drvdata *drvdata) { + const struct tmc_sysfs_ops *byte_cntr_sysfs_ops; int ret =3D 0; =20 + byte_cntr_sysfs_ops =3D tmc_get_byte_cntr_sysfs_ops(drvdata); + if (byte_cntr_sysfs_ops) { + ret =3D byte_cntr_sysfs_ops->read_prepare(drvdata); + goto out; + } + if (drvdata->sysfs_ops) ret =3D drvdata->sysfs_ops->read_prepare(drvdata); else ret =3D -EINVAL; =20 +out: if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read start\n"); =20 @@ -245,13 +278,21 @@ static int tmc_read_prepare(struct tmc_drvdata *drvda= ta) =20 static int tmc_read_unprepare(struct tmc_drvdata *drvdata) { + const struct tmc_sysfs_ops *byte_cntr_sysfs_ops; int ret =3D 0; =20 + byte_cntr_sysfs_ops =3D tmc_get_byte_cntr_sysfs_ops(drvdata); + if (byte_cntr_sysfs_ops) { + ret =3D byte_cntr_sysfs_ops->read_unprepare(drvdata); + goto out; + } + if (drvdata->sysfs_ops) ret =3D drvdata->sysfs_ops->read_unprepare(drvdata); else ret =3D -EINVAL; =20 +out: if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read end\n"); =20 @@ -277,6 +318,12 @@ static int tmc_open(struct inode *inode, struct file *= file) static ssize_t tmc_get_sysfs_trace(struct tmc_drvdata *drvdata, loff_t pos= , size_t len, char **bufpp) { + const struct tmc_sysfs_ops *byte_cntr_sysfs_ops; + + byte_cntr_sysfs_ops =3D tmc_get_byte_cntr_sysfs_ops(drvdata); + if (byte_cntr_sysfs_ops) + return byte_cntr_sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); + return drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); } =20 @@ -297,7 +344,11 @@ static ssize_t tmc_read(struct file *file, char __user= *data, size_t len, return -EFAULT; } =20 - *ppos +=3D actual; + if (drvdata->reading_node) + drvdata->reading_node->pos +=3D actual; + else + *ppos +=3D actual; + dev_dbg(&drvdata->csdev->dev, "%zu bytes copied\n", actual); =20 return actual; --=20 2.34.1 From nobody Mon Feb 9 06:05:51 2026 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 0356F313525 for ; Mon, 26 Jan 2026 07:49:15 +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=1769413757; cv=none; b=EBiCc3wgiJep09oDavn6MNDqQGbDQRUHBxa8x+MhYg3pQLqSj0S07dqr72bVW5cz3ODpvDkzlPNGItXa9BNi9QRjmx5bsMnsSYpjtU48d2CwI8DYgNLew7WoQ3dVRaOl+SzrwJ6otv11uql8Yxx2nZzTJxAWRo50Ly/JK0uHqDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769413757; c=relaxed/simple; bh=U3SBm8Q4F2Lqg46nftP77Qbyf63TqJWnGptxyfW3r6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oaI1voO3HKa7S/u7I5kMJ7LnjvAkrhEaXeIR8AFqp+TardB7sx4/8uTVCN6sp2QAb0Na0YRV5w0nvw7Rps4v0BgHcPbw8FCeBVULNocujPgtHqPhqSP+hkUUl15a0GYnTqubhtQZWNIjRIMX0bvWSlLchVzThBHm8o5NROHc3RU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=AmYeYEYe; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UEqSGAmm; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="AmYeYEYe"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UEqSGAmm" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60Q5UK6C1019099 for ; Mon, 26 Jan 2026 07:49:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=AmYeYEYehVtu71H0 KIhpYPSDb2kinA3gMeSwg8DB95QS6Kw9LHMGlfF/XhKsvlMc85Sg7s5gTkDI77al xq2OMmGNboe6LCX9N38mSxuB4o7iBUslZIbHvZzA8o1aKhcyxKGYNDLrB2aTBpEP R49pjvjaYI8abpBD4D3xOevnRRo7lUgMW2Z7Xllh89kq2lWaRsJAvff9WM9Raotv sou+/1bS9VhAZijQUmWSrkVasYh1/On/baMRUFOMca99suFQFiswiz4AOAsGYTrL ozsP1rKt6rqxFN4o7wJ696Forka5PrMpg6je/NGTguf4lgocyZBfWYy3M3HVhZLb NrZX5g== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bx26809hv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 07:49:15 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-7fc82eff4adso3285882b3a.1 for ; Sun, 25 Jan 2026 23:49:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769413755; x=1770018555; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=UEqSGAmmOVAhri8ONhV2vDZ2fZlCrN4uDGze2CvsnKQGiyKiSY9RHGj7UVRY0GGnhp hqQU4KTcRx1x/iXMzUPd6Mabt8ZqLE49TLgGYK7ehBrO4V19rJxkFmp3nBqab/XAAHSE qLI3IX+OV1z+nGUT0FwD3USbVLSlzDij4PSS7k5nWJbpfOmWAeugiJBrhx32ljHEW9pr W4y5kYMG6kSA6IHO1/gfvLBU4G9CBFlfM+7C/RV8nbqcJ2Z5yQ/CmmW9zuERAmGva29E CCordeEOBOw/MrDxey0WlqKtYIt2RJ1ArdcK/HGFeU+B0uMjtnbqRpS//oFcYp5+KTJH JL3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769413755; x=1770018555; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=DlrvvAsLo/QebUL9JzCQ6d9S+Heyfs5VQY/v5M61pQ7wL0K66QwNiagD2RTUwl5tNz UKsSebBzt3JGrbtTISe5IMzjAB/HosILGsoAEhjkYjvdDneHehq+AsAT5x1fdzZc6f5I h86/BmwvzvlGb6vrT6j4V2hbuUss/wfiJ0D9vczSSebuuwFDAXQPb3VzIHbxMQyoeMJw t8r9uOzH+7eVfyC3eLkmDSK22CBaPFyG9bZNGP/0zZvrq+fBbiY1ATpRHmGDC/a6oGIO qVeZqj9A9oVHke4f8yDrvtCGAv7yyq++W3PV3+gOsitfpPwQWtQ4S7gFcmcfwv2iTkX4 mlNw== X-Forwarded-Encrypted: i=1; AJvYcCW5j4kg7Q5qy8ty4MnoE51t0MHahGpMw/Gh4xQfpMaajPZDsdA2QuDN9ieghtZN5iwOUXAEB5fmPqiWZRM=@vger.kernel.org X-Gm-Message-State: AOJu0Yzfu6fU83TsU5rrYD4tEtTXQ7NRYbtyQ/dLQ1s+fihRgQjSMfgn W6boBT7CFrmlNUNUviWwPzc6luzo3KCbx1YXnAYLQH59JLCJY/+QHNyIihRRxa/yYywtzSAFnV4 kcI4aC/WWmilUEWLrhdYtfQbNzIlZKiRqMw+Xk3atha0Q1xyqIsD05RtcpaKcRs5jX5k= X-Gm-Gg: AZuq6aKumG6iC361sII78ZECZbBW8eiHRp6CLn3+GNU3iLIsZdzs5kI79XvKHDqSVlS UVQRFWDSMJb2WAO1746Eok4WYWSobdb123eHv9eeUftZTZuVOBzYUqfWFq+SEquzoLFFhukw/Kb HYOc3RkIbbZLAoIuU2aJ4NB7eHOkGciBqb4e9YJ8zlLGUuVTEve/+feMmRSv0rYLyiCnSgoxXQc PEoXJtXHR/UvBCqZJAZJ30A99vIsWM1j1WC5npAdVrpmAxSUfO5550ziN9Q31ITALbgwJ/lgDKB fDdse4mvamUS5l95+8lv55yJKOba4eIjPKe1KgF1VRccT+ErYMMehAM1rLWi5Y48HEQzhW/Xdqp Mb1X0f2IogQC0a46BcRieukrkyS6ybjUpqDKX9JdZcB28oCtK10A35GcyH7r6LpwFEu2En2B+v6 FP X-Received: by 2002:a05:6a00:8088:b0:81d:9862:a140 with SMTP id d2e1a72fcca58-8234114ddd6mr3939379b3a.3.1769413754717; Sun, 25 Jan 2026 23:49:14 -0800 (PST) X-Received: by 2002:a05:6a00:8088:b0:81d:9862:a140 with SMTP id d2e1a72fcca58-8234114ddd6mr3939338b3a.3.1769413754236; Sun, 25 Jan 2026 23:49:14 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8234fd9a5a7sm1223418b3a.63.2026.01.25.23.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 23:49:13 -0800 (PST) From: Jie Gan Date: Mon, 26 Jan 2026 15:48:00 +0800 Subject: [PATCH v11 8/8] arm64: dts: qcom: lemans: add interrupts to CTCU device 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: quoted-printable Message-Id: <20260126-enable-byte-cntr-for-ctcu-v11-8-c0af66ba15cf@oss.qualcomm.com> References: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> In-Reply-To: <20260126-enable-byte-cntr-for-ctcu-v11-0-c0af66ba15cf@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Konrad Dybcio X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769413706; l=769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=U3SBm8Q4F2Lqg46nftP77Qbyf63TqJWnGptxyfW3r6I=; b=c3fl1Yn5d+S/JHZtZgPGa7S7m6K3H/GIa1tLJGLcn+2zhh5RXPn5Yb5BBM24+SyvhJ9NHbxLI WUStbQLUzctDbGOvcdjUgxHbg9ibXBmtMIbL9fRjVw0A2+itS9OMGgy X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=bIEb4f+Z c=1 sm=1 tr=0 ts=69771c7b cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=gBkj9RZkAcI1HbXH1KoA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDA2NiBTYWx0ZWRfX48LwIeXDvbBL fEqIhMEdVXAJj8l8ELp7fc/Y8cgtJ1nLDNyoiLrtmWM/L+jcfvd0hZjwBaL7qU+tVCkdtNCAAaC yg05WNKozdH5DlYCgmbGpKSdTcJ1wQGXWPBGXD1FAi19XmqXzT4ZW41n8IM/g4a2pCebTShCj08 DGuurFWbL+FEAdsdsCAQvQV0CmVxrNXtBz7uJfjdaSVJaWiDr8L5ecHGE0moF8un3DqO+122BDl 0HDU9Cu6pSFUM7iwUd1ow7b7KJZlMQqaNgFdVl/PKK9AaijK0c8dun8YjhCBPYp1xqwDIVrEFT2 mQ7OtcHP3HpvoIbrsyPn0jkThON0S7bNUjFQI0vvmERuJnQa4AbJqeLPfFHuHZXhtJiPW0TDLmf ME+QewrC5AsQ6Amk6dGU0tl0CGwwhrfrBQpjjIIyLgkCTdGrJ25+eGq06NtTEmJ9OWvccnTLgd9 o6mtqH+ThXIu04UAVAA== X-Proofpoint-ORIG-GUID: ArADZDbYFFjYv6IkR77AsNmLl7GYMylf X-Proofpoint-GUID: ArADZDbYFFjYv6IkR77AsNmLl7GYMylf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_02,2026-01-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 spamscore=0 impostorscore=0 suspectscore=0 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260066 Add interrupts to enable byte-cntr function for TMC ETR devices. Reviewed-by: Konrad Dybcio Signed-off-by: Jie Gan --- arch/arm64/boot/dts/qcom/lemans.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qco= m/lemans.dtsi index 0b154d57ba24..75a468ddbf53 100644 --- a/arch/arm64/boot/dts/qcom/lemans.dtsi +++ b/arch/arm64/boot/dts/qcom/lemans.dtsi @@ -2776,6 +2776,9 @@ ctcu@4001000 { clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1