From nobody Fri Apr 17 07:44:39 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 13C1D344D91 for ; Mon, 23 Feb 2026 06:45:08 +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=1771829110; cv=none; b=AjSx0lWP90KPGXxieNaZ1gWogGoLNLW+Do7JwDmRHjY1svwSaEnewiq6RpzgOcSUjMKsQoJsRbl4PPn59jX4U3UTftpnbAPLTw34JHqSFFFxFZH6KA1dPI4HXY/ifDdPWSXswa8l0hemB06H4Z2saY91N6pi8ivKQlNsv/t/WPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771829110; c=relaxed/simple; bh=nzaF2yP3ATiqQC37LSxmXVL9MqWLOY4wwOUNTmvz/UA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=neG7S/uFchIYfINl/IkRHYrAP8NTkNGoP4+zA33tLcnCCmiIWX7vp8WXJHilsdJBzGBTUXPEFBvVCqdegF+FXeJ+Wt9IBQSr9mEdnqs+ohbwM7jOpQ2UsqZBbMAIeiF2l9YQRtMoyL80xU8Eum3jXDVapAO/ZJVVV4EuvKP1hXE= 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=Gt85oWnE; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Vp00Lynt; 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="Gt85oWnE"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Vp00Lynt" 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 61MMt1Wd1197849 for ; Mon, 23 Feb 2026 06:45:08 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=Gt85oWnEcPTFwVoq 1Kz7eSbhehMXi9y4glNxoc1Ppk/rS98AEXxikS2feuNsldfPtVGcvYjANBuvHTyD zX9s9/Q+Liu2Ctn2SOXpNmbtKbB/ZUNPDRU8MCBihMm+4SgXOE3ea3uuhVXJwm4g +K1/Evk1WIXqLZXhxYXdEkAC1nMFs2W6HKqdFa8Grkpp7nWMXLh94XrpUcSNhndH XHflUq63rnHX+Zak1vofPjnMM/1PipFuSQdmntf1Tj9+/n6WSkRFTg1wkRaX/xsw olm+kdEeO6evQ/p6cgyjulXEyKRSwylriVyHc/8oi0m2w08NNctrlUj0CE+oZAC9 JfRTgg== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf603kp2d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 06:45:08 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-c6e1d074b26so2428783a12.3 for ; Sun, 22 Feb 2026 22:45:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771829107; x=1772433907; 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=Vp00LyntECTNNpSEO63RKajMaHQ6haOGQHFPU18P3t95MpVPkqs6XCVfWc2VVzgGEn 4SrHYuJOum+MBxO5DJgJB+mYPUs9RF5WzOmhpFlNYL5F1k91yIl2wul/1MqhjvdgQM6L TGz9WQeJOvIYXiGBNr6n0zUUBnZgnnXVyYgtOJmJX8c/NycwGJO8/2rOAsEcT5uhwdOK jmf2QQP3GN7eiurDGhpwWIZGza9E76GZEDzppm11iEEXOBD6z8RyiZIk4j+aWTZddxZl 2BsA/2TUQ/mpUjMvp3oHXxob7YC0nUCj8lf++YmvJRTZRFVE1m0mZ23jM9hG+/YnDfPF Fi3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771829107; x=1772433907; 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=XP3RHAj6NNk6DYe9E5ldtmRVhfHvFpx9wcmmqKSfGMwPi9hm3iqF2L/DXcpnA5JPiJ yJF8fZDqPSwnYPBw0NyXx3pG7KkADWtMno6m9aGp826FN+r4FWT0RBbfJkEq9TxEMnVA q9Ox1Jr/B8gLkDttVoXqpiL2/1rHfAIjflUpG9hhaJKTscblUABWw6IRaNv1cnpv5svt GztNS4ZyTj+wLIoKBKZaS+NUHSgmPPxBuUtwYsHEsvvRofHG3NGsrjyPVNlcqqiPsORD Icc+jsMHMSEKHPxJY9cF8pSrj3CtpqYgGkWsqTVSvEdgH9FDNRrssUmeMU9gPiGyJ4IA 7GwQ== X-Forwarded-Encrypted: i=1; AJvYcCX8pwniDiV6X/7KuUd0W7Ah8laL4Ggz4eSELr/Z4lnDG9zOmwXS4ZFxsiHr08IgP2+vvJrjBjt9KMSNZ80=@vger.kernel.org X-Gm-Message-State: AOJu0YwCNtpqPV6LODpSpJdX9FB7c8Mm+md2FX024SHgUIP04xaaho1y ecnClz5iUnsbsaZWETelCjlXO3kRlXWhp8Et/E5jm5NV1aZCKuL37K1RNcJI1fvVPuCa7S6gcl4 RfyNf0EbfxiXL+VxB6Anjf3PFFhMIyoyFo6UK1eDBm29oztycOJzXU/0OaUu97ZiPq0I= X-Gm-Gg: AZuq6aKNzz8Vx9/FrSXTrtv+NpA1Du5iVqOEZIKnH0yit9JngOC17F1BOokEFAwIaBw URnWCf79V3mXzaBq9HgqxI06fTgLwMDozY9HvUmCctkQKme4aGjMhwk3W4JwFKGfkXKr+RhBSG0 UvDvavAd/n8hK5NO3zBISvrVdULKiOyWKxalgSw5YfPfMY0m91jAHBfHHtFZuallqGbKm0ACWUm yaDedixJaahg60clU+84mR5u1JdGpKx6UrXGyyr+W8XWaNbbXPLIvs8Gc6fbmRq5H53g5w2NBAg W7qPYQKDvv7mhjLlJ0ICvbdmuPika0XB+fxqPqcCVbLgukaQK3x+D/48dreh2JHHdyF0UTqGrBY AA4I/PT1hHpav7D/7fG0EzxNBofLtPo7Z1+CIokvFdIkWC2hFX+9Ia4yVRdnusvh8I/D8LLaPqM la4P5vaeJ6eiOh X-Received: by 2002:a05:6a20:158a:b0:38d:efcb:2e84 with SMTP id adf61e73a8af0-39545ee9279mr6513136637.32.1771829107437; Sun, 22 Feb 2026 22:45:07 -0800 (PST) X-Received: by 2002:a05:6a20:158a:b0:38d:efcb:2e84 with SMTP id adf61e73a8af0-39545ee9279mr6513109637.32.1771829106926; Sun, 22 Feb 2026 22:45:06 -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 41be03b00d2f7-c70b71839d6sm6483993a12.6.2026.02.22.22.45.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 22:45:06 -0800 (PST) From: Jie Gan Date: Mon, 23 Feb 2026 14:44:37 +0800 Subject: [PATCH 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: <20260223-enable-byte-cntr-for-ctcu-v1-1-042fb35bd37e@oss.qualcomm.com> References: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@oss.qualcomm.com> In-Reply-To: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@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=1771829096; l=3771; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=nzaF2yP3ATiqQC37LSxmXVL9MqWLOY4wwOUNTmvz/UA=; b=6PX0+KbbUxmx0pLLi8jsGxkcATkRnlG4xmCYKqJnrQba0pudV9Z7EqTAJVU86wlPFlBQRecKN A7FhRx5xw/lD/7MPk7J4n0yJTu3Q08Kr9uXwdywud4R2PpUsgmVgP17 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=XbWEDY55 c=1 sm=1 tr=0 ts=699bf774 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=qQZ2XtAyJf2dEkEvaVsA:9 a=QEXdDO2ut3YA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA1OCBTYWx0ZWRfX1ISbwPolW3il Q+iAYPpuFvt05fYNGOOV82wSM7x98qIPWGNJoEuqAqC+feEoFLSnNi9Sp7qpdvZs/c4SeyMP39z lzRLlgSf3ZeCr4D44rqIfa7yPCyQ4X12AeXnlNqu8t/gK3VN89WOyS48nyWvGPKsCSEZS9CFJfl nKf9BkgGkgZSJkhLmiTbMtKNcJl6L978m69d7IPN2q2yzpNQz4vaYONRYPsO6ngyx3aLm1rBkuG QL2Zzoelc8440M3TvPJeVn5og0cCPQScVdC1e6KOSWsDHK5Qk/ROv1xpz9xc8HfMGGitSPnuFG/ IUsBTvgGdkZzCupqCw8kVsTONYZQmxY57ndGAqqOTJGJAPDykzEoYSP8hyZNVn2R6AEw2IUkTmQ EF9H2n/374g5FxD7Hz0nFH6vixQ2HqoCvPYoJaJdx8AvOVabPdJmUfum6+6BHcDQmpSemB69zZn U1BgxPnWkQVxC3s+zlA== X-Proofpoint-ORIG-GUID: 8HFwvtvmirDVAOoewnsM9mLvaGF5tZ-X X-Proofpoint-GUID: 8HFwvtvmirDVAOoewnsM9mLvaGF5tZ-X X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_01,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 malwarescore=0 phishscore=0 priorityscore=1501 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230058 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 Fri Apr 17 07:44:39 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 E3EB4347BD9 for ; Mon, 23 Feb 2026 06:45:13 +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=1771829115; cv=none; b=FYd0BRHAENktG93MGI585nXkh/MyC2DYHxeRg89Gd6GL8xY6/S0exUzbj2YaDywi/YP1Bl4H6h8WG3nqUEstsP2BtZsHZYehK7dwmIGqxNNBifCyhKyrGqzcn3/c0mgjaw+c5Tc8bQ7Eez/dclh6Tk70kYDSxCmszWi73ErWuwg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771829115; c=relaxed/simple; bh=fR8lvHhL4oSY/n5eSl541nai+feNwPd8lhB8kmyGxEU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OoovRhW7XjpyoPRYxTTYjcqwnW17xYS7Kd7NaUbVVEHfiTaGVG5ec6oqJKzKxE5f9v95xuLz+5YFThQ2neia43eyELu+iUMW8jMxXildxbSlu5l/W3IsbSSbKBpKMfskK4RdBbgrk2DyjUwj+MaQVD0Vgbdo2d5diSy4IgZOi1w= 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=MPLVNK4u; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=bQfWaJN0; 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="MPLVNK4u"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="bQfWaJN0" 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 61N17nse2203676 for ; Mon, 23 Feb 2026 06:45:13 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= ovOi7Obm+BV74hN+gFqooWA+6V4qnwZ8iCgfUiGKqmo=; b=MPLVNK4uhQ9LU3oF L5YSilKvKcCmYwwZXCZNdCPFrtDF3oBtAydmYJw2ID8mu4802EMGXWPFR37rcgvt Zvq61XT+Xv8yEhiLnS77GA3CzicxdsDix/HU4cNXbynmBhb2hzArl1osU1tWWSFO lTqpayni2Du3dOa6JlbGSBWwUICTVXB7CqsDN2oHgMqyxGRhynIjZNfmLa4Of3RT j53dgtzGOfAuSUL7wYqWp9djTkCMHNCRnR76q1AFBmdMgu9F1JfOp/n1tYn/ovW5 F2tWaI8sJC7rimKNAPOP92mlWGlXlKmftCK/xV/pEuPV9x5YvfrCSYivigmcVoZO 6vzMYw== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5wbbp05-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 06:45:13 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-35464d7c539so3833460a91.0 for ; Sun, 22 Feb 2026 22:45:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771829112; x=1772433912; 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=ovOi7Obm+BV74hN+gFqooWA+6V4qnwZ8iCgfUiGKqmo=; b=bQfWaJN0BbO1xFd8dtufPs3/YfGFBvWVRQfJREvo5ejN+8d212rNZz0Q8GoRyjAvIn imc+EIdINGPUpEilh+Bl4sryspQnKr+Q6b1o65MJOrLLFkndO03sJ0MjPX1rBJxalNpT 3BDXs/R/7GVJ9p5Y2LEBz34BVAYWsr9Q5kXedt2TV/Su6bTvvSY9GDnQD9ghQpHyR3+8 PDhKcY8pc/HubZiKkJkTkfPLLNgyV6KCsakAGXBsIxgIdZdS7WO3E7dAkE9s7B7lx87d F6m4FQW+8abLxXAhMPSdv/wWt7PcaNcIl0WvhoJmW/cNyL+7gfZfnblNM4hi7Oal+jvo lqrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771829112; x=1772433912; 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=ovOi7Obm+BV74hN+gFqooWA+6V4qnwZ8iCgfUiGKqmo=; b=BU6MRR3uWE4zc69N29I9VxQa1AXJyzJkh10Y2uaExDWBNijUPeJ5g5FO/cioXDaY9N WEyQTFTPLHiOk72JfJHxzA8Hy/Ahp63KciP5DFZmz+XzVRHU7dWCguzl4CMjwl0S3W/i w0X0acGvGJ7pY/Suo1+hf3r81y5iFkgsGZIp+HnGOuHGkuWHPV8t3wkgdps2AHK+BeIM X92UDOLtgV1+i2kHERETRBJhJmFx0yP86a19X+McfpvBYIfZFA+1xrX1QnSaq1uqYnPU HC24+2YcGp7xHUe6e+tQsu74JjHXeqZuOhYdjFMinSm3+FNDgbWK3o8ZNacM/NFcexPM Q/Gg== X-Forwarded-Encrypted: i=1; AJvYcCW19w31i1iFr/WV6zCYWnn3FbmXYzmJu9boa0nDL0L4VQZdo7+zdxTQMrBe1pz82Qor250QHug04bICp/c=@vger.kernel.org X-Gm-Message-State: AOJu0YyvT6c1HeJe5Lo3iqwl7h8LikF8st8259859aLxwglD2UD5vNuR gzq2Ueyk7En4Nam1XUXPMksCQlATIlL+rQllJjXLKntLFusjuaniCEf+rHTe7/GdLBy2Wy9lRNy ndJq2ccSaOr+5eQPkDLz1x86aA8wiTwfRwuUJlmoUTGe4nRTJIB9iO81WZAz5c7iZPaQ= X-Gm-Gg: AZuq6aLsM3UQa6VnFYhdha4Wtf3DhDjBWkjutJOLCfhWyfHlDcvQwNcQ4c5cQxrFupz NiF7Yh0QCHxxlbnQ/qFv22mJLfGDdr7vVsVOws9JcC3YeM3EEGIFakqv93sOHyhKeOxBgKiFQUQ 6/FNINizdLRaqCAy39K20kku6Zjg21c+LQHrB2bJJK8fRdeBSiNjF5fMbUTexn2fIS+PZMEaoBe 2xzOQSz+BHoRd/HBOUS45Hz0jIUGnuxBYPBXyqF0DjOIkPBfmuWAgIhjDIABpIoZA34mec6H2CG gcnSzDoqrqeSzTbMXhf2IGQKxJldNkQnQUDfGc8UoIif71OwjLVu5LfWnjfTG4+zLUpxc6JmDEm YRtCRL07IpfAScvruptAy6xulNjF2A4f8pKx/2W7pbQq0nOr8/qJL+AsOxb1prOX/wHWYA7rclX uBsHGtdYd98HUp X-Received: by 2002:a05:6a20:918d:b0:38b:e7a3:9d17 with SMTP id adf61e73a8af0-39545f8b3b7mr5728356637.49.1771829112144; Sun, 22 Feb 2026 22:45:12 -0800 (PST) X-Received: by 2002:a05:6a20:918d:b0:38b:e7a3:9d17 with SMTP id adf61e73a8af0-39545f8b3b7mr5728335637.49.1771829111648; Sun, 22 Feb 2026 22:45:11 -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 41be03b00d2f7-c70b71839d6sm6483993a12.6.2026.02.22.22.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 22:45:11 -0800 (PST) From: Jie Gan Date: Mon, 23 Feb 2026 14:44:38 +0800 Subject: [PATCH 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: <20260223-enable-byte-cntr-for-ctcu-v1-2-042fb35bd37e@oss.qualcomm.com> References: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@oss.qualcomm.com> In-Reply-To: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@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=1771829096; l=6164; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=fR8lvHhL4oSY/n5eSl541nai+feNwPd8lhB8kmyGxEU=; b=uKDG7hCuKtaBtw/peRApH7rv7DLycTy9TzsIu7InQl620hTm7DtJfiAgUqwvyMjC0iPtMCqFD PO1vXtX4ehKC+WpBAUXC12qHVjta+Na+bwaeM3TG4uG9wePExyakbQK X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: KIYHCZmTNBP2aqqyNV9FGHuWoAUTxcUe X-Authority-Analysis: v=2.4 cv=UZlciaSN c=1 sm=1 tr=0 ts=699bf779 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=pN8Znu5onTEf3dnVCfUA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: KIYHCZmTNBP2aqqyNV9FGHuWoAUTxcUe X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA1OCBTYWx0ZWRfX0ckMIqEXxrYU pevyeEOFXDZO03tbBDKURiX+MKV93SkSDVv4zIK0EUrkrc5EDDsntq5u/GY2NJ7Sfc+yJ/YOmw+ vAUMAIQjivNfJzFt9+YPGnC36apo7kPwtGi24CMT0WMBGZFuCvZVHI3d/uT7C7btbXR6lIwMxbM T94TopUNVnRhnrQlU6D/HbjG4X8sF27WWamvRW0ge1HKxLfDLDpAMMJTtPUc6tB/aAtDOo9abA2 fc538a32ktE7ewsh0kZPyfiXHAix2Lg7KgVqveFadjmBrZxrKDEDDhIkLlRRUG6ZMNDUg2KFFI2 vV6GdU2FI8sXMcY/sXSgDng94La+hDTL2S1ANQrSasU9vPGb2k37zULZx3NtA0d8dVOgu6bhs0h pBmqrR2Y0UBCeBgCBt7Gw/0FZzEeoZio/pBi3HfTRorAz9nzC9HnI7V0FtehWF+KEiSioOgCvlf 0jZcUWRoHa2FCTJy9JQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_01,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230058 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 cee82e52c4ea..081498162011 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1920,6 +1920,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_obj(*new_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_obj(*new_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 319a354ede9f..57d8394d09b7 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. @@ -245,6 +258,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; @@ -275,6 +290,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 { @@ -447,5 +464,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 Fri Apr 17 07:44:39 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 8FBEF34A3C5 for ; Mon, 23 Feb 2026 06:45:18 +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=1771829119; cv=none; b=DllR41b5/j1+HCz3ToUXlFidtCQbhFGV1WK2TZmX29ix/eU3PYttMSNz8wUfA4KS9FeYeDEJWrJZTv0oJcNzGMagk6CcR3/sPjdoQxIkIIx8GPaMzrFSLKovNzhKpPKIGNjpcgt49R3ZPm+jsei/xMZY5YrDco2pR/PmHxhyKUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771829119; c=relaxed/simple; bh=wH5nsU/eD/1ygNqCsVaoWKHsLxpu0A62Fho+0L9SEqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z2ZWfWZ2p1wiQt4fNIcfA3oXZvrXPSZ4n4Jy+mrpKngeOO7MxeE5HTk5+44xeAy7T7OWswpwcYgvlNdMBa5EkZB7Xr++keo3dKxIyIS2McKCErmEptR8ZimN4lNpheNws7zrl1dkUe5L44kwGO9Lp9H67/Ir16rNcDM9Ap/QvnQ= 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=mhGmyFwv; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PfnKLtK9; 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="mhGmyFwv"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PfnKLtK9" 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 61MMx4DL1953696 for ; Mon, 23 Feb 2026 06:45:17 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= oLBqq1Ga3quq8yhCCoDLuhaEl8VPL3r4ILjvN9DeBME=; b=mhGmyFwvDVVEi/7Q AgewNAIbJw7C1+2DMq+kuog2SX1rLWtDTsD4DOnIHEK72ZvDFr9dSwJn0srVCjmm ZroJWtCNG8gKFpFJ5wG/9HEpyAND4aa2uLLaoPkuabEDOVyi1HES9xxppgcQZQxE s2AVdSsfjSO4payuZg+gJ27NNya6VTB/y0xdQlpHfFXfJXrikhY1G5X3mx1Fbyh3 hJxC1VgdPSK3yM6IikY9sTQIl9JeIMojQctH3udksoI02//IgQ3G8XIkV3qlbnya 7nfsEkjl1JMaX7377vf5ej9dCE6W88j/oN8alEH1LvWz/omp1WKmeOziAO4uje94 dmn2eQ== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5wbbp0d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 06:45:17 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-b6ce1b57b9cso3639230a12.1 for ; Sun, 22 Feb 2026 22:45:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771829117; x=1772433917; 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=oLBqq1Ga3quq8yhCCoDLuhaEl8VPL3r4ILjvN9DeBME=; b=PfnKLtK9OJ48NSuhMMEdfMdxVCQY0t029wdNVh09dL1Wsdt7q+c8XtkLrfim53afas MtTdxbearQOcdfx7s9rxZNHuQIw3Xlhk5wJYOqZV9Ed/+Q/RknuNLJoyVggcgTPatlOY tGqFIDBz4DKG5a5tGCCau0BW1/UmZPPHVHQQDLEoMdjYCymMYFW3HRtyJcvHNs9OAWl+ F6AawSsoRDUNO66ozsTDCdCUhwD8FMJKXQbNfPBEDAZuR4pn/MxbBN/1bTktRNmCjFSU b3HNA4fLOFSCXJyoFZbeUEFQFQKcnwlhnPDc2GlNortBDlvkFpHiskPerSiVkmO9h6e9 N9nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771829117; x=1772433917; 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=oLBqq1Ga3quq8yhCCoDLuhaEl8VPL3r4ILjvN9DeBME=; b=gmvFiWVqeqE5/cwKT8e4AyE2vg6RG7piOb5fjAGPvtgnS6hsxE9IbSR3cIqLyaypB+ XjjPEtJOkFQD+wuPnieDzpf+H0qLh6pf1k+p9pd24dh2Dn8IOFG0m5+Hr0Jp0K50vD+U WcltHD7TGyZWQbqqg1DNlVluOPPqPoLK0glY35qSTdigDtPfqkG5Vk8tb/1QASDnpaq0 EQXmzgOwO8f89iHRGOfsmyoIwPHrgnlrkmDUYoLoc9IgMRyrhW3NVKlAcgR/eKbtn6dX 0YCOPRs/7BecUjPZArQzZI5GghER+KPKPBEdMobHtEflALowTgrZgUI/1jhwUIRld1Sa PT7Q== X-Forwarded-Encrypted: i=1; AJvYcCUTTe4BYs5Opnh1Rg7Y8Bg0kKopFzQ9uotzlhOAT9ws6hDNpHmXE+v4qYdO+jqW22XLm5WIuV8uh+2SQME=@vger.kernel.org X-Gm-Message-State: AOJu0YxVeX/3dI8jfN8oIjf9x0d2OkpZsO8Jc+pNX7AwxzMuuyib3KVn VFyxAuDgJI13bxpX9Fv79Akw56Bc4VufzrpN5CYL4g/VqrJWZ+eESsRKSeFomHpoazzBssBhVxH BOCBE3k0s+lUTnl+wp3yycG343gyuY4g5NUyrF7rwaIL8n6waJsRoNAMH8KO+w/sRAWU= X-Gm-Gg: AZuq6aIGVpjIpIS+ewqpGuBKdc6HDfKCgFRjcoKtPlhcyKo0+2nQK9hDyGtM0NswbnW LqUf/B1PseNi6Az5nbN8Q89NHDPviEqkknIUGOf6PweusKLW4AYbHiriq0dojWYv9PKfzzVpffa pV/7OwVYgn8MHsXBq7ccQjax12cV/1MI6XzxsRB09/nHnkoxt4HQY5oZqfsucGdzON2AxW14rl8 N21ceOl2a5tY6B73gqvbjPVvaqk//7g4lAMMisjClGWCOELYOOjfUuAK7BfMiYqcER+Z+GyXn/m waYlCR7ZaE94TXIZfBppAPNEijCjvD5QV0XsP0P6DJf7L9YR7gy0JLwYouDXCIrUiFuvF+muAW/ K6Azjxndev4jZFC9G0AMv9AVhFl/XvKHK4LHhU/Y8gwZOklxdjzwbyLuuVuV5niFbLIbHWtpnX3 VFh4IgozAVG348 X-Received: by 2002:a05:6a20:958e:b0:38b:e9eb:b12b with SMTP id adf61e73a8af0-39545f5619bmr6143374637.41.1771829116906; Sun, 22 Feb 2026 22:45:16 -0800 (PST) X-Received: by 2002:a05:6a20:958e:b0:38b:e9eb:b12b with SMTP id adf61e73a8af0-39545f5619bmr6143347637.41.1771829116409; Sun, 22 Feb 2026 22:45:16 -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 41be03b00d2f7-c70b71839d6sm6483993a12.6.2026.02.22.22.45.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 22:45:16 -0800 (PST) From: Jie Gan Date: Mon, 23 Feb 2026 14:44:39 +0800 Subject: [PATCH 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: <20260223-enable-byte-cntr-for-ctcu-v1-3-042fb35bd37e@oss.qualcomm.com> References: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@oss.qualcomm.com> In-Reply-To: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@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=1771829096; l=5212; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=wH5nsU/eD/1ygNqCsVaoWKHsLxpu0A62Fho+0L9SEqE=; b=/Ol5kPXNRuyJ8aJ1B7Rj8Vw2iXt3pEy61jXNtUqmXNvS31VweILr/0p2h37cdoRqTQekIAjUV rSAmP6UDBNHA4nLOVAzsdsz+bUgp5Md1LtWq/TO8oHVt2/H4L16pMoQ X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: XqxevJ_UJJw71Q-1lAxDLfJPBHHGzEKr X-Authority-Analysis: v=2.4 cv=UZlciaSN c=1 sm=1 tr=0 ts=699bf77d cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=ia3uihG--C1vaqsH_ucA:9 a=QEXdDO2ut3YA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: XqxevJ_UJJw71Q-1lAxDLfJPBHHGzEKr X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA1OCBTYWx0ZWRfX0GmMjRyhxWcy FOkzzcQm8atoAZ4e5nBhOHkpGE/ylr+71QwihwiTYIFAo1a0x5yIGbu9xku2zay+qMSkir96bxN iTEaUzvXekSHUEYdf0UEtkk03erZ3j6kdb6CMk7L2JHY2ElfPXrE4poG/hpxyFT2He+S/lHt7VD fXHSLAtfhfuLuqrc6BsEt/+3XENUAm8iwe10s/RDyDbTwwH7bxu9QYFL1K69KePurxEFSZwKUpm dnY3l62KezTeqjHxwHnVGqmFEDtqvHYN8qku2/JJ9OJKfZuKRsGnpAap06idXo+gPfHakt5VhMg 8CfchoygmtwcFcYi8xIzgp75Qy/mPED+A/ptnFCNVtIqcOkFTQ08N/nk2yzlIv6PNblf/5o6I0b QPdjHM61A/UOuL3/cK8pJ7LfbAvp5FjmZ5395INLr3m7JxzRYy5bcRTTYkLPJ9syraKUv1Dnzb9 4ht4cSMiPxM/bCcs3AQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_01,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230058 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 57d8394d09b7..92ffaf771fea 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -260,6 +260,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; @@ -292,6 +293,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 Fri Apr 17 07:44:39 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 E544934B18F for ; Mon, 23 Feb 2026 06:45:22 +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=1771829125; cv=none; b=GKtzKyTi1b5zKBjTD8vGsBS1yiGomnXeh/zWazZ6VSB5wptLEyZ3dMfKLm/eJx+iqht2WKY2oK3HiYha7mFVLLQ5nTDxcIhPkBRhGkEgncEwyYsIlsK+E3KtZB5baVZ4g8bJzDK+xoIEhYWmlpckJqNfVYE/xHcs6G5TBHaP9Co= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771829125; c=relaxed/simple; bh=XbEF7lfm+dBjOkALDpKb/LLjuMBdmQi6ikgLxJ96uLY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T13NucF9rmWVQ9BmAqKoM1U+2txkoSUE+GbqeMGePd3A9H9YUV9F2s9J67mB0sfE5fctAnEgXgvXGAqcmkObM9xAJQQawCLz9biknpwaojObXjDLkDP5XcMzK1D7ccOfB8YKk/5NhPmdxbkvdxBi61Kyjji1cR1Jv3UL+KBA4MM= 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=RLjqLK1b; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=d+f7WHFH; 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="RLjqLK1b"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="d+f7WHFH" 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 61MFj11J366810 for ; Mon, 23 Feb 2026 06:45:22 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= sEr82x2IlsxHod8Ic8W+n2/1JQBsTzrJLVgT1R1I5aY=; b=RLjqLK1b6P+q9cVI aTsxfOg9QjnjKauIsXAgHXXl5ZnbsMtCFVaRb0jguBtSzanNdw4JsO7xoWQv4LzJ NrWSP7mZUFWZl68w57siwDjCHO63eOkvBChnn+F6vsFRBhOwXi8D1djqjOAnU3ve /23d6A5yfiDE2QA6KXg+boFoNlNXWFvpbB/dPPjVBqGMwq1QQK434RHXnW+Qo+gu PRVYeFsyS5ygzpTb+UNVP6wpaeQsVRPOwK8j9EBeo8DO0CLdtBioCptANI5xHze2 zejVmqsiF6d0yDqn0EExMvvXvYNPDgCEbsqqZVFW2GfS7gXmJlL+MOdC4wUzn3Ql PeV2XQ== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf603kp3e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 06:45:22 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2aae146bab0so43513205ad.0 for ; Sun, 22 Feb 2026 22:45:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771829121; x=1772433921; 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=sEr82x2IlsxHod8Ic8W+n2/1JQBsTzrJLVgT1R1I5aY=; b=d+f7WHFH6C4bNmmk+n4j3pwe4coXL6PSrTVtmS1ze3hMIPw/JCc0rZ0ARdJWso4eae 45oyRKYGGQK+423XalmXyQcdCxKjJq1YWQTjthgvAkxxzKl8iX1IZ8I8Nww0mM57Us3I O2W1ilz4vaf/F2V2KGahFVJr4gAICeK+BGxeyLPJIjZV/z3fdZ4QG1R8PMqkf9H37znQ q7DgqH7hNnY4Xh93evwKDF5+gBhvPE7MkNcJ5MWV0Ul3OnevEVEgf8hjR2i7pelb1j5o FHDlzLV1JBn/Q0eDL1whzyZz4MwqaMrRmyaH8uh6/f1k0UQzOwqxAeBHvIx69QMhClYs 08lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771829121; x=1772433921; 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=sEr82x2IlsxHod8Ic8W+n2/1JQBsTzrJLVgT1R1I5aY=; b=B+mGNfsREr7/SkNbl0wDrMKEjEJHolCt9WwR/kdokiAGoEr+et20Nagw/9fUH9Y7nZ DBZCl+dwW5SVQYzPpzvL9UzqNI5NlYS0jdzf4M6gMfmW7OG1v+V+B5FN+58PD3su9nhR tSNB4qRNbSGw2cjsRjwa8WNoizBo9wnAu48/dL1OyNuUd2iaVWOuvuJGajG6MLT70c+4 +KAlmQfscojJ6PhNMXX6IU84V32cgzxDK2FHagI0M2u1aCzOQBGP6NGkY+pG4+PcAv30 xV25Mn2hLoqaBojeBLvwUoOCRg6ZJheRhmHRFfedvK7by2k5VfdjvIHjoNBLT6IMmjfa NRRg== X-Forwarded-Encrypted: i=1; AJvYcCXLobzUWJhh/ckVTaqjQB5rkCWdcAmAEKR+0hg1r+m8hgpsxns6R3FbixJ0PRtpq23SujWcUA27msRDvbc=@vger.kernel.org X-Gm-Message-State: AOJu0YzZZFb6jpaVSXdhsC3follZ8RaO0rz5JabA8F16BuJe4JjWvND5 iDiLdM70wJidPH5eao9yMQdWb5WiaCvYoP+OfK0P9xzhZ/UHGMxo6wyf83CupNwKzFDpjDwi2UT M1A45OcxmpXpSuo5PFzrUa9QKwhgRZj1lZajTqXczhD4taJOPEasVwHGA14dZW7KzfBE= X-Gm-Gg: AZuq6aJMREtOtuZE5hLFb8pZKRE+Akd/56q0OqA8AYOsGKPpgRH1YWN1syNsXkKQYsi JQxQj7QB6WvovoX4Ul05KBYXWvapIYVMMTLt86glqvL2mCoKbdK+T0Kn3yLQyECNqSqktLa0Q7/ 8GkEwjS9AvOWJaiQ1x9I41uCm9Fp+QZtbM+qBN0F7LtzR9/TBTSOgn5tm8JVZT7wf1ORKcnvC94 /6J3UxVehWHHFVcekeDR52AsXw3jOd7DHvnGCJr4RB+RyEpkrudaJrCyYFzqNZ52BcB6qXEhDlg q6WB2KFlqxxBygl0bk0Fi2ZyaAx6BG3WtA18OIPatSDAV+BlVSFMWTTBvgkMxGYM/bIT0q+zHvi 7afi/g+kqpgu5qUNA6I/3CJ6z5KGTsDZI8s4I5KflqIM7eZUWQv+FwRmQ3gNMSw76c4hzNyu6f3 4vMyBGvf8D5LKQ X-Received: by 2002:a05:6a21:a34b:b0:364:33f7:7338 with SMTP id adf61e73a8af0-39545e549f1mr5199018637.8.1771829121499; Sun, 22 Feb 2026 22:45:21 -0800 (PST) X-Received: by 2002:a05:6a21:a34b:b0:364:33f7:7338 with SMTP id adf61e73a8af0-39545e549f1mr5198991637.8.1771829120967; Sun, 22 Feb 2026 22:45:20 -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 41be03b00d2f7-c70b71839d6sm6483993a12.6.2026.02.22.22.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 22:45:20 -0800 (PST) From: Jie Gan Date: Mon, 23 Feb 2026 14:44:40 +0800 Subject: [PATCH 4/8] coresight: etr: add a new function to retrieve the 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: <20260223-enable-byte-cntr-for-ctcu-v1-4-042fb35bd37e@oss.qualcomm.com> References: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@oss.qualcomm.com> In-Reply-To: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@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=1771829096; l=2348; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=XbEF7lfm+dBjOkALDpKb/LLjuMBdmQi6ikgLxJ96uLY=; b=78YAd59lTYgK/tbuk4c/MCEBFv3Qi22W8s2kk+5gInZxrUZ5yMqCCGi8XGwxyb0DJMjyylj4P 9MW/hrvOYgJARBc0EPCuuyhP5TvWAoEwTmX6QCFeolBXLkqpz9JPvJ9 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=XbWEDY55 c=1 sm=1 tr=0 ts=699bf782 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=FuIWbRVyn4pKkvqW11oA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA1OCBTYWx0ZWRfX3YJ0yewTJQBe I8tpzDhUVKvK2ttmFIli5Z0ew5S1SeiqM1QTxvTvro1AIyycRIv7JtN+3ILN9jik+PEHmI4i6fG ORviMy4GAR+YlwesDft+QVH60VBflnWj/kgQnCKf85e3/6ZxhITCxDJnDqtRklKoxf10JJh4SC+ Sh1+a53745mm8yyvxQRq6275Y+ZbqTeQysIldPzE9mVQh4ufxPEIUEyY18S94bMfyDNkNfSYk9c dzHbIdwqLm542MStsudUo3ZthgmCgCim8fb+gwUJrlvXKv7q1e1YYzaqe7w5KmFMdjrXTQP+Oie nEYDnSVWQyOcFZHGbWX11LCwtYy/ZM61urb4SWFmU13tbSkZnVTiM93D8/I4ISC4VZM/1mysmuK 0TwDZA/INDInfNcdFOkFPR5o9mA9FOUDSElwE+aWF+CI0iNgkSB2+AGOUR77yf4HlYZfOvwa+l9 mfSDtqb5LSPtFPpUVFw== X-Proofpoint-ORIG-GUID: ZL9eDVgYdncbOkMhbrrj2TTiwkFh_up6 X-Proofpoint-GUID: ZL9eDVgYdncbOkMhbrrj2TTiwkFh_up6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_01,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 malwarescore=0 phishscore=0 priorityscore=1501 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230058 Add tmc_etr_get_ctcu_device function to find the ptr of the coresight_device of the CTCU device if the CTCU device is connected to the TMC ETR device. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 24 +++++++++++++++++++++= +++ drivers/hwtracing/coresight/coresight-tmc.h | 1 + 2 files changed, 25 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index 081498162011..32353980964a 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -867,6 +867,30 @@ tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) } EXPORT_SYMBOL_GPL(tmc_etr_get_catu_device); =20 +/* + * TMC ETR could be connected to a CTCU device, which can provide ATID fil= ter + * and byte-cntr service. This is represented by the output port of the TMC + * (ETR) connected to the input port of the CTCU. + * + * Retruns : coresight_device ptr for the CTCU device if a CTCU is found. + * : NULL otherwise. + */ +struct coresight_device * +tmc_etr_get_ctcu_device(struct tmc_drvdata *drvdata) +{ + struct coresight_device *etr =3D drvdata->csdev; + union coresight_dev_subtype ctcu_subtype =3D { + .helper_subtype =3D CORESIGHT_DEV_SUBTYPE_HELPER_CTCU + }; + + if (!IS_ENABLED(CONFIG_CORESIGHT_CTCU)) + return NULL; + + return coresight_find_output_type(etr->pdata, CORESIGHT_DEV_TYPE_HELPER, + ctcu_subtype); +} +EXPORT_SYMBOL_GPL(tmc_etr_get_ctcu_device); + static const struct etr_buf_operations *etr_buf_ops[] =3D { [ETR_MODE_FLAT] =3D &etr_flat_buf_ops, [ETR_MODE_ETR_SG] =3D &etr_sg_buf_ops, diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 92ffaf771fea..27dd72065c60 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -472,6 +472,7 @@ static inline uint32_t find_crash_tracedata_crc(struct = tmc_drvdata *drvdata, } =20 struct coresight_device *tmc_etr_get_catu_device(struct tmc_drvdata *drvda= ta); +struct coresight_device *tmc_etr_get_ctcu_device(struct tmc_drvdata *drvda= ta); =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 Fri Apr 17 07:44:39 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 AFC70346AFC for ; Mon, 23 Feb 2026 06:45:29 +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=1771829130; cv=none; b=TvDh8166aK+0U1U96tz7Nt0yAFAPTtL+hRxSWaqQC3/xlAdWOKlYN1ffvc6lTfWkxoKJtZN/s4NbLt3U1EbGWhMIRP2C5UdiPaJt4JdfpZssns5AwXPoxfWbWdF0BlLdsk483liAxoY0eK2DrBmcukV3qNCaLZLKbFzwTiMjjhs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771829130; c=relaxed/simple; bh=DsL6kcYT3hY1q2jvZSOp/rxfO6RBNAUHqHA9yEMzJAk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=axH0HaJ7p21NpWP3LXpXB2esN+ocX040ZjBTO3V8r7EcljPt242MhDXlh30Pm8UeiMHws9KCh+by5VPJAsCbrdOusavyBVL45TtmoyJmBGNHSPJq339S9X59wGD5y1mYk1+CXL0UDc4QrlVEQC/zWAInXm5mukuDKwhG9+VzwvI= 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=ix8DF9Lm; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=P1Jd+C/r; 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="ix8DF9Lm"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="P1Jd+C/r" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61MMne562783699 for ; Mon, 23 Feb 2026 06:45:29 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= 5AiUjeizRXgIt0pWaEk9wGXXVAIJo5RCeKWJBfIhvcE=; b=ix8DF9LmUni4de00 khCA1SoUKSQzji7xApq2vVKqZnzWhrhtMazw81w9FkUu0cWCoNvAwDL6f0XJ1TIg nlt9VBJ5ttdURFiZREuaK6PrQNBDMpo19k/lDPAZnzZ+pMTPUDC+yoig/ARe+/ea 2q/pDn/C9J8iZPQLC5y7jyBEMTYJi9kHRoMb7ro6P9NHrHmT53m6NlfqB4NxI9Pm 0/qVjWyIhrPHXC2p75hPxkEOGT5tVSxLrycYuCXTQ7RBtjH+qBYIuaem4wLknEir l+5KK345ulUFbZD+40LH9y0qC8q/ZmMOdHHhKDYiMXjeIdHzLbrhTPTFMb2B9PXb e+X6FQ== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5vgupfu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 06:45:27 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-b630b4d8d52so2832896a12.3 for ; Sun, 22 Feb 2026 22:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771829127; x=1772433927; 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=5AiUjeizRXgIt0pWaEk9wGXXVAIJo5RCeKWJBfIhvcE=; b=P1Jd+C/rDCqOzWoYidZllU2/p98XtWT1rWzMGkH8ifMgHzWh0s1AyxIAdQ4lZs1g4e 7Zil+9RWCEi/G+DoKutH2AGp2MW0/O82g5l++QEu4IJclsBuTbh8WHCJM2LRGfS9RFqO Tkmp/+931DyaEIrfpd4lyQnSeXceU7E8OVOIa3wrIg2yYfqVZi0J3UvEjDlXUNPyuWNW Qp+dsD2LwhdJl+H3cYKn3HBi8TTRVf2hEQ2CEhAWiCr0LOff+CJwCMr01Vu1/EyTKi5d DzJKGDTqqhej+oPA9AW4B8vZ1Idhvp5XlgJ4H1rV7jtEeVlCNG44zRuYkZnT4+J5quL0 bTAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771829127; x=1772433927; 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=5AiUjeizRXgIt0pWaEk9wGXXVAIJo5RCeKWJBfIhvcE=; b=a8o+jJPkObF6I/Rc21286pWYY3GGOpxE5CizWEzh6zdpwNvf5tBVCDJmrJs6U8fOq4 GZDRZmSkIDBoxTClZlhStDFsCMvq7klsHUHN2M55VDgC9YCj3yNk4M+/uCJd+9eLAPW1 Kmd+mqwUGo5GbvP2XvsED/VjgjoyKGQYRfSiZlUsxx8PPyqYqGQnio6DVShrRzuT7aD1 GMA3+IK+vhRxqhv/kmKm2ImvAmNag7Q10nnNKcGCB4XrMEZp+zWu5NLOxef78v+CevXQ eZE6KrjRdUK2h5W4m/myDXe9W6Z51AMPPkgj2/jgd0DGIlsmSiJ+1a+MBZ7lzH+G3BMM Cn8Q== X-Forwarded-Encrypted: i=1; AJvYcCV7pLCAf4dOfLCmvComXgiICjhvOVYoczI1W4bZO1+v/hyhPyTZ0m7EnQ3MDYjBoDs8HPNGlRDfve/n12c=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5Zb6O/4DKpNL7Hrt7713SEJyvrxlTW/g2ftFDo68rrKWhM/28 31VkZy9t5s5Axf6vPVXkYWlp7e33ANsOwbfuTI1WuwgfAmbP5kGi06e7zneIF6Tlt+juzv5Oc0Z IYOm2WXP5x5s5ob3e99RIYkh/eupdtsruMtbfRMZhbkpwUI/U4y6yNk3lgQSwUGD2AIOVN+I3V0 /EZw== X-Gm-Gg: AZuq6aKHdiBVMaVl74/13UXcwTQ4KsPYOE1rf7uWttYNqq9wHrQ4lA8WgNyoREWwy1J rDgajbIF/HZyD2xvz/EpOB/vfnGZWBT3fj73BZXijl15IsALXeurV+2LjQRsYA4ygOn5B6NBSac HK1QPjU16t0cPNCSvGsz/DttzhZSGqHGqv0IAD+zthncCic0U/C91Si0qvIqtx9nTvmf3uaowvm 7y5co6lRfVtOqul9tpapVobtmKffIJE55aQvQfdOyPQNh+YRaAfyZWyB9DuhV+qT4hTWApr+YKz eDzQNBdP/63frhKmR7y5r9bDDkSSfS9bSc6ZOu4wAPTQ7zTwYhsf1vBNYeCrkX5OfK9pKbLzVIe DxdgT8BBbjRJ1neFFiwNU7RU0qp+IJ0Vo0zC5G1oX263YGSnC2deR42VlG1pvdcd5ETHyIEHR/T jJ9HxnICn9LX52 X-Received: by 2002:a05:6a20:258d:b0:38b:ea89:700a with SMTP id adf61e73a8af0-39545f55426mr6544376637.34.1771829126540; Sun, 22 Feb 2026 22:45:26 -0800 (PST) X-Received: by 2002:a05:6a20:258d:b0:38b:ea89:700a with SMTP id adf61e73a8af0-39545f55426mr6544342637.34.1771829125924; Sun, 22 Feb 2026 22:45:25 -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 41be03b00d2f7-c70b71839d6sm6483993a12.6.2026.02.22.22.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 22:45:25 -0800 (PST) From: Jie Gan Date: Mon, 23 Feb 2026 14:44:41 +0800 Subject: [PATCH 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: <20260223-enable-byte-cntr-for-ctcu-v1-5-042fb35bd37e@oss.qualcomm.com> References: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@oss.qualcomm.com> In-Reply-To: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@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=1771829096; l=1751; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=DsL6kcYT3hY1q2jvZSOp/rxfO6RBNAUHqHA9yEMzJAk=; b=dKirz3jBPCDSlBfWyW2kjkYiVvnjbcuEABUq5s5D1lABgfXVMfeJ6WvofATkXja4IF8NUrRI8 mJYR53CJLf/AIv70geMxfmLFBU3Su1cx91BAhNV81HGkH4DOotQqnOF X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA1OCBTYWx0ZWRfXy8bGZNSAGlA2 UQfAHf9nN+43tHzox+VUTTDw5LqQGU0MkEriyqGV9WtKHyHA9wIyGGoqMgF68qN2uW5fyWsR3dU wnmREMo7cyt0ilEMdPfBrXmd1umGGsNTV/L1KEDbC9BpuEOiBqChogmjYUyUWnaLjYI12pRD0Ke /zczMIaSgQT2YreDDRu+8pAYKMkAXazGfN9p0nWlhZqHM1uSqhZSFqm1aIWEPoQAaHzQPTVDQpc bZQMYC/YP+RaYBizOK3Ix3Ua0K2ovpXpczQA7daYJKD5eL2jsQj1BFmCoSkNZePWs8Qi7lkWTe0 tklUcTIEUUQouyDryYoT1NAatgXyFrtFDAD/Ktt/5+BK6aSouF2My6j4zmHLBtVR1ETPyH9wTdH B3PHq/UCZ5CZwTXbDjftJ2jfsHmapMkfdTnZOO2Cj84fuh6GC2Nf7kOQwXEQ2G2stxmoK1OxOCY YI40toHPFJuzYdoABug== X-Authority-Analysis: v=2.4 cv=W+A1lBWk c=1 sm=1 tr=0 ts=699bf787 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=gSyxy6DGYGa4b6s9XCEA:9 a=QEXdDO2ut3YA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: ZmKf4GBlfvDznMAZlMYVmEHzA2d0sh8_ X-Proofpoint-ORIG-GUID: ZmKf4GBlfvDznMAZlMYVmEHzA2d0sh8_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_01,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230058 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 e002f87361ad..2981001a7d7f 100644 --- a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml @@ -44,6 +44,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. @@ -65,6 +70,8 @@ additionalProperties: false =20 examples: - | + #include + ctcu@1001000 { compatible =3D "qcom,sa8775p-ctcu"; reg =3D <0x1001000 0x1000>; @@ -72,6 +79,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 Fri Apr 17 07:44:39 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 3F9DC34A788 for ; Mon, 23 Feb 2026 06:45:33 +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=1771829135; cv=none; b=CqcorV+hmiF+geobvN8yPNIUtLkfoIi5DNDlAAE39Q73V5vV91rxG0tdrpn9nzyMid7A8kQBYsgI3jKAzgzXc9qOFP7xaDQWOZVIvx7D2sqi4puBQZr+fWVL5vD450NG23Rv0YDsiAw4vM7TUUMP2Al6U1hP/wOiILmF1hcN57w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771829135; c=relaxed/simple; bh=PSFyCTD8XsFN5DnKm90Bf8IQfG9qwIw/GufXvDirK9w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CTCWs2ORyxbSZfCPSsQ3DVt7mq0oA3cYGKB0g28jg4Dz5bNpdyXsYqtGND0y4zJps2kLioylBDIGtVu5nup95Ve1EhnAGPFt2+cJo4YVBTZCJCYa8aWmnU/f//B61FcZEhe3OwKjCN0hQW0g4xj45aj6oSWIscAnGHm3aLwpA5o= 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=cnKQrC48; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=DXVsQp9u; 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="cnKQrC48"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="DXVsQp9u" 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 61MMt1Wi1197849 for ; Mon, 23 Feb 2026 06:45:32 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= a+f2aelFlTlRKGk/p4jbUmXoQWVOXGg/ifJWTMb0PcE=; b=cnKQrC48nrlsB9wZ TdP+gG4yMIab4U0Fsa+oBbqz6WavtdJ68lJ3DMiWtucrD9NyQHtBnLk6t8g6uJtc KG+pxWHHMhAVt301jWX8OEILSD6g4a4sBHUx7A8RZ3WD/hnpBFkPh24BBPHE/oK2 VWurlFdk3vXe+hXj1QDJF+mCyaU72gsd2aD2YmHufegOpcnnafW2wfYzQqOpveBY lXIzS3mOC6lAAauQ8Clwy0y8Mv639mZOIL59ygrcQK6ElafCpdyJSQeqanFf1vfQ 4tgDv+I6icjmRB6SCiS3dEmrDLRwgiHpbuXPxKuXlGJ2uD7uUVD9LKEZsBUixmq/ 9hyEnw== 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 4cf603kp3u-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 06:45:32 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-824f75913c4so1816835b3a.1 for ; Sun, 22 Feb 2026 22:45:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771829132; x=1772433932; 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=a+f2aelFlTlRKGk/p4jbUmXoQWVOXGg/ifJWTMb0PcE=; b=DXVsQp9u2x0W2A9e44d0J5A2Uye1L5FF0faRBBgBkOdeTIINv4oVE/hgFSQZLLLx2L /iVUeRg6339g4/c2R0LmdzXNjeoUyBRrCCQgpUGRPIFkbGFrVl/pCfHvroX35rdJ9IUA Knysy2e61uqvjgpUvUd+zHsCHETBXylxlqa5disFQOFeU4VeUms+9hlkHc4kAfLm72hW jHbYKjB84rJ7JIE/tv0myhkmN6jYP44whb2n2DLUUJyJt4egK1ai1vu2jo0Uig0cvBz6 hcJK0Wrdl6UfN2ktQY/moJyRxj/sBLHRZKUsbuFtbOziFu8liTfN4rfcrqg6zZGguQbq d4Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771829132; x=1772433932; 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=a+f2aelFlTlRKGk/p4jbUmXoQWVOXGg/ifJWTMb0PcE=; b=wixl+xxx1YQ5LsjKwW5hg5vEdsFMo39NL1Hxxfj67TrInYmXjjZpdTVkRpLCDrgwXZ KMTS0HotukapECLFrY6BjqPwYg1KXlt5C56NCPjolwqgSx/R2h2n+coxG6dRfLZ4fDlf Z0nwSc+0xZwSgR7q/gwBZecGtYHdPbllVVtcN+/Es4+/SCRM05EuMzdlX0hrlPKqQbWv yYrX+BejVM31SXzlhO9QOz6RGQbUkO9qVUnMHcsjcBiO8UAXqr/pAS2If7/MIm3KKWSN 70vFTl4NcauSYZjYZdM1j9eH+PIG/bTfutZ14gLle37ZsmrL7LPYEVb7R35e0Qn7/Fe7 SYzA== X-Forwarded-Encrypted: i=1; AJvYcCX1q1vO/4YvWuxfnMP66l3wvVlTCgghIIZNL13mMGOvpXRAUj8/GVLoOQtA2IL1kQi/ibjQ0gIs0KsUuoU=@vger.kernel.org X-Gm-Message-State: AOJu0YyObBktwrIn598uVklC5DIDuwyRG0snGA1DfXb5Ya8V0r+1O5KW E0ZyPP6vI0UX+N1YinspW1n4myYJa++X0j7pO/vtbsucyp41odIx0v7vQMsHbmMy0H6tjZqPDOB PT6XflTnImJ+NbF5LvTjbDV12S7/KKYRuE7tUp0JMkf+cuKHzowlZ/46GlBUQH5ZVdqA= X-Gm-Gg: AZuq6aJdjZu/sPQQ7HnZkwUe6/0y3dBorMDRSF4lxC06wgRDoiDhIZdXIuSWASq4dgn uil1nlSpo433hwRQ8PB9dTGW7y1OHZWgP3/xDqBG3UgQ341srvlocHxjMVw+8teha4sQQiEwaou zSDGlTeFZS7xbL2Rl65Y0ZfT+pu8RI0yOCM263aQ6JBieLuCcTDJ8wjUimxl250dVQhWGrKkXiz +0XGJLe0mPOgg8lEUzFsQESudM24MzO6c39W3o/QVNzaO8CYaNVHaKsDaXHXJkjtQe9iopz4uyZ huFD5SjS8h9LW+G/8xbqOFpuBq7xPraVf907XLLjp4LgPCQVwdanHMeNPGtU12YM2eVkhnvvj9L 0Fdo512V4FbomplHS1pkZ0jYxAaEdLb8KHpNR/DjI8Zlzj4d9bLPhJ+zrtHAAy19vhWGKpFGpWa m5m1/DQWKlRStg X-Received: by 2002:a05:6a00:1828:b0:81f:a842:276a with SMTP id d2e1a72fcca58-826da8c0e30mr6284457b3a.9.1771829131485; Sun, 22 Feb 2026 22:45:31 -0800 (PST) X-Received: by 2002:a05:6a00:1828:b0:81f:a842:276a with SMTP id d2e1a72fcca58-826da8c0e30mr6284430b3a.9.1771829130839; Sun, 22 Feb 2026 22:45:30 -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 41be03b00d2f7-c70b71839d6sm6483993a12.6.2026.02.22.22.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 22:45:30 -0800 (PST) From: Jie Gan Date: Mon, 23 Feb 2026 14:44:42 +0800 Subject: [PATCH 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: <20260223-enable-byte-cntr-for-ctcu-v1-6-042fb35bd37e@oss.qualcomm.com> References: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@oss.qualcomm.com> In-Reply-To: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@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=1771829096; l=24560; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=PSFyCTD8XsFN5DnKm90Bf8IQfG9qwIw/GufXvDirK9w=; b=KCc25b/S1pFSROCegbebaN6N9jfUB9C4VMoBDBZTXR9qtXlTqvmoT2EBnlwjUfMHRtpucHk/0 ROzJEdXNut/BVEy3QLp/pinVQC+s8IRLznYjdmVi8cxvF6O6ZYhLVUD X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=XbWEDY55 c=1 sm=1 tr=0 ts=699bf78c cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=TrPPj8Ph-2G9coJyck8A:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA1OCBTYWx0ZWRfX1HRxXLEWHMXi mJce/cs2KARZYCisXWYl0O23y+q5F1s347fYpBWN6ZG4ezIbc6EGGL63HRDx36HdyMCJsTvnccv NdO9d0S37vgM1Q3dnI5UFTQ6vju152oyKGtp0ZQdiMJXByZIZwOcCxxxiAYVRJ8SA5OSmlSAWJe uvI9FxzUimsTOw6Th9tMEOBtSQEbbrwqGMynShxv6te9qRqqKaH8SGLxeZPOAp7ga8UQ3WVrtjX lfSzWLf8T3U7oi634Npk6sWrHxFa7layDHk2FJ27PCoTQHVSZg+xv0p9qrpcpahRPOMh5Pl27Xj W6bbE6eeRdHI4lqjvQ9Bv5gAojaO2l5KY04r2W6+IqkB2xx6dDY8IGbOsgnshOUwtnyaAdYlo8K Qamn5h2Bt7e97An+zxaIcjqzDcivihvu81lQfMmMkR5beEKyW9VqHEwAicvK0WMSL9/CGkDIJhl xg+RQfm0Agc+MVPFgUA== X-Proofpoint-ORIG-GUID: QThZF8qCIAAEixT5GChpBeQsllqrhVSV X-Proofpoint-GUID: QThZF8qCIAAEixT5GChpBeQsllqrhVSV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_01,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 malwarescore=0 phishscore=0 priorityscore=1501 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230058 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 | 367 +++++++++++++++++= ++++ 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, 563 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..a58a05491f7a --- /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: February 2026 +KernelVersion: 7.1 +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..bf59e654465b --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c @@ -0,0 +1,367 @@ +// 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_ctcu_device(drvdata); + 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_ctcu_device(drvdata); + 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); + raw_spin_lock_init(&drvdata->spin_lock); + } +} 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 32353980964a..83514966df5a 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1187,6 +1187,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) @@ -1250,6 +1254,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 27dd72065c60..d60c70530c8a 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -482,5 +482,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 Fri Apr 17 07:44:39 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 E24F434B408 for ; Mon, 23 Feb 2026 06:45:37 +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=1771829139; cv=none; b=WFny2bwOAVIygSPuzjInRQZaDWnBZ85AnI3u39U9qbfsu8ee/M+4STbCtnDE5efOzUZDDs0OJ/nW3QS+nFlKencqS3/8xkPh2e7qKJ2do5tHa9tvBexSUikkizInYqhfmtOavNlRKNX6JFcCLDTWBbc6q3J3B1yJ7frUyGsfcfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771829139; c=relaxed/simple; bh=+caVanCR1MkRvTlDCUseywuTVg2NMA0xm0dQkI5ZlEc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o92ywJ85rlPH919+I5GX/AwjbydpVJs+qO1SwCRBiPer8WLVQfY2VuJLmE0BTotgK1RoFSY5XAKhe8NOzVWcs7jjb/C9WymlciMCKZJZeLK4jg0J6nh9hgN1SkiMYlDDXOdaferJvCxwooltqOTfORPv0F3GDdKVCjNRTKjkAV4= 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=kQr8LKbn; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IaNSpoG2; 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="kQr8LKbn"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IaNSpoG2" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61MMNgTC2211942 for ; Mon, 23 Feb 2026 06:45:37 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= jI9VMtFL2iZSHiAcQIxgD0sR6qS7voT+SLIQjeTVTZ4=; b=kQr8LKbnIdWOnO3q E5Bo3HZi2RVbxdnWm+EJxOggxeGkG8iTO3a0PiF5aCrvHtQUgAoZ6wIoABNBHzDJ T4N8D53Ng2Wg0f7nifMxXcXnIpiRRGl8Z/aKkI78yM6V0Jlpyq7nui4tRFlolCUw vtQFXBHXdwBajDGb7Gg1AtYL51sXnFfBd6d0XLLhWmBTupuAdYOmdvkvYfelVrkn TBFZKiozc/EW4xkAFJfZniDSPZjRqxKvFSiWkRp4GjLxXYcyYYTaP9SejQl6xVWI +f5NyyGVtijiHeWhF/t+4MPLZaTfPwb0fcyT2YsYr1+/h0+9LcwZ68/AUCWCP5ue 0sZijQ== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5v3unbe-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 06:45:36 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2ab0b2e804cso49310525ad.3 for ; Sun, 22 Feb 2026 22:45:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771829136; x=1772433936; 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=jI9VMtFL2iZSHiAcQIxgD0sR6qS7voT+SLIQjeTVTZ4=; b=IaNSpoG20y1bZD+gFlTqp8mdnWtC76QUqA62MuBmXFDOA20Ggr14TwcnylwSKVSHJj HV27+gmMgmWt/L09wKSKqLWLml5e6Oaf9sadjfER31rC36ZTgzXIipVrxqb2gKyETcHG Y5Uw3aTH6DWjTCpDWGXqDGzpa3F3KuLQEXB2Xp1TLwE/Y1lrH8Jys40q6QYWk+3D8JtJ qMllJgYVduNylDS2ZEV5hG3Ng4G7hEhxglswB6pCqlYIhKEG33xjLuTz4oLR3BTdPH3I E++useq3a640ZAjLna/aFyRsh4wJKuDggfvdr7D6hNXWtlaHWk2idvdtqGwNM8+49JJ8 LeNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771829136; x=1772433936; 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=jI9VMtFL2iZSHiAcQIxgD0sR6qS7voT+SLIQjeTVTZ4=; b=LHaQuCqtWbZHyMSDBmA+qVKl5JhSqelhUgbvkihIPFfuUSG+98ZHYi4DbUiZUkwbTG 6X2VE9xLhP0ssrXT21xKxDUmLAAeqLC8cR2MNU3CfSRawuhgSxzytuw62F4y0VwJd2oy KgvQsu/Nr5eCJwkY94QSwOb5C6n86Db/1N3HjFhkhtWBK3UHAs4QloK0yAeY3Ge6LACk JJjZGJd1eO75nAKQ8m2DN9nYNBKpV5NVoVCCXcn3lNa5IGs3if/Ok4AjXrH2C5Jc6HlI 1yt5kT9M1C/AzGkKJKgRNwL6v4yrzc7aKXG+dX/hoyIa6e+Ghj48ahcSJdo+kF3ydLBc P/mQ== X-Forwarded-Encrypted: i=1; AJvYcCUGRgr1eum6u+d1q5+3ksk7vtuH08ZPW5ry4kIVsSS7BGeVYwFditvGqg153ha1IKkcAZrUxG/oZYCofm8=@vger.kernel.org X-Gm-Message-State: AOJu0YxrhGQqAK5JcN+0E0rQtyy2+2OS4jddoh+LQ4P561fQsavmEYdU SCaQQq8CXOcx2gSg5QwnwHNMdeAE1BgrXOwaOgQ7nxA0Yr3gK414uNXPzLTV5xASaVGyTdqDH6d Hhmz1b2eX/0YGC3taJ8G8XReAtQ7EgBDOjI1BzYaB0mHRE3RtFgYmVtEQ0/RiI2BGhso= X-Gm-Gg: ATEYQzxvzsJlAUyNDFkABYe/2JfgK7FafQFxtRkK2UIqnDGI1G71fV+zdnVfi7NUJnM Clk6NiQH82QEd0yx59DUem6BSy8DEIuYdoUe3zj2q8GrNc2yTXRcizFxeqYMGtwArQtAOcgRnBj HSw7CJth+7SX/h9WjCqFyzQpIWnuKN+DZii4P5aM5jhGaBHls8dV8paOpnSA4j1xaLgvoATeYGD AubHL/x1Q9iESgPm4rXFaXlby6r86z/14LOr45ga7dNjA+Q+iaYhj54v+sxZNx4sBz0w5jxEfwc 9nal7cNgcm/FpJY7hccwyyjcZ+rg7zrlNCJiiz/Ed350Z7xvEopsbXB1tPJrY5YOAK7MX9/aVee VU/3UfmI3EHW1bD//xwuXkSDq/cEJ//vMIa3yk+NrYad1xtk7hqZOBoy1CQuqKpMNnIOSQKj7N5 gpF8QDNmpR39OG X-Received: by 2002:a17:903:3850:b0:2a7:d42f:7065 with SMTP id d9443c01a7336-2ad74511791mr53085125ad.27.1771829135920; Sun, 22 Feb 2026 22:45:35 -0800 (PST) X-Received: by 2002:a17:903:3850:b0:2a7:d42f:7065 with SMTP id d9443c01a7336-2ad74511791mr53084845ad.27.1771829135433; Sun, 22 Feb 2026 22:45:35 -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 41be03b00d2f7-c70b71839d6sm6483993a12.6.2026.02.22.22.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 22:45:35 -0800 (PST) From: Jie Gan Date: Mon, 23 Feb 2026 14:44:43 +0800 Subject: [PATCH 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: <20260223-enable-byte-cntr-for-ctcu-v1-7-042fb35bd37e@oss.qualcomm.com> References: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@oss.qualcomm.com> In-Reply-To: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@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=1771829097; l=3465; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=+caVanCR1MkRvTlDCUseywuTVg2NMA0xm0dQkI5ZlEc=; b=3ejEy2E3BRft9RB3V1QrLiiFOb5rAhjQ2kogpVIj7yrQui20Lqdro3f8n7UQxkghk9OuO/i3C +8B8KlvbavECf4ep/LIJizpUXLv2Nv07u+F8EQ8f/XXbFEQIKNcQx/J X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=YL6SCBGx c=1 sm=1 tr=0 ts=699bf790 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=i2GxayCjj04of9N-vEoA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-ORIG-GUID: 0j2zRuiUCmo7sDABGZPs_IwrYDOOlEUF X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA1OCBTYWx0ZWRfX9X0Tjpo+ysnY zA/aupQ0V1dB5X3DarUZ2sIgQqwCT1H9WnwFNKIqo3iJ1ZeTxgggiVs1S2BRkMoGR23AyZiFYyf Nx405DiSo/ix63EpbzYwMPajiFovMQU2XF6AGVee8lod0/LPSFpbpQNYRXhg02GCUCZrVQY4TLL uhuiaKdx6f1Pm3yLhCv3WLL+mhD8anC2gov6plYJGAfgFhUzWxyZAiA9ljmgILKOFhj27W6qzeg f1ycPqX7iDaAU7ySJXjCEY3k707kblgRkmOdg6uPq6ViogJ1mVElFZvFWxl4/vPqBPAGGrVQYle ttGBB+xTB/65kSMQWPr5bV4IhV7EQQ0FaFob2sNa/plib5wBsQ+2wwSejXrmVpYtTlMHjl9f1zT PXSe+LIdsy33KK6Ypmx9+5QLPT78ZA6keOm3SyctvQenjcS1V6lt9v0bf1MfMmFaJLwILpk/SKQ ROLS+qGxq23ZqZtSYcw== X-Proofpoint-GUID: 0j2zRuiUCmo7sDABGZPs_IwrYDOOlEUF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_01,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 phishscore=0 impostorscore=0 suspectscore=0 clxscore=1015 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230058 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..6486bdafdddc 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 *ctcu; + int port; + + ctcu =3D tmc_etr_get_ctcu_device(drvdata); + if (!ctcu) + return NULL; + + port =3D coresight_get_in_port(drvdata->csdev, ctcu); + if (port < 0) + return NULL; + + ctcu_drvdata =3D dev_get_drvdata(ctcu->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 Fri Apr 17 07:44:39 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 A664434AB17 for ; Mon, 23 Feb 2026 06:45:42 +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=1771829143; cv=none; b=ewpbS1WrZEFXHDV8hmYiS8d32/ZpzQsIA5Tby98RvETbW/+NXClzZJ997xF0ftYT9uVYf/TT3ZvEW8iLnJjEYef6ROjHz6zLFXqwzWBJ3Mq9VCY9wJ0p/CP9ZcEL453H6zHOVN/ba8fC+LF5dWPqfG+bI+w7i55dRnjWbi/nMXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771829143; c=relaxed/simple; bh=0MADiRxGeDkPQDc+D4cOyR9YpPfqVXFTQN8hJDo+rxc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n/9NoURRV5svQq4loDYnsV5NsVKQzTQeT4AznHtHnUCcZTBmVKL03G0J6N3udnbIIzFtiDCFo8xvZTQPz5Y3N8a7kmZkpnVAEL+X4J73fR9FHqQBuihrmGmPQ1DOc8Ch2HlneULe2FInoCEG3W49WVzzAadazNQROxX43Eg7ISM= 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=pPXNeC5N; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=FldUu3l+; 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="pPXNeC5N"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="FldUu3l+" 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 61MJtpIG1150263 for ; Mon, 23 Feb 2026 06:45:41 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= Q+6sbBvItLVDaaK2nVoqlOqVJ4lF02bwo0WaOVku2Og=; b=pPXNeC5N16HuJEvH NNTVLdWJKjRpycH9VZwxi1Pl9MsXFMI2y1QzyOD5sq9R3aM6mzht9joPQ+z8WoJf iwKPoujoYeYJu9A0fIRQX1MqHqOOf0WmQUZBVXLYPsAQyB9Al8NyH/ijJ1RclWdu g/Xn3xP/4aIMlIFec9KmOCihOREqbMfZCNZxibQGkCwsDAoUmvlU38cGP2mCVB+o KIatDV6+CwnC4P6I1QbILRz3sK5P7K/nFOSZCGyeFwhuUg+Pto5m3lBP/bQwM7ny 9IZkN3VaRSgzskW1/+XvlTjWYosVfun8Sj1itZKm7KT8ZJWVABDNTv/qOM8yOfE0 uQzOnw== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5x7uq58-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 06:45:41 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c6e18b8fe1eso3203379a12.1 for ; Sun, 22 Feb 2026 22:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771829141; x=1772433941; 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=Q+6sbBvItLVDaaK2nVoqlOqVJ4lF02bwo0WaOVku2Og=; b=FldUu3l+js+aH4e8G4bg5dzdqQGgK/kIvqncTv0UIDKOi0WrdOOsliCYdGDmcfa0Oa LWEtvBfhXQKL3b++W1cMfdX1oq80m8pvYLFx0WkywoBVYb4uFkz6B8Pmy81P+3wYPcBs YJSJRKICyr+/SjRbXATU0w3a3HU3k42vVhQdcPeNSYmsFwm6U5j2XS+8DIiSDZVT/zNe WRI9Q0n36zvmj2ZpsF3SL+dYf0IK73WPbjXb5mgQL/0mXOLFc80IPPy1NukcyUx6mSEU JwWU4iyLsFyautg2CLryrLK342PqZi8XOIDaczAZxIIaM7Drv8FJqOnfJZI+3DV1d2vh t57g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771829141; x=1772433941; 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=Q+6sbBvItLVDaaK2nVoqlOqVJ4lF02bwo0WaOVku2Og=; b=PgcVcH2GMO7SWombJgNLzKBlCBUB/W0RdOdwT+6NEb2DB5i0WS+qelz31kqZvoulT5 wr/XU92Q9c8HlJdPqRZ9WhNLcLR7IfZdZDqyq/DGfrYZ7Ip05fyhyTsERjGEr0kFnMlU j98B1G0uL/K1klH9OfTSPby9vixnNpIRx4Jh03PeZDL5GhaXym9EAo7SSKOEFdU6OuIt hNG10daewP/5oXyAne2YJe9wlJE57/4YodmKaMwKdH0B4lakxzVc6CUclgjeHjOCdDzP GE7t7eGsRza1+ZYOK2+0iN+SYIGjAxB65Q7QIocj9wUozMjytFWB3gkjBpyltY0Z+S6j Nn1w== X-Forwarded-Encrypted: i=1; AJvYcCUP6Wa+pbmOzQwkE9mcVSb4xVmE55thS+I+Qegod2PeRDodbZZgPXzzgQVgm8+7J7wSIqOjb0XHCo/y7JA=@vger.kernel.org X-Gm-Message-State: AOJu0YxFQRMkgrbVJViUefpv5hG9XYWeWGFrX97/EUvcS1VOOrgu35Fj qtLkQrME1DVr72n6/w8JZIuxCEKsUf2F/5XVq2MNj23ouOWlIJsdhK1eZc7O4tpqiR4wE7dZE5p Kk3HZ//9fnl6s3tyx9BWtR9LgeNeHrrQk7V/bWjIxkeMPwG+mAj/kK0kuZR6rTqDNPfTSpO0JyY CxVg== X-Gm-Gg: AZuq6aKHx2FS0R5pSN3/xBGS9/VsgLB977Ud9kNoSyNrb3hvy2+IVYi8qFFL3iqq1eQ LGhQGSiY4kEQtRMrSdlg1sD1Qe9LqI1MU+vpqS5y07d62JUOVT/iINtIPyCOg9CINmwSuRiCvCt lL6cIlld6PYeI5xVW1dX5bqbZESJ58ulEeTOZtzpMJAdcVbIKnEr/r6NcEnQTCsn4zvugLFa3pG blsywpzZQqbrB6xCNpGALuNWSsnkwEwTSa3tSvTalRxUEaWlHNDrjPBf6foG2x4o1mFR7SceDmy 8r2BP3u1D3zjqqK9W/jiaurkDkvPe0FAp5f9t8QzTx6faKvvtR2Li9prRO7OC9bGL9y7cVdEX8n e71yhtx1FCsRtQAmi8dRIxQeSa7vR9QuccpgOIpi2bF/VO5YZA0S0HcBkz27BjIl0h9JXp6YQ+Q xJ03VbwzsqQRqE X-Received: by 2002:a05:6300:8a97:b0:394:f617:b418 with SMTP id adf61e73a8af0-39517b35a81mr11353953637.4.1771829140633; Sun, 22 Feb 2026 22:45:40 -0800 (PST) X-Received: by 2002:a05:6300:8a97:b0:394:f617:b418 with SMTP id adf61e73a8af0-39517b35a81mr11353936637.4.1771829140165; Sun, 22 Feb 2026 22:45:40 -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 41be03b00d2f7-c70b71839d6sm6483993a12.6.2026.02.22.22.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 22:45:39 -0800 (PST) From: Jie Gan Date: Mon, 23 Feb 2026 14:44:44 +0800 Subject: [PATCH 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: <20260223-enable-byte-cntr-for-ctcu-v1-8-042fb35bd37e@oss.qualcomm.com> References: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@oss.qualcomm.com> In-Reply-To: <20260223-enable-byte-cntr-for-ctcu-v1-0-042fb35bd37e@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=1771829097; l=769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=0MADiRxGeDkPQDc+D4cOyR9YpPfqVXFTQN8hJDo+rxc=; b=A7MusA8b1rixgM7/D/ASj0yIGsmRsBAexrkdv9rI624/50t9vZK5GeJTvPPItLcY41IBNloz8 6huL2xXkTumBdYn/0Dhp0CDcxJhVHuohW+RmF0KAeN5DRuFE1OKOZNn X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA1OCBTYWx0ZWRfXySntIumNhgWi xbw6lZQfWdih+cvZ2LmhT9pWP4sOLEzN8zWp5e7vRONiznjQQ5sxGuf2AC/iUcxVk9HdAaiORJU +YJZRItm3RRFtQhwpFlg3nJcGomGzlt+rglZMmeirbJsIRqOIEFgh5cq2GsHIfxSa1xtLlgwI6B usk+x512HG/Se8jDkjYkIIwsKlwbPMWMV54pULb+XQmB5e89Tib4Otfj1YoibkthYzISoSqvcAf ijPosskjOJenSlmlEKEXfAsbnsO/5Q0pNfJFxmaAfCBfwsU2HoRKlTfqcVd7vVsORfca7uPcrZI tnZdl2Y8ddwA+wJIPz2L9NxOo45138Z/l27CAjQiGEB9RY8/joJB6BQCyBiYweuYBrf7VZy8ZVe p9WWXoA1IBN+Tqys+oc6KdCpMJ4zG4HtEvSGDiDN2tiej+xKBRCNM4cKKYwqm8W10W4D1YZn5tH S1y+tGo7aSUDQq97sIg== X-Proofpoint-GUID: tQsI0XUh6eHWotf6qng28kuk150NtD0e X-Authority-Analysis: v=2.4 cv=X71f6WTe c=1 sm=1 tr=0 ts=699bf795 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=gBkj9RZkAcI1HbXH1KoA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-ORIG-GUID: tQsI0XUh6eHWotf6qng28kuk150NtD0e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_01,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 priorityscore=1501 adultscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230058 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 808827b83553..e8a20789cd58 100644 --- a/arch/arm64/boot/dts/qcom/lemans.dtsi +++ b/arch/arm64/boot/dts/qcom/lemans.dtsi @@ -2800,6 +2800,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