From nobody Sat Feb 7 05:49:04 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 D2A421DEFE7 for ; Tue, 3 Feb 2026 05:51:53 +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=1770097915; cv=none; b=MhLZJUDBxSoJ2AEp66faEPPsWhnvIVoAPe5KwhjvFbven9Htgg4q9tWLK/L3RktoXPfi4ZAaor6B5vI50aYtdZhKbMxz/3e4rmAaPVLkLrLsmAbYYJZQJk0Bfo/NHVDCfZpss3WenaGJCUVgryh2OXeJeQSfXSaDlN8QfvYqjHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097915; c=relaxed/simple; bh=nzaF2yP3ATiqQC37LSxmXVL9MqWLOY4wwOUNTmvz/UA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K1DuRAvChUA0C0UUHtHiJ1rvlQrsScSGOwLwSzt1t7tEiAwm9ZUjRQCyieZCSJQ/fBoINubayDrlztaCpnnYnLhBYmofTSbxM+tM7uN24FACB1QdIRQ2XzkfIPQmik1zzA1obXsyI/hJjROwGOuwT5Wkzvwl+HB9701N7SX0WTg= 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=Kc5+5Aid; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Xw5zyeba; 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="Kc5+5Aid"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Xw5zyeba" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 612Je25u3459151 for ; Tue, 3 Feb 2026 05:51:52 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=Kc5+5Aidb3REAC1G ke09e+x+zNjfgc3Myt2Df455wKfo6lNGhf1VNCeY5wj4zedcyDghrniCw4v2+vcB 281+jmmbfFaBBEwNcjywDZxJSv5L1vyOJym4SObSqDHdKlunznDcSNup4w4w6LCr IC/YCsMSe4l8+oVj+gy3gJJZlp5abIxub8zL8LG9OmnhcveQ3xWSyyBL/oAeVRvN IMEzORnDEI843D3VElopMBndhoGAWw7Dj8kW1pchrj86CWB0ANgMUmJnhWtZORI9 gPjreJDR6iX05Yv41esSyssUW2UkYp1jQ83UBeBnfXPqEtIU3sw75vnyhIQO9f12 0bVUQQ== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c2trbk1f1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:51:52 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2a7701b6328so139156425ad.2 for ; Mon, 02 Feb 2026 21:51:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097912; x=1770702712; 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=Xw5zyebadIGjRZhYeyH7ixIyeqkhD4bCjnk0sYsWe3LEm1AtN6Q8Hoa3EJbp1Es85H Xoc0Rzaq2f32OBlKLjl24kVpV1cAMUL99GQhO9th9pK4hPGg4MSWl0d2qlzM7nuxZ/1T qKxZJU2sfuMV97iAKqZinuQEyiHIbpqPyfoEjUctfs4HXRRYFq3LsQt5iupM1tXN8QGI cE8zE70s+P7HpKPhYtX4o6L5qEVOi7+/bKiTUOVBn32UZwcrVpTr63eTpwo7HzeQvw5j 5V62N57E7K9kvGf+IZl3sVRMrEO+hYBw+9IWcD2+UmFvCOxNIc91x4sSwZ8x0uJjePSy qrpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097912; x=1770702712; 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=Teeia21VPEyozMk9EnIlz56BsGXzILYTvS32eSqNKWq7mPxDBqhlFW6O/9i+YOVoUV 3yOepUmQiFABzLtF6K23b0X4TcesDLTLR74+K6eUDsIJh7TNrTjjzV56JxpMCyKVl5PD qdx9Uzt8gw9QEczL1tnepYt+29A4N8Ukk+7BWoa6vgReF8sxWssXLA82mIvo8mWqQDWG 6LJznBJdDARijywOWDzSuWq57fv6j8yKqjP1Rd/l+Uy55RiyyHE5XhAx2qLpQBP6nwfW cdnniY37SPxhfU5YThhnj0hjOt76a6ibResXqieVOjfFVf65DqbqlgdwEapLhr3ye77H U3rw== X-Forwarded-Encrypted: i=1; AJvYcCU7NVKjUIO/vOxJjgUjzrHo/CdQl1ld20lIqs1p2c0j2bhq/NB0M57AvFUYGV1QPlauNUIS5SntgprFLKI=@vger.kernel.org X-Gm-Message-State: AOJu0YwXS/sKFfPfVNJA7Tt23pcL6I8WBr3tg0pew9oKkmDmkI+K9zID cV569XZ8B0xG1gKgYobJgfC9FL/jzzM59NSxjU6MocaVoyPw9hneNuavmsDPAZeAsiRh6aj8ajO puJPuE6EpA+hD75291wDpr6dwfZBqvzLmS0M0AtUKHZ4gLk5qQk5GDuOK55bW67jI8lo= X-Gm-Gg: AZuq6aJdv3biVwZqnitkvVYtIahN8RrCn2/MQ8Uc1ERV7CY3c96tlcavg4LgCAJRH// +WzufEuAJiqVFq0Nyw3/ocnkqNIyUiYZn+8EDat04Wdym48j37YDH+uJ9FTdIwARFUglsd4nBcr Bqr0Al0yJMcifERSn8M3LI7HOZId8bzNv8Yeqw5PkJdlnvm+WB4mjETA9xfAAI2UmlzN/dHSa7R Y3zIOENTXtrfJlNonCr+ZPwykvrnO1TVc9O55Rrth2NYxxdbDyGge3nTrNfNc4ADAHjxsS+Gb6c mLunWkbob+/vLDrWxqwwhJvqWK5JwvZJjrL8nmR+EN7G6sUYZJfoF/d3v3xm+Xd+6Tnmmp7JLAU aB9gHOpTyeLimuImx5B4S6E3P7FuYe3huw+jcx8tbsC9KY3UBG66PHJf39mhvgHZ3LyYkTPnI X-Received: by 2002:a17:903:3e15:b0:290:c516:8c53 with SMTP id d9443c01a7336-2a8d994f3a3mr92432405ad.40.1770097911517; Mon, 02 Feb 2026 21:51:51 -0800 (PST) X-Received: by 2002:a17:903:3e15:b0:290:c516:8c53 with SMTP id d9443c01a7336-2a8d994f3a3mr92432175ad.40.1770097911032; Mon, 02 Feb 2026 21:51:51 -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 d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:51:50 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:17 +0800 Subject: [PATCH v12 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: <20260203-enable-byte-cntr-for-ctcu-v12-1-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@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=1770097896; l=3771; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=nzaF2yP3ATiqQC37LSxmXVL9MqWLOY4wwOUNTmvz/UA=; b=pWy43CaYoKueLn4k+QHMpLlbjvhPJdeqt0RH1YtNLHBUD5VRBzTiVeUCJeC3H6dSaokWtzCPc /0ltV4l8ISEAGDviAXJSq5VJuQ9V/sIUpTvPn+F4d+9g8UsK4JfocOf X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: JFBpctKMAH9M4XYO6_lpWP970xgjoofO X-Authority-Analysis: v=2.4 cv=dcmNHHXe c=1 sm=1 tr=0 ts=69818cf8 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=qQZ2XtAyJf2dEkEvaVsA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: JFBpctKMAH9M4XYO6_lpWP970xgjoofO X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfXyckyqPLw+Oaq /c061DNXYemIPKTSmCDLF5Mkk/DDfJyEFdhLKKa71NC270fdTKZ3pHxji2IF32hiugbFExybl/g eYng+fxacTBXMnMjc1vc2aTgk/7fSCYRSAjhE6PAWBICZV3KzJunKaTpbTjyWmVJEGdgXstoCIw 68PetWPadkbUpuXfwb3EVzX4Sj+69lufoNCdxRLFY92vVCIikmI12cAUaHLWMFqk3ZpLcYP2IQ6 6hgh/tdsryybx6TFjga8s4P2+4IPUXLzpn6JmtlXFv8+HPE7JJZxyn78pOKAoYiwZydHIrCYDGK VO2NyM8yUvcsrP2Cru9bNBvMmIpKEaQ+4TjBAi2Ud5o3HIf7+pdByJf5pJJx2ygr8Pe5zIuAJhu 0n/5wFuMp0yT33ODOx6wgarXWn7CzrY0N4YFmR7SjK797KFaNzbZM5aEurwETUE4fHNI/d6k8Gt 8QixTWYDYZSxbmflYHg== 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-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 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 Sat Feb 7 05:49:04 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 E0B6C1DEFE7 for ; Tue, 3 Feb 2026 05:51:59 +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=1770097921; cv=none; b=IuPd07aQS6hS50Gjh3a/8uKVVeodOJDgulccK1St7A/WoYtMMP1CVjxolNbVCw5VPE7rw7Yp4OQRQxZ4XBDQ4vUbN+w4SCib3XAW4sJZieX/t5MwVMLk3+KN2hYrdBxU6yk0JY1QAiyBOzpM5qv+1+B83AChdFWPdFDszhitTIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097921; c=relaxed/simple; bh=iOBlKE7wcNNqdQg697EHs/307n7EmzHjJxd5G5rMLIU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I94rl67EE1jcbHwfB2ctV4np+bMyxKM1/Rk7TTY1MvfwqPsvNmEtcytHijXGqo55DBQFpfiBudhX1eEACRsMfgIVQQogVdpbeltzEEJ8+mfx68JyvjDxlWpm/w1YQ+Gp8HB44fBSbC/AxbubGw5e57bRC2jQn71VzOO1EqaLu8Y= 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=P2nCuFX7; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=NeCsMmMy; 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="P2nCuFX7"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="NeCsMmMy" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61344uD62998767 for ; Tue, 3 Feb 2026 05:51:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=P2nCuFX7safyPSt4 md3wzsabmXuDGIOuzhF+VIlU4aQol5XzPLFz9VR5mgZb2tF0EqW7wBeKb05L/Mk2 Twuu2UKx1g1XmLKBX+k4u+zKSiaPyEBrL1Z16MnPCEEPTpeU4k4NDluH5bVO5pvu Ylr4gZahpdoCJopOnL4MIiUznzvkhrB3WtBXUzpvu1l7TkfRJkOHSP35dDuamwnF btTQgB5uFIayj6PqjKtF6bPCzDHogxhSdcP5GZD8vsEvJMWCirIq2Bo9praryObV lI0uRINWiVAGIrpk8OCIFBZTVzagFGHbN1fMZjK7mBNS4WtGIy+LOKNtMxEFHMQI pTi6Tg== 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 4c2v0massh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:51:58 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2a75ed2f89dso46168955ad.1 for ; Mon, 02 Feb 2026 21:51:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097918; x=1770702718; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=NeCsMmMyIIHEvMeRIy02FsaZliS84DApvj+lh6qB07mh38+KYCSxYp948UPkEoa3Z0 uqdPDStUeXJew1eUxmt06TKWj+YWsJlKKNCbNJTM8JhPWSy4KeavaMBEvq/Y/mjG1oW0 R2TO/APJ49Fxsn9j/nnXKgxveNwUBPW2APyNqEzMhYA99Bg1p37732NW3hUPJW7TGtkU kRkklT+J4edv7UgU+vkHTUOPOsUBkPClrdIr+W+skjo8QuPALNpEQ4F53bLu+mpkfxRr e8wuMnOESu6TNU2i5iGndMsusmmLWdgEgKjxZqTfCKiNkD4wa+SkY+7S4S2OXH6FWl5J 6BfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097918; x=1770702718; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=WYO23H2C/5mEuuvAZfEAXf3aUWhW0A9tx9pEEhKi7jXELwU4yo/qdUzBnPQlFJc8IH frd12iSHQAkT2uXkAbc26VApeFGce0WBmW9wW53nYDBmaf7QNm0JFky6KRU1Tm+Dav5Y ybBQ9hw4GarKAe0K6RzgKb2hfkKEa/HU3usi7hJQaQRV4xeIJd288iqW0OdIMyDdV3o0 7Y41OSONyAynwhgXKlEKrJkk+tc3p7Lrle+G78D0c76HgVkd0ZZQX+MfdRxoMJ3zTzqx vYhq3ZJAiCJNJwGNcOjVNUxyRumyHY3PIgkmqh6RLNsNTfdV+HdyFBYtozVLfaDXGeiW TlFQ== X-Forwarded-Encrypted: i=1; AJvYcCUa0MSU+wjqz2/qwNOc9dkm4fgfulp1W/VWBBkDu2iQGa3h4+I9/c+yXoBcfb2SR+LpLpuwwPTnNremZ5Q=@vger.kernel.org X-Gm-Message-State: AOJu0YxZ9TyibMcF5cQEeVXeCep2n8Vy1Nk9n7IJNoStULGRPCyRiDLh vNbf9neya33Cl03uM00a1FFYax3CBD9nzIflkoNy4aT1Mw2TJvUJGN0+SCPVVdnrAOKM/iOxlw2 FZ1xSLDCqtmQatfyrIxIkYPNw6ODZ4ANHQF+wk4Jx1Tv5B1wMRaytUwD6FosjKXsGojA= X-Gm-Gg: AZuq6aJSwiwyPX26L2tbgKabZXaGxCWb+4qpQs6hvVqQYfoBQfxQD6fpbdR0a1TagGs o1KABin/UZnaVf4aBmdQ5/RBOI/wDHwk/JwSc1WYRVRoWKjyufadwbAgoFy4/YRKX+yWFDx9KDK AsNUFb/Hw3s4y62N1Lmymh0tF1MF/W+AWiIbzXPqO5qg21LlKXfA07Vsli2vxkNLUyXy6Yjd5Xf hICmLWd9J4WPASokEwiUsFZOHndyEcUpD4oJLeBsAbjbti+Ot3ABjA+gWlSphy3Xe2TgiUgJ6rR FsIOaeBJbm3sb1C02Q7MgpnBhdK2ouZ9cS3yZ22Zw1vM1AaBhLL+tEXSCAgHLlVaoOZTVPfIsay dZWpC0n32MHA7jNt9fvV7IeBZZpTWcm0uYA8Y6hTDqcK5BedoTtdLCmwDyMMacr1SE7MEoF8o X-Received: by 2002:a17:903:41c2:b0:29f:3042:407f with SMTP id d9443c01a7336-2a8d96a521cmr137241365ad.21.1770097917912; Mon, 02 Feb 2026 21:51:57 -0800 (PST) X-Received: by 2002:a17:903:41c2:b0:29f:3042:407f with SMTP id d9443c01a7336-2a8d96a521cmr137241115ad.21.1770097917398; Mon, 02 Feb 2026 21:51:57 -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 d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:51:57 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:18 +0800 Subject: [PATCH v12 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: <20260203-enable-byte-cntr-for-ctcu-v12-2-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@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=1770097896; l=6192; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=iOBlKE7wcNNqdQg697EHs/307n7EmzHjJxd5G5rMLIU=; b=VqcnM4vNbyRGQwAS7LjKD/ijBNX9/5TItxTwYFrPQTUdNQ8N938fH6Incwj8y6Zf3Ls5c9MmF ihumcsv1vgPCwdqoLuvnKUdD2LhamMVlLN8dukCCpdJdg7i699WMtMU X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=dceNHHXe c=1 sm=1 tr=0 ts=69818cff 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=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=AScg1gZdVb1XvqdcXssA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: 32PONw-Eodu6TkQWw-AWsZ-17jFaJmWi X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfXy+Sh8tqpn1z8 a6xH17Re2xcqGqz+2FsC5ceE+cUEl/I7qQhEZaPok7oQK1fQjX26hsqAnnj7L3bN2rEWcHCrFOB 7VLd/my0OIWL+gB+K7MRLgOxe2CIxR44MOqFdm6Ka3wjlsKIESM49kc3vDGqFTU/2ReO5rYbr4u AUI1IAWH5UDMcNQ4Kqehmmh+HQzl9i8PWkO1ft+7DglQ7wBlnU11rlS50Xi49gqjhn8bMTTNupX UPnvpjjwEnpwD2/SamFYGIX5JT10WTqGBfLiYzgReKTciDSi4tNj6jUaV1NpjaYifi6LYakXRUR ShceDeuzAdwKGKOAI1O6tt8LPNpLD4RS1xgmoivte8FyUCL7ShO2/bMOZMVCBHGfqakY48oR7IA w8WevF7EWkJ10bUffTF1MXb+Mrjfiz4gNDkxTogUGnW+Dg2AasGO+M5ru+2G+gSHTHpftZKeQNE 5C8n97Eqm1UBdpTaBtg== X-Proofpoint-ORIG-GUID: 32PONw-Eodu6TkQWw-AWsZ-17jFaJmWi 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-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 Introduce functions for creating and inserting or removing the etr_buf_node to/from the etr_buf_list. The byte-cntr functionality requires two etr_buf to receive trace data. The active etr_buf collects the trace data from source device, while the byte-cntr reading function accesses the deactivated etr_buf after is has been filled and synced, transferring data to the userspace. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 1 + drivers/hwtracing/coresight/coresight-tmc-etr.c | 94 ++++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-tmc.h | 19 +++++ 3 files changed, 114 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 36599c431be6..1ea255ffa67c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -840,6 +840,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list =3D &etr_devs; + INIT_LIST_HEAD(&drvdata->etr_buf_list); break; case TMC_CONFIG_TYPE_ETF: desc.groups =3D coresight_etf_groups; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index e0d83ee01b77..cbbb15648fb7 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1919,6 +1919,100 @@ const struct coresight_ops tmc_etr_cs_ops =3D { .panic_ops =3D &tmc_etr_sync_ops, }; =20 +/** + * tmc_clean_etr_buf_list - clean the etr_buf_list. + * @drvdata: driver data of the TMC device. + * + * Remove the allocated node from the list and free the extra buffer. + */ +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata) +{ + struct etr_buf_node *nd, *next; + + list_for_each_entry_safe(nd, next, &drvdata->etr_buf_list, node) { + if (nd->sysfs_buf =3D=3D drvdata->sysfs_buf) { + if (coresight_get_mode(drvdata->csdev) =3D=3D CS_MODE_DISABLED) { + drvdata->sysfs_buf =3D NULL; + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + } + list_del(&nd->node); + kfree(nd); + } else { + /* Free allocated buffers which are not utilized by ETR */ + list_del(&nd->node); + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + kfree(nd); + } + } +} +EXPORT_SYMBOL_GPL(tmc_clean_etr_buf_list); + +/** + * tmc_create_etr_buf_list - create a list to manage the etr_buf_node. + * @drvdata: driver data of the TMC device. + * @num_nodes: number of nodes want to create with the list. + * + * Return 0 upon success and return the error number if fail. + */ +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes) +{ + struct etr_buf_node *new_node; + struct etr_buf *sysfs_buf; + int i =3D 0, ret =3D 0; + + /* We dont need a list if there is only one node */ + if (num_nodes < 2) + return -EINVAL; + + /* We expect that sysfs_buf in drvdata has already been allocated. */ + if (drvdata->sysfs_buf) { + /* Directly insert the allocated sysfs_buf into the list first */ + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) + return PTR_ERR(new_node); + + new_node->sysfs_buf =3D drvdata->sysfs_buf; + new_node->is_free =3D false; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + while (i < num_nodes) { + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) { + ret =3D PTR_ERR(new_node); + break; + } + + sysfs_buf =3D tmc_alloc_etr_buf(drvdata, drvdata->size, 0, cpu_to_node(0= ), NULL); + if (IS_ERR(sysfs_buf)) { + kfree(new_node); + ret =3D PTR_ERR(sysfs_buf); + break; + } + + /* We dont have a available sysfs_buf in drvdata, setup one */ + if (!drvdata->sysfs_buf) { + drvdata->sysfs_buf =3D sysfs_buf; + new_node->is_free =3D false; + } else + new_node->is_free =3D true; + + new_node->sysfs_buf =3D sysfs_buf; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + /* Clean the list if there is an error */ + if (ret) + tmc_clean_etr_buf_list(drvdata); + + return ret; +} +EXPORT_SYMBOL_GPL(tmc_create_etr_buf_list); + int tmc_read_prepare_etr(struct tmc_drvdata *drvdata) { int ret =3D 0; diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 95473d131032..9b3c4e6f0a5e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -208,6 +208,19 @@ struct tmc_resrv_buf { s64 len; }; =20 +/** + * @sysfs_buf: Allocated sysfs_buf. + * @is_free: Indicates whether the buffer is free to choose. + * @pos: Position of the buffer. + * @node: Node in etr_buf_list. + */ +struct etr_buf_node { + struct etr_buf *sysfs_buf; + bool is_free; + loff_t pos; + struct list_head node; +}; + /** * struct tmc_drvdata - specifics associated to an TMC component * @atclk: optional clock for the core parts of the TMC. @@ -243,6 +256,8 @@ struct tmc_resrv_buf { * (after crash) by default. * @crash_mdata: Reserved memory for storing tmc crash metadata. * Used by ETR/ETF. + * @etr_buf_list: List that is used to manage allocated etr_buf. + * @reading_node: Available buffer_node for byte-cntr reading. */ struct tmc_drvdata { struct clk *atclk; @@ -273,6 +288,8 @@ struct tmc_drvdata { struct etr_buf *perf_buf; struct tmc_resrv_buf resrv_buf; struct tmc_resrv_buf crash_mdata; + struct list_head etr_buf_list; + struct etr_buf_node *reading_node; }; =20 struct etr_buf_operations { @@ -445,5 +462,7 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, enum cs_mode mode, struct coresight_path *path); extern const struct attribute_group coresight_etr_group; +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); =20 #endif --=20 2.34.1 From nobody Sat Feb 7 05:49:04 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 191A836606E for ; Tue, 3 Feb 2026 05:52:05 +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=1770097927; cv=none; b=qMpF3vdz7oZQypD3hWdgRrO8+AIgeumxzwy+2eShcl+XjXIxcTcRwkPCQrA4afgtSv7nZbG4PbFd24ByLX0aIwCol7yULS1C+W1psNHWW3/HEgbxmmGWYpqa/Z3iis6bfTbzR3gzBKAAjQmQ+6/tvrNG4XL/HaNoQnjbk07e0h8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097927; c=relaxed/simple; bh=CwCT5/x9boKhb1Ajkz+foUdUOzmm0/q81QDotkFpGzA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KCyeNP0qt4FsTotaBHZVoZtLre7gKK7VdED19nd7ZvTdKCFhB9d5RN3wW/rJIr5mTu60z4B1f9L44w6BPIpJ7qlpbiaPMthUvTUprtRgFQLcpNJW7BIaOAbLYyNaS0/om/g0j5Lul4WpH8h7Co9oY2eZ2ocg518fm5elThodSfM= 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=En++TTvU; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=CgzovpqN; 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="En++TTvU"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="CgzovpqN" 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 6135bwKf2261751 for ; Tue, 3 Feb 2026 05:52:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 51VyzH5MVWt5pCU+WtqPfgt9gr9jXVE/0KTTZNnKYmU=; b=En++TTvUAIK5TZHQ J+sDgDrZmY2qq6ex6kuRa6RApo9SnxG2GekP3G1ttyHiaXDkoeeXtTymcq2GeTEC 6vurqtAYnx2eVeNyiIM5D5LhXL2/Leni3hhMnRgpCaB1aIoPm0EnsmmflmScYfND StkMisUmOHF1lkbrekNKJsv+4pGt7TIYvBb3aNRabaLMrBELzvJ15t7auLL4Uhin lgJBKlzgbfOyABwEsyi2ePj+NPOcwo36t8h4TqF0cGL2ZKlT8zM1xNRtp5qxi9lD FPneeTXzmQxXWfF8KialDDe08FOZvncl7I8yie/35FOtqQoRduiRVFQews+kNVJu XUPL5A== 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 4c2tmtk29c-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:52:04 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2a0bb1192cbso44008775ad.1 for ; Mon, 02 Feb 2026 21:52:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097924; x=1770702724; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=51VyzH5MVWt5pCU+WtqPfgt9gr9jXVE/0KTTZNnKYmU=; b=CgzovpqNi5MArdXDvAshvxh4xdE+GQhP2CogI8rZFPwwQH7yTBV6sphFpWYcXUHLbb tmSYtl/4CUk8wemqVjCioMhVpoAlnAv0F+LIZR3txDOY1S2rlcJitFdyVs8oeMAK5+cM 2zDw6on7ioyR2dTOtsSePxhyxCbXx/n6SXQgSYCawVjLcKxClqIkd6v/gcIyoj2K/1kb tHhHlcQt+bxVNsXhNnu9kJ+NLwlyFtQLp3Yk490WopL2vcS/1QFyr+m7Ho6SeOA8imtd QPePxZEsDxFV9xah/1lJFjklllIjBG33wSL6XL3859xBxxOUVcHeemLoydTqplQs/k6Z ueCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097924; x=1770702724; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=51VyzH5MVWt5pCU+WtqPfgt9gr9jXVE/0KTTZNnKYmU=; b=eREiDIoK59cK/y1F4UvnUA6SQzWzKmiYux/nVYHslvvKjxzdcp5hKEWDEfgBUcgUSJ ZXTN3Mm3RVBlFy1rbdK5JRFvTv5NJi0nhPTjax3Foz3BzPSqIYn2MkSTtAVgh+azUqr8 k/xi3MngLqnYeRq8qaAdPlY70YJ1cQAx13AwQaVOjHsNwIuum62YhEsLmm1vaRRxOY6i PnOmkcEi4q3Tx2/qQGN4BvmGqtdWZJgnCjP33S2GOIPWKkfHRPSuDfGP6VLFpFHfzC7i mS0y0jl3ZSlAJtlq/a+S35TvIi2+0ATxNLO3FvTDiMXhJJX8fuAtA4Sp+8rrmbG+iug3 L7Dw== X-Forwarded-Encrypted: i=1; AJvYcCVa0CbysYEgYftLitFxnCuJk40OlZrG8gVKCztgCs+Bs03FtPkU7kU+yFxx1DooNzuIdWqeZVijVzO0KyM=@vger.kernel.org X-Gm-Message-State: AOJu0Yywx6eJuums1zY9ZC2dE79SaHBwcnh54Buy2yKXDjdIzkuxn25L Mg118afyrOE1rfcQkXc99vtncQu7GC+9IQQIsEIiZCV+jKrgDDSGjWx7Fisdxz6Z4ZBmk+LEnca TyZ16dkw8I9jYkjD3vsAPCMGDsUCOq3B8iBcOXubmbCiDSRyRqqfZh4TCuCS2pQWDy5k= X-Gm-Gg: AZuq6aLo41R3rNUmGHoFqld/KUcy9cgedGInRrb9GXfXeVa70y8/scZqt6aswWHrm6A lyV7WPrJ5N31crCpwY4UbRxVkxux41+BXMY1CGrRq+gkL86AOnTG4MQMgWkRxsH/6CRTfmC4awe NAXpCgWM0Hn8mwLr9ekifXgL++LT26/HU6PVz5rBV5SnAopPhZOQOyynMaqWi7ageaNBQNS1fVD M9nNHm3xG0XtVivAQb/ncfOD1Zrr2d4ooenHmtGX4iO2vwzbxYvlngtH7YshWz1RID1Io758DUJ x92XI8B7tXfcfTRcQOz0fBEOLiqMGCLCT2FkDTC0QC+P6xD4fO5slx7IhnmgDUBdiPDoFGhv9X2 xrnpVP0eAZ5knKnPTIJHjTNq0UQ0yotrRLmF8AOg7J+sKDDToJk4m6YNCwj+TJiwbMVtupHjz X-Received: by 2002:a17:902:868d:b0:2a0:9970:13fd with SMTP id d9443c01a7336-2a8d9943c36mr99480685ad.43.1770097923978; Mon, 02 Feb 2026 21:52:03 -0800 (PST) X-Received: by 2002:a17:902:868d:b0:2a0:9970:13fd with SMTP id d9443c01a7336-2a8d9943c36mr99480535ad.43.1770097923508; Mon, 02 Feb 2026 21:52:03 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:52:03 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:19 +0800 Subject: [PATCH v12 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: <20260203-enable-byte-cntr-for-ctcu-v12-3-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@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=1770097896; l=5212; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=CwCT5/x9boKhb1Ajkz+foUdUOzmm0/q81QDotkFpGzA=; b=kA+GBzzIvXNSvvOWRPmGgpNHQ4tzGkRgViKapki96YY2xM5iV5eA7MLSGbpTQeREnapw2+UDm sLP7eOQq/76Cxv3LJb0q7HMP+V2TISsKCLBlFP9H35U2ntJPBaC2O5K X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=Xb6EDY55 c=1 sm=1 tr=0 ts=69818d05 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=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=ia3uihG--C1vaqsH_ucA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: C9yegeUndM2B-4ObPazWz8DyLGEUnQVc X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfX00EdNDY4AtJZ zyjGkwolSZ2kVUZ7H/Rzfz5Vzns9SIzciRy1iRC4frSPrqeAu9PwLo9C8j0vJQMpk+p5+jttf4f jZl7wUAJ7ly4lN6238IyHmyvVKMJxidw8c5O59FpBrWYyQSEZoEID2zqXMkcisPuxDURCW0ohWw RZvUjxLwuQwcj2vVaI8tUqRLCbZ0yNsRkMP/OqouUpjKkTKsWG366Og2xj9aWMVUbbEe83fb9IP BlKm0bogcoL7zMvMvHVs7x3C7rlu5Rt+uou083ywP08yOAlFs7ar2KQTNf6vZ+87HFa+NDL/q9Q OpCD3Uf0uslAAkm+4SfZlPZyfClF/2C4a6GwtdWObz4eKduvmEmyd+xQgwWjgS7Cn4cPGB4PfXh GjfCdn09TNDFfLoiXtYmc9SbhIPCcOU6klhfzCcfx3+H4dXLB8xEYTq6im4hWCn3qNWCAoGpdTX y83lQckZOqgOC+W8SbA== X-Proofpoint-GUID: C9yegeUndM2B-4ObPazWz8DyLGEUnQVc 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-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 phishscore=0 adultscore=0 suspectscore=0 bulkscore=0 impostorscore=0 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 Introduce tmc_sysfs_ops as a wrapper, wrap sysfs read operations, for readi= ng trace data from the TMC buffer. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 51 ++++++++++----------= ---- drivers/hwtracing/coresight/coresight-tmc.h | 15 +++++++ 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 1ea255ffa67c..32ca2ec994de 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -232,17 +232,10 @@ static int tmc_read_prepare(struct tmc_drvdata *drvda= ta) { int ret =3D 0; =20 - switch (drvdata->config_type) { - case TMC_CONFIG_TYPE_ETB: - case TMC_CONFIG_TYPE_ETF: - ret =3D tmc_read_prepare_etb(drvdata); - break; - case TMC_CONFIG_TYPE_ETR: - ret =3D tmc_read_prepare_etr(drvdata); - break; - default: + if (drvdata->sysfs_ops) + ret =3D drvdata->sysfs_ops->read_prepare(drvdata); + else ret =3D -EINVAL; - } =20 if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read start\n"); @@ -254,17 +247,10 @@ static int tmc_read_unprepare(struct tmc_drvdata *drv= data) { int ret =3D 0; =20 - switch (drvdata->config_type) { - case TMC_CONFIG_TYPE_ETB: - case TMC_CONFIG_TYPE_ETF: - ret =3D tmc_read_unprepare_etb(drvdata); - break; - case TMC_CONFIG_TYPE_ETR: - ret =3D tmc_read_unprepare_etr(drvdata); - break; - default: + if (drvdata->sysfs_ops) + ret =3D drvdata->sysfs_ops->read_unprepare(drvdata); + else ret =3D -EINVAL; - } =20 if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read end\n"); @@ -291,15 +277,7 @@ static int tmc_open(struct inode *inode, struct file *= file) static ssize_t tmc_get_sysfs_trace(struct tmc_drvdata *drvdata, loff_t pos= , size_t len, char **bufpp) { - switch (drvdata->config_type) { - case TMC_CONFIG_TYPE_ETB: - case TMC_CONFIG_TYPE_ETF: - return tmc_etb_get_sysfs_trace(drvdata, pos, len, bufpp); - case TMC_CONFIG_TYPE_ETR: - return tmc_etr_get_sysfs_trace(drvdata, pos, len, bufpp); - } - - return -EINVAL; + return drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); } =20 static ssize_t tmc_read(struct file *file, char __user *data, size_t len, @@ -769,6 +747,18 @@ static void register_crash_dev_interface(struct tmc_dr= vdata *drvdata, "Valid crash tracedata found\n"); } =20 +static const struct tmc_sysfs_ops etb_sysfs_ops =3D { + .read_prepare =3D tmc_read_prepare_etb, + .read_unprepare =3D tmc_read_unprepare_etb, + .get_trace_data =3D tmc_etb_get_sysfs_trace, +}; + +static const struct tmc_sysfs_ops etr_sysfs_ops =3D { + .read_prepare =3D tmc_read_prepare_etr, + .read_unprepare =3D tmc_read_unprepare_etr, + .get_trace_data =3D tmc_etr_get_sysfs_trace, +}; + static int __tmc_probe(struct device *dev, struct resource *res) { int ret =3D 0; @@ -828,6 +818,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) desc.subtype.sink_subtype =3D CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc.ops =3D &tmc_etb_cs_ops; dev_list =3D &etb_devs; + drvdata->sysfs_ops =3D &etb_sysfs_ops; break; case TMC_CONFIG_TYPE_ETR: desc.groups =3D coresight_etr_groups; @@ -841,6 +832,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) mutex_init(&drvdata->idr_mutex); dev_list =3D &etr_devs; INIT_LIST_HEAD(&drvdata->etr_buf_list); + drvdata->sysfs_ops =3D &etr_sysfs_ops; break; case TMC_CONFIG_TYPE_ETF: desc.groups =3D coresight_etf_groups; @@ -849,6 +841,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) desc.subtype.link_subtype =3D CORESIGHT_DEV_SUBTYPE_LINK_FIFO; desc.ops =3D &tmc_etf_cs_ops; dev_list =3D &etf_devs; + drvdata->sysfs_ops =3D &etb_sysfs_ops; break; default: pr_err("%s: Unsupported TMC config\n", desc.name); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 9b3c4e6f0a5e..c780f6d5dede 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -258,6 +258,7 @@ struct etr_buf_node { * Used by ETR/ETF. * @etr_buf_list: List that is used to manage allocated etr_buf. * @reading_node: Available buffer_node for byte-cntr reading. + * @sysfs_ops: Read operations for sysfs mode. */ struct tmc_drvdata { struct clk *atclk; @@ -290,6 +291,20 @@ struct tmc_drvdata { struct tmc_resrv_buf crash_mdata; struct list_head etr_buf_list; struct etr_buf_node *reading_node; + const struct tmc_sysfs_ops *sysfs_ops; +}; + +/** + * struct tmc_sysfs_ops - read operations for TMC and its helper devices + * @read_prepare: prepare operation. + * @read_unprepare: unprepare operation. + * @get_trace_data: read operation. + */ +struct tmc_sysfs_ops { + int (*read_prepare)(struct tmc_drvdata *drvdata); + int (*read_unprepare)(struct tmc_drvdata *drvdata); + ssize_t (*get_trace_data)(struct tmc_drvdata *drvdata, loff_t pos, + size_t len, char **bufpp); }; =20 struct etr_buf_operations { --=20 2.34.1 From nobody Sat Feb 7 05:49:04 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 02FB52777FC for ; Tue, 3 Feb 2026 05:52:12 +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=1770097934; cv=none; b=M0jhieWcIeya079URMqgT+2ZdYepbQa795cmAURduVesyZHX23cKnVD6E9BUgvOa9lec/bMOnari+TQ+CS2ljZL9VFiRIM0pDlwvxB+ptJeTNlEIUFi9/yDqgzgINLoBiuW4Es0Jnfp0Xy+l3e5oUPvVXv0413hqgM5euxDXb7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097934; c=relaxed/simple; bh=U4/sKRr7M4WW+QFUhNUawaF5P5iRNlfK2LYJRhPxGVU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DtwbxQcoxaakybhOE3JpL9T6JfuAvvAU1P3OZUEbf2c7BufASabzWo/WumaLEtrERMIjm9vCYwGhLg5y5tmaNPLwbx4sOJYhGWTdsqvAkSRjJxZ6FSzf6X30/a3CeKp1gjL6/n8uH4+GR/mPeYCSVEjmBklaJN/AbcmCq7LwUcM= 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=fJP611Ij; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=I34QfpfH; 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="fJP611Ij"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="I34QfpfH" 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 612JKXhZ2899920 for ; Tue, 3 Feb 2026 05:52:12 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= JNtaBtXRyxbHQmjNKTqpgrs01dpaRUqnQPmUDzf1zhY=; b=fJP611Ij23SMmBPP +wL2u1ISSs8pZ4YQLVnBUNHnn+eW9XBJUaS8I2a6Q7lLHSaoPprdd00py3ujPUbG nyT6+W6RWmkilnmMqHrf+4SapUFyDDdIPFV8hWxp7lzklvTbrbSfrth4HtHpJpYM zbCer+GVkS64FWEdnjar6qZ8dyXj61eZZaNfw3cfa7tOaUquMiCIa7KQUjaTOBW8 AorlmhWALpumAZHcTP9Zo9JJPNZjbEjNGbP3fv9aXMttMnnzUaraBDzR5EebiaAx WXyUA6wCFlggXUm9Auamk1acnQxxHeKQmBlT/0A/3iQ5W0puRFxrPID4bwj02aYV E1T+5w== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c2tp0u1m2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:52:11 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-29f1f79d6afso58886905ad.0 for ; Mon, 02 Feb 2026 21:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097931; x=1770702731; 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=JNtaBtXRyxbHQmjNKTqpgrs01dpaRUqnQPmUDzf1zhY=; b=I34QfpfHfq4UDaCc1EVoYI/59wMincuA432RK6WYScoHfWBIA//FcLYyelRLr3zA0/ Y/v88Z0huEKCtFGA0C/RFJrS5gN6DHAplA0HBefpyRgkyeHznQllIzZ+vds6UPPiTcg0 eWrBaaFv11K4AFylg6eF/mN0hy+pU/s+3QAfJm19SdnBxYd2C1tWMwk/E/NsXM91bi5T lRGodrmGauxhV7DYgk5yOymLeAuDxaJrs/YXxOpveTUO4CB/A86rgFOLTrCJ7OZV0Ukd fr/QIX7rg5Aq+DoN70h6Zu0U4bfBouCDa0maDL/mMMKykoIgN2+2yv5d5bjLRLLpcSzt XX/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097931; x=1770702731; 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=JNtaBtXRyxbHQmjNKTqpgrs01dpaRUqnQPmUDzf1zhY=; b=iHmFRCS1EQR07o2jNZaTdSV1o3S3xpmlamAvuDu29vjguedXef+9TvCalG1MbnbszD fVlyqMeJHKnAXEqoOaA2ntY/SjzSdrxRSPYqURYq/97n50SWJTtWNNnLJuiUI0emECtZ uikETDgDrQPFy6J8CSjtuM9sWoyaTpYd+IqY8vh7LsYwWv+FhL4dnYaK1j6q5AbRr6Xp aBIpJY+wWp9NzKRGlouZEK5QKg/SI9ZwMGDZtWt3TELZPEKZiiqgQm+CK5GwJgGZPR31 S7+RVgzQ4xH1rzFkvihb3MBiHstSZzwVYMg6fqPvzDn33D2Lwx+BhMqucu0eiFhcI3W/ fp2A== X-Forwarded-Encrypted: i=1; AJvYcCUyEQqu6HJRjBC+esHfqyO0H1DsRGzOsX01y2rl7sQiBxYelFBZz/tBfP/ma9JJ1COM4Dvtyeu9kb/N5S4=@vger.kernel.org X-Gm-Message-State: AOJu0YwmEXYRL6wpQpkfuplCnbP7a6/Wha3XoHSQ8aZhta+MUvNOdEgk 3b10pBbHqzjCFShEQKY0/uM/tDMmQ2KrA4S2hdIZtPxQ2aC39P0AjO0sA+7xRNcDdlY8YEGDGRp QLC/eQdYDyYTIWZ4beMMjemFmqXYTsl7ygoOME1s/rk7n/zwg0xewEMlXA3Ep5AF+q3U= X-Gm-Gg: AZuq6aL1iqDb9uMhrLkkbMnb5yt2KvmgZT/hfqyVG8dg8hAvd7itSrHDhhY4rfEK0BH 7AZ7xdgjalsNUaDPaDdK/o7l+fFJesSlwaMQRluVF4q90ECclkXaWGrwrgiKq3oANDb64NkmRr5 5ltDz89M7qTq1vbpTE4ruJ3p0GXA5lvU4+28LyjMispTT4q/a7lbRllYfB1rh/zBxM4knF2od7Y XJ+5daVRwS7/j/eMgEIE/dm1S+G6pX5e2r/x2nGRZmLRLCbho+CcKpd91oLnDYJt3BK1B7dcv9Z odFuxWKspWLPiGGNNAQZJBb3bIcE3nskKfNCwpLz9+E9trSCwpMAyWhhP+aafSfNfZSShlMhFie oBXR6ryUc3/zbVn7LbnSwidWJ7wdIF77kia264sJPE0GDpne02msVUUoEgVf3N8areBJbxqgV X-Received: by 2002:a17:903:1b67:b0:2a8:dc02:8939 with SMTP id d9443c01a7336-2a8dc028b56mr145595415ad.0.1770097930804; Mon, 02 Feb 2026 21:52:10 -0800 (PST) X-Received: by 2002:a17:903:1b67:b0:2a8:dc02:8939 with SMTP id d9443c01a7336-2a8dc028b56mr145594975ad.0.1770097930170; Mon, 02 Feb 2026 21:52:10 -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 d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:52:09 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:20 +0800 Subject: [PATCH v12 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: <20260203-enable-byte-cntr-for-ctcu-v12-4-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@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=1770097896; l=2348; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=U4/sKRr7M4WW+QFUhNUawaF5P5iRNlfK2LYJRhPxGVU=; b=G2P/JwHdNHZQyowWhQ1wY2ctXlPUXOxK/PH0GtLc9G99wszt2WdtAuEyE5bWv4ckTmAaNB2TN EviVDs51LH1DYJ1cKrgi6QUUn2CTECwwf/QIXC/OiYNejdM7tqYaoLH X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: l7iAq2fCYsEwBvN08p_DqiHXYHzXPYcL X-Authority-Analysis: v=2.4 cv=VJ/QXtPX c=1 sm=1 tr=0 ts=69818d0b cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=FuIWbRVyn4pKkvqW11oA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfX/65OE2mLYzJH 1E9wOlkMMbDamZkz5iEBNs9vrttO+wDXAi53p1OTqgN4jioEQfzsl86uwmFY8B+1/pA/1nbDeSM 5wq/tbXYaCY8eYUMqYSKc2xQh8df/mVBtOps0N+vd0c05CtsPJzJzYBS7+pXK1q9jlkjfnSjPzN rWHC4BOI5101XQw9dMqkEIPhCoebNbSIiD/nS53BotQkDdl5B95rJyilmaKUIFsToH5icZ2JxQi lO1cjjYlb6aPZJ6eEqGzG+FUcS7S1RDDQ4/SGDEL259eQLmyakpS27PaE5MSu4Dxinqe8r31tKe rhNGfvIBet3Pr82xWRSGEXZi/+WDNPNjr8uhRX5JogKSqr0jLeGEkMOdmWaPi/2ai+hFYwL7OV9 FhG/Nc9b4JLQZvS7en6zBg0cjQ6GiU2EoWZxJPyP3VKi3NOcs5CGHnXcvqi7HSu4emraYERWDq0 lDQLGMyf4nt975Y7esg== X-Proofpoint-GUID: l7iAq2fCYsEwBvN08p_DqiHXYHzXPYcL 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-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 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 cbbb15648fb7..2ece3985e2bc 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 c780f6d5dede..8ea2de08ffd0 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -470,6 +470,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 Sat Feb 7 05:49:04 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 7C9C136654D for ; Tue, 3 Feb 2026 05:52: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=1770097939; cv=none; b=nf4sk+GYX/tyQoAG1D84mM1D0vA3Ljkuhwx+vKAs5zGNAuYK5WwXUkKxc9o68cN11jua1nLec79ff0jmPXUTfCtly6XJFijfDvogqCWv7xYGYyJP4vbA/xuKgtEx4X+00lH46Xo1AOjZ8SlaNXLshakPvzztFyehmNTsweew8Pk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097939; c=relaxed/simple; bh=D10EnaHvzxc5IcCAThb9a/AzzqWooUS88J0GgYqXhUw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oiX36k09tATdytNzWu+y4sU6uQT3Mf94Nu5MfldSw/8IEhCNOeg5XB2xh1XHNm9nH8cjuYzZxKYM4xYWROkfuVtc3UXAj3jozBiovnps3gj9bT0NUnhGWOQiprlA5qOEkrgC1oXoLWavGhaOwak7qP9MXtAwM0p6kXIdBC3jU0A= 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=idSHbaOE; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=VZ8MW0t+; 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="idSHbaOE"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="VZ8MW0t+" 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 612JaFJO2848571 for ; Tue, 3 Feb 2026 05:52: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= I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=idSHbaOE98zccvVu mKnErx4Wvc2uhjCfw/iTivTthNMg+ccee/X+WyL9l+2sbkaxURqKs75SDOR1SIf6 vnKfBz+qSLzqwwoGvjLKAqmoWM/gBnmI4r/IBWnD38akwEdIwibneTtwpdhBZx/F gnPE27Ia0tSsPYVVC1PdhY3lcCfZfOoXbbEMg9WMWHyM93DSsa/qeTMgjgNIpsHK gsjmulx5SL4yiZa06YcPzoS9msayFgeWBEXumDMFuGx6bwAaqty83qaWvHG52T/h b0LIFbiUGsqJ5mc8aF55gMeUb6NpDkMFn6fkYihUm71922wgl9wqNTn3TYBbkU3j vOpDfg== 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 4c2tqtk4f4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:52:17 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-353a5c295e4so411511a91.0 for ; Mon, 02 Feb 2026 21:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097937; x=1770702737; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=VZ8MW0t+UKRFmnx97tDhGWUgjRbIkloyMe9spJL5tAKN9kWmj+B9yCJlzThqbEIHi4 7kmyzSW4wuQlld+rI6bqy7TduuLxoGh4Ydkq2fA56jn1VCfVzVFwyf9LmmSbO0akhXsW BdE4IHBV98/ei7b+xX02Yh0jFHiWXhXwOL0j/DkIjf158KGYpO5d7dp0lnlPmkD+P6A7 V9rgmkQukkc5qnu2fq/AOhXIceY9FhU6SEBGZ6JmvznKJ2jB2/5fHyleffAuRxq+Rk9C 1pgA+EysTHeQ0GWaQJbOEjAy1boWyAZ6aT40UByY8p9J1ikA+Kfmm3779UVoUZ74x949 HNnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097937; x=1770702737; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=dw+H/5RihgxC9jLnEBI9BLK4yP1RxZ23jjsaWHhfO5X2sMZkAwkEB9Un58otBtkKRM ah9UeqXEc4LAi8VRGBS2y2Uj+Veka+jbwtFHq0KLWCvtdvrUtkopPyBZOITMynnGePLm 78llmfoJwzSKMYAinZAUGTgHo9wIjKWrosZmt+c+aVmfCdxYVrHZ6Sj7oZG6aYdMDfvL hyPW5ppOB3HKIcdsA5SJCSp976ww7hFe+oZE0Ns9ydyoaENzd0EBeP9toHpTFo/AnQJW tRD+J855Tlt+MHOB7lh3DIp8TeOtJ3UbMZT0BGv5MQqEkto4SBhcRJv2+RqS+cgExkfJ uGNg== X-Forwarded-Encrypted: i=1; AJvYcCUb+UIpdjpRE9kdRaJxulQ+OtowpRtLQH/OKilTabPFc3dHzl79UnarQQNrJB3U0TPkX1hUH7nEMmxbVVM=@vger.kernel.org X-Gm-Message-State: AOJu0YzNUTLWxVTQMEAfVemxbT6i9IAhxWl70CB0LvpyIqRl2yKeu2Qg SkddwVrjejLQVHrs6+tIyxEWWgrrqsnWb9lM1Bq6VomEuMb2BPHuCb1e84Dz6xdIogveLkzkck/ F54LbbMBkEr3Io/xXaZmbMOSB88XWep3NO5Ae3M2GXaf1eTw2DcrpabYDCyYax9zioks= X-Gm-Gg: AZuq6aJ0qN6l4TFGJW9NQ+FKY1UhdA+b8ph1/aDQLO3kfXGUefyu2BGzwaGiyye6zHN D2Qxt74v3pyPVmsHozM7iACiZeCP/n3f3LZyAy6ScqWL4khC6tV+m0lcso+yy047CQRy6uy3NPi BdqUH49lkfPe6DNFVI1P5nx77egzdDrYVL6T9+k7WGkrV1LbocpiAonfOEBUbNUMyf2meD/8ICK Oe7fZfk4mwVcvYUT32eC7Jw+FQVSjvCIBsXVVQu3+JpBA9pwYhYt983JcZ6NijQ7tYXEu+X51al CTZuc+MX4aQMcH7OsOU2tCkGSULiRbsGGDsO8xcps5Kf3e0eJUEm5xUxypq07kR5XKJPn8SrC5m llTwrNpAJYVGo7CVjQLEefMK/JTjElwtZGXfcR0P5ilXhcV6qE7VZQ/slaUl581WHaMZvnw5g X-Received: by 2002:a17:903:8cd:b0:2a0:f0e5:74eb with SMTP id d9443c01a7336-2a9246611e3mr19726115ad.28.1770097937118; Mon, 02 Feb 2026 21:52:17 -0800 (PST) X-Received: by 2002:a17:903:8cd:b0:2a0:f0e5:74eb with SMTP id d9443c01a7336-2a9246611e3mr19725725ad.28.1770097936638; Mon, 02 Feb 2026 21:52: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 d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:52:16 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:21 +0800 Subject: [PATCH v12 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: <20260203-enable-byte-cntr-for-ctcu-v12-5-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@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 , Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770097896; l=1751; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=D10EnaHvzxc5IcCAThb9a/AzzqWooUS88J0GgYqXhUw=; b=QjGEOOMg56eJBct8Kwsk+5m4YtQDj1HjvjzbLb9nksZDFfwoEo8hvfykF6PE/wRYbcmXJQ0Hn eMv0nFedomqCmqJV1q/ImNOWc7BRvXpsBHi3OcrmEngQMS1+9V2ELOw X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=XP89iAhE c=1 sm=1 tr=0 ts=69818d11 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=gSyxy6DGYGa4b6s9XCEA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: mQi3GqFSGLB8z1WGMAWighzCPg52_bS7 X-Proofpoint-ORIG-GUID: mQi3GqFSGLB8z1WGMAWighzCPg52_bS7 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfX7Rza7dX4ZcAT KZdGNng471ia/4DT0I+Nt9hiZgDkR5lloAnEzYwujQmFBJcfHgj7/a49o2TtmS76ACjbKEQgB6i zd6PIBrKq8K91wvRvjcPFvY0Hg38haDwjxxWL+6cEYpcprCY2jmktmxRQ+2wTjZqNyGFhOlVI7y ZEI4kdD4fxpEM34jPJR/pKWuEB6hm/WxmFZnUHNcPT/4iYBpKjLWKIRB6aCsh5ZSGoFQLhw/MMl uK/0HXzh4zUCMjLohTk1FzcDsrjRaIZRSS25TaHANHWjPWNpIPtxKuqFn8RZnY02Ywtnv02BvsZ wkUFS6A5MXtxr/s9JnT57F3bWk3wPPqJZp5oW0Fwh/s4AxsbY7Pdb8H6f026jBHO/0zkgcb11mA IIRia42FQKbtE6NiDol6gpLcn+Yj+0lTwhqxHMcYXYcqqLQilfm6sONevc4GjgQ4bhSgFIHF+6o vL4SMs/XqtH3HhZMpkw== 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-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 spamscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 Add an interrupt property to CTCU device. The interrupt will be triggered when the data size in the ETR buffer exceeds the threshold of the BYTECNTRVAL register. Programming a threshold in the BYTECNTRVAL register of CTCU device will enable the interrupt. Acked-by: Krzysztof Kozlowski Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml | 10 ++++++= ++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml= b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml index c969c16c21ef..ac27a8b89085 100644 --- a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml @@ -39,6 +39,11 @@ properties: items: - const: apb =20 + interrupts: + items: + - description: Interrupt for the ETR device connected to in-port0. + - description: Interrupt for the ETR device connected to in-port1. + label: description: Description of a coresight device. @@ -60,6 +65,8 @@ additionalProperties: false =20 examples: - | + #include + ctcu@1001000 { compatible =3D "qcom,sa8775p-ctcu"; reg =3D <0x1001000 0x1000>; @@ -67,6 +74,9 @@ examples: clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1 From nobody Sat Feb 7 05:49:04 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 0DA62207A0B for ; Tue, 3 Feb 2026 05:52:25 +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=1770097949; cv=none; b=Rv4Fs0w5nH7Bf8ZHC2coxPmd+Ol1152diFGCRbvVJC8hTX/HUIuz+wOjEYNyakc1q6SnzXGw3tsj2PiLIZCfwH9gY6rbPgueJMxYVxQRhNf7FizY3YeXIAGUcGrfKwbaZm7f0VgQvQ6C3/l8n1XvoXaUwslsALARurz3aG8y2cY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097949; c=relaxed/simple; bh=guZYRjuXuLlwC8jARDG23TGa5s8CcsTOk947MYOLbzc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IjOTkv21QC16AdOu5QVo9U4MSchEBpBkwClomVXhHMh7fdPRAvMf78d1NlaMQ6c/72kPTasSt4PZ6Xw4Et3GgM7sE4ip4HGL+W5EI5CU2PKaf/ws87eioIzGzoye0vgE74MvIg4vXIVvS60q/D9iu+DPqBvhtk2xGRY0tacL2vE= 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=e35GapK8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=MzpMonWI; 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="e35GapK8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="MzpMonWI" 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 612J46iI2899946 for ; Tue, 3 Feb 2026 05:52:25 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= hUJRyvVA1Me8TRfoRWTgybCPswI8RoChBbCvzPJ5NIs=; b=e35GapK8uQRMjALy ig7bNgSECw6FtDBq7YXnN9EGOspQUaOKn2kESrfs9B7ThMFfCBZRF6nia183IioZ HxI0v9G9NamekehbcPNv3KTM/8bo4QWVEvlCyQq1QZ19hjszhZWi8UVUjZc194lg ZgjVYNhxj8R5UCd/gzoG5YykBAXornh4MkBKNxyUSUdcT6UYIY9gdZ5OnPQ4bM1U emzXHuSaY/qPFqQv2p4In6O4nDI5HOeB0fghXTcp0XjpvfcGWjcqevOBqYjf1cJn SvLfBBOPqgeF3/LkDcd8Zc+0dyg4fdrc6u5Wx/0mAR2rcDgrgGkNujTP7M8wBtyl fydWig== 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 4c2tp0u1my-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:52:25 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a784b2234dso145779615ad.1 for ; Mon, 02 Feb 2026 21:52:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097944; x=1770702744; 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=hUJRyvVA1Me8TRfoRWTgybCPswI8RoChBbCvzPJ5NIs=; b=MzpMonWIs842dVHXz5UUrJo5KBydIYboMY85/zw6plOm92b6lFwrjXakbYSzE9SrBz YXaE5H0kpnOzYIJhv6K9hKwTtlV4qC6UHRbPnD5+MiTxFqsu3eO1oUsE5+Iv3MixU1Hx cxmDXbaffSGjSr/tY53j2TZQjU6WEXFEnWwUMysICxo7BhYvOUklPCDt6HbEo+41+AGn c0K+pOgD7wOdSMVfo/GaLS79PAIASOIwZeffFoar+CX/SeXZJtN+9Ssn7Twp86o+CIdf B+KHGKCYePmMHjHRgSi7mutNeh0Lm88w5O80OZfLn2nQzmt0YR9FLS4F37qjr+963Vlr Ny2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097944; x=1770702744; 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=hUJRyvVA1Me8TRfoRWTgybCPswI8RoChBbCvzPJ5NIs=; b=KnCnxz6hMWbV+IIahqLtuWe+7/2Ce4Nr8XvLNth7VHl3TzepEy+9b38Bej5WlJixjN dnEQxJUO/kIfrJ8MA2byVQB782812fkzsjw5ji8gs+iA1ZpwNa/TegFxJXyYQO+DN9U/ 1vHAKFwX+i8kjLmj9VrFfOgXtuQqLa+VW5rkIq5/HLX5unpejDXklozyXADTjFTnf6qF 3trj/h1P/5V6sXqH83j8GbnouCN+bNhYURnSNa1S6pRedcKOZyWINvQvk6NbBxBSh9nR XRRw1BwEOOK7DawtDGvP8JJLhDF61io9SQxxUa+GpK7jbhabMKUKb/g1MfMJnI+z9osD cLXA== X-Forwarded-Encrypted: i=1; AJvYcCUGiPyi8gTO+NjeHC5lLNjhvTktFwt7Gwygf1cP6A0kNV3dVUmzugWVY3WIZcTekLp6Ys5/s1w0Ghmh4jY=@vger.kernel.org X-Gm-Message-State: AOJu0YzjlPtXkpnwBYJBCstApGWdFvSPmZng/8GeVlqxw/6SxIznozR6 q8hC7B4BPvtjzj7kdccEcNepNLXbeeQhX/vp9CpThfSv2mZcToAbGn3zZluEu0SJ4CG/R58wBcY c4D4f9zL2Z4aVxf50L6avtg8Cg+SB1DD+BgBkWcYfonrSZwzyuHHLu22eLCeNKqEnvXs= X-Gm-Gg: AZuq6aJEhu/MnMSxcqziaxtjXBAZr8y8FRWrqu4xp1idHHn8H9nYZrvJYsljVkyAYcJ JjuK4iit0VmSQFgYEwHI9dR2inCZvXj7ZiL6KGhuwEgUD/58HjBCnRz9J3lb2gBO1g+Nri3QdJD mrcQhO4vqAFiHm7tqUdaVyWAP8ucjQW6TF/lllJ7kIGJmzHcnGUedu9geV4qYWfHxW13fjP7wAo 1eUSw1lvAYy84vLqRrf2Z3GhQF952XuRDPklU/Ssv8rzTZqLl4Lm5kAtm+9vzkxxdNVexj7eWAa kPEO4RfgoJMK/3dt33Reau8V4rkeyVp25yXqCqNU31EbXlvmSfQAuPHvel6emlVk7ZGpJkPl0Ox bso+3/RCoM9NmpTQpBhG/rH0AD0Rze+armN8uw0ainSPUkK6Hvxyl649Py3sWrm0bM+JXfAdp X-Received: by 2002:a17:903:2f87:b0:2a0:c84f:4124 with SMTP id d9443c01a7336-2a8d9a6f717mr149408915ad.52.1770097943791; Mon, 02 Feb 2026 21:52:23 -0800 (PST) X-Received: by 2002:a17:903:2f87:b0:2a0:c84f:4124 with SMTP id d9443c01a7336-2a8d9a6f717mr149408705ad.52.1770097943267; Mon, 02 Feb 2026 21:52:23 -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 d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:52:22 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:22 +0800 Subject: [PATCH v12 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: <20260203-enable-byte-cntr-for-ctcu-v12-6-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@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=1770097896; l=24516; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=guZYRjuXuLlwC8jARDG23TGa5s8CcsTOk947MYOLbzc=; b=7nXie4aklK2pprUnvp/IzLv6bXv6Hk/Rqvlz2BaCju3sJm/VpAMt8lqF7c9oIPISPGe1HgkYc 8nJwc58oam7BqVcT4Ev4BFFugWGGDc3/stnLzSvPPB0P6FJ3E6zdxiu X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: mvMFTlnbVm8GQmIf-bbHmNI_Kf6T7ws_ X-Authority-Analysis: v=2.4 cv=VJ/QXtPX c=1 sm=1 tr=0 ts=69818d19 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=TrPPj8Ph-2G9coJyck8A:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfX8Cz64lQ5OByi mtdCG85NjneItJT4VzSro56uCAX1XFEVtoVyf+DQj7FNDNByj80h3GPOrW8Y0XTEzquTsAH4siQ nlNL21hp0nhFuOAn0M9ce3ObWulLMvgpvIkeqn2/6KR2nx1pyCbME93yQIzUj0C4gXZBzXADR3z lQ/t+IS76BwShNrZG7V50dpLXqEi6kKs6MSglfBKkoIcugHnxbWdU9Xh/oMOVtDhbNzww84P2JM QlC0GgzOxalu85DxGwZJQSjRVfdRjomtLW6Hu0KJllEJ0J+mvC4l7AVcW7p7JRPV3xJ0WoYrfOA Vzf1iMzgzJJOND/1SScbQzYXfmnfd5tzNU6na5Qs8RPPS4to6Q58/ew7G4Ka6UcfdKKk78Cpppw h7wWrr7YX5R8uJR6tfuNAyykbhjAhH4ykhDO5eN4+c5AFG4EPm/Vp77VjHcLCxIN95k4GP+SnJr vmKImUkXT7oBiKIr8Kg== X-Proofpoint-GUID: mvMFTlnbVm8GQmIf-bbHmNI_Kf6T7ws_ 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-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 The byte-cntr function provided by the CTCU device is used to transfer data from the ETR buffer to the userspace. An interrupt is triggered if the data size exceeds the threshold set in the BYTECNTRVAL register. The interrupt handler counts the number of triggered interruptions and the read function will read the data from the synced ETR buffer. Switching the sysfs_buf when current buffer is full or the timeout is triggered and resets rrp and rwp registers after switched the buffer. The synced buffer will become available for reading after the switch. Signed-off-by: Jie Gan --- .../ABI/testing/sysfs-bus-coresight-devices-ctcu | 8 + drivers/hwtracing/coresight/Makefile | 2 +- .../hwtracing/coresight/coresight-ctcu-byte-cntr.c | 366 +++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-ctcu-core.c | 103 +++++- drivers/hwtracing/coresight/coresight-ctcu.h | 77 ++++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 18 + drivers/hwtracing/coresight/coresight-tmc.h | 1 + 7 files changed, 562 insertions(+), 13 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-ctcu b/D= ocumentation/ABI/testing/sysfs-bus-coresight-devices-ctcu new file mode 100644 index 000000000000..9b73ac807d7e --- /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: 6.20 +Contact: Tingwei Zhang ; Jinlong Ma= o ; Jie Gan +Description: + (RW) Configure the byte-cntr IRQ register for the specified ETR device + based on its port number. An interrupt is generated when the data size + exceeds the value set in the IRQ register. diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/cores= ight/Makefile index ab16d06783a5..821a1b06b20c 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -55,5 +55,5 @@ coresight-cti-y :=3D coresight-cti-core.o coresight-cti-p= latform.o \ obj-$(CONFIG_ULTRASOC_SMB) +=3D ultrasoc-smb.o obj-$(CONFIG_CORESIGHT_DUMMY) +=3D coresight-dummy.o obj-$(CONFIG_CORESIGHT_CTCU) +=3D coresight-ctcu.o -coresight-ctcu-y :=3D coresight-ctcu-core.o +coresight-ctcu-y :=3D coresight-ctcu-core.o coresight-ctcu-byte-cntr.o obj-$(CONFIG_CORESIGHT_KUNIT_TESTS) +=3D coresight-kunit-tests.o diff --git a/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c b/drive= rs/hwtracing/coresight/coresight-ctcu-byte-cntr.c new file mode 100644 index 000000000000..e444928e024b --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c @@ -0,0 +1,366 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#include +#include +#include +#include +#include +#include + +#include "coresight-ctcu.h" +#include "coresight-priv.h" +#include "coresight-tmc.h" + +static irqreturn_t byte_cntr_handler(int irq, void *data) +{ + struct ctcu_byte_cntr *byte_cntr_data =3D (struct ctcu_byte_cntr *)data; + + atomic_inc(&byte_cntr_data->irq_cnt); + wake_up(&byte_cntr_data->wq); + + return IRQ_HANDLED; +} + +static void ctcu_reset_sysfs_buf(struct tmc_drvdata *drvdata) +{ + u32 sts; + + CS_UNLOCK(drvdata->base); + tmc_write_rrp(drvdata, drvdata->sysfs_buf->hwaddr); + tmc_write_rwp(drvdata, drvdata->sysfs_buf->hwaddr); + sts =3D readl_relaxed(drvdata->base + TMC_STS) & ~TMC_STS_FULL; + writel_relaxed(sts, drvdata->base + TMC_STS); + CS_LOCK(drvdata->base); +} + +static void ctcu_cfg_byte_cntr_reg(struct tmc_drvdata *drvdata, u32 val, u= 32 offset) +{ + struct ctcu_drvdata *ctcu_drvdata; + struct coresight_device *helper; + + helper =3D tmc_etr_get_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); + } +} 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 2ece3985e2bc..d69f6999c5c2 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 8ea2de08ffd0..c7ee53612748 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -480,5 +480,6 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, extern const struct attribute_group coresight_etr_group; void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); +void tmc_etr_enable_disable_hw(struct tmc_drvdata *drvdata, bool enable); =20 #endif --=20 2.34.1 From nobody Sat Feb 7 05:49:04 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 49A41367F53 for ; Tue, 3 Feb 2026 05:52:32 +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=1770097953; cv=none; b=hp7mor2KqoZsbAZiCt4diUjEVUPW3ByFaQYeXbfqNhc31HKxLCd8G6tj2zKpM1C7WyeWo4kXwnRd+OVaRjcA+Lyk4ZGhARzYhf7Oqw2m+9T9T655+LaPKh03YgHAZZ8Ksm+E8cmBPcib+PaEMx/xRMbiSbIxl5AcpYZjw/7LyKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097953; c=relaxed/simple; bh=+caVanCR1MkRvTlDCUseywuTVg2NMA0xm0dQkI5ZlEc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t8AoItH9tz0dH7PffYLdZSClp2ZpSfQGpa4c+czeKNnwz+wiDG6uMFbbDo/jDt2CzlRCQjpmRrFX5UT0WbYKvFYJt5HWzPE2nYEa4lMAzx6g8//NVQ9BPMPqyrgtT/xtEsUNIYMCVcMqEdNodIIK7xvekwsW4OWkrWTCdStnYMQ= 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=X8PoCUAe; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=cXTXINAY; 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="X8PoCUAe"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="cXTXINAY" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6134XY0G572589 for ; Tue, 3 Feb 2026 05:52:31 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=X8PoCUAeHt4sKJuk q2uqwLzaBjMBI2nWiGa/33M27T4ZN7/1RyUhx/BUFkneQ2RkpTSlbXjYcTqLrn8L JVNAWfUnUDqI4+Fj6mQx7RL5UKybXcQoDBqWMuC8aU9An/iF8vglDF+l6unPhP+u CQtuIk1Juuh6pPfvk1grSmXwcHnEpOAzKTieEMMSJSH8Deug0wYw8r05bOVco9e3 ccF9S2BxOzUIY4f5AaV+aaM0w0SYIP4V4tJOLCpRGF9I+v2y7zjN1CDYGEZCSZyC O00QvbrA9wfF3aGrTNCDFyx+dvtbfl8Ga8mIXP3g3YPaM24Sjk1XgOx4EMwEV5nR ECHiCw== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c2tkmk3c2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:52:31 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-34c2f670a06so5469419a91.3 for ; Mon, 02 Feb 2026 21:52:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097950; x=1770702750; 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=cXTXINAYH+RtevcTQNQqU4XilGp4T+Ey+aZwtk3X5U4UnnfcyDwmR8IRiSuXWxsULX BbevrNdOnjzl27pcT47KRh4E4C6Hs/GgNdGHVryOzpFsNOCN7W5ppNnKUG8IZXAgxcKy W2L2Fap67ifits7tXTs/5qVrqJ0qsQgx3ozRqto3rtu7qksZIKIUGhF6VOf6J95nvgIL 5zrF3087T+5RHs/GNLwBHypSUV34xGlUClNsrZHgrbqBcGcr+bv9Qz8vlapI7nEXPikk Mp27gV4VFbiwPIlX90GDVxhUac92HMwpj4oo2Qj4ZV1RzmCM2PehKjS8dAjesnXh1eF1 Gd9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097950; x=1770702750; 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=v4ZgW61Ocut42U+HEBlW2bA4YKTOc3PqMMZh6Z/rCHhANuhLXPf5vtoLOGlAvJ4Hh4 ULdgrPLwxi6j6Jw0N2rqcjpggAxEN1S5beCow3jTBeLXVTfdB12P/jYWol3eaGuy27fT iU4Xiub5biGrLwOEYuctM7amIeGpHH8dEdmGo0S0sxuyOl8m3Yax4RU75lWt6PsfFAlb dGXb79PGiqh8OIz3wLPhPtChHU9LrXG9bUt73gtp8d3yAZz0OUGhrHj0EzEj48KDcLNa necuQiQBDHYRPc5nHhHQaV/eF29hDPO7ZFyF4qz3MCEpIq+oqmQJ2TblfViehpRNrvn/ N6VA== X-Forwarded-Encrypted: i=1; AJvYcCUjqoutmdr2VFp+XoaKnhhiyN1vWSmk9xyOD+qtZIBZ3dJAzL3C4BWu2fuskKjl/93tNJsQNW7/te+FT5o=@vger.kernel.org X-Gm-Message-State: AOJu0YxmCJw/mmGKqqBIxwvBYdKJHqml35HfuQr8wRnQ6g1g7DkJ85Y9 eUTUSJVbEwKnP13dlR0RHRjU4uEOZHjiI1BYPQXJjYaVOCP/nXkcbAudzxkwlcZHGVwBwul5eQM nXG6/hwZXl890z/YzJOXwfJf8ZxyNHmM9juq8qHA0AfRCoR8z81wQ6VAKKo8TJHb7Jak= X-Gm-Gg: AZuq6aJLnNor8T052nd7qlTDP+A+rohBqY4rds9y0qvqHO5kYfoFj0aNmjUp/ReO0Bc TvKW/K+avTDNj1Re45uxnIq5adYa0YmyblmG5TKoih9l/qsayF9BpSGdt5cogzuVKiATbep/B+O udSayus+qQx3NCSbfTTcLu/ZlZzTj/ZuMkUD07IyL6ZWfTiW4BlhSE4P7BEOwIgAZW4n8KR2R5z S7XkIPkgAWWUXOjtfag+mj4GCVT4l9oO54Y22+fNZzWiDhHR47BVSYD9Y0h7GcCoy28djBKs3x6 v5kUsMYHXPt2oEwm7/HDMjVx3SrVZ7lzvAyo1eI9XrapnvCMkMp7Plv4QaYw8DfzTr1MAI7tV9F Q1Ui9NUnSRlrNiOyGfsy+W5s8+Bsz7GT6OxYz4eEfcxcH1IonN8gBdRYxe6ugRil6H0nb1TLO X-Received: by 2002:a17:902:ced0:b0:2a2:d2e8:9f25 with SMTP id d9443c01a7336-2a8d990ae07mr158884145ad.33.1770097950160; Mon, 02 Feb 2026 21:52:30 -0800 (PST) X-Received: by 2002:a17:902:ced0:b0:2a2:d2e8:9f25 with SMTP id d9443c01a7336-2a8d990ae07mr158883885ad.33.1770097949600; Mon, 02 Feb 2026 21:52:29 -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 d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:52:29 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:23 +0800 Subject: [PATCH v12 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: <20260203-enable-byte-cntr-for-ctcu-v12-7-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@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=1770097897; l=3465; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=+caVanCR1MkRvTlDCUseywuTVg2NMA0xm0dQkI5ZlEc=; b=0aOnb04P44kXcGnsHxDOb6cbQen5ROGAS2XQyDBqaHKVyj5sjZaeFpCmJjSPKNNE+BMBcZS/c FFgK17b8+98Ckj9YidIN7fV22sSSJPMwv7A1Kk1quwFNDXOCVSizsHK X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=TaebdBQh c=1 sm=1 tr=0 ts=69818d1f cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=i2GxayCjj04of9N-vEoA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-GUID: S6q5GzHDkWZ4uiRbW42BdTVpi1euFT2n X-Proofpoint-ORIG-GUID: S6q5GzHDkWZ4uiRbW42BdTVpi1euFT2n X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfXyD/fjr5sS8gI PRW80IBfUxmqRnlyvWTXyfHgganYXyFNVbS+uiSvQHK2JNXk6/uVzyvNqGa1kVT216jqb6XZTCS K+mH4mvd4VAdbt/99AgJTqJKNyeUcVDNR/1PsiH6XBAeUXAhcS+vGbbs6EztBgue5+pzfIJ51rG SIIqCop9VY2UjyOABBNyKXs+WgrH0artObDU95aq4WEzLk5BLyTWp9ouos+8VknWUMyDUz9OVtw 6rITWzltOb+YDeVKSX327tx6Zn2c1AEnWBau9EbxiMPodYdC/NPs20ajMWxppq8k1L0/KZYEXnP NkTkD3jNSe7hrUY5aw2jydddKKg7SHpcQVir6KRy4+EB8eK2nM2z41s/jOzM+U/xH9DGJVa/cRo 90Fpnbm/FyvXkP5udmSb556zEwsoEmUFBFCvh52abqgRnbMYYVm/JyNbs6boP7UpOqv2nmfm/ai eqIkbJZyjIkS0qMseUA== 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-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 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 Sat Feb 7 05:49:04 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 8345C367F24 for ; Tue, 3 Feb 2026 05:52:38 +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=1770097959; cv=none; b=XEJ8JRVYusc72PHPUqUyYlpVdHRJGl9lMTVbnIGU0ed3wwcZ+vSTtFTkKwpUMGdHC6SVdglqBwX1TwJOSPFBiblBCM1+fyLiKuB/eOyVPXrIql8VzNY8EKMvaE0509QTUgql4iM+rACS7iYB1sEBAWFnUQw4cWqBIL9wa5awlL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097959; c=relaxed/simple; bh=U3SBm8Q4F2Lqg46nftP77Qbyf63TqJWnGptxyfW3r6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k8AWfADybZV/GmJCQOYAEM9MeRG2ekOC+vWTn4DixTbW3Q8uw2EXzIKiP4Rk5cKcLlD52/JSO6Sk64I6E/p++S3nRk/WFHT7D+ASCRpi6IvYxfOJF9wbiuh8hd19sbhKnMUK1ilxgB86fzVo41iyvjydgu6/d7AEsm/FBJc1Mf4= 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=K0kqsd8h; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=aB3Wxgey; 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="K0kqsd8h"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="aB3Wxgey" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6132Qqkl3386846 for ; Tue, 3 Feb 2026 05:52: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= 2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=K0kqsd8hcHXqDv+m men3VgvgZm9iXoRodTQL9wLGndo3xuDNk6I3Bz1MWn0LLI046yfRvt1fvqRC4iPv xmohmWjV6OpySZYccV/Fw306/+pe1nfhZ7L++CLfJXYXfo2ib92ZHCdbsmjETvVg xH8M/pFaU9FCTBAxHTSnDidcS55hkwrGzAdTcDYstLilhocidCReyG21RH9/Sv4B ggd/Z+1ExIZIo5k6H2VxE7htrRQWOdUYNS9tpIiulrcmKfEqGQ1qZL9YSgr/ENPT k30gv1rE6RuiLpXXhFbL/U6a+iyMoUWrI7VHQPn6DN1MJMx5DnV3Q7e3pm14UPQO wlIJng== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c2xvbt7yw-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:52:37 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-29f29ae883bso38276505ad.3 for ; Mon, 02 Feb 2026 21:52:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097957; x=1770702757; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=aB3WxgeyGJOD5vYIHMYXDnBxJPcf8MaLXC/rNLZPc2zfB20sptqfgt3kYRM4GOvg9X qejGnDNrO3hh5k4lBB+BUvD/nqXeRCzsHNzMw4oiVqGiXiJM2w6hzChm+rq8VGQuHqWg EiKIp9Wbto6mGlMr0Kv9mV1yAXr85HHickWdyMN2ikSTXHXHn8Gtd+UQ6wBRXWxYf8Oh IJlb3oKFcKrmVPHx0ZjRMxY4mZlKYx8xKrBwRpGcxFAqgRrbChnGDJjkaa3u4W7Z5HCs 1oKWbo59i1AL71lKGqYstNwQ8hWp89woOlVTwscloFrBOu9z0h5B+Kg59EWq7h5ItnAQ FPUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097957; x=1770702757; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=gbIc7/6na2oTKODZINppN9chWAF8u6AVn6AY0+cFIty5WgG7nsxClu9aILIOmxrobi 1BqiNItYeFIjYF2EsvCEYwh0FIts7gd2EPdGQcq2q8MqqMaIZ2BlZfOeB8fQ8BexTQUC 9EXcJaWNFi21tKpVWKzzlDUO9r299GkSnhNcRi1tYaxW6oLk9iTfiAvx1Puy++BtTv6D QeAOCBc3ZVNKGu9FzunxXU4v40MEyxDZO9+Xtk9GGr5tm5drl54KOOs5GjBRYaNrrCFG Cad6WjWTMNqc+BYxq2/Hu7oOnelb/7Twk3ZcT/bOYHSe+CRjojW9PX8b8OyIfo6I8ICI S0qw== X-Forwarded-Encrypted: i=1; AJvYcCXMHdb79ZJqWe67Yhy2IoyeuGmmN+IznSrrbvXzFnHosEI3hjtcn3bdVpPUkWGgtF//Pk/6O5iKoJpjyYA=@vger.kernel.org X-Gm-Message-State: AOJu0Yzm8fWr6Sxn9fza0oX/TvnXYMZP9gwuMIhJjHeHBLODKisDxOtl SGSvn6G8wJyJy1zzQIm97aan+PFygZta++aTcItgmr5mkCJsn6DMcTNojB6dui3ReL+FMi0TtVB tjbKlOEcN+JsFAhdFGIdcJ40nUxG4qXFpwjWQmiYnUgVCvVe0isMWXs4+i+FCzfhO204= X-Gm-Gg: AZuq6aKuLSgRDZMpZxEz5mQJdaOebwfV9GvlArp5xG0fIlO6ycu42GC9Y4HH+Ao3t/8 f3RWeMvtafCk8I83iAdDN2HmeXTXVe0717IYxgUpopqPW0H0tizG7wK97nWXrHoP+16RpEVxTaq suDdmx+m+I8LP/EG0y8cZ3hVXptuvQNiD5txLtqIRXHA+9AB4SY774baYAezTKTR2s3As+pTVhH SotWL/wUil6v173stRon9jU8xA44xhAr+5mj0W8HGyWMs26uTjSOC2OxzcP713gsOxeoQ6dqBsX GoWGdfA+dXU/UlhMkQ/uHzarEjrGN73yIxdCmE4ALBqwrB2PbnFfVNbEyYSr7YPniGE1x/XhT+d Dv84ysJ8Ts8bDvDzX9xBbmaauaGmAQG8Men1uiPQfAP2InTqhaIqIgPl63SG1HyG7GIY/eZNU X-Received: by 2002:a17:903:4ca:b0:2a2:dc1f:78d8 with SMTP id d9443c01a7336-2a8d993fc9emr98505555ad.42.1770097956570; Mon, 02 Feb 2026 21:52:36 -0800 (PST) X-Received: by 2002:a17:903:4ca:b0:2a2:dc1f:78d8 with SMTP id d9443c01a7336-2a8d993fc9emr98505295ad.42.1770097956098; Mon, 02 Feb 2026 21:52:36 -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 d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:52:35 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:24 +0800 Subject: [PATCH v12 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: <20260203-enable-byte-cntr-for-ctcu-v12-8-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@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=1770097897; l=769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=U3SBm8Q4F2Lqg46nftP77Qbyf63TqJWnGptxyfW3r6I=; b=1uZvAUAeceK/WP/F0pOERpVVCDW2i192FDsv27hjFMUWbZ1zfioae9HdwPsbFgIfuTlV1q/S6 RT6QhC8e2ZsByser15YbRD35K3uiM61LNYKv8pO5XpoAq2rbPQE+ImU X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: 3ZtP39QS0RyLqKbPzQ6pV8xwr3hYhGp2 X-Proofpoint-ORIG-GUID: 3ZtP39QS0RyLqKbPzQ6pV8xwr3hYhGp2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfX8d3LBhIksCfq IUhBvDmN0ZZiZKeKgtknPIgi3CeHP22K01jTWBH+EfldVNhWTLHOLLOUg6dMFC0GkGzvskiwkmm LC9jPVUAh7rwVgpTObJgomqofXpMAyI0jKYu5gJnKaTuhHtXzf79JJy9nKXDh6OhtUmSGy8p9s2 XF8s9ZDGv2vxIHGKfOuoHDGN5aEHbKyXy57tGeKI5zj0KcJX+iW5DKXNjwkanH5w+FRq+iSxxjS iXSZYBAXqU/ARrtO4cQZt7LPoEvIQGJu2EBn/1eGfJyRueTOraE4sDTz8Fng2o0vm7Ur9nGsoTt iP/vr7nck49rj77J4pjUfM5/aMATafCAfLTAgfCwN1Pp2iLnmQFw8GpgfB8PC2GdRFLSK+Gr3ID ohCurd/TjUHu7jFbaeBFeX8H0HAN3XnqjY2vase4oIiz+aKLN0ni0y37rfsUvONPwIrvnEcJDxY lNCiNNPNCsiCWB78JAg== X-Authority-Analysis: v=2.4 cv=AurjHe9P c=1 sm=1 tr=0 ts=69818d25 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=gBkj9RZkAcI1HbXH1KoA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 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-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 Add interrupts to enable byte-cntr function for TMC ETR devices. Reviewed-by: Konrad Dybcio Signed-off-by: Jie Gan --- arch/arm64/boot/dts/qcom/lemans.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qco= m/lemans.dtsi index 0b154d57ba24..75a468ddbf53 100644 --- a/arch/arm64/boot/dts/qcom/lemans.dtsi +++ b/arch/arm64/boot/dts/qcom/lemans.dtsi @@ -2776,6 +2776,9 @@ ctcu@4001000 { clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1