From nobody Mon Apr 13 05:38:13 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 8EC3F37FF48 for ; Mon, 9 Mar 2026 09:48:19 +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=1773049702; cv=none; b=rbJOkLjUJdnFJ+L8U0mQAGzQaw7D4O/XbohHKWIJUb5O1l3cgWTU5BtOUhhHTZgjHFDqsqf7oIxuPdIRlPZtNqFz1CndkdWwgkEMxHLspOFegrr/X3Kd86nth1LFw1Bi5kVN4/Fz0HvfjfqrYheui5Eqbb23cwtXw7LAdFvjF7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773049702; c=relaxed/simple; bh=ckf80wWUcb1qnI0v7q/6ZqqYr3nuJh7ROL35EVLOH7w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dp/GJm4xF/uJuolIrAcpdQWnc+zHVXgzhFyEM2cAX4aJV9zFwuVFFqaYekog9fYApAGJIP3PB0rivtfZUeDkBFt+wbwz2tksWyQwFu5dnpNp3nSV+BNMhqKnQWMC4Flrdoa6776uhQWby9FH6XqW6IpuNW8x7RUclr9S9WfMetc= 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=iZzMoV6k; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=BzEhv8Hg; 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="iZzMoV6k"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="BzEhv8Hg" 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 6297xapZ755770 for ; Mon, 9 Mar 2026 09:48:18 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= aOdpdbZJkeNi3c6n6qEjoFu015+pEeWRTwmOxcPblaY=; b=iZzMoV6kALXGGI+H YEwVtlR0hvT8XhKBqqCBBj9skPwKCYNRNle6mOvuPSJIKpzE40/zsdqY4Pb7RUrk YO8SCq0/9/iNQX8EIIht3o180FlBIBoy5mX2FzOx2AAsE8XVxJsDz/LtTa/NB4ID 7tKkCJoU1kiLIvRX4x4oQX2rewR7+NbYdjPyOxWRNv48xgQrnrDW6+tEGbOCHDBE AnZWIPRINCZDPzMhC8OJY0eTJHjousLcrBucar7D1IjiuEbwx1VDX0eTEn2+gjbf ei14XxvoTRUe3Tr/JlMnjnAyEbifoyxxXIh2wvbk4j73I76g0b7KCOTx+4wBfWpy r95BKA== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crb14vykd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 09:48:18 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-35979a03106so8569272a91.1 for ; Mon, 09 Mar 2026 02:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773049697; x=1773654497; 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=aOdpdbZJkeNi3c6n6qEjoFu015+pEeWRTwmOxcPblaY=; b=BzEhv8HgVaYTZGWKL+D5nWrPiy8igpW1N8sBZ/u1AiD199bDK2PVbbthdI8k6EXBZk 9+s7FD25mvN+MfqclpXMhi5So2VX5qsH5RP96y1j5lv9fOEGcpsb1XSl13Ye0yVfa5NK sG9MbO3+XokPep2Jf5/scImG8u2lq0vMU+kX43U2WJUXiz7CKj4hCmaWgN25TODqxsO5 sfvl3gHrgMedOkqKeOvbCtcC46u/TPGUIIwQIs5JToaTGhqv15DptP0I90zagrZI9xNw v7c1Y3kDYe8RC565YOsHke1wqK30cjgfbh0HTar8J0fsRSGq4Y+QvOoLtjoNBE5V7Cq6 aykQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773049697; x=1773654497; 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=aOdpdbZJkeNi3c6n6qEjoFu015+pEeWRTwmOxcPblaY=; b=EVtd0/AHJIYYcmNMCoBE2IxVic+cEVEYkQiTUQ0dv6np3fOAIC74HH8PbezwNrCd// OZVdfBRJkOnndOqO0qtnT+yJ/WNM97gHSE6idthcyS6VZbxyKNOfxrMCPn2CShYRcoDm TVxaXLManzXXsek0xmIcljLV/PoD0cEB1KCet2tiLkgomd3AZzJOXupmAJz5wYothjV0 0jmofWyLyUmg0du4BM0/rtymbd/HRXDnN12SSHGi+J8awsS0uOg/hVDsw7T5a7Gez1hF y1dmPjwkZrBOTT0+8vKdsFi/VOMfC+9N+WOgjj2YgfkO41nz/vZsW6+eIccucI2xxLx6 Rs7A== X-Forwarded-Encrypted: i=1; AJvYcCWRYtxhC93/WnoNWKjs0ZkoxkmYGS/Xrphxoc14P/rdKkRkAkzq7s7WFdPutVGzsKUB4d1IXpqsH106gqU=@vger.kernel.org X-Gm-Message-State: AOJu0YxrhFL72xaS+2zYj5853azPZCZCgHtpLOGwf+BDcGJZEOyftrCh X1/qb1rXGQM6BFTjAuFD+Yk0OB0BYMcmnK7T+BlWWJrQb3OCP92xfmbQv23zvwGYrNABW/ii4lc AsbAS7pwI7DoCCspq5bGGBZYqhLZl7gtZKOnvqcnVCLbNncIknf0H71CjhSBNoN2jKZ4= X-Gm-Gg: ATEYQzz6RpuhaX/T0pLq/zTEYpeLm+NofBLo0rtT2hSPvxx4CIlnmIyR77a4k90iAmo coJ6PIxGgIevwQL7JG+Xm3XoGhVsJvzLCsAi7tpS54a5Eg1lnVqw4cOgFVL16gj3Ij/S7pKbqBx SJBCL2mGc9M1maI8eVMXjMZtXkHaUJd0Ixql0i57I7DvO6ECl5XgtJdzrbHd2DRZhLCLwiDKKfx vHzQuF8BVNTetz0GPkA6hyzUPGMqd4fVpkj8Qo6pKVY0B+75VCG0Gwd+rKpo4p3y4plr07o8ZVM /N+WBRlasOqY0Q+/Kc0OQRi86GEm9e1bf9bZ4+3eec4dY8HkSM/lEFk6oRfCRUSZcpBPyY1dt2i gjJ0ITcIH3HsWwLPZGU4Eqop2PYVvcm2VQhdy2fFQ+QvyKj4/sSesbWuDKonB6tRNAqBaC1ygw9 9Ve4yETnxC X-Received: by 2002:a17:90b:3b51:b0:354:a2a0:259f with SMTP id 98e67ed59e1d1-359be2712b1mr9314281a91.12.1773049697351; Mon, 09 Mar 2026 02:48:17 -0700 (PDT) X-Received: by 2002:a17:90b:3b51:b0:354:a2a0:259f with SMTP id 98e67ed59e1d1-359be2712b1mr9314256a91.12.1773049696833; Mon, 09 Mar 2026 02:48:16 -0700 (PDT) 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-2ae83e575e6sm104948435ad.5.2026.03.09.02.48.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 02:48:16 -0700 (PDT) From: Jie Gan Date: Mon, 09 Mar 2026 17:47:40 +0800 Subject: [PATCH v14 1/7] coresight: core: refactor 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: <20260309-enable-byte-cntr-for-ctcu-v14-1-c08823e5a8e6@oss.qualcomm.com> References: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> In-Reply-To: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Mike Leach X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773049686; l=3771; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=ckf80wWUcb1qnI0v7q/6ZqqYr3nuJh7ROL35EVLOH7w=; b=SP1XBoxrjv50xLFsBmzMeldsDCMB1RShb3RxUsYvVhf4SyCCM5CIn2Rs0xqX/kti1exe207ZY cY1nHs7jN9UD/5HGaQRmMbnoWI5WtLsPWwJpBpPBKQxAlTUdWxXciWl X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=IYSKmGqa c=1 sm=1 tr=0 ts=69ae9762 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=qQZ2XtAyJf2dEkEvaVsA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: 4YOYGAmc9ylLxj0VPV9ke4BkQdNTpAlR X-Proofpoint-ORIG-GUID: 4YOYGAmc9ylLxj0VPV9ke4BkQdNTpAlR X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA5MCBTYWx0ZWRfX9+7CyOyiQELb 4qGuwpsRu/wc0dZDOIjIlzNBQ7k15gNMRnpcjC9WPKTMNo1nHLpxOz+5RyY3WLPRJMeyTYp4vgs /Sv25wmb6WT9sXqpH+erPk6f6HA69KsFUeFa0MkV9qpIH3O5yLosGqqtxuBQymfNrYCfxNbYqIE bxHZFJLD4AzzaRstqeb+ItjNwWPA254T4nkcl0qP+HLdOloE2BlUb0wKD2Pa59+mywLO0UY4lzd VMD/ansGdKsWdIuNPQrYr/AI1Ajoey/rpiPLCm53HKTLL6UCcQl/jWwRz4ZM0SBsj84ptlxlZEm kv3TS1lv2ITgpkLHT8SqI/FLD/VIJsiZ2/ZGN7VwXHyqWgYM5ac3rIIJDYHo0Hw4i5/dvxsrrHt d1tqwxoHlvubQTSe7t1NPF+GUIJYU8adFE4Cktb4frtTXTlNJtpPc4sILaXiqzGt9o6k6vxYLZL 0YCCf5+cdRpGm6uGcHA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_03,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 phishscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090090 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 46f247f73cf6..221de57ca57b 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -588,6 +588,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 9043cad42f01..e8720026c9e3 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c @@ -116,23 +116,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) { @@ -145,7 +128,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 1ea882dffd70..5532ec82e82c 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -155,6 +155,8 @@ void coresight_remove_links(struct coresight_device *or= ig, u32 coresight_get_sink_id(struct coresight_device *csdev); void coresight_path_assign_trace_id(struct coresight_path *path, enum cs_mode mode); +int coresight_get_in_port(struct coresight_device *csdev, + struct coresight_device *remote); =20 #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) int etm_readl_cp14(u32 off, unsigned int *val); --=20 2.34.1 From nobody Mon Apr 13 05:38:13 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 EFC1E37FF7A for ; Mon, 9 Mar 2026 09:48:23 +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=1773049707; cv=none; b=d4EC1dNDGFEOLT9g1K5MUVG5vg91pISB3l6WwbUZEy0EQrR8B+3NBAlIeX5P0nghcBtowJfh7eb8RnfmFoHKIgxS6QrKkxMYoLU77XJEaGUNMcgR42DY21vddSYxH7DfbYle+0XL2AClpUX7V3McOmPfFUf3KtlOrrBdWuswlIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773049707; c=relaxed/simple; bh=cfmc1VLxOy3etVkZ/MkjeByju832awJF6a/lCbGf8bM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UD/nZhiKOQmCOMI2RGOWhLSqbWzcAAaJpaXqyVvlqhpG6AKV5bjQre2Kgwp6vwzuSs3/AS/eDSX13wWQZh2b+z9Oa4zsZx5ArgcHotJpH1y7yVjMti7Ce0F6alMjds8um7AmcLC6zm8PButynTvdCqj0Shs2YwwIeDIWxyydUhU= 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=TdJ0jIab; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=QfknxrKU; 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="TdJ0jIab"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="QfknxrKU" 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 6298WDaJ3773276 for ; Mon, 9 Mar 2026 09:48:23 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= I9dw+WcJObrPUnwMy7R6sdjv5SOnPFzHWtKFt8DY7KY=; b=TdJ0jIabWVqA6Qhf ZhNAid9muT4UGDFoFgXZfFb3mQRfqza800NOCD8j5T8Exh8iffBDy2ot41ZKrsPw jkFYkcYZtKFL74CiZvjdY62jLU/qwmu38OasR5PEepENC9nm220N7hapgJkN3DL0 B4SbyxvGxUrcmn2gZBVAEbFNWVAb5rRaVODBE0g9Iq4Hm/OCSzbuFcx5IbzVEAXa 6C3mfTFuTrnIeraf3Mnw+sJstpm8b0OmHrlXF4CyW5crZZAjuaRZ6akQL5VMsfAG IC7cDtfTjWBleV6Y5d7sS9eCqfJSHYmP0y2614ycvywYRIXmLtRq8s5mS/fjBGM7 MOdHbw== 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 4cstsa89e8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 09:48:22 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-35985522c1aso28453588a91.0 for ; Mon, 09 Mar 2026 02:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773049702; x=1773654502; 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=I9dw+WcJObrPUnwMy7R6sdjv5SOnPFzHWtKFt8DY7KY=; b=QfknxrKUZut34v90jdPITBAx/SXDPT597HyHTu7E+PupgkmZdDnkP34G/OmtThM9Gj J56yBHR9jop+8ez2QHeRCb/+K/tyhnynSKrN7bwO9G6retYaF/wnGwfg6d85xhNBgTvB PfUDpnrc5jU+GpF4zZ+SoO9lC4HhI7Q50uUOlS5k9TfJw2i9mgLX43efjHBcRHMcA+Tk A81b4kwvG1nJqW33eSeq325tmEAFFhq8oKatL6m32liSUFG8C4JU/DKOHetYgrL/FDEh dzohUyK276gx9oLF2u3KJp91Rc0nPcRdfipuZ1IfTUDNyNDgvOplBNXEp3lGIqSrSJmX 5FvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773049702; x=1773654502; 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=I9dw+WcJObrPUnwMy7R6sdjv5SOnPFzHWtKFt8DY7KY=; b=AnSr6Tc8FvlZQ1+Km4zgsuEW7giCqDDWbf0+zjH8vpiUOPaKTQ/sCEa7bb1t2TzTjk mxHNSOF1BAJRIoUCzypWn6C3HJXJ/kExpjzhhsfuKBrZNGWPvakvjVxAHCaBqggI76BE /IyldHKfvbLvBE9GwCyH5rOY7kpJqW6c5i2kRw2oPxkfKYqe2EDqe4v9+rzVwH60lxjR 8XnFO5ZLg6yiefAlPiT3M1EdhkUh9Hd1qsbuzgf5mKj36sajWTc0erv1n3zcBsLMTsvH +/LSWuWzC89SdkufwyPw8PCLADcVy7Db3MZbEXLj+hZTCSThjL6yekSlkcTmB4ZQ58UW vEdg== X-Forwarded-Encrypted: i=1; AJvYcCVGMJ8GbwJC5lt67+bcyuuJc9b5Bmh1G/zbDJFBpGVh4kTvayLZenQxWHQFk50LH8SwyVeeJcscfTC0dwg=@vger.kernel.org X-Gm-Message-State: AOJu0YzsJpoBl21Qqxq2v8ut2m/uw84YhuVfxMdjWimcC62p76HaM9id H7IUUjqMwTD5bb1jB1d1P8hHVr/3NRkFSqFPZBoEzS3l93OioN9ctI67CzdEGyRFGJMKtdeyrEh zR5EM8xbNmpFNkRRw2dHiRM4YITJGL17mymbG/uofAIBcYDgpWuYvdFQ2ZOAPyi1apXc= X-Gm-Gg: ATEYQzzI6mWFnkHa6C5vu8VLF+a1orhFoPaz/8EpzNRYCFtnnBWFT+noJQEUkej2Xbo RuMUpm88AaZ0OAuwQJeJsey5kZbSXhv+VOmJ+HWVdnN+XKmIqcwGiDyY5OA4tQRnAm4t4XLPtoa tkjVnMee2i2vR92XBGmeqK0/8sLYnISxW89uLyP4VLkFJcGyaO6Qh1AIVuc9lsM958YoknzhB0Y LFrQsUigmNuIP3plpV8vNE5ovUK4vDIoctOnRtKUUzWJ63jK9aIcS96kvE0tvqZPO0a6ZbiCcPo HgKdvPwNDoETSTIFvn/MFNqNfo1gSgs1XIA0e/101qpU0tFSW6JsMTsHIS3Akkr2EjOb56mqKRy kdhIoJlDKlvyOnq59PX4qJaO6boVeTsWEUKnXkBnjNavkgtVRz1qLlXdoGVhRAteph1PXVOvy5W UjlfGpleyS X-Received: by 2002:a17:903:2c50:b0:2ad:4265:bfab with SMTP id d9443c01a7336-2ae82367abfmr95444535ad.5.1773049701574; Mon, 09 Mar 2026 02:48:21 -0700 (PDT) X-Received: by 2002:a17:903:2c50:b0:2ad:4265:bfab with SMTP id d9443c01a7336-2ae82367abfmr95444295ad.5.1773049701114; Mon, 09 Mar 2026 02:48:21 -0700 (PDT) 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-2ae83e575e6sm104948435ad.5.2026.03.09.02.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 02:48:20 -0700 (PDT) From: Jie Gan Date: Mon, 09 Mar 2026 17:47:41 +0800 Subject: [PATCH v14 2/7] 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: <20260309-enable-byte-cntr-for-ctcu-v14-2-c08823e5a8e6@oss.qualcomm.com> References: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> In-Reply-To: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Mike Leach X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773049687; l=6057; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=cfmc1VLxOy3etVkZ/MkjeByju832awJF6a/lCbGf8bM=; b=p9HlbDiLRYUetMVKeBUUGiPvA5RXjctin3mI94zp9naMCYnHV1bF4jaYxPMEFztVftCOEWJUC TSVrIhT+X9EC/Q/AaSaaRYoEq7cNkMBB9f78Lb1cjLIN0Wi5o5NJK9F X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: IpiVS5D9D0s_-KD74-fER-ObaXsxVnov X-Authority-Analysis: v=2.4 cv=I+Vohdgg c=1 sm=1 tr=0 ts=69ae9766 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=pN8Znu5onTEf3dnVCfUA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA5MCBTYWx0ZWRfXya1Y1YDB1Elz uhyfOn2bbgdQL4EmjXQe6IiqVqih1FjOzcEpdlYQzQXT9hrn8F5compvYRNabbXUkocChfwY77p J5cpYj+BlJpzXbPxr1VMvNsM/pqjj4u7Ta9IMLih4a9sV1QFqXv6UA7caW92LCmujLU5lATT1na O4kywguK4FhqtNQ805OW9b5syl5ne1wmkPjChw+195NZ4rLy5b/xG5fupGhYnQncaHON2MGoBBp fR+GixeTsrI9fmiN94wRMmMnuavRIsgkyi9OJ1EMz3ASZuBmInJbqKN8Rb2QEmVEATH0jlyjh// +hvIiQJg0hqZlUXoi10TtQu2KaSJE9gKgGg7uZzxrmZPjZoFEJZRJfyiSEL/ZZHp7nqjAPUrYoW fs6FGN/Z1ntUjhUzS8Wveak08pTUWPE5x1ulq7wapoOSyMAUUYoqFiIL2fnvsprJhgyh9mRsSL/ ZbQC2hq6/bjB3wyWlKA== X-Proofpoint-ORIG-GUID: IpiVS5D9D0s_-KD74-fER-ObaXsxVnov X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_03,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090090 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 | 17 +++++ 3 files changed, 112 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index c89fe996af23..bac3278ef4dd 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -835,6 +835,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list =3D "tmc_etr"; + 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 4dc1defe27a5..15c0874ff641 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1918,6 +1918,100 @@ const struct coresight_ops tmc_etr_cs_ops =3D { .panic_ops =3D &tmc_etr_sync_ops, }; =20 +/** + * tmc_clean_etr_buf_list - clean the etr_buf_list. + * @drvdata: driver data of the TMC device. + * + * Remove the allocated node from the list and free the extra buffer. + */ +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata) +{ + struct etr_buf_node *nd, *next; + + list_for_each_entry_safe(nd, next, &drvdata->etr_buf_list, node) { + if (nd->sysfs_buf =3D=3D drvdata->sysfs_buf) { + if (coresight_get_mode(drvdata->csdev) =3D=3D CS_MODE_DISABLED) { + drvdata->sysfs_buf =3D NULL; + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + } + list_del(&nd->node); + kfree(nd); + } else { + /* Free allocated buffers which are not utilized by ETR */ + list_del(&nd->node); + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + kfree(nd); + } + } +} +EXPORT_SYMBOL_GPL(tmc_clean_etr_buf_list); + +/** + * tmc_create_etr_buf_list - create a list to manage the etr_buf_node. + * @drvdata: driver data of the TMC device. + * @num_nodes: number of nodes want to create with the list. + * + * Return 0 upon success and return the error number if fail. + */ +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes) +{ + struct etr_buf_node *new_node; + struct etr_buf *sysfs_buf; + int i =3D 0, ret =3D 0; + + /* We dont need a list if there is only one node */ + if (num_nodes < 2) + return -EINVAL; + + /* We expect that sysfs_buf in drvdata has already been allocated. */ + if (drvdata->sysfs_buf) { + /* Directly insert the allocated sysfs_buf into the list first */ + new_node =3D kzalloc_obj(*new_node, GFP_KERNEL); + if (IS_ERR(new_node)) + return PTR_ERR(new_node); + + new_node->sysfs_buf =3D drvdata->sysfs_buf; + new_node->is_free =3D false; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + while (i < num_nodes) { + new_node =3D kzalloc_obj(*new_node, GFP_KERNEL); + if (IS_ERR(new_node)) { + ret =3D PTR_ERR(new_node); + break; + } + + sysfs_buf =3D tmc_alloc_etr_buf(drvdata, drvdata->size, 0, cpu_to_node(0= ), NULL); + if (IS_ERR(sysfs_buf)) { + kfree(new_node); + ret =3D PTR_ERR(sysfs_buf); + break; + } + + /* We dont have a available sysfs_buf in drvdata, setup one */ + if (!drvdata->sysfs_buf) { + drvdata->sysfs_buf =3D sysfs_buf; + new_node->is_free =3D false; + } else + new_node->is_free =3D true; + + new_node->sysfs_buf =3D sysfs_buf; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + /* Clean the list if there is an error */ + if (ret) + tmc_clean_etr_buf_list(drvdata); + + return ret; +} +EXPORT_SYMBOL_GPL(tmc_create_etr_buf_list); + int tmc_read_prepare_etr(struct tmc_drvdata *drvdata) { int ret =3D 0; diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 319a354ede9f..5ac07e8dd5ff 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -208,6 +208,19 @@ struct tmc_resrv_buf { s64 len; }; =20 +/** + * @sysfs_buf: Allocated sysfs_buf. + * @is_free: Indicates whether the buffer is free to choose. + * @pos: Position of the buffer. + * @node: Node in etr_buf_list. + */ +struct etr_buf_node { + struct etr_buf *sysfs_buf; + bool is_free; + loff_t pos; + struct list_head node; +}; + /** * struct tmc_drvdata - specifics associated to an TMC component * @atclk: optional clock for the core parts of the TMC. @@ -245,6 +258,7 @@ 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. */ struct tmc_drvdata { struct clk *atclk; @@ -275,6 +289,7 @@ 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; }; =20 struct etr_buf_operations { @@ -447,5 +462,7 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, enum cs_mode mode, struct coresight_path *path); extern const struct attribute_group coresight_etr_group; +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); =20 #endif --=20 2.34.1 From nobody Mon Apr 13 05:38:13 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 00B1737F8A0 for ; Mon, 9 Mar 2026 09:48:27 +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=1773049709; cv=none; b=hxzUpsRTIg1Sv9bxLgY6d2ZFo2lFNxwJ13CEAepoz9KOeLhv76XXNNw28TVHBju7RNrXg0PD4CFihMwqbWHFqcQWkmIpc6hE89JH9qU8f3QMFFgh8sFb5EHnKXjFGQZ5512m3OzUKUECeSvA4OBqu6z8Yk+P5bOjK1odPw6+skg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773049709; c=relaxed/simple; bh=QrDgnVgN9QaZlb9Pjj5rr7RirVn5w3K3JbRC4UnCJSw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XXDeRYHiAq6xiMALtFHlFcux93J/7V8IoqqZeuhaNsdxK+hRat0fO40vLTKJeGfXL0oRzsLkrFN76O54T71SjEq8BoUVXJiol+XMtmmzyGyJdSRX987o7c34Z/FGYMxrAy5IersPJGg8kIR97HRqJ1krbvr41YqfIOZ/BwKuSDI= 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=biTdSM1m; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=OlE9Idj1; 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="biTdSM1m"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="OlE9Idj1" 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 62981GNq199406 for ; Mon, 9 Mar 2026 09:48:27 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= /lTbduWn2JF6hflXdfZAESir+Ygdnj8CJ5d+aQvJmBQ=; b=biTdSM1m4se71qQ0 hxdNSuTApqld7yrnRvd4vLWTmunTo5HTJtjxq/as1tzfoO7TVigOzuJCymH9iL1+ Xvxc8gJcvyDHHzBH4G5c470xx0KLetraxqWSO4mV3V/ZYsWDe5/ckQ3VmdS58XL/ Xr/j8afTcrY61ue6/HpcIXyy3f4Ih7sHnnBNa5LBg2g8UvISSy3QyPs8h9SFv449 u62vMd1JCy+GUGyfvOXr0pVYzP+6WMXPR+L+yrNwkebHJU66QrQt1fgWPCRj/5Lk 09JPgPF6WG29FM3sHJcLeO55KE35rTc/bl4/Z3ql4rDC1DPz3u7VFyo76H+J5dtd qfQuKQ== 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 4crc3vcu00-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 09:48:26 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2ae65d5cc57so308337325ad.2 for ; Mon, 09 Mar 2026 02:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773049706; x=1773654506; 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=/lTbduWn2JF6hflXdfZAESir+Ygdnj8CJ5d+aQvJmBQ=; b=OlE9Idj1xYh0efEYnDRwF+L+Z1D3ct1dKYQiCFaCBR/Qza8Hq7TFFd05D91XnF4Qsp INUBJrmocEx/ylYHChSB4PIFZB4TzIdONXQKZpuMGqbgIkfs4g5QLPbqSVBujyEW1PT9 ixl/ULQvW72SOQd3EW9jyTboJlkgjg9X3pTfMpuB4nYZbAnCXdPnYOds6+5P7FkAGuum /rjR8W/Wg9id0l7agb7X+v45jC8M6mU6TINhZuCL4jF1/9T72cU2q1EJBz2EZX1hsL9O weiOyHO+AliZnRUgjK47h6qOoHv0LkETvqRtOQil/dZ0/oisPl8lU95XwO7XNwPa2x9e uy7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773049706; x=1773654506; 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=/lTbduWn2JF6hflXdfZAESir+Ygdnj8CJ5d+aQvJmBQ=; b=LXuc9UhO0EADDRnRcb5VZJ0kIMYdik1lixxNwFHF4g4zPo34WlBgK2K7O/9xt4aQcE R1E7D+bu2Lo2j2GwqxcmwzNHAjTSry6vOzQYcnmk2exLDHlRICPknDtFsCLLc+9zaVpK U4iPDHY0vonmQRy0gPhVD/4hJhX4vFDT5zpKkfwalWBDZsayfiiIz7d1CSoerJMjIcCE /8HNhdRgmKzApbc/q2Zqat9jEnkQX1NitRn42Tfav520tNjPZ3MlC3b5fo/UySfMuOwr Iw7/0P6ExthPRHI2SJHR27eLF6iOyoHc/HK2NSs0WMsu99MKGJz0Nrdf2qfvRMdwkJ7W n4dA== X-Forwarded-Encrypted: i=1; AJvYcCVjMQg4CM/AsMDThWRsDMkagoDa7YOFxpbh5ON/j7HQUjZFXEwz3+cng42GbkuAStvvCN/R5NoIJhidsxE=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7nH2mD8fDuPxXUbduQev0/JqQ2n8zDOvhs7oeNHUTd972boxs fBplYh47FftpYGclJUywxC4I4AlAa804Wwzphm5GViacvn/cwbj/hMXs3UVQ3z35lJYH7L5fA+V Sq8oizKrm8eIEPrKqyiO077TNp1GYEsrRZXBH9szALCpwQO5AfKa5MhiB1Yd4ncFIZI8= X-Gm-Gg: ATEYQzwcIAF5qcf0Oatb0cGdNWYNgi7TQy2y7D3k/FlnVrSwhJKM8h9/gQwdf33siQD 5irEYAwrDbU6h90agzUDMHT9RSAQct7yqfVGAOo27uAhN49LF7IdFZW53G2m3td8HslQaZgUHM9 L1BKgBy8v/ZvZvqmuXyv3rPgrQRw0n/xNBtwjj09EwDEXenmJbU5UBMOZVz5QIMbstwXYeVk0OT lFDN5Czg8on+ndO4kNvWGOlGwRMcpn2P0O8xesKlpttcfgPj8O9QqQFwDlKua8/r9zkS6n/i5UI 2jZk2YEdUSOCIPk1YDGRH/5ICMVIpOPGO2VFUgzy9StOKIdK59zVi1wWZPazCTIg7JI2xk4czq8 gaMP4SeA+3Cz2nwsVa3XiXTrcd4PPttrISfrY7X6kxAdAx/pUSZZkR/YmS5ha+OMiBxrt4Vm1gL ahdNlgAnt4 X-Received: by 2002:a17:903:40cf:b0:2a9:5db8:d651 with SMTP id d9443c01a7336-2ae823b349dmr103277375ad.25.1773049705968; Mon, 09 Mar 2026 02:48:25 -0700 (PDT) X-Received: by 2002:a17:903:40cf:b0:2a9:5db8:d651 with SMTP id d9443c01a7336-2ae823b349dmr103277085ad.25.1773049705400; Mon, 09 Mar 2026 02:48:25 -0700 (PDT) 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-2ae83e575e6sm104948435ad.5.2026.03.09.02.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 02:48:25 -0700 (PDT) From: Jie Gan Date: Mon, 09 Mar 2026 17:47:42 +0800 Subject: [PATCH v14 3/7] 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: <20260309-enable-byte-cntr-for-ctcu-v14-3-c08823e5a8e6@oss.qualcomm.com> References: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> In-Reply-To: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Mike Leach X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773049687; l=5200; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=QrDgnVgN9QaZlb9Pjj5rr7RirVn5w3K3JbRC4UnCJSw=; b=yxl9m8Ty4i26yQ6UJTJPydSgQqLp+CGWhP1ClwC6hg5uLbQ/+Vgjx+t+odguyBG2oDLHYXcn3 h7WKUo6vdHHBOc1Ah7ir+FojeGznSGL9aQnqEDrOwUW69m2LqA6SV9e X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: sdwTkdps_6KmKhJUuqdojgRe77syLwT_ X-Proofpoint-GUID: sdwTkdps_6KmKhJUuqdojgRe77syLwT_ X-Authority-Analysis: v=2.4 cv=OOQqHCaB c=1 sm=1 tr=0 ts=69ae976a cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=ia3uihG--C1vaqsH_ucA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA5MCBTYWx0ZWRfX8tU2R779UjmP POS3qNRLnbgXqx3f4IVZnwtMcIHEs6sPRnls+JtWq7tWsOumEDqVKIERTXpSx5PJvkLsgg2dzaE a2nVc/vKvcCAlNw7EL1DplPOvHvF4cXPWHY4/loyf80yYfUDlkN+vUkq+hlMV0bjQXd9B7QhQeO XuaLgJjYe0i37NG6iQc4z0e2NmtiPRbS/HopcVCFa/5rZ67pQosIMNOJKPG2y0SJOcltIF+NqXv DEBsSeBC/l1YKKCXxrGW9/mnNJPlWwRGoNmQMOEg94kHNFV23NINryfGV8Zeamq+NfBzaKUPB22 SfQFsUdvfGmCZF2NYytQ+uNFFIqVzChPR/UaYTLSy3WJbtnT3eIE4+umtjGISzeTUBF1Ta0urYb BORt++Uksazr8lBdIvfyMVBlEAjuMvbbTmHb0X2YXCJuBb4mAbI8uhtycaeZJXEcVTX4mfgk2EA M2zxAsf0X862Z4SpGRw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_03,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090090 Introduce tmc_sysfs_ops as a wrapper, wrap sysfs read operations, for reading 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 bac3278ef4dd..110eedde077f 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -228,17 +228,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"); @@ -250,17 +243,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"); @@ -287,15 +273,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, @@ -764,6 +742,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; @@ -823,6 +813,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 "tmc_etb"; + drvdata->sysfs_ops =3D &etb_sysfs_ops; break; case TMC_CONFIG_TYPE_ETR: desc.groups =3D coresight_etr_groups; @@ -835,6 +826,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list =3D "tmc_etr"; + drvdata->sysfs_ops =3D &etr_sysfs_ops; INIT_LIST_HEAD(&drvdata->etr_buf_list); break; case TMC_CONFIG_TYPE_ETF: @@ -844,6 +836,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 "tmc_etf"; + 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 5ac07e8dd5ff..69d55ee3895f 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -259,6 +259,7 @@ struct etr_buf_node { * @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. + * @sysfs_ops: Read operations for the sysfs mode. */ struct tmc_drvdata { struct clk *atclk; @@ -290,6 +291,20 @@ struct tmc_drvdata { struct tmc_resrv_buf resrv_buf; struct tmc_resrv_buf crash_mdata; struct list_head etr_buf_list; + const struct tmc_sysfs_ops *sysfs_ops; +}; + +/** + * struct tmc_sysfs_ops - read operations for TMC and its helper devices + * @read_prepare: prepare operation. + * @read_unprepare: unprepare operation. + * @get_trace_data: read operation. + */ +struct tmc_sysfs_ops { + int (*read_prepare)(struct tmc_drvdata *drvdata); + int (*read_unprepare)(struct tmc_drvdata *drvdata); + ssize_t (*get_trace_data)(struct tmc_drvdata *drvdata, loff_t pos, + size_t len, char **bufpp); }; =20 struct etr_buf_operations { --=20 2.34.1 From nobody Mon Apr 13 05:38:13 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 5EEFB3806CB for ; Mon, 9 Mar 2026 09:48: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=1773049713; cv=none; b=i8zEIqVSincEoXE7RcM+ICtdKGYxloikkTQEoGSFXbnsVTxTxyBMTE+BV3+loMLo6BWOHM+N/19Mu9QnTlIdGCRR40zHB0iu7E3c34jq9420Idc3yMZfOa5xXTllwcBUGTldtT6Sw+TKRnPcrwWZAyBloY7NOYRJk9mjoe4sOCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773049713; c=relaxed/simple; bh=llmH4e6V3hO6E83982AsOxGjOSWUtW0WJVedEVEMywU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kQ8cOlmZGA3bCbOCMG8G+u4j21c6jC0t8o32xKfgeszXKwapslPvDkzhvYzkvcDlOO/tpaxRxQE2FfXASeTs1KolzUVAUBXI66ITkITg7vQJiKP9nbfNYbW8RQMeDTFPN/LmGOrxmFj0+tL86NqfPH1glvEG/kB8sCpb3hn3ZqQ= 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=BhUnyAja; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=OUcJmyqF; 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="BhUnyAja"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="OUcJmyqF" 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 62981evV233691 for ; Mon, 9 Mar 2026 09:48: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= ni0/4keecpjX5VSQGHRPGLdHSb1TkQhd8WAcXKlEV5w=; b=BhUnyAjaLEdiIxpL jvTrmaziZsrGUESQ24yWUDhSw0n+/nxKNUZyBXj5Z3vL0raJ/TyDAvOfGFMoO7fD oECwOB8zXIBfMYL+bFgOfMP6W5DxqimYpKDyM70cH95O/Li6i8HiQt6RcuPiGVeL DQV1Mehy0okpQ/rK67uJ8o7DfFeywOx2jr34169dMM70a5kJeIXj77juF0h4Jc1i tMI9Us9lWU+/nMMM+hgU2I2SdGhFzZj8CqW6J6gdItRyVJNiPFKNW3iVpG8YaXym +F/ULQWIa1a/DQAwU19YiHn+jiYVyTAzFIvAjpeEuyQjD4oaZ0t8XoF/23aV0R/A t4Q9LQ== 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 4crc3vcu0r-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 09:48:31 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2ae66ee7354so58065185ad.0 for ; Mon, 09 Mar 2026 02:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773049710; x=1773654510; 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=ni0/4keecpjX5VSQGHRPGLdHSb1TkQhd8WAcXKlEV5w=; b=OUcJmyqFy/wVeIm2/rCgyDfhFaU5r0huE9Bzi0Y5ccXgJtLMkWH5IzjZmY4bWvX0ee 0TwIBxmb3cNt7uoUa0+IiNtX6Y519tL9EauORJwpvnrYZoAyJZF4MIQwlrQd4JjC/mzH map51MPI7apfxlbbBNtXielVWgE5dVzaZNgtcv0GL/mc93xtYcJtRt40DI4BRDUc+/iu BwAzyZAnGQ/juTX0TVzFrzRiZswQv+qmDkhFmwAUOPx2dfMKyWJgzRvzA6911hwIGAym rrjTYNdC5n0UxvvsO8vf4gg2Y5dDMd4Ko3xyeBcI1GqsYSFTtSV6pUv5BoV8CkPqW/Gs +6xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773049710; x=1773654510; 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=ni0/4keecpjX5VSQGHRPGLdHSb1TkQhd8WAcXKlEV5w=; b=Ul4f+sugSIcFmpKnSSJ0DKZHA/BfcLJCII/tMz1pebECNBNdG0YNXFxKlCZZdsRQ0z TuvKpdyCWj4VgBa8sR0uP4UHqLobIf8WjUd2htexE3EXc435pDsaIX3f+PzV2WP8+Hvq hPNFci0LU8PxRY/m/nsKFbS1wWyOJxw/wDourN9XMoP8hAn1dgMhiGsTkesmUCANqz12 RYiaDpOGQ6KOyEyaXugn0wV0FOdhjQBltiixw6T4HD7xM9OdYCxG5Nmibt8ujZRITo2e uq3lBG/jeOIHr+PtDo3Z32ghFuOE4tNMvJ8b2obfAUhQoc6265YKubpoFCbQvOkUi+eu YcHQ== X-Forwarded-Encrypted: i=1; AJvYcCUWeswV1V/VUBdmW2tQK8rQHNPBRKeojALBPCPw9R/A1Hs1T9kgJSAg4xqh+orsxwWepxgUEz3rzkerDDE=@vger.kernel.org X-Gm-Message-State: AOJu0YwMkUw78uKeg7RXAVL+MJOlokeSlhIb/AhWAmcnLeG/InXuXpXO Qe+2NqTvV1pPIw1JaKrVZyENXyK9sncGkS3+bT5ZoxbyLYtX5+UjkZZRp4zWCUYMFz6EvhYGQ+D nuT0d5w/EemlpIpvzIxZrp5sW//jFX5SojemRhVCDpKdhcf0SN0R2TbRJ4qVXWDJGcH4= X-Gm-Gg: ATEYQzyOoyPTD9ys4Qth62+J+9ws/50nfh88le8/r/SWxsYsB+hVQymfd6BclwCjMe5 iWdfdKzMf4WQSR2wXz+TfJaENtSapy22IRC0cxuqr7bqOdTx0br2ZsFpmnwoOgPFyqZkeLOhPsJ wN8gGWBxs6lN/KOg45z0kCQ/zrF6+9wyh9URG+SWdjEfgfAC+rgRavUXKPYAEjainXDRZ8Nu9aH sXCAi8+XpkXCs7u++ohEWoPHHxbByGBjV5zPbWGbVDE1oeMavz/Vr/b2leRKMGjJEVIkFiCmODG ODBI1hlNPbcLH3NLMEQrrbPeGtn47mm9hGvJfV3tPvtLS2iIDRSvWRpHo9b097rwuvg6MlBTuO1 DsDQHBwvzKecl71BPpf4f71S+yUD+vz2Je8/f+9YqyVeDi/PX2lsAbd6KwPjRfhii4fD7N00oFg rZ4IvKHgHG X-Received: by 2002:a17:902:f54e:b0:2ae:5b64:12d6 with SMTP id d9443c01a7336-2ae8250bf7cmr106451105ad.44.1773049710255; Mon, 09 Mar 2026 02:48:30 -0700 (PDT) X-Received: by 2002:a17:902:f54e:b0:2ae:5b64:12d6 with SMTP id d9443c01a7336-2ae8250bf7cmr106450885ad.44.1773049709754; Mon, 09 Mar 2026 02:48:29 -0700 (PDT) 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-2ae83e575e6sm104948435ad.5.2026.03.09.02.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 02:48:29 -0700 (PDT) From: Jie Gan Date: Mon, 09 Mar 2026 17:47:43 +0800 Subject: [PATCH v14 4/7] 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: <20260309-enable-byte-cntr-for-ctcu-v14-4-c08823e5a8e6@oss.qualcomm.com> References: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> In-Reply-To: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , 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=1773049687; l=2348; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=llmH4e6V3hO6E83982AsOxGjOSWUtW0WJVedEVEMywU=; b=ZWwvjevBRuD/l0uekFO+E3V0xCFxTSow6u0fcDJPRW/fuMwYDlO4ra1VdbrW0jw8FnH5JfkuW /Fsg2B2btOHCX/vyFjPgGVmo2b+UJ8qqqOk+hMQtjgHLukNIAOBhn31 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: aTqAs2LEuKRJOEt8l79wf05wfclYSLjy X-Proofpoint-GUID: aTqAs2LEuKRJOEt8l79wf05wfclYSLjy X-Authority-Analysis: v=2.4 cv=OOQqHCaB c=1 sm=1 tr=0 ts=69ae976f cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=FuIWbRVyn4pKkvqW11oA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA5MCBTYWx0ZWRfX1An5Tqn5/7Cj GAjQdg2vdOhypGFogI6hSdCxF0+36xW9J4US63Z/XNHxUjN4T71ptIVYA1qyhcscKAeXZp8P1VY ELjds3G4VJ9ULJVmpaR1TNAl5L/7mCHABwujMPcb7S4MIktQop1mpnI7g+mbFZtcWwNvZAioflL DznLH3fm5CdVmZkOisYiKtVRhqQ9zaWdLBCi/ZoDAa9LyFrWloaeeXZ+nhg7ns8qy5orlou1TmY 8k+GmS5nejAAYLAMoU4Gb8xxqtpcRBfrD7V02GMNk+FAwZcERAkTK3C5P9GbaQaSG5QZXLFJH6+ F80pKDDuv7dMMii5JAxP2p+SacqbrXpbHl5pAk2JW3L1I1jYXHeuiST5ZXPuWajeeguUA8+CjdU gfuvU4AQnGCHv8m2tsbrXWTe3TrDFhHRr6z47SjESGM6dpedD6Zem8ZrRbQ+PVegV+mVhqjiYFh zhyQG3Z43LrrtzERISg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_03,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090090 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 15c0874ff641..f4223215ef8d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -865,6 +865,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. + * + * Returns : 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 69d55ee3895f..aaa443abe8e9 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 Mon Apr 13 05:38:13 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 D32983815D8 for ; Mon, 9 Mar 2026 09:48:36 +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=1773049719; cv=none; b=Z683rIRnHXgrvNBjJiU/6jWiKzsG3UbAvZPmvxu1HZG/rQL2ikuSOTL1208tp8TjpmIysMy8HKaHudq+bS6Cnum5We2vK16Z/LNQ//kZ0WMwCSFRHwJMha2bmBcZ8Jhmn7H+ps/G10CxBF1av3UtLKce8inqCaYfP1k2jI8mMeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773049719; c=relaxed/simple; bh=DsL6kcYT3hY1q2jvZSOp/rxfO6RBNAUHqHA9yEMzJAk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pfulxhpzIN+AgzDXv448UpCbeRdyvC8xlM9YkrIjlsKoezEhjABZR7v9GIQO8H7dXaOsfT5Aps7M0AeTKwGdXLcxjE9/jJMUjPEtutyqJvPW9vb4Zwflzh3ZZaYSKDreBtYYFSob+xuqtfZ9T6PBd8TU7NKQRfQWKUV/qJFBi+Q= 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=bUNbB+gA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Cuq1faEf; 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="bUNbB+gA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Cuq1faEf" 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 6298W9Ae3773088 for ; Mon, 9 Mar 2026 09:48:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 5AiUjeizRXgIt0pWaEk9wGXXVAIJo5RCeKWJBfIhvcE=; b=bUNbB+gApcvvdBY5 b8XQnyMYEXkMJsk2FqKHhXCE1/gBey0epeYpuCZRq8jHXOBBanMWKzgWP7VaqLWp 80Y1bg/KOybcJ1tasooPS6Ce4qOfpP+L83NJAc8czrx8pQLEmgz1DGgnhRuCeFlG Tv6vWaoOaE0iLBg9PiPdYb7tAgSF/lw/koXjJLMYAUa89xaAYueiUfGZrjBBSMVz 7VTouxuojTkz6pOUo0gzA7+8WEOa1kWP2j35379HFhkAVD3DDIr5Px0Kz6boBsx3 DetbvhxftJC/FXeY5dY6vOWzdIZ+yxbN615IqQQxeoFR4dQzbhETn71IY3AiZDBV QQfoDw== 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 4cstsa89g0-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 09:48:35 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2ae62c87973so316645295ad.1 for ; Mon, 09 Mar 2026 02:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773049715; x=1773654515; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5AiUjeizRXgIt0pWaEk9wGXXVAIJo5RCeKWJBfIhvcE=; b=Cuq1faEf3mkWLzLGgbUsPk7YEL0r6ULGmK9A54k1o9CQnOo1KUdqpgXf4JWcfU1TLW zwdbmFF6DUipuEJxRHaPiKlR3VmlgGpkalfUv3bHWcEdlIt5STn0Lkvnvd/GwTZluC73 aQSGwlaWmWiUcHOPKdK2AdA0BB1ttmf/Y/PZkzdMwFXoUDWGKMOPib+UDMkBj7xjt1vL tk1qMLbeZXJtqJJyW6hjKp5pUhnjHauMlR2bNGN5cC6/yVJBBTd0j6yz6hezD+R0FVJc wXE8Hl3Kk6cPRgtfz9KgaUOpGLJRIUjRlFzrotZKY4AIuJLQEoKBy3aA/aWNthX3S6+m fVvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773049715; x=1773654515; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=5AiUjeizRXgIt0pWaEk9wGXXVAIJo5RCeKWJBfIhvcE=; b=Wf1kJOXZWmGHr0is5KW4/ax73yJKWuQvU0KUaZrHml1uKpXIWVtr3X4mEFgi8Ii/Kg 4Ti3QJgcX9AneTniLWkcpawIkMOprWh1NbhIuxkqsvuUoeJLrFOadAUnxyNz2EBowhgj vsGAF1d+AA+jxE8aHdEhtd13X8GkgVcU93yCYSC8gE2npY4MRTFDO2mc8pVkPkJwK0nR 5RHi8PLzxnAdVl1Bh1pY+shZv2z1A5k28oVYLu1fWIHgjQW+9Coh/8gkVIB/y0m37e+Q cjETrNyKW/08gfGH2lMF0fvIQM9D/pwYkAjTQfyBdY4tuXFXw0qldzLNz8gqlrp1fxJk 9NVw== X-Forwarded-Encrypted: i=1; AJvYcCWiUS1byDgHST7nOGyEbBvYFcGCZ2a+enwH/n4RlRT+QYeB1CD33QRrruaO6oVRJtfaj0lzSk2EqC+u0yQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxBesSXawUtMv1OWgdgLjArYI6qO6ogmjnMXnnTRxJDrVNt9YX1 0Hr/M0bePHMxom/swFoQISq8hsmwOMt2sw2Wnex543OlW08UGleZ4kBEvgXEpsewmdqbN2fyFvO dq7qZxvgBmNbxMXx2d+FyEiOZfz9rQztJx2GHHh7POMalvODj0NpKO3Tu/nFrhv3cArE= X-Gm-Gg: ATEYQzwmM3e4GmtnIAQOdkXlSV/jDX+NxR2icKPAOLJKGdm9PxUZB1VBnnS7qKoOzU7 CLsNvzi7Uvk8CiHp3z8V5rfpipL7VEdfV4Ivf+LJS1/+gfg1RRoFLro+GmUJHIMqD9DN4G/4LnF gHK/oReq3qMOKCowMEvDqwvaM4Wz1KbQiIPBDE0ryUz0Xpxd8PsqLnR4Em0fvibeQxpbav6Nw/T diMlr2pDISaokNDHRzGUuv2k1l1zgs5CUNOsuzxG+PVYx6VnQguNKUafEykOT3xJ6NNiUONcceD UnSV8WKSbKJKdCQfUAmoV2imdlxnVO9Nq+Mx3LbPreYAW/OOQ87E3OSLza4DkrtOQHaQV++oaRx aGjN3gi8s1IZ93ar5P8UYi6EEMO/E42NX/18I91jo8lRisVjS1qV1JIqnet2xN+tZtVZ0ikgseg Uw9nPoQBNY X-Received: by 2002:a17:903:1af0:b0:2aa:daf9:6980 with SMTP id d9443c01a7336-2ae8242d919mr118233235ad.27.1773049714818; Mon, 09 Mar 2026 02:48:34 -0700 (PDT) X-Received: by 2002:a17:903:1af0:b0:2aa:daf9:6980 with SMTP id d9443c01a7336-2ae8242d919mr118232925ad.27.1773049714233; Mon, 09 Mar 2026 02:48:34 -0700 (PDT) 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-2ae83e575e6sm104948435ad.5.2026.03.09.02.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 02:48:33 -0700 (PDT) From: Jie Gan Date: Mon, 09 Mar 2026 17:47:44 +0800 Subject: [PATCH v14 5/7] 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: <20260309-enable-byte-cntr-for-ctcu-v14-5-c08823e5a8e6@oss.qualcomm.com> References: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> In-Reply-To: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , 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 , Mike Leach X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773049687; l=1751; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=DsL6kcYT3hY1q2jvZSOp/rxfO6RBNAUHqHA9yEMzJAk=; b=VVEH4Y2bVVMa+sGcTQvGmFBKcR9SwZ1HAcL2UCbh4RwkexIhcoJw8V8NmeZDhnuDq9LuoBMXe tKGwtRztBngAwhUxuHA7JlFlvLhoivX6tXijBQz8/UA5NnCSU3B+cvD X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: anim0L6SsxON3YODXEHFa7ZBwRCq4fAm X-Authority-Analysis: v=2.4 cv=I+Vohdgg c=1 sm=1 tr=0 ts=69ae9773 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=gSyxy6DGYGa4b6s9XCEA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA5MCBTYWx0ZWRfX5XBGBL4wqlS1 qkMG3IW/fGTEnAADOXbl8FeC0kLXuldLOGhW4TmvCIZ8nZMfJaiCtLMJ/gbVDmJbyiOuy4XNOt+ 4bp2eS7J6hL7suPVvhK30VIRCvHv+qT48fp7NPDg0wF5kuah2kG3OByqgednUn2bA+ByVhynJIX QzJUGG2HoGII5bfMBPJLFyyrnXYke8qGyNJ4fyopJGjcPm5oAbFwf+5RzqBMhtqh37OwYjLlay4 vsGHkqkGk+1LbVETp9QGZmAgy48cdyoKZWp2KTcgUY+fSEQEehmqpaO7nQ0TolmlXQoGwveyYog hZZCNG65HgJMCxGwcjKuLJ8h704pKoebWtetanbyFUChrkZ4V/StIHPszKIsS1PVKbi5mg+E96n eA9/h5j4wXj6PZa8NhH54BQuGdu8Rcz1jkcwLtmQ/ueZxmvS83HJj846OUq6ZjjL/bS37KMI2qC X9vo+Rk6MeEbHZxr0tw== X-Proofpoint-ORIG-GUID: anim0L6SsxON3YODXEHFa7ZBwRCq4fAm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_03,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090090 Add an interrupt property to CTCU device. The interrupt will be triggered when the data size in the ETR buffer exceeds the threshold of the BYTECNTRVAL register. Programming a threshold in the BYTECNTRVAL register of CTCU device will enable the interrupt. Acked-by: Krzysztof Kozlowski Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml | 10 ++++++= ++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml= b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml index e002f87361ad..2981001a7d7f 100644 --- a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml @@ -44,6 +44,11 @@ properties: items: - const: apb =20 + interrupts: + items: + - description: Interrupt for the ETR device connected to in-port0. + - description: Interrupt for the ETR device connected to in-port1. + label: description: Description of a coresight device. @@ -65,6 +70,8 @@ additionalProperties: false =20 examples: - | + #include + ctcu@1001000 { compatible =3D "qcom,sa8775p-ctcu"; reg =3D <0x1001000 0x1000>; @@ -72,6 +79,9 @@ examples: clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1 From nobody Mon Apr 13 05:38:13 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 D70C83806C0 for ; Mon, 9 Mar 2026 09:48:41 +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=1773049724; cv=none; b=bcRVZijknyR6rA9K+K9Vwx6+dUsLnqngmnAhhX3nSFOSDfneeYfFKRQZdYmRdRKTdfdMyFuKm+e/JrlrqJhh8ETg7dZA/EtcDOswUhnjeez0NWwIgRSU+z4YvVqOfioFagvWMjxCgTx1SVpQjzmRXGm2+q3eQbOpPcg7PpFJsVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773049724; c=relaxed/simple; bh=0T9jMctLmHsKsJot7YHh8HAddfx384FnlCOuHPfCehw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rjIeKbD/amd9520HY/SzF8xqdklSeZX1eL2dGDhhAEdeMjKZGKr07lR/z9a/zSy7sUVRiCxHAMdnGzeRfbE2OIAuu3cbEHdkH9MIsxM7NDU7d5/UThlKf9QALPU29mbwyW9Q0vNhY0levcKsi+a2ygeJDTa83hV+gcgzJBMuE1I= 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=GOGh24cb; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=L5GEPTZw; 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="GOGh24cb"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="L5GEPTZw" 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 6298IMPi2662872 for ; Mon, 9 Mar 2026 09:48:40 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= fUousL1A5O+9XuGsxNbzLZLx2XOHUqV36IflzFCBpCA=; b=GOGh24cbN/ohLmQ1 WAdnPlf+qzWGEbUd3puiCIhBB2Ish4EezRjgZ2qQlrTSceNWnYxKk5vygwWqGbpd mjlHdFwU45xVVwNkFUUb4Y47tJT2vPqmR2YF1xlLrgXOrNENT+pbG+qv9n/kicw4 LNGMfWS+QGdAgZeYXxBh+zzLIlHZ5seg+tDVHM8heYOepTsf3c96WxoVC93tyaTD WX+aZXmIfo9L0nrxmirtU+s6TGRkSD/4RFk7cf9ENX5LncWXMMu65jbWAmUzVjzX 0RZf7pwdZFphL2AWAWhSgUU6vRXhgEAfNzfdJ/njZ4CU1RTB+S5ujLjgNpFhW5eb y+fBcQ== 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 4cr9cpn4pp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 09:48:40 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2ae50463d18so75296355ad.1 for ; Mon, 09 Mar 2026 02:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773049720; x=1773654520; 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=fUousL1A5O+9XuGsxNbzLZLx2XOHUqV36IflzFCBpCA=; b=L5GEPTZwW0kcHyzc9a6DVqQrRa31RH8T2qS/bZBoZ65IDWtyToNSEycmge1iJT25a5 UTcQB6W5CedU9GUqZ0o7bvY6fYhhdmhRn/L0ziEzWjz8P5cS/BLG1Y1+QyRJYoox+hmG CFySsViTbNyUyXhnMOhkQhXMn/XmlJF1Bp+OY7F9zdSHfMfcEecvfxIyPfBawcklEelK 0TslL5uMeeLKFQgPWfnvRr1T4CAKcTwUDVJXx+KM2Hvus356ilk3rGba2kQz1Y1w/rzX FwFRfhvwRzrq1RkL0zsr2ONXYC1Bp6QC2JtW3hwPzjvp2T50DJkyFK9splbNRKF9FXBR nssg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773049720; x=1773654520; 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=fUousL1A5O+9XuGsxNbzLZLx2XOHUqV36IflzFCBpCA=; b=QZQKErcGOQyaEGGiJwsq0cc9HgU9t03WU4FH/d0jt4DMM9Ujv1mcrYDB/Crie8G0dO yAks8ODzX+Kdw2Q4BlNoEgItEKjOqe79GdsJgFztP4lGI/vaeGjxXdbI5b4qk365NTRl 4gmnmgAc07wCet00vhL+VuYyMepp6HmZyV73Qa8ik9r4FNMb8p2/hDFPYAqZZbVuaN27 71fVa4ZZGjhgz7g6PWJ46cGvqkh8TPAi5jFugEthXmft2TkhR7UuJuvptyZ7fI5i3rgN 9QbzvtFrONnjjfugQXMFekyLIoNyR+ZOlmEma/Aso+JI7vcrpuorQVkA3zTJeXoRf/wp sKSw== X-Forwarded-Encrypted: i=1; AJvYcCX7V8NTWwtzUy4ZTMWX/sm3QdQCpIHKfa77VFgM4JmB9JSMqaLK8fheBal14k2q1b8PO3/xO5zK7n0ZGtw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+TWSmwUik4GgQt9Pg2+uurEHumUrlv95AvVFm6oCm53qEH19+ 2aG8Arg7mTmyJJRM3KcoNYTJVsT4in9/ZUfGwPb7eEhrW5NAYCjBIYmpOS+NqeQGvMkIiy5sU9G dRdtXI4S7MyqIg4uoRbLGa0gCzNgoCDNLDoz1b4N3K+Q+IxgDmZTLAFB1DOCCxYqEWd0= X-Gm-Gg: ATEYQzxwdLhXEGAilgW0EaZkn7h2s9j9WH+UyPfhsREavOS16kWIX265EGS2XTONb8T 7qVRvpEu/MTSnAYd26JMB/1Y6u78rMDs/xGI6ANF7mdTg9VMtItc/eDAHcyCPpwrCElr7A9Z0xL mOoUb3i8IDOihOh3J5tDRe3BFSCx8WCQ7gHQvjUV3dhMAALeHwV3RGn0JZs3rpnxCTf+dwzlM68 35zSjRTR3US+soPqNWSqe86dJHwu1oC9BeZUK0MdlEbOd6+I24e7+uedDpIeuaxqXI+hhVldZl3 P3zR5OZfrwHjkW99doebGJ3Z2uJgkYX3nasS35r/z0LnoulCSePwCwXGP1B03xRWP3SF1iyovP7 WFb9TAK1RlxboDHeWt+J76GiAuzRv5Jk/atKS9pumZGuRj1sQ6+qD1eoxgJ6IlsYhAADALOT5mV 0h8d6762Kg X-Received: by 2002:a17:903:3bd0:b0:2ae:5435:1940 with SMTP id d9443c01a7336-2ae829ec14bmr89343675ad.20.1773049719339; Mon, 09 Mar 2026 02:48:39 -0700 (PDT) X-Received: by 2002:a17:903:3bd0:b0:2ae:5435:1940 with SMTP id d9443c01a7336-2ae829ec14bmr89343445ad.20.1773049718738; Mon, 09 Mar 2026 02:48:38 -0700 (PDT) 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-2ae83e575e6sm104948435ad.5.2026.03.09.02.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 02:48:38 -0700 (PDT) From: Jie Gan Date: Mon, 09 Mar 2026 17:47:45 +0800 Subject: [PATCH v14 6/7] 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: <20260309-enable-byte-cntr-for-ctcu-v14-6-c08823e5a8e6@oss.qualcomm.com> References: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> In-Reply-To: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , 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=1773049687; l=26004; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=0T9jMctLmHsKsJot7YHh8HAddfx384FnlCOuHPfCehw=; b=tsG9QCRl4EFuO47U3OcDZSjkzwi6fiRrGbrHS4DW/Sf7DtQIYJWfxDPUHJPReaoCLvk7QiR8T eKOwdGoCMc+D4tUp9iIp7xgPzIRxeEg2B5BO3S4XcXkNJ91okU8/LJz X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA5MCBTYWx0ZWRfX8aMEYE7Zz8uy qshIp5rX5gAma/6y4jz5TYmXcdpGYIRJJY9dQycLPXU9uRS9ix4InYQBnR1zsvAjPRsp7SkP6VF pN5uuN0wO6ofEgBtr+GM0ZOrdO94ye/M5eu399x/zTp+YOtHnlG6ooL/25AYjBOnHRmgD0v+rtf 3ZTy6/WjVT+4UX0CpVFEfkthxVhLsDEoD/IzoXN2K9t5PoVA8aB32/3lSgPuDf58Vy2rP751Z5k 0F8044Z6lbfQQc+Xn3ICizLs5PS94Z6Cgi1YOMGAHpzCmBjQ7VfslqRKT0tLbx1Nudq851L6ydg rUbntg6u8nivcwIbtbhDDH6xuqdrzaCU2S25rdPDPk4nLYOXCcZ1WpR5v/0bpMzAdD8QQbRpz5j 7Y7dUcKFdgTkTm3ARK8SLAd5/ev2j3E7NStmO4OIglbOo+x+c+8eEEpAOZHZrdSE2weTluHvNfE +QaEitQ3LebKGTZSJ2Q== X-Proofpoint-ORIG-GUID: R2PgG42IqERbv1iswXaME57XuY2AF4og X-Proofpoint-GUID: R2PgG42IqERbv1iswXaME57XuY2AF4og X-Authority-Analysis: v=2.4 cv=e7sLiKp/ c=1 sm=1 tr=0 ts=69ae9778 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=fFPNNibJxoUyT2dqj6IA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_03,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 bulkscore=0 impostorscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090090 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 | 351 +++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-ctcu-core.c | 103 +++++- drivers/hwtracing/coresight/coresight-ctcu.h | 76 ++++- drivers/hwtracing/coresight/coresight-tmc-core.c | 8 +- drivers/hwtracing/coresight/coresight-tmc-etr.c | 18 ++ drivers/hwtracing/coresight/coresight-tmc.h | 4 + 8 files changed, 555 insertions(+), 15 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..6ff1708fb944 --- /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: March 2026 +KernelVersion: 7.1 +Contact: Tingwei Zhang ; Jinlong Ma= o ; Jie Gan +Description: + (RW) Configure the byte-cntr IRQ register for the specified ETR device + based on its port number. An interrupt is generated when the data size + exceeds the value set in the IRQ register. diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/cores= ight/Makefile index ab16d06783a5..821a1b06b20c 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -55,5 +55,5 @@ coresight-cti-y :=3D coresight-cti-core.o coresight-cti-p= latform.o \ obj-$(CONFIG_ULTRASOC_SMB) +=3D ultrasoc-smb.o obj-$(CONFIG_CORESIGHT_DUMMY) +=3D coresight-dummy.o obj-$(CONFIG_CORESIGHT_CTCU) +=3D coresight-ctcu.o -coresight-ctcu-y :=3D coresight-ctcu-core.o +coresight-ctcu-y :=3D coresight-ctcu-core.o coresight-ctcu-byte-cntr.o obj-$(CONFIG_CORESIGHT_KUNIT_TESTS) +=3D coresight-kunit-tests.o diff --git a/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c b/drive= rs/hwtracing/coresight/coresight-ctcu-byte-cntr.c new file mode 100644 index 000000000000..0bf738d6c283 --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c @@ -0,0 +1,351 @@ +// 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 initiating 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->buf_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 once a free buffer is available */ + 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_data) { + 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 the byte-cntr\n"); + return -EINVAL; + } + + byte_cntr_data->reading_data =3D true; + } else { + /* + * TMC-ETR has been disabled, so directly reads data from + * the drvdata->sysfs_buf. + */ + actual =3D etr_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) * thresh_val >=3D size) + dev_warn(dev, "Data overwrite happened\n"); + + pos =3D drvdata->buf_node->pos; + actual =3D etr_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_data =3D false; + drvdata->buf_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; + + 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_data =3D false; + drvdata->buf_node =3D NULL; + /* Restore the original sysfs_ops */ + drvdata->sysfs_ops =3D &etr_sysfs_ops; + 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; +} + +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 tmc_drvdata *tmc_drvdata =3D dev_get_drvdata(sink->dev.parent); + struct ctcu_byte_cntr *byte_cntr_data; + int port_num; + + 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_data =3D false; + /* Replace with byte-cntr's sysfs_ops */ + tmc_drvdata->sysfs_ops =3D &byte_cntr_sysfs_ops; +} + +/* 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 (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; + + for (i =3D 0; i < etr_num; i++) { + byte_cntr_data =3D &drvdata->byte_cntr_data[i]; + irq_num =3D of_irq_get(nd, i); + if (irq_num < 0) { + dev_err(dev, "Failed to get IRQ from DT for port%d\n", i); + continue; + } + + ret =3D devm_request_irq(dev, irq_num, byte_cntr_handler, + IRQF_TRIGGER_RISING | IRQF_SHARED, + dev_name(dev), byte_cntr_data); + if (ret) { + dev_err(dev, "Failed to register IRQ for port%d\n", i); + continue; + } + + byte_cntr_data->irq =3D irq_num; + init_waitqueue_head(&byte_cntr_data->wq); + raw_spin_lock_init(&byte_cntr_data->spin_lock); + } +} diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hw= tracing/coresight/coresight-ctcu-core.c index e8720026c9e3..60f1db3ab70d 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" @@ -43,17 +44,21 @@ =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 @@ -62,6 +67,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) { @@ -140,11 +227,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 @@ -195,7 +286,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.dev =3D dev; desc.ops =3D &ctcu_ops; desc.access =3D CSDEV_ACCESS_IOMEM(base); + desc.groups =3D ctcu_attr_grps; raw_spin_lock_init(&drvdata->spin_lock); =20 drvdata->csdev =3D coresight_register(&desc); diff --git a/drivers/hwtracing/coresight/coresight-ctcu.h b/drivers/hwtraci= ng/coresight/coresight-ctcu.h index e9594c38dd91..c52cf6a33d2e 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 (3 * 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,68 @@ 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_data: indicates that byte-cntr is reading data from the buffer. + * @thresh_val: threshold to trigger a interruption. + * @total_size: total size of the 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_data; + 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]; }; =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-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 110eedde077f..948ea864f2a1 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -293,7 +293,10 @@ static ssize_t tmc_read(struct file *file, char __user= *data, size_t len, return -EFAULT; } =20 - *ppos +=3D actual; + if (drvdata->buf_node) + drvdata->buf_node->pos +=3D actual; + else + *ppos +=3D actual; dev_dbg(&drvdata->csdev->dev, "%zu bytes copied\n", actual); =20 return actual; @@ -748,11 +751,12 @@ static const struct tmc_sysfs_ops etb_sysfs_ops =3D { .get_trace_data =3D tmc_etb_get_sysfs_trace, }; =20 -static const struct tmc_sysfs_ops etr_sysfs_ops =3D { +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, }; +EXPORT_SYMBOL_GPL(etr_sysfs_ops); =20 static int __tmc_probe(struct device *dev, struct resource *res) { diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index f4223215ef8d..8896fb7a9ed3 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1185,6 +1185,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->buf_node) + etr_buf =3D drvdata->buf_node->sysfs_buf; + if (pos + actual > etr_buf->len) actual =3D etr_buf->len - pos; if (actual <=3D 0) @@ -1248,6 +1252,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 aaa443abe8e9..183c649b982c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -260,6 +260,7 @@ struct etr_buf_node { * Used by ETR/ETF. * @etr_buf_list: List that is used to manage allocated etr_buf. * @sysfs_ops: Read operations for the sysfs mode. + * @buf_node: Available buffer_node for byte-cntr reading. */ struct tmc_drvdata { struct clk *atclk; @@ -292,6 +293,7 @@ struct tmc_drvdata { struct tmc_resrv_buf crash_mdata; struct list_head etr_buf_list; const struct tmc_sysfs_ops *sysfs_ops; + struct etr_buf_node *buf_node; }; =20 /** @@ -371,6 +373,7 @@ void tmc_etr_disable_hw(struct tmc_drvdata *drvdata); extern const struct coresight_ops tmc_etr_cs_ops; ssize_t tmc_etr_get_sysfs_trace(struct tmc_drvdata *drvdata, loff_t pos, size_t len, char **bufpp); +extern const struct tmc_sysfs_ops etr_sysfs_ops; =20 =20 #define TMC_REG_PAIR(name, lo_off, hi_off) \ @@ -480,5 +483,6 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, extern const struct attribute_group coresight_etr_group; void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); +void tmc_etr_enable_disable_hw(struct tmc_drvdata *drvdata, bool enable); =20 #endif --=20 2.34.1 From nobody Mon Apr 13 05:38:13 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 966B137D138 for ; Mon, 9 Mar 2026 09:48:45 +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=1773049726; cv=none; b=HkDZX3tF2ZkP9fjRc8KNG+UPouYxL8oYCNX64CchHNDwjRwbiGtnKjukSP6piDHq16WX4ZH195ZorezRxvnUsjxtRwF4MIQMjVWxuTK5HVJsTrzxE398yUKTKZwWf8RRox8KX6bYdWS3W8eNHi8DLzDQdDMcMfMoH2TZSE8Sukc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773049726; c=relaxed/simple; bh=0MADiRxGeDkPQDc+D4cOyR9YpPfqVXFTQN8hJDo+rxc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AYkeisxaq7NaN/BRW/fpXBAxz+fTZv6zYTJCtzZksLqMzAFId4dqYum1W2hcQXEbM6KUfFw5Y1tf8rFp85+3508cONomC/qWDIIwByR/OgAOgvcEtXecxsntfu9GVF3UgsdghV9Lk9L57iBEh4Nf3kQIH5GmEoGO2Ed0vLptQ1Q= 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=FaNOT4rT; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=EJQ0n1PT; 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="FaNOT4rT"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="EJQ0n1PT" 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 6297xDeT200749 for ; Mon, 9 Mar 2026 09:48:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Q+6sbBvItLVDaaK2nVoqlOqVJ4lF02bwo0WaOVku2Og=; b=FaNOT4rTHTMX80BO NNDcD4DlDMmDyOthYlfwnasf6azYcFvjPA8cNV5qe6kXFfrSzV57BNnz4Xodp6Kb esm3e3psLAVtGV2zJ1RVcIZvzhGccFPiRg3A4aQ9qP2XDGGBoHIA/F3gqtpPhUeI kQVgwY+DPTc1S++6VkAQsBbeFzhTWOXLAK23PrX8KNbRarY4YWXiWHwehOT34a97 oe11MyGkKbp3D8HVdkv6pGurF/ppPXApiXgL/uIcSY1kcKYzL4G7t7SSnexujfvi jUn0xgodnWynzoqAJFJbIA5G7eo94bOXgtOjO+n6YmkvXalj3MpKdb5h8Hf1Tq/h htfYDg== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crc3vcu2e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 09:48:44 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-3597f559e70so5831827a91.3 for ; Mon, 09 Mar 2026 02:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773049724; x=1773654524; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Q+6sbBvItLVDaaK2nVoqlOqVJ4lF02bwo0WaOVku2Og=; b=EJQ0n1PT0LqVaKtkbcwOgEZspDB1xQ47GR1qvFzXyIQILtsmiI7zWRZsH9IlLGjd6W U0rBF81D7Eo28s2V4+p9xIsZ7OSiDGoUvOmSX11N8CQvqVBjBswMpbc864UK/nW7Ntjn ZEmT8uALDL4BTKi4MrfKKp9LWxcyLhZIIjZEN70pgTjBLoVHyTJ26pb/YoDxv0sopkRg vfA4HnQbVXjY5X/DpFTJ9G/d9UyPpRNkzs4jBFlsH0RcTrgwJUXZoIlans5R7/l9diQ3 YjsfmwtrfwssiyeChOzhJnfRcjD338GTHcb/gvUAKhqIMWwGpo7bXgFdVl1sjdNcuXCJ ZLxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773049724; x=1773654524; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Q+6sbBvItLVDaaK2nVoqlOqVJ4lF02bwo0WaOVku2Og=; b=YmmgSxnfkJoNuFBI0huPyRIBkH7tiq9kO0UNS04a5WSpjskWg8PVY9v+fR4tINCROA C6NLFkF1/PzsuEZPvS1yMygvi5gsif+IFQ7bweO/hnfgL+eKddrZK2Ex5aWt/EqNNrFl IdGJD5gmBIyu+xat2vfr+EMU9Zsu3TtwxrFg+Gy8ykV21VhXe8D/ds9OktbFjL7F4tnH vr3X+3jyj+qI3oAsjpHqRRjU3s9ir3gU/m4R3tQWpfqy8wk0F0ayYMPifrmppNSk8NHl 5N1DpBQ2caTQoGcbjltdBvw0jzYUozb9qBvlm8b7u9R2Q7hdlUEimMVKhokTJVFDB8ZG nA/g== X-Forwarded-Encrypted: i=1; AJvYcCU+2xMfV137TKSZUv+/ENG29a+SpNUB01DFKNJXfIX/fz5V5AGFD2uhXN+KIkYaPPaLbnxrJPJKTvGW4a4=@vger.kernel.org X-Gm-Message-State: AOJu0Yyt5XZAhKEcIgGqX3cI1dUmD6ePaLhgk/CDg8Xyz9K+5zF6sIbl Zz1BvX5rtO4uu/UCTdlmqD/Q8mUyoJQbWV/+FrdIOkOs3ds/j0EOFEOFM9rD8bZyO6yu04HlU4O 3DezreHpPBVnYprZUO8baz+izi88uB4yA8I9nfTVsPuBirtLAkUWwTHqefBurKjfOsjM= X-Gm-Gg: ATEYQzxYw/FUySwfXa0wURgNWrZgtxiDPcSgAa0fCdaW+641vb36+8yHRTbh8eEjKIl PQgMK6ziukfRH7l1GmXPVosfcu5txRpLpcGsevL1p+4ejWEeihEZQpRvLyA0tzOfGSFH9VkdK99 teSThTmugL5reAxVomTC3uMUfhreh3pVOk6Ioe8I0dAbZ30DRrPYHOi+oPMhREL9CVFG7AlbC/4 Sl4PC/n7rqz8l9cKiQgzJ8sg5bnVtok1v2NOgvmaB1eob0caPoM9k4H0p1eFMABOO9gCWTayqaU He69RFl6MABId8zndF2/6HDL+nOQFrjaXpuxEbOcgo7wwYsb5j8Ub15FbwWyc9fU5xJtnVVyWzj Uby3lzptA/2qtuR/Usmg10kk28mzZ/96MyKlnnOamPzcoYS5UZv/HhwlI4euc+ypu5/tkbu3LyC 5BEX/BBErt X-Received: by 2002:a17:903:13cd:b0:2ae:506e:4711 with SMTP id d9443c01a7336-2ae8243297dmr63511705ad.31.1773049723656; Mon, 09 Mar 2026 02:48:43 -0700 (PDT) X-Received: by 2002:a17:903:13cd:b0:2ae:506e:4711 with SMTP id d9443c01a7336-2ae8243297dmr63511425ad.31.1773049723199; Mon, 09 Mar 2026 02:48:43 -0700 (PDT) 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-2ae83e575e6sm104948435ad.5.2026.03.09.02.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 02:48:42 -0700 (PDT) From: Jie Gan Date: Mon, 09 Mar 2026 17:47:46 +0800 Subject: [PATCH v14 7/7] 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: <20260309-enable-byte-cntr-for-ctcu-v14-7-c08823e5a8e6@oss.qualcomm.com> References: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> In-Reply-To: <20260309-enable-byte-cntr-for-ctcu-v14-0-c08823e5a8e6@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , 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=1773049687; l=769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=0MADiRxGeDkPQDc+D4cOyR9YpPfqVXFTQN8hJDo+rxc=; b=RSm1iC1KmuhUuoAcNzQ9MDJjlZW0pji30cK8svj/c/5UUe1a1wjIKbxi1G6/YIyTm28tHffPt 1G2/LSGs3vjDhii5pTvNxPkZ6p3YG4NvMQWo2QInDv+Lud2JFO1bKVD X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: g1mTGEJ8TLt5LB6BcqxtttR3KPfVV_Uj X-Proofpoint-GUID: g1mTGEJ8TLt5LB6BcqxtttR3KPfVV_Uj X-Authority-Analysis: v=2.4 cv=OOQqHCaB c=1 sm=1 tr=0 ts=69ae977c cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=gBkj9RZkAcI1HbXH1KoA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA5MCBTYWx0ZWRfX1ifnqLIKrava jYCBIA1t+bB+Me5qIOnFDUqj9GPw12bUO9N5BoS+35weHeehbSDVS5T6du0RVaNYvhZDwy5GCwj +LNy0ZVoGkkV1H/Z8T3d6wWn3YbNK7MFIAyrezset+KJ/saTddWlnh9TRVSq3YSqVA/GooLr9pQ r6s0ILVtN7NW0Gc7HMxPoPPPYpnTFVAkinUd/kD5l9Fw3Vr4S1tiw7Cpk4RsN6CRvEyX6fRPKRS PEBUm6VB4OZhu6x+87GySEdO0T+i8TyiX/b7rdUgopEzySu5M+E1TSYxuTxGV/MxrMHQQGm/xnX A/fvSn/3kapgNsEBk8eS/PiXVQoaI2Sx3NPZCtgchaac3VaeDMqIK7sqZxRk/K96T6QPRwm3/n3 kCb1PjCxKOyQlbk1p3kLnl0d7WxD/9lX5S9ptEILivRTF9jAD00cOTRxE0vPeUcY3CWmCW+Iv1N /mKpHzaliPHZwm2fEnA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_03,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090090 Add interrupts to enable byte-cntr function for TMC ETR devices. Reviewed-by: Konrad Dybcio Signed-off-by: Jie Gan --- arch/arm64/boot/dts/qcom/lemans.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qco= m/lemans.dtsi index 808827b83553..e8a20789cd58 100644 --- a/arch/arm64/boot/dts/qcom/lemans.dtsi +++ b/arch/arm64/boot/dts/qcom/lemans.dtsi @@ -2800,6 +2800,9 @@ ctcu@4001000 { clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1