From nobody Mon Feb 9 11:36:08 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 6ABAE32F746 for ; Wed, 24 Dec 2025 09:07:09 +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=1766567231; cv=none; b=McnhRHfG2tFAgm2zchT0qRDL6x7HGLz8rw4jWAJzDSa3l9v6ZoO5hAnEpHjQ1UGf9PUhgJ7/jyWlS4+gl4174anuPZJn3az5V/57TL2SALMGN3TthegLFX7Tq2Jz5JzHbIlITDOHbnzpWXwn1OGMS1+XpITVpZPV3YLQIH3xLGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567231; c=relaxed/simple; bh=x79EOx0VHbHe/nWXls6UDtNS83yDuFtih92LzPbC2MY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gH6sl9ekgu+JijSWHtNgw11WoCz3dn4XiC15nmW6bhnGAlgGsoOWwSrsUj7V9dP+UEzHb3SbGIqWl0VcJBUzZ+ow2A0nCRV1HIhNV8umWnAYoWMEJ0NLAr1KrZey9ThYaaZLeIAX3DIao+snN1drdrDqtJUHjjbl1Sri3lYElTw= 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=XDscumjd; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PrAFx0+j; 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="XDscumjd"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PrAFx0+j" 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 5BO8JKe9721758 for ; Wed, 24 Dec 2025 09:07:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= TjPxjq1G/MyM9wZuLe71IZ2aZxQ93j8UibxFtFmopSw=; b=XDscumjdhCvlQT0G q/9wE09bSUcmwIuE36rs2C8PAN+c2FqQGvH5yPCoK7Joxyw7LiB6wnNw/XiQyszL zIiQLONjVDYIqKe3I4DerP76VUks8T+Ass1tJAeCHoQLPDPPk4T9HHdW5PavM5tP IVdtHwplSEnwect+0F9iZqLWORvzi0j4RFOQBTGi7s5D28xrZf3Td37e5E3bdXoW tiR+mTJfPfynHIIX0XKKHKJYrnbX+VdpLjeBzc7hCAQDlm7RqtzwguAsiwXcNwkF FkTuONKTrRzHgseEoMFFG/Q3usNstR+OhI33uItnb/vC5/RZbh0XkxcXvS/HNfAp D8KHIA== 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 4b81mt9r50-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 24 Dec 2025 09:07:08 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-29f177f4d02so128981345ad.2 for ; Wed, 24 Dec 2025 01:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766567227; x=1767172027; 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=TjPxjq1G/MyM9wZuLe71IZ2aZxQ93j8UibxFtFmopSw=; b=PrAFx0+jIw1dECwVwE7YV3gzg1AQo3d1fIra5zx7q/XAb88Agp1l/dcGMKqJVfZvfE 7Mv3OShwtk/JsoxSiZI0+Nth5FeWZv1BUkRGLDrD2YrzBUKpZPjvpCrnQ1K0c+Kxx+rt VFvbXkFRz09VWT7yIoEQW3piYSqZmpGQPeCOzkZSYQKfY79RBxzkjyaRdMDPHJbTkuMI ruNPLcwUFRekK7p53fDVCGCCzBz84BZkmZPiFBeSKOIU6yVWCCvteZ0BKfyBD99LJQ6N 6GCXnOXskQiXBJEp+p33mTDNkFxg610sxba6F+KdIa6JTZIK4uACI6D4Ghrb9JuJ0B3g KltA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766567227; x=1767172027; 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=TjPxjq1G/MyM9wZuLe71IZ2aZxQ93j8UibxFtFmopSw=; b=KR9t7e704yurIjddLSoUMCR+rQ/YBVotBYARkdQjpFEhHf/xaKcMBuwG65nHeIwMCk BjDCPJQzsbMee6G/NCGcZ8eOFI83VXqTLRHShuIXk2o0LzGQw1hSF8waBdzNwa1nnd43 uQpB9cAz2rUwbiXouVT+eIjUN8tr4Z6ygZp+BG3GEO33Xl2sZW3rx460LyEdrfHOfB4/ FqjQWn6IheY9boA0dUXgxHCfyFH05OsTCcAZTthUZ/EEZKEuGeqtyf+Q4b6RTT60csKl faJIjDLSLpbwEA14uqQHNx+gXLn8/gZlzIMAF04VEXzOSz89htfoX1Hv73gM+yRm7zy1 4j+g== X-Forwarded-Encrypted: i=1; AJvYcCV4ySs+zpYuL0JjNBBGT7a1srcBeBcVI4vXb6DDTZP5dSppFwJIiLU+XJyrtu/k3J8cmP+pmlMVQ3RzSmk=@vger.kernel.org X-Gm-Message-State: AOJu0YwWN0Y80Y1zfvLmScYoxJejWSuFar9FigYDiL1SwjrzinbeYr0g j1cqmelkpj3xqYlVBbmDJOOs9DLvUbOti9dfcTMbnVr6epdG+4vTwJhkoQs4DWnWWHYVPhDVPB5 CKVXU9Tl8U4qzLPHmtZB13aCFu9eWa9qVyXNokQpXKAEDhOpGM/YP4aJLbcGBsGLfTRiikGHc0G Y= X-Gm-Gg: AY/fxX4TJBPMLAMWnCzvyF12K9GMzwOK3tIU7Qy427yuRE4FyyYuLYExWoWFZ3zOP7u ZuvEd7TPMOACz2xCfTMwLuQpqvn1HMu1nGZ/bNrEQRL6hVuQzu2BC3xEq0Y3zCR3l9qpCYDxt9F vuniQRhSbEPznSaoKVz+jIK497PC4330yZavpUQLpSLzRbTwX8vTHUfIFQdPHjtMnzETB4WzhTM vchWC/BG6t8X6a5gmm1kML0ofO1/SrETKSXQw9J74TNOLEW45GBz41h4gnfDWfXSVTIivaJ+h+X YSxloxuuSCxsM4WKI0ICLOE9GTWXqYWW9vZGN8+dRQ6KuIsqufyN0B6CDP2vyeK1d9UGKxWUEDy V/T0FMCPBd2iQlleBURZZy3oA1lGN4wnlYfB6hDcUGLDiEoLGoZHDA0r8Ox8pqlWTstQTcybP X-Received: by 2002:a17:902:e552:b0:2a0:8360:3a74 with SMTP id d9443c01a7336-2a2f2835cfdmr127686755ad.51.1766567226984; Wed, 24 Dec 2025 01:07:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUOmvjkE5jwGJCb1wUcNBlhuAbPgrp6XJATw6fq12VDVQFcyEJstSLNscyietWEtLwkYnlwA== X-Received: by 2002:a17:902:e552:b0:2a0:8360:3a74 with SMTP id d9443c01a7336-2a2f2835cfdmr127686615ad.51.1766567226479; Wed, 24 Dec 2025 01:07:06 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c666d5sm148418095ad.21.2025.12.24.01.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 01:07:06 -0800 (PST) From: Jie Gan Date: Wed, 24 Dec 2025 17:06:11 +0800 Subject: [PATCH v9 1/8] coresight: core: Refactoring ctcu_get_active_port and make it generic Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251224-enable-byte-cntr-for-ctcu-v9-1-886c4496fed4@oss.qualcomm.com> References: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> In-Reply-To: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766567215; l=3769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=x79EOx0VHbHe/nWXls6UDtNS83yDuFtih92LzPbC2MY=; b=Ah6yDC0yixoVi0q8wSVIKghtnnoYfvtBJTeVvk+aonsv3NXB7C4bH8t4+1K3l/vrrufgWoUar EQUzPjule/GCEB4sXHar2a67gpPHVoCFrE9le94DD2JN/ELf3ckIfg8 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=e/ILiKp/ c=1 sm=1 tr=0 ts=694bad3c cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=qQZ2XtAyJf2dEkEvaVsA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: 650nRr1bMhNfTuOGbxPy2W0dngQP5o9Y X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI0MDA3OCBTYWx0ZWRfX5kMxgxnCmXGw GaW4a/pQ5XyUWnSbZpAxz59F8WPxTknt9PjKCUFtODo9gq50GVJIX60ZHyuyVRPf767KpCVjpJh lAJecS9SuNOo23eGtrGetvOE+b3Mo511yCSF6UKP3s8F8H8Y25S46pdE3PN9dMuzouYjMSpDdZ4 3PDkougqabMEdes7dho/G6lgt2pdpvx/uV9tdanngSKoz0fP9GdhxpVQ8NvsdqDODAsWuI9mFdb xoYsjZOKOoPISbY55YXPFRqBrVJgv8+ssek073EWYcePWHv3ZJc8gU0et/dqM4Iwf3zAQYIDzaP SDgg2ULtNRA5pM2Zes6VvCz/qypjDgxZvYkIOEjQuY4VuzCtNfYTh9JxAoZd29UVP2R1a04S6V3 V3mV1QunAmrWhsx4g/DuypfXZG5Uh5bEdfuY61YUkY0tvCde+LDhV4vi9dOVeaLZr552dPzwUur ZLPT9sSNPmnI7h/Huyg== X-Proofpoint-ORIG-GUID: 650nRr1bMhNfTuOGbxPy2W0dngQP5o9Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-24_02,2025-12-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512240078 Remove ctcu_get_active_port from CTCU module and add it to the core framework. The port number is crucial for the CTCU device to identify which ETR it serves. With the port number we can correctly get required parameters of the CTCU device in TMC module. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-core.c | 24 +++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-ctcu-core.c | 19 +----------------- drivers/hwtracing/coresight/coresight-priv.h | 2 ++ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index c660cf8adb1c..0e8448784c62 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -585,6 +585,30 @@ struct coresight_device *coresight_get_sink(struct cor= esight_path *path) } EXPORT_SYMBOL_GPL(coresight_get_sink); =20 +/** + * coresight_get_in_port: Find the input port number at @csdev where a @re= mote + * device is connected to. + * + * @csdev: csdev of the device. + * @remote: csdev of the remote device which is connected to @csdev. + * + * Return: port number upon success or -EINVAL for fail. + */ +int coresight_get_in_port(struct coresight_device *csdev, + struct coresight_device *remote) +{ + struct coresight_platform_data *pdata =3D remote->pdata; + int i; + + for (i =3D 0; i < pdata->nr_inconns; ++i) { + if (pdata->in_conns[i]->src_dev =3D=3D csdev) + return pdata->in_conns[i]->dest_port; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(coresight_get_in_port); + u32 coresight_get_sink_id(struct coresight_device *csdev) { if (!csdev->ea) diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hw= tracing/coresight/coresight-ctcu-core.c index abed15eb72b4..78be783b3cb2 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c @@ -118,23 +118,6 @@ static int __ctcu_set_etr_traceid(struct coresight_dev= ice *csdev, u8 traceid, in return 0; } =20 -/* - * Searching the sink device from helper's view in case there are multiple= helper devices - * connected to the sink device. - */ -static int ctcu_get_active_port(struct coresight_device *sink, struct core= sight_device *helper) -{ - struct coresight_platform_data *pdata =3D helper->pdata; - int i; - - for (i =3D 0; i < pdata->nr_inconns; ++i) { - if (pdata->in_conns[i]->src_dev =3D=3D sink) - return pdata->in_conns[i]->dest_port; - } - - return -EINVAL; -} - static int ctcu_set_etr_traceid(struct coresight_device *csdev, struct cor= esight_path *path, bool enable) { @@ -147,7 +130,7 @@ static int ctcu_set_etr_traceid(struct coresight_device= *csdev, struct coresight return -EINVAL; } =20 - port_num =3D ctcu_get_active_port(sink, csdev); + port_num =3D coresight_get_in_port(sink, csdev); if (port_num < 0) return -EINVAL; =20 diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtraci= ng/coresight/coresight-priv.h index fd896ac07942..cbf80b83e5ce 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -155,6 +155,8 @@ void coresight_remove_links(struct coresight_device *or= ig, u32 coresight_get_sink_id(struct coresight_device *csdev); void coresight_path_assign_trace_id(struct coresight_path *path, enum cs_mode mode); +int coresight_get_in_port(struct coresight_device *csdev, + struct coresight_device *remote); =20 #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) int etm_readl_cp14(u32 off, unsigned int *val); --=20 2.34.1 From nobody Mon Feb 9 11:36:08 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B5B32BD01B for ; Wed, 24 Dec 2025 09:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567235; cv=none; b=pU1/03cG0hBkHM8MSH8zaM/ehK+NyxsJYu4s0yAbXpGyVr9KbT/GZ5K09itoXoVIsGf1TWVGOHE76ZQI66imfjPUrvgHM8Eju8f/tI/HoCClhwX4kW6luhQJMSiXozQPwtU2DzU2ecIdEQyscdFA9KC5u1DkBfkVyFXGFwp0/xQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567235; c=relaxed/simple; bh=DQTHwrw5ZG2QGJ8ed13ET3tSu6napM1SixB2aelNLzY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R32V2jNrCm0ktdgFxVbbkYH+I/OdbWb9ozhDnGq983YiEV+lsPCBAD+LpzqW3sh5st7Cfrdzg/X9wcTd5rKfYSqrBJhK3I4oeYGaM7MC7CPutrSJfn0305z/wln7eXJb59SeW1gyq4wdWSl4d3nqo9PtiqS68O18zp4foea2r+s= 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=HUVZDb6s; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ktv+RENq; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="HUVZDb6s"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ktv+RENq" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BO17X3u1597821 for ; Wed, 24 Dec 2025 09:07:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= yJrhvTjKt1gwCDmMIJvxf5jwPN8hV2K72Dpp7uCkoXc=; b=HUVZDb6sIubFr3ur KfOD+Dui0I2bup1HzqpAQ2uG+49BeSS8aas3QyLBKvktk2Kaau8MyZYuOrEWNk8W fYELGZoFtpm2wuALGq0lS8NH3ibMcAV9Gnr+krOex+bSwnH1oo8zqf1qCGa8pLGv 9/s4qC9oND1P7z+JA7XbfpQX7UhkxtbXig7gQbA2oyjP0dsgL6bKbvc9HLN9Si8i IcSG4R9E+69BkMoQQDrzDvVutNn+pcFyk9c1Go8Yu9gtGGR9vu03xGdpbEVr37K7 eSTZnS77eHykS2SfmRWzMLDRxcVAAwv46xvA7lfh+1RXrmcTo26MywkPGwjBcCZl cWoraA== 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 4b8683h41v-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 24 Dec 2025 09:07:12 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a08cbeb87eso93036835ad.3 for ; Wed, 24 Dec 2025 01:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766567232; x=1767172032; 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=yJrhvTjKt1gwCDmMIJvxf5jwPN8hV2K72Dpp7uCkoXc=; b=ktv+RENqTOlOI7tN9yC38yvNUl0TixEIfRtA6K2WR21iwejyVFWJVA8b9qYzxWDpkA BzPR1z7LdBUQtsDqREo/lcA8UxcE2g9MeZisLqm2LOXEyFQlh0HTBA3MgubfSFvsPUNH fdVrIfZYKS2PV9ztcaeKb0VjSvQCqV7Ct+bhLj2Dd46ireww+Ex4HsMIb+Rw2VmIhbrv bF790pNdTmuvU73DgsANltmYNVdvNOJ4HUARYXCkci7icoNHwhMtgO0pG2GIkW301UiH vdhWcgsUbjxyW+4yMfIZrsNKl5JnmyNNcKjKuZKytUEdUzBlqKnn6HOZQ8sSPdqvFjb1 rz4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766567232; x=1767172032; 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=yJrhvTjKt1gwCDmMIJvxf5jwPN8hV2K72Dpp7uCkoXc=; b=v16AndlYC6vXNS7aFRYpz6omYPoLJPp3iHV7B3TnMt0zZV3bMydpfKnYIzrGlps10C 0cqaKsD5ZF8SOntRNKDsRFaduF24k5Xc4ALkV6zQ0H6BHRgTKETL1WcpXAK7OZPfW2Ys pUuUonllq4sR95NpWRM/MLCgv8bWIEYB74LdaOXmmbVETJ0i9gykATnVYiyEEaema9XW zZU/h/VdWEfeJAjwQv2rLaf7TgaVy0CjiAmsvoyzFOY45YJnSqcK5BcsP4DY3NtWNP1H tHZ2zjf+Xe4GV6qAGxtCAkEKv40wAUFl6TCTgrmU4hfeA5pwZOE14izTW/yr3BmHXnSc /8eQ== X-Forwarded-Encrypted: i=1; AJvYcCUeMhtJwzTP57+S77PWFeRZkZnZmZ0cy7uieDWgTaHlV0ozgFSmfwD3fDernwR3mdata04roVwZo0436F4=@vger.kernel.org X-Gm-Message-State: AOJu0YxiMmobMBVTSSiyRSS1vb91TDFJleqKWD4sDsPYwrChrU3QDeo9 hQoYurX0n/OMsZKi2NWh+XXZBeqHT8g2pImUDnf74R0qqtQl8Z8v0u4HZiLm5Hf4jkm2vF5BQwC gYfQhx/Mr834zXWefhVenH0ISwnQ+tKLjt08oGm94rXsKs+dIQn2YhYQwNNaI9ldJwqQ= X-Gm-Gg: AY/fxX7Mn3MQHoVNYThIVBK4ZBtOO41qdg9QjF4UdwKp2XcA2TqvIs8P81RLi8Uj7cY YUWBYK+7DFe/UvuA0Bbnv32uRA65xxc+bkDwamV/wAV4tnxRG7+fZStuNC9gnLkBlrLhyEsKw7U 4OWvKFnP671E06UYZV/T5ZNcZG91LwGxFW5peZ7bct/2FHxW6wDNvCBSmWsug+pBzJFcViYK5A4 YCqUZuZ99gES7Q5juEKY4ZG77sCt8j+CbcwpdL0lxx3ocuyoQ846WL3oybQB9WOhW4V/pwH5fTd KFYTWtpS8T1h912IO3wCQyjEbmJaCviHshCB6IWfwav9lfJ/YKRf10CfO9MZBIUeq1+Ju6W6mhZ BpfA89LyYLrcgzf9lfqNWkZ06hyELrOBkAyTzZSb0E+mfYoNPi9PzqVoa7hz9Hc4cZG6ah0Aa X-Received: by 2002:a17:903:228b:b0:2a0:f0e2:94b7 with SMTP id d9443c01a7336-2a2f2735298mr158517425ad.30.1766567231641; Wed, 24 Dec 2025 01:07:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9R4j+4A+H8ctHEtX19Z9Z16cJ9cTeGwAKw7LskVs0+ffbYTqFmG+XNTiuFk9yR0FXsiA20Q== X-Received: by 2002:a17:903:228b:b0:2a0:f0e2:94b7 with SMTP id d9443c01a7336-2a2f2735298mr158516845ad.30.1766567231081; Wed, 24 Dec 2025 01:07:11 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c666d5sm148418095ad.21.2025.12.24.01.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 01:07:10 -0800 (PST) From: Jie Gan Date: Wed, 24 Dec 2025 17:06:12 +0800 Subject: [PATCH v9 2/8] coresight: tmc: add create/clean functions for etr_buf_list Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251224-enable-byte-cntr-for-ctcu-v9-2-886c4496fed4@oss.qualcomm.com> References: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> In-Reply-To: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766567215; l=6191; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=DQTHwrw5ZG2QGJ8ed13ET3tSu6napM1SixB2aelNLzY=; b=YVcHaQwkrn2AAtWFiqYdJr9AiveFl+f25fpc3B8TfSHyb4UoTyTk6ns89oIx1UcuHl2fU+b6/ qUzSCoXYQs3CI1p8wZN5hXIQ4BaMmSq8XR9n5JvBCbqRgq5I6P8FJrm X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: pd-kTRckY8PnCC2_ohN4UiMcds4zM3TY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI0MDA3OCBTYWx0ZWRfX+gDBxwllG06O OBlkeoIjZztlVe2onN5FJCEPXTrdePFQd/i/V4e/+FfmepBBxpZjpIAa8AKa07ybyz6Yhb0nB9I BrtrKwgCjUl/JMX6o5lFbINojmyW07g8D08SIJFkBRiHoBjustGXdjwj4FgRp8XM8KpGgGoPpKR kQ3NMT+YGUaPe9Pd/LO7lAmmzawt5BtZBRX/SxBRydfvfi8P0GGb49GCsis/4xH6yhyTATBLpI6 YUpqS4eu4LkCDpWwaD6A1UpbQvDbpuyfmRChKSa6zb3e3mFYOYw/asmfcV80SkbaiJd/qdlniiV /xQ+ss0CVv/8G5xHaUAqYt54/lQxSKqORWTJajjKx1oEdTBE9ggdqcvlM8NnvHRPCP2Twd0NXoB iBwUzFKlEpWJpWg4DOGq6OwaTRv929qwzZR6nrg5iAMuUad6ws7zRT4cB9GCESfpwvetiKDoHFk JX4B2TyOpYNLwKw/L6w== X-Authority-Analysis: v=2.4 cv=HqV72kTS c=1 sm=1 tr=0 ts=694bad40 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=AScg1gZdVb1XvqdcXssA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: pd-kTRckY8PnCC2_ohN4UiMcds4zM3TY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-24_02,2025-12-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 suspectscore=0 malwarescore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512240078 Introduce functions for creating and inserting or removing the etr_buf_node to/from the etr_buf_list. The byte-cntr functionality requires two etr_buf to receive trace data. The active etr_buf collects the trace data from source device, while the byte-cntr reading function accesses the deactivated etr_buf after is has been filled and synced, transferring data to the userspace. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 1 + drivers/hwtracing/coresight/coresight-tmc-etr.c | 94 ++++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-tmc.h | 19 +++++ 3 files changed, 114 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 36599c431be6..1ea255ffa67c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -840,6 +840,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list =3D &etr_devs; + INIT_LIST_HEAD(&drvdata->etr_buf_list); break; case TMC_CONFIG_TYPE_ETF: desc.groups =3D coresight_etf_groups; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index e0d83ee01b77..2b6ca1f8bed2 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1919,6 +1919,100 @@ const struct coresight_ops tmc_etr_cs_ops =3D { .panic_ops =3D &tmc_etr_sync_ops, }; =20 +/** + * tmc_clean_etr_buf_list - clean the etr_buf_list. + * @drvdata: driver data of the TMC device. + * + * Remove the allocated node from the list and free the extra buffer. + */ +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata) +{ + struct etr_buf_node *nd, *next; + + list_for_each_entry_safe(nd, next, &drvdata->etr_buf_list, node) { + if (nd->sysfs_buf =3D=3D drvdata->sysfs_buf) { + if (coresight_get_mode(drvdata->csdev) =3D=3D CS_MODE_DISABLED) { + drvdata->sysfs_buf =3D NULL; + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + } + list_del(&nd->node); + kfree(nd); + } else { + /* Free allocated buffers which are not utilized by ETR */ + list_del(&nd->node); + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + kfree(nd); + } + } +} +EXPORT_SYMBOL_GPL(tmc_clean_etr_buf_list); + +/** + * tmc_create_etr_buf_list - create a list to manage the etr_buf_node. + * @drvdata: driver data of the TMC device. + * @num_nodes: number of nodes want to create with the list. + * + * Return 0 upon success and return the error number if fail. + */ +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes) +{ + struct etr_buf_node *new_node; + struct etr_buf *sysfs_buf; + int i =3D 0, ret =3D 0; + + /* We dont need a list if there is only one node */ + if (num_nodes < 2) + return -EINVAL; + + /* We expect that sysfs_buf in drvdata has already been allocated. */ + if (drvdata->sysfs_buf) { + /* Directly insert the allocated sysfs_buf into the list first */ + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) + return PTR_ERR(new_node); + + new_node->sysfs_buf =3D drvdata->sysfs_buf; + new_node->is_free =3D false; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + while (i < num_nodes) { + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) { + ret =3D PTR_ERR(new_node); + break; + } + + sysfs_buf =3D tmc_alloc_etr_buf(drvdata, drvdata->size, 0, cpu_to_node(0= ), NULL); + if (IS_ERR(sysfs_buf)) { + kfree(new_node); + ret =3D PTR_ERR(new_node); + break; + } + + /* We dont have a available sysfs_buf in drvdata, setup one */ + if (!drvdata->sysfs_buf) { + drvdata->sysfs_buf =3D sysfs_buf; + new_node->is_free =3D false; + } else + new_node->is_free =3D true; + + new_node->sysfs_buf =3D sysfs_buf; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + /* Clean the list if there is an error */ + if (ret) + tmc_clean_etr_buf_list(drvdata); + + return ret; +} +EXPORT_SYMBOL_GPL(tmc_create_etr_buf_list); + int tmc_read_prepare_etr(struct tmc_drvdata *drvdata) { int ret =3D 0; diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 95473d131032..9b3c4e6f0a5e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -208,6 +208,19 @@ struct tmc_resrv_buf { s64 len; }; =20 +/** + * @sysfs_buf: Allocated sysfs_buf. + * @is_free: Indicates whether the buffer is free to choose. + * @pos: Position of the buffer. + * @node: Node in etr_buf_list. + */ +struct etr_buf_node { + struct etr_buf *sysfs_buf; + bool is_free; + loff_t pos; + struct list_head node; +}; + /** * struct tmc_drvdata - specifics associated to an TMC component * @atclk: optional clock for the core parts of the TMC. @@ -243,6 +256,8 @@ struct tmc_resrv_buf { * (after crash) by default. * @crash_mdata: Reserved memory for storing tmc crash metadata. * Used by ETR/ETF. + * @etr_buf_list: List that is used to manage allocated etr_buf. + * @reading_node: Available buffer_node for byte-cntr reading. */ struct tmc_drvdata { struct clk *atclk; @@ -273,6 +288,8 @@ struct tmc_drvdata { struct etr_buf *perf_buf; struct tmc_resrv_buf resrv_buf; struct tmc_resrv_buf crash_mdata; + struct list_head etr_buf_list; + struct etr_buf_node *reading_node; }; =20 struct etr_buf_operations { @@ -445,5 +462,7 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, enum cs_mode mode, struct coresight_path *path); extern const struct attribute_group coresight_etr_group; +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); =20 #endif --=20 2.34.1 From nobody Mon Feb 9 11:36:08 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 BB1C52744F for ; Wed, 24 Dec 2025 09:07:18 +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=1766567240; cv=none; b=ZbuomdrVxIq5lZ3mZhiTJ3wwVh0ZxpvJPBbcaGPm6RB9SnXVayf49Sk3H5Oy41hyZc4WywTICuYnUHsvB+goLsCYPFlWmKHPKhriK+9LM1ZlD5ixGGQ84t+ygrNAGFN/iz4563YS4kX3Nwy7daxfKEOGlDiSb7kTW3PQD3n1z14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567240; c=relaxed/simple; bh=adb+NstK0OrGdQHboby6lmZs7rWs2zBc775hVSg6Ay8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tYFT172fbEdtQFhPiTMf2U5g1LAGMijpnRS64eKHPfrLMgmwYj2AB52uQik7X1tTJ+iVXx+h2etrlZxOQDEEayrRKOP9oO/QXOUjEg/lgcyosYzuZjrP267KVReUOWFggKKzVf9jkDjVx+0BSzD/T8TQoI7yvpCdXMOsOC1zXtQ= 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=YOBUPMmM; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IiO/Mw06; 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="YOBUPMmM"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IiO/Mw06" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BO2ga3Q913433 for ; Wed, 24 Dec 2025 09:07:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= lrMZyOpw/ZRelpfuA7qROurtddaj0sg5lOXpksKz24E=; b=YOBUPMmMdrDmeAIx Huv1FMsfe4YCuYUYWjRNLI1S7ntZ22ELjQ3MckP4EgYL9z21DlhTwaVHWF014DTu 4lDLayaKTXKzv1sZMCx+NiQNAHASjD6LlcT5DYgRli6raS29BmBwa/7THC2Sjqdd 4dNFknNfqrommWeiboRHuQmSAgPPGz2UnxDA3DbxwSs3oG2WBn/XA7naTRkPrTQ6 LzjihxAA3K+CQOeU0fK+2+Wx/WwjXOQUEEMUILCHNorecrPQ8OrVDBHEv7Z7ChNt 6lWQaI6TUgplNeU7SsT0w7IPHGDXenPCxqTMbY9mrRv/ui2nxDvdEk2XqOA4QwzP ClCVYw== 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 4b7vt2jqnk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 24 Dec 2025 09:07:17 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a0bb1192cbso116862905ad.1 for ; Wed, 24 Dec 2025 01:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766567236; x=1767172036; 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=lrMZyOpw/ZRelpfuA7qROurtddaj0sg5lOXpksKz24E=; b=IiO/Mw065efPTMCFpu12JhhCjilarF3wGucTrEqW3t/pbzV0fHzjPQZHtwYtZj545p xsYW95/jaoGyXO3Qcj3CPwGIQNigQ/B0hKQ66u2INBjSqkGs8gcEVbpa937yrKF1ter4 xSxpd8wIyaVH+VPVhTh52/sWGGEx8+Ax0cnWFF1VdojCrex+YumVjEqYXpHvDUT3QOUy W3zSYhi7g9LoETi+jLhDMyFe4S8gwM1uekENihxzstc7uPxA1z4D0IkSFJ9U8vMZTDyI hZr1hpVd/6q+RDzLPhJl0ujowZlkMxkwFGT/Eo5UTwQ6aVjQTCzaKCU0+XPWHit4j6/g gB1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766567236; x=1767172036; 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=lrMZyOpw/ZRelpfuA7qROurtddaj0sg5lOXpksKz24E=; b=FV7BS1PvCmXmjSW8ySmruQZkkKWX3ynQdtb45lEqpD/ywYmf9jAZNyBTHw5iK/FLbF Aje/fCb7kKNn8wzFcokdhMD11tS337xXh8YwQ/sjWC0QQSCVPOCd6ONb3C4WaOj/rXgn crlP6cdOGfbTbofMz0wqwrS4YDCA1KCtxHrzSbZRAP3gxQK5F9zbOPz0QqXUcvzPd012 sg09STrON+ZlyGqvUfG5X6jEbTfD3ePpJkopZcag94ewNCcHhgSBKCmRoM6Ms7LYvOkA 0ONd5MWzYjwMdtbAn4MddabPaiyvZNbOuXvR/x4jqbBO9DodAMp/g4uBhzzYzJ6neZe6 dmtg== X-Forwarded-Encrypted: i=1; AJvYcCX8jxnj0zgxPQsz9gSsK5VKpHYziDOOVbQ7M0lm77HHzHiwYKdS53KReuTqs/fa+xvi2RbW4pd4iHiFRrI=@vger.kernel.org X-Gm-Message-State: AOJu0YwVToZpYG3kFlxE3l08QvOexWWog217P7XPCZAy9r6bzm0WQ1tw dYqSQbkdfJVT49pO6OGNQwL6M8iHMj7mfqZEr4pns6N8+suKaRbgMrTgFhlyBVhmInIdAPwBa7U 0ROCGTqY4rm33XNICjkJ2CrGWIH+CcWrmolxjRdzIIMNBqs1eDlOOecc8X6FMfxyLERg= X-Gm-Gg: AY/fxX5oBHh1m593/EIP2aXnbk6S8fiWu6JH0vv/wWVRTnfPSCbiumehoUTMXUdRdMH jAzBuQzEPByPKuONt+F2vBj6OoG7J1ayrk5h7H0eQSpipBXA8tJHmQd5ulpQovKLMooOOOiGxY2 TrGnjucmyWMM6OGS140Cx1SfkGFDV0etMHDujNvws89XD7vWldlSUv8okUh5OE+Xhc1h6cPUpof 0PRiGoYqgA6/N9GyKO+tFy43rlI3ELLWub0AliB2sDhe0sUpyblbkSDGVmV0n+csNXFX4ZBrGcw fMKsWODeuWcLEnoFihcAAGQzDbLT8970BhR5BiE77G7PxKKtVKSk6sxtHScMATZ8BD0WFvOSXpq zoig9CHu5R8wdbbsj6lnnmni/D1G0N5Xp0QpvBhdYx37PdTa84jZ0qnbqWBAMkmHfctcRkCwW X-Received: by 2002:a17:902:c40b:b0:295:7b89:cb8f with SMTP id d9443c01a7336-2a2f1f78d07mr184952165ad.0.1766567236202; Wed, 24 Dec 2025 01:07:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9Hm3W3DFtHwdujiHhNesaWsev04lu15VpbBPkpdmQV4QFHQ8NusHUQeuYpvBKkLyYCjutdg== X-Received: by 2002:a17:902:c40b:b0:295:7b89:cb8f with SMTP id d9443c01a7336-2a2f1f78d07mr184951915ad.0.1766567235667; Wed, 24 Dec 2025 01:07:15 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c666d5sm148418095ad.21.2025.12.24.01.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 01:07:15 -0800 (PST) From: Jie Gan Date: Wed, 24 Dec 2025 17:06:13 +0800 Subject: [PATCH v9 3/8] coresight: tmc: Introduce sysfs_read_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: <20251224-enable-byte-cntr-for-ctcu-v9-3-886c4496fed4@oss.qualcomm.com> References: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> In-Reply-To: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766567215; l=5450; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=adb+NstK0OrGdQHboby6lmZs7rWs2zBc775hVSg6Ay8=; b=VCt4oiunM/XKuGR5ta/0wbou/1Ac6C8/Ako/ofvneEGNiOTCJzogA5q3kT1UhQ6oYti6pYWxo ueKG62Fh/mUDwZNVX1f/tUbvKvhVSVDe3VbYOgM3/0XwxcQQJmxX+1E X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI0MDA3OCBTYWx0ZWRfX79T/wcY6K5sr 4nXT46EZFY3zTlMBZHYBK+a2DidV3H9pbmtbeuM23imhpYUwtnr865Q63JzpG/3DEHzMjaWgHTN 7fpDtffzRbp9JBZ17S2bAfsnBVzLJuOWMcXpfjr3g/txpv0dKnTjEXP5wurhooeyNrbV4Al8QZM HRp0sv//5EZ1FxurOb5YoilJvtkida2MAI1H/fnspcmG2ofKaqulD6LrW/q+Y4Oc16BUBVDYajG aJ5TMyYh8PK2eU7SD1mzyW/5XUvpJxKkxr0cth+V10ibUAh9l0n27bfzXxOFu/dwx+Q3PUwkm8x 2ZmbYLWT619Sy85QFS5qe6i4mCu1ZWcYNv/Nr1KjtfnlYwkc4S2U7IWCb47RSvdByzIy1OJp/vz yOgMIMMmgjZrjLeftUfomwCi3MWo97xmlKgVqFwCXkP1IW3e0NI+ddmfuJhtevJ80jm1vHUaSa1 7VSsCWMZz6zR77JK4cg== X-Proofpoint-GUID: I9ENiA84IIOGw2SGetQZ1tKafCrMNzhd X-Proofpoint-ORIG-GUID: I9ENiA84IIOGw2SGetQZ1tKafCrMNzhd X-Authority-Analysis: v=2.4 cv=brtBxUai c=1 sm=1 tr=0 ts=694bad45 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=JzqEjpkVlBH90HjAhVoA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-24_02,2025-12-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 spamscore=0 adultscore=0 priorityscore=1501 malwarescore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512240078 Introduce sysfs_read_ops as a wrapper, wrap sysfs read operations, for read= ing trace data from the TMC buffer. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 50 +++++++++++---------= ---- drivers/hwtracing/coresight/coresight-tmc.h | 17 ++++++++ 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 1ea255ffa67c..8b0397a77e57 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -232,17 +232,10 @@ static int tmc_read_prepare(struct tmc_drvdata *drvda= ta) { int ret =3D 0; =20 - switch (drvdata->config_type) { - case TMC_CONFIG_TYPE_ETB: - case TMC_CONFIG_TYPE_ETF: - ret =3D tmc_read_prepare_etb(drvdata); - break; - case TMC_CONFIG_TYPE_ETR: - ret =3D tmc_read_prepare_etr(drvdata); - break; - default: + if (drvdata->sysfs_ops) + ret =3D drvdata->sysfs_ops->read_prepare(drvdata); + else ret =3D -EINVAL; - } =20 if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read start\n"); @@ -254,17 +247,10 @@ static int tmc_read_unprepare(struct tmc_drvdata *drv= data) { int ret =3D 0; =20 - switch (drvdata->config_type) { - case TMC_CONFIG_TYPE_ETB: - case TMC_CONFIG_TYPE_ETF: - ret =3D tmc_read_unprepare_etb(drvdata); - break; - case TMC_CONFIG_TYPE_ETR: - ret =3D tmc_read_unprepare_etr(drvdata); - break; - default: + if (drvdata->sysfs_ops) + ret =3D drvdata->sysfs_ops->read_unprepare(drvdata); + else ret =3D -EINVAL; - } =20 if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read end\n"); @@ -291,13 +277,8 @@ 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); - } + if (drvdata->sysfs_ops) + return drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); =20 return -EINVAL; } @@ -769,6 +750,18 @@ static void register_crash_dev_interface(struct tmc_dr= vdata *drvdata, "Valid crash tracedata found\n"); } =20 +static const struct sysfs_read_ops tmc_etb_sysfs_read_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 sysfs_read_ops tmc_etr_sysfs_read_ops =3D { + .read_prepare =3D tmc_read_prepare_etr, + .read_unprepare =3D tmc_read_unprepare_etr, + .get_trace_data =3D tmc_etr_get_sysfs_trace, +}; + static int __tmc_probe(struct device *dev, struct resource *res) { int ret =3D 0; @@ -828,6 +821,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) desc.subtype.sink_subtype =3D CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc.ops =3D &tmc_etb_cs_ops; dev_list =3D &etb_devs; + drvdata->sysfs_ops =3D &tmc_etb_sysfs_read_ops; break; case TMC_CONFIG_TYPE_ETR: desc.groups =3D coresight_etr_groups; @@ -841,6 +835,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) mutex_init(&drvdata->idr_mutex); dev_list =3D &etr_devs; INIT_LIST_HEAD(&drvdata->etr_buf_list); + drvdata->sysfs_ops =3D &tmc_etr_sysfs_read_ops; break; case TMC_CONFIG_TYPE_ETF: desc.groups =3D coresight_etf_groups; @@ -849,6 +844,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) desc.subtype.link_subtype =3D CORESIGHT_DEV_SUBTYPE_LINK_FIFO; desc.ops =3D &tmc_etf_cs_ops; dev_list =3D &etf_devs; + drvdata->sysfs_ops =3D &tmc_etb_sysfs_read_ops; break; default: pr_err("%s: Unsupported TMC config\n", desc.name); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 9b3c4e6f0a5e..c9a82ff6cd00 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -221,6 +221,8 @@ struct etr_buf_node { struct list_head node; }; =20 +struct sysfs_read_ops; + /** * struct tmc_drvdata - specifics associated to an TMC component * @atclk: optional clock for the core parts of the TMC. @@ -258,6 +260,7 @@ struct etr_buf_node { * Used by ETR/ETF. * @etr_buf_list: List that is used to manage allocated etr_buf. * @reading_node: Available buffer_node for byte-cntr reading. + * @sysfs_ops: Read operations for sysfs mode. */ struct tmc_drvdata { struct clk *atclk; @@ -290,6 +293,20 @@ struct tmc_drvdata { struct tmc_resrv_buf crash_mdata; struct list_head etr_buf_list; struct etr_buf_node *reading_node; + const struct sysfs_read_ops *sysfs_ops; +}; + +/** + * struct sysfs_read_ops - read operations for TMC and its helper devices + * @read_prepare: prepare operation. + * @read_unprepare: unprepare operation. + * @get_trace_data: read operation. + */ +struct sysfs_read_ops { + int (*read_prepare)(struct tmc_drvdata *drvdata); + int (*read_unprepare)(struct tmc_drvdata *drvdata); + ssize_t (*get_trace_data)(struct tmc_drvdata *drvdata, loff_t pos, + size_t len, char **bufpp); }; =20 struct etr_buf_operations { --=20 2.34.1 From nobody Mon Feb 9 11:36:08 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 92A34311C1B for ; Wed, 24 Dec 2025 09:07:22 +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=1766567244; cv=none; b=aWBQKK12/mR1ej4u2LjHUrSqCP5Qntv+5Kuy0enmeJ4WJ7ZAtgw1NGhr2wv72/zHFTZTulPHN+meo2T+LN+oveyKU6jsDo85O5aZLMagrwG9lDem2ehWni4MEF8NaNr5SBu1MUd3hkkmzL2Cc1GHXuuToIlVrYckVgDh/Oggz8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567244; c=relaxed/simple; bh=E+ppFBcrIJvAdTSLfg3aWv6Te2yyYQtt5h1yCZRSC90=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hXJsHeJEm/5Df7qcun0mzQneynP5dlDKCnIu3Oq76lMCQh7fmQ9BhG0ZwW2iiY5uERiVjgU58wt4Qp0lXgrAmqXGJmRA1/6q5s22ISZWxvrLkSFaExZxTCnf/dbbMJCqeyimpV/kWGFd3pKjSFpSeKCcW/A2ODpoOHN9HMictuM= 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=DxuAf/zB; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=VmpG5h0z; 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="DxuAf/zB"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="VmpG5h0z" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BO6egrY1245990 for ; Wed, 24 Dec 2025 09:07:21 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= 1fOi2vF66t90yroTgrkpJuJ7GaS3pPHt+cx2IRW7gGE=; b=DxuAf/zBg3i59ppl k+V8egBVcJ6GOb65OtIfFKMeFt4llm2xa4RcDA/zhOWZ//fZFZaebx8+HAfeuJw9 Mvrz6Hxq9numQ31355LhdDPD6xpJW0M0EOFS1OkOwko4fbIsFjaIVUFe8X9mAnz+ MBIMKUoPUm22xzgD2VjM93/ChNIsiMI5ksSCdvWE5euGhFpfHFMUS4EpEsSDNan9 06kTje54gZ/YdRvkjToZWXtQfnbjAh19d+/q41g0Z2pYoNaNhrDP9XQs9JxvPSIM y6OdOPBMnM62i6v6saYOqpAGP5XJy/KxXfCBKdzg74zrXiCJ1Ny8JVgoPgXvcfVa kDGziw== 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 4b7u9cu2k0-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 24 Dec 2025 09:07:21 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-29f2b45ecffso94855945ad.2 for ; Wed, 24 Dec 2025 01:07:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766567241; x=1767172041; 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=1fOi2vF66t90yroTgrkpJuJ7GaS3pPHt+cx2IRW7gGE=; b=VmpG5h0zR9kW6UNS5y7A4pnbjGJXloBm1drNyYn0LcRZZgP+OowhEE0ubkj+7Rb3Bz bvlGVK5ieZHZHZaXQ2AvbVWrX9Y5YGSWOpI9+ssLvKGrPQoEVnCpmdTwhoPPGiWkyl4b k5N2srJ5hgViaE5B/oFPQzuus7WvEdz/cBsabtttdqjS+7VxPaD0Pf44FZSzMKzZAo7g k9/adPMJeQTCOhpmLPKwVUXMCXkbgk4lih/LqyW9aC63VbXExdBJUAVyaRSN8wgk+IA2 Ds9tGt43IUFq2lF7TDI+hzUyaBQIW3q9xRBgj+UuCIKUMVslmCMmj7O/xX7ZASRMNZj1 vfzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766567241; x=1767172041; 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=1fOi2vF66t90yroTgrkpJuJ7GaS3pPHt+cx2IRW7gGE=; b=ndqf0nW1NFs17VqQ75AahnXEGcyhGkfPI7nZbuqIetgu1G9CCm+ZcACh3XDDe3xNOu EG9WNS9dstO+LdZDRd9sJ0QrD2nrD8fFAkq7hwCsq5WIjERJ+gMkDRBE9Tt6bHOFeGiA JTjwhn/Ef4gRdB3JND5eSDLbCJlmzKmCNr/Zt8isjocRqIQC9hGJIPsdW9m4aT+qY4D9 BQBvSOJGRym9tRKezmj8pYdL/HvM7CoGQN8lYH446Uf8K4Z9NTRwCK1FAGfx5tfE/lDV 6St6XW7T2SOZPeVY1dDHx/don3HmH8geHRQ3C8Ri/3rcV+Xz6ACe6dkfBvn7D3AxI3kH +ALw== X-Forwarded-Encrypted: i=1; AJvYcCVv+lO/P4HdSnHhP2S0iDzk2bY7UVbuHk+WsrTm3kmM4l7PN8D7yf8jc7YnqQk70CKx9npbBUHAgokOX3Q=@vger.kernel.org X-Gm-Message-State: AOJu0YzwZ8C6oIxS+tTyesLP27XEA6yGHm5IouJahgobk6loccSb6CMg ItXWHF2crlxOYwvYCXtPFkErm32l6ReG1Uq2m06rn+GXcIbLZxnJYGHxqG2zAbhff5GGAePLA0d 8++WwaFbg/hWjC+jMgpBAQ2bjXJQ8nw0DIBgFUSqDpYBBA2GJUgfh6qaq2h/70qqJnYU= X-Gm-Gg: AY/fxX4Exwa36xEXTB55C4NZjo4iVUxkdq7lz1uzGPvAFhMJJLf8hCTl+8FacSYn/A9 xJmAoVLktt/SnGFYztQ9uWz8e6GUBr4tIso2VUgiT2RIbwN51qByb2KRxCmBQylKfRxmUclY8cM 6BTwnh6mAxrBx0hpvDv3nmH726+34X+q/N5Q2W2X4i1i6IH6M9RBbZ6156boo3vGk4ZMA1VjC5b o4T3NLeXdpzNiqaM7690I6OW1C95YkEeHUFxmHaAFp9SuZm1x9sXy3obRENBIpT9SZ+cCzWv3BI KWja/IY7gEumyfL8btolJCvHlZ6hTY65TgTTs/AvzHoFKWktlrJ1ZJBLTyV2QL2XDHYgfLuJJzS OcxtmWvxkVW6U2M3iNjqltxTRMcg5UalHgezDZJYJzW5PH0ybY/Zxb4FPN5uX4TNu43dl5EUl X-Received: by 2002:a17:903:249:b0:2a0:de4f:c9b with SMTP id d9443c01a7336-2a2f222b700mr179027085ad.4.1766567240662; Wed, 24 Dec 2025 01:07:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQC2XxAia4EX4NnIXvKYIkoEvVHiwnA8mWK4j1DSqVZwUZZzFNed1w6NIHIhhDYYgcHL8Lnw== X-Received: by 2002:a17:903:249:b0:2a0:de4f:c9b with SMTP id d9443c01a7336-2a2f222b700mr179026685ad.4.1766567240214; Wed, 24 Dec 2025 01:07:20 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c666d5sm148418095ad.21.2025.12.24.01.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 01:07:19 -0800 (PST) From: Jie Gan Date: Wed, 24 Dec 2025 17:06:14 +0800 Subject: [PATCH v9 4/8] coresight: etr: refactor the tmc_etr_get_catu_device function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251224-enable-byte-cntr-for-ctcu-v9-4-886c4496fed4@oss.qualcomm.com> References: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> In-Reply-To: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766567216; l=4412; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=E+ppFBcrIJvAdTSLfg3aWv6Te2yyYQtt5h1yCZRSC90=; b=JorYpjDt+HQSZZ4cqDjMRyi2/w/tKFXOb4XpusXf/jp/55B0wZHXDs+JaucpIRzl28QKDlkgG cMNvERbaINXDNbFhJsuUGl2JFNVE9P6C7AWXC4/+2+DZtP4iH/FsDSx X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: rPFcUyjOz6F-XOGmeaKeXg2mssVsbbz9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI0MDA3OCBTYWx0ZWRfX1sPHuXWb5PcY fB7dXMrhfdhp8atwqMeC/MkOH3w65n+LV2i2tNGxT4R7HGqwhRcWYV6CPmN9d6C1g8NEWCwsujB mXXbpfzwj2VYH3ltNIaiSoSJYefnSQOJdnNHi1c3sJOIosKbkOcvwbsO/JLvvIOtuKxs1f9jRz4 ej+Akf7limCPZ6Fj6acj+dgBQICGDvmRdUiWUj8pI0GY6JySr0yVQRcpFp3gQl5EWDRdqdFlE7x 2DtcJUqvMvGAr04JPLzO9eoh8OR+w7NKwJTVLdRJ6plSnPReyPEwyYVPejdxnorJhinbodwTojH qZCm8Qv1ZktJLPYs0xm51oqMZY+3UlSuPPcj0o7TnocJQoLeKCyddNsDAL9NLljjB4mVL7o4X4O Jp/xB7TJnG3l7wHSLkHYuUsCGc9YLIybfNrch9A+JyEKVEStfUc3aMqtYTupnt09BY9JxaUBYLT mjzKFO6nniKm54/ITGA== X-Authority-Analysis: v=2.4 cv=HsN72kTS c=1 sm=1 tr=0 ts=694bad49 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=-ozbsww5GKt6_lkPIaMA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-ORIG-GUID: rPFcUyjOz6F-XOGmeaKeXg2mssVsbbz9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-24_02,2025-12-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 phishscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512240078 Refactor tmc_etr_get_catu_device to retrieve the helper device connected to the TMC ETR based on helper_subtype. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-catu.c | 3 ++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 32 ++++++++++++++++-----= ---- drivers/hwtracing/coresight/coresight-tmc.h | 3 ++- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtraci= ng/coresight/coresight-catu.c index 69b36bae97ab..d3972619cc96 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -334,7 +334,8 @@ static int catu_alloc_etr_buf(struct tmc_drvdata *tmc_d= rvdata, struct tmc_sg_table *catu_table; struct catu_etr_buf *catu_buf; =20 - csdev =3D tmc_etr_get_catu_device(tmc_drvdata); + csdev =3D tmc_etr_get_helper_device(tmc_drvdata, + CORESIGHT_DEV_SUBTYPE_HELPER_CATU); if (!csdev) return -ENODEV; catu_buf =3D kzalloc(sizeof(*catu_buf), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index 2b6ca1f8bed2..18981b6cc172 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -844,28 +844,37 @@ static const struct etr_buf_operations etr_sg_buf_ops= =3D { }; =20 /* - * TMC ETR could be connected to a CATU device, which can provide address - * translation service. This is represented by the Output port of the TMC - * (ETR) connected to the input port of the CATU. + * TMC ETR could be connected to the helper device, which can provide addr= ess + * translation service(CATU) or data filter function(CTCU). This is repres= ented + * by the Output port of the TMC (ETR) connected to the input port of the = helper. * - * Returns : coresight_device ptr for the CATU device if a CATU is found. + * @drvdata : drvdata of the TMC device + * @subtype : helper_subtype of the helper device + * + * Returns : coresight_device ptr for the helper device if a helper is fou= nd. * : NULL otherwise. */ struct coresight_device * -tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) +tmc_etr_get_helper_device(struct tmc_drvdata *drvdata, + enum coresight_dev_subtype_helper subtype) { struct coresight_device *etr =3D drvdata->csdev; - union coresight_dev_subtype catu_subtype =3D { - .helper_subtype =3D CORESIGHT_DEV_SUBTYPE_HELPER_CATU + union coresight_dev_subtype helper_subtype =3D { + .helper_subtype =3D subtype }; =20 - if (!IS_ENABLED(CONFIG_CORESIGHT_CATU)) + + if (subtype =3D=3D CORESIGHT_DEV_SUBTYPE_HELPER_CATU && + !IS_ENABLED(CONFIG_CORESIGHT_CATU)) + return NULL; + else if (subtype =3D=3D CORESIGHT_DEV_SUBTYPE_HELPER_CTCU && + !IS_ENABLED(CONFIG_CORESIGHT_CTCU)) return NULL; =20 return coresight_find_output_type(etr->pdata, CORESIGHT_DEV_TYPE_HELPER, - catu_subtype); + helper_subtype); } -EXPORT_SYMBOL_GPL(tmc_etr_get_catu_device); +EXPORT_SYMBOL_GPL(tmc_etr_get_helper_device); =20 static const struct etr_buf_operations *etr_buf_ops[] =3D { [ETR_MODE_FLAT] =3D &etr_flat_buf_ops, @@ -913,7 +922,8 @@ static void get_etr_buf_hw(struct device *dev, struct e= tr_buf_hw *buf_hw) =20 buf_hw->has_iommu =3D iommu_get_domain_for_dev(dev->parent); buf_hw->has_etr_sg =3D tmc_etr_has_cap(drvdata, TMC_ETR_SG); - buf_hw->has_catu =3D !!tmc_etr_get_catu_device(drvdata); + buf_hw->has_catu =3D !!tmc_etr_get_helper_device(drvdata, + CORESIGHT_DEV_SUBTYPE_HELPER_CATU); buf_hw->has_resrv =3D tmc_has_reserved_buffer(drvdata); } =20 diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index c9a82ff6cd00..7690a70069da 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -471,7 +471,8 @@ static inline uint32_t find_crash_tracedata_crc(struct = tmc_drvdata *drvdata, return crc32_le(0, (void *)drvdata->resrv_buf.vaddr, crc_size); } =20 -struct coresight_device *tmc_etr_get_catu_device(struct tmc_drvdata *drvda= ta); +struct coresight_device *tmc_etr_get_helper_device(struct tmc_drvdata *drv= data, + enum coresight_dev_subtype_helper subtype); =20 void tmc_etr_set_catu_ops(const struct etr_buf_operations *catu); void tmc_etr_remove_catu_ops(void); --=20 2.34.1 From nobody Mon Feb 9 11:36:08 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 99AC832FA25 for ; Wed, 24 Dec 2025 09:07: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=1766567249; cv=none; b=Oc/9poWKEB1aWMkAgXHUy8+dY7l/aAbeOdgWTl5Bp8SfpVSUKDc9WzUaAuWAk7xx5wd3RwUGaq2jg0dDtD2GNhmCYlSFzMdPMnqrcvcvLTYEa1Ra45ZkWndL+lmt4c8sICUnvr+Eu7oktvJwqj6nOfWGLI5rdjFlWDBEKw6dtjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567249; c=relaxed/simple; bh=D10EnaHvzxc5IcCAThb9a/AzzqWooUS88J0GgYqXhUw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t+BJzZbG5rbNqoDinggZvaCaHvIapIQsSyxKk8YxQ5mwTo7XTYn8NjhjiZ/Z2TqbVexVI6gJQU0fPXtsoPj9ywqrESx03hgOxJSGLem/zvKWQpM9zW0qAvCJTQGyXXwpHylsIZAazeVknjWRtwolpALVb2fS9cjsEwzalpi443I= 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=KkGGFlfV; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Q4g31L2a; 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="KkGGFlfV"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Q4g31L2a" 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 5BO8JKeA721758 for ; Wed, 24 Dec 2025 09:07:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=KkGGFlfVJeNvO8nW DO5c75xW7tB2eW8su7rJMJ1aW6AQkzjDeVIJ//9yr4/DvhEFoGxRHNv5O8n8hN+N D+Y31zvGf+XYWMDwP4JD0vLnnj9w2bna4JrUVB2/vHz/QqIYrf/wJcVN7X/OdVlI nrXT+KqYQzdoe8YA0aMlZVqBspjypgbE2ZnCf7BEBkJDei/fngmMJc9fWHnUWADs AOr1CejqUVBTz6WsbbaLrHnDZwsDOfilWH+gGXwp7h+BL2wChaI0EiCLtAiTbhTx G4d2myIYVKPQ0Z1nnxkCD+mvvhP0PtNpI0QH9zXKxZ+ceeYBD9ZoSalYz39dJgEm JxO/UQ== 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 4b81mt9r5x-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 24 Dec 2025 09:07:26 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2a0f0c7a06eso113194505ad.2 for ; Wed, 24 Dec 2025 01:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766567245; x=1767172045; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=Q4g31L2arGS1UhpebplBvjubyIiIED/WS6DvcBwczDxSuD69b5LnHUHJu+DvQ4Puiq UdWZE4b0cUKbU/sGTeUYdBPwHrXsRGyG3RJ9EXeEdH19fJghpUcfv6Hi+a5jdQ5Apdp2 Zi/i273BtKa7FZRYDs5NElJN5FnAJdnjE9LwRqrU/dZ4RTUzUDNaHiCO1aw6Q82u4qNu a6yXBm7LH+6kZceo90ybR5y3GeLNBvAp0Ge+Sv2IrqU96AeQKjw/addzXK9aCNn1lmju 1Cy0CnG4ypG38yd1VXZuHIErEKGI3btcVnN/BkzGmkS7xKVOCSl/RNE+fFMEe4EBiOxk +q3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766567245; x=1767172045; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=I5PgA1qa3IfjGRmReOuT+Jdii9AuqyqupAfSP/tz1CU=; b=gaj1uxlBpP8jyRspPNr/XqXLNa3MDN2kZIjqe3VyVbL0bxbZ1tVj77VcExDVP3pa7Y FWpFyPIfYTyH5SowZJg9o1uBGZp4DeyXmFfjANW38qgfkUPbpkTvsulQNrawgfk4XERF 6NgYI2KzZMqyNIlrHz+wAcXhfGcYwzj3Ajngh+1TJDr/TZmHiO34SfiD5eHX6CkktrXN gtW6BAz+nKuKIY+thveiuSP3QcXd9/BlY3Inun9Oxy/VN6BXdqXZs3iaDfCzYBb/HCyv nrpf7yz3Nymtb2AUyIN7g0sxiR6gy6kOkx5WvAQyxcJ5FuVIR8XZtNJtiDUQMzCKOxPb sSRA== X-Forwarded-Encrypted: i=1; AJvYcCW6Iv26XF+bWCMJSOyS7/KowFV2TmTcV2kIUTr/k/AR9rhp83H9OlVPrFsDP4830eQk5oS5iddeKrb+D1k=@vger.kernel.org X-Gm-Message-State: AOJu0YxBjbKSGMeQ1iolX2MLYDz14b4Y4QgWS17CIXzaHtigB8m7uXaV qK+KqEmUqUHobiON8ymaCNAYrEhOPHJe4+leQUrPRGMrEnUTpAw3X1hLxnkylYzF0o5LGTJO1lU HSZDskh+YHqDm6hsZf7/eDxM/RrF9znp8QEPf2cR+Yh08Rex3I9agMdlxhobNfJBIQi0= X-Gm-Gg: AY/fxX6uIPd8qEIrS/x1OSyotVFATbRqLwEeKrxKV9aJFD/87w7YgY3bRelFsYTauUh 99l4s/LZBLqUnFFhMU4fMNLefQc/eP2//0dfQHc2pHhuqeND1G9nj16FLUbMADcpuxYN8rmNK4O mTffwrkZFmoqyzjaElIRH8KvgCOaEDgB0tPbsYklq0KBagAzS7YdQ95A/IyNtqaxnEweltB8QSr zPFGbr8JDnsrj5WRfqT6gsVqeuW1Z9HvMGKoEN3XOFHx9/2Ktuvuf+9FbhMlouA947jblT0wf9Z zS36Hix+8xvmnBYnjDhGMkjZBTYFMR27utjIJ3a4H4fio175BR6VUfJtoFImgWhfX0QyKWU5KVV 3zaq83oHFZBAMU1HoYdz5K3EaJFOYfF2RpIHdjNSDmrMjFUy+yuj3eo2ywqf1sb6iVHC+YwII X-Received: by 2002:a17:903:3bd0:b0:2a1:39cd:7462 with SMTP id d9443c01a7336-2a2f221278cmr148934385ad.8.1766567245443; Wed, 24 Dec 2025 01:07:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQJSCcEDJYpAElLBdwqPKFsyNLcK2o3ZpFHifNOj2aFk1A63DITNNzdU1841TN9YFANz2I4A== X-Received: by 2002:a17:903:3bd0:b0:2a1:39cd:7462 with SMTP id d9443c01a7336-2a2f221278cmr148934225ad.8.1766567244933; Wed, 24 Dec 2025 01:07:24 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c666d5sm148418095ad.21.2025.12.24.01.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 01:07:24 -0800 (PST) From: Jie Gan Date: Wed, 24 Dec 2025 17:06:15 +0800 Subject: [PATCH v9 5/8] dt-bindings: arm: add an interrupt property for Coresight CTCU Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251224-enable-byte-cntr-for-ctcu-v9-5-886c4496fed4@oss.qualcomm.com> References: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> In-Reply-To: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766567216; l=1751; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=D10EnaHvzxc5IcCAThb9a/AzzqWooUS88J0GgYqXhUw=; b=tKR99cySKmryaYnNrYe05xHL6TEQFTTMHE0xGP1WEUL9152DOtRwuSu4OlI2/9ZkD/Y8RUsDv 045i+bqbKOZDc9WJKr1W1gRHkc/BycGY2HUPjFzCpHYx1zIvbuBsZ9C X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=e/ILiKp/ c=1 sm=1 tr=0 ts=694bad4e cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=gSyxy6DGYGa4b6s9XCEA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: bFr7gtBc6QneLkCVntVPHO42WkuQghFP X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI0MDA3OCBTYWx0ZWRfX/Xv0oNaRFIJ/ l7MxlQNpLKv+afeTznp7IgjaKua5zsO0trxZGrDSzSIbfgDo/xo0Ucn8F9mt6Y7JjX9XTdHGS2R clqr7YxhEbNOcTnOc/1SBbdoTD3Kh+VIHX93U07ZeZpNK7q7H4Sl8g0awMtDwMV/4Y54+StQw0F 9zYuZWkruAK+ZKgtW/KEJATimwpBV5CIu8yTvQfszbWYry56jqOVPoBOqYJ0N8QwhVmA72KVzcY Y8Sm3fqU2ItlEV0tP6Oh2WWIT0HXsdLf0CycC2wZF4TXUj0EnaAbwWFACEVKBLzWTiD+dy92sss 2yRkHEP9D9QfQrA90fu20Fq2fsJw8fekqfS7bU1W/4AI6Vfl3YmKg8ZwXnrb8FjLwBCO1D6qQUV c8EYFXSPYO5Tgp37Oxko+6Al7QvB8bWQe6HUuZi9xYPGr4szfvnXKgVI6np0URIHC1yjo1nGdvu 63Vdit3aSg8U+QIUNtA== X-Proofpoint-ORIG-GUID: bFr7gtBc6QneLkCVntVPHO42WkuQghFP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-24_02,2025-12-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512240078 Add an interrupt property to CTCU device. The interrupt will be triggered when the data size in the ETR buffer exceeds the threshold of the BYTECNTRVAL register. Programming a threshold in the BYTECNTRVAL register of CTCU device will enable the interrupt. Acked-by: Krzysztof Kozlowski Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml | 10 ++++++= ++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml= b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml index c969c16c21ef..ac27a8b89085 100644 --- a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml @@ -39,6 +39,11 @@ properties: items: - const: apb =20 + interrupts: + items: + - description: Interrupt for the ETR device connected to in-port0. + - description: Interrupt for the ETR device connected to in-port1. + label: description: Description of a coresight device. @@ -60,6 +65,8 @@ additionalProperties: false =20 examples: - | + #include + ctcu@1001000 { compatible =3D "qcom,sa8775p-ctcu"; reg =3D <0x1001000 0x1000>; @@ -67,6 +74,9 @@ examples: clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1 From nobody Mon Feb 9 11:36:08 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 9F5092D8DD4 for ; Wed, 24 Dec 2025 09:07: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=1766567255; cv=none; b=iJnpB2JC6MqIsOvGIQWTtmqgmm8OYIVS10hYwc4c5ft7ntjy70hS6wqZkG7a0wT13ZhOPFipV9W2B9z7+TGfX//ZGqoHPMQm3LcNNKxPZUQxQDfTQv9jRWCF9PAEKtoRPo0H4m43FNyFKNQnOGigI4GiweIylV3Aj5UZE/ouaH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567255; c=relaxed/simple; bh=3Dl2DBkAgYX9zBHeNaof/UbPQ1QTq8c4q8PPipBTEdI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=myYaw+YVBCgWZLcb8TL163H+OX03p/hWfpBPvyDnkjEIaiDdeoPmEnw/wZzW7hmCzJlZZ4+BIiTmsTBCqELQ93azLOtpoZAJFWDB7Y8svIYOe5q7j1/DBIOKJsjiHtQEsGB6Gp3eqB7uXWqeJ1t/gv8fyF6a3dG7gPjfCxaU7SQ= 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=oRKyBh2x; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ZG2Q/j9V; 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="oRKyBh2x"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ZG2Q/j9V" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BO6wFer1245478 for ; Wed, 24 Dec 2025 09:07: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= zftXLZejHschfaqV+Tjhewh8xeTRL6I8Q+dOwBPpAGg=; b=oRKyBh2x4xYMX1VI Upb1tfFJ4c/faXBW/WPCJu8ovzA6r4dtZ7gErp6inpuBFOdeuPvmtWPR+fqCnq1I tQc2FdybYXtLpEpJ7B6gs3gXfh/MIZZDWVh0BCi+KKjOgl2eSQBrPzBFBolhlhkd AocPxg0hqwKZ515XFOhg/nV5pYXpCp+ywq01pb5tnUz5K1LAchcxWRWOMW0X3YQd SjccRsoGHDUKMj8Hwp62PLQD4FssG1oQSX2I1bGnx32bj4haEaM5GvzzUJiiG/0a 8TbXNLI/zNflbZnVlbwqf/lHxAwF3pAiiNK21RYIt9ZeOJKNHhQ4/HCNSv5jygzK S7D9TA== 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 4b7u9cu2kc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 24 Dec 2025 09:07:31 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-29f177f4d02so128985175ad.2 for ; Wed, 24 Dec 2025 01:07:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766567251; x=1767172051; 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=zftXLZejHschfaqV+Tjhewh8xeTRL6I8Q+dOwBPpAGg=; b=ZG2Q/j9VAxNHTN6g/860CYuv8X+amnk8w9JY478MKSBZ4GoxU8sWLSE+VgG5CFWty9 j+1OQyyeWy5Qtn12B55OF2Aa4TNg/zDamuZWQ3mikphezzSW/66IlctC6MFgdjmVO0jv LqcH8Rq6NBdH4sw/TsyGZR3wt0hv1cey6C0qZW+Xsh3VIYhCTXgEkD+Ww16Vq5HcP68G Bn9lmFtCIX0Az7lcHDmIoxFMKb0kkQlJFTKqjo9Yi4SjNrk3njUo3nuF8COvMPj1szaw Dkk3K6XbEnHWHm1E53nCfJ+L4aC+mFfdu7uIZQTaDo6hQsJmaIfjw9W5CA280MClTTaG 1jPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766567251; x=1767172051; 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=zftXLZejHschfaqV+Tjhewh8xeTRL6I8Q+dOwBPpAGg=; b=qx6jw6b5HzmWLPRCr3tOtURaiYGJ6bK7KS5mtXu9GkfdACnNbT83Cn4PmfzRFwjxZC EZmWjDUJWcpObPAiNLoScfxi0zaV6U+o5LcmF1YP2kAX+f9B9ZvZ/4ZpEf5bi2fk4iW2 xAzK0M5B7Kq8ypvWrXIbb76jVcj//syd6mMJSJk0DMW1GKFo1xw+iw+ejle5yMG3jLHs jIpXEMmi2xZrV9ARVvtn9tDso1E7wYDYGHKjN22BQW0sbEBwW4xuXTPDMCh7CfpxKM2C xCMfhIUI33p9xlV4ewvTZ7zoC7PW8c+Ziuzah6yXzcC9zwK1Kxcfo6MiYAIAG+SvEUob eAxQ== X-Forwarded-Encrypted: i=1; AJvYcCUk0/z/ZmWZ0dQSaBnox6XG5tlxnEIzxRpeInqNXfzT14S/ihKZPkOormyOpIVYyjHEacSQIDycNEliWo8=@vger.kernel.org X-Gm-Message-State: AOJu0YyQ55BSef7Pgq5CEbP8iE9qHolHwuCketKw6rCq/kQexrp7sAsV Z7zkb7DQDgGCZ3KCV6ZM50mQKIG08Qrolhx4hKLkRKr7GSfPP7PjZxm2Iaa5g3aTleDa67ymruv HdfSoIRAuUVlk/o8J/7YwToLVtqCKWyK24XFds7Lb7TJMqbudRhK1Savia5gESYvWFoU= X-Gm-Gg: AY/fxX6U5ND6c8JE7yeuKrm0UEOeDF/Y6XKQh7uAfAmBc4q7DQmj0p0F4bi6MlUCPSg TLXtW42pwE4Cpdaug0c88YaVZygC23cZYF7vVLIUnOwHgePG23LCaSJz44KbE+heU4LhCNM5f3p im63QTZD2dHR71cqC6MDqjTLxc8st4/6x9ghv6kIjfC96sMEIYgmUvsDOpNbSkrnfGrM1eVV9BE XKUXoQF3msYwl9G1zjQM/TKZwf0Ykh3kpzAYop668mLTGpZ+2xNdL7A26EmlfyIZvQPJQ76mCdo Rm3Bq3n8sqTjhrTKt3rmxXz/aEiz/Ou5MNsuleiKUKSp1ZGP2FGMcx0/XXkWskjJNR6AkKMst7k ZIMYUsvtTb1fKrRGDuKAu8YP/tNygSVMb0LvSq3SaGVaDCpNRjpItTmeCKj2BnGKj7FCVLVnW X-Received: by 2002:a17:903:41c5:b0:2a0:d662:7282 with SMTP id d9443c01a7336-2a2f272c829mr190794545ad.37.1766567250370; Wed, 24 Dec 2025 01:07:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcrgUGDs1E9yfx0rYvFU3bBWyOf69lj/01yxHJnebRf+VxWPtP+/oV08kvYYd9Y+jV0wHKGw== X-Received: by 2002:a17:903:41c5:b0:2a0:d662:7282 with SMTP id d9443c01a7336-2a2f272c829mr190794205ad.37.1766567249767; Wed, 24 Dec 2025 01:07:29 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c666d5sm148418095ad.21.2025.12.24.01.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 01:07:29 -0800 (PST) From: Jie Gan Date: Wed, 24 Dec 2025 17:06:16 +0800 Subject: [PATCH v9 6/8] coresight: ctcu: enable byte-cntr for TMC ETR devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251224-enable-byte-cntr-for-ctcu-v9-6-886c4496fed4@oss.qualcomm.com> References: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> In-Reply-To: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766567216; l=24608; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=3Dl2DBkAgYX9zBHeNaof/UbPQ1QTq8c4q8PPipBTEdI=; b=QjRdB64sXaKj+w4CrbMYAcGK9P7balSx8NYz3SSOg32gwryeYaRAVaUNUvJ9jmcT/vZqLIzMh ZiR6YJt16VbBdSizbJIrWzQAJYuLSY5fXb/6Bqg/0xdgk1HJsUUC2Ak X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: QyER3U8JiI19Hu-w8oQ468ckqZHYYZ-3 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI0MDA3OCBTYWx0ZWRfX8klXkY1dKwq8 mZWMC8+l7C8bC7fJZVw5XdebsSYzu07mZwcj6kYVhY8aahzlUNNBNeSvC/CJhSUTjHz3Yo/AHSp e5Lm7Hvlpk4C8bKLz28bJRjOa6DsrXZAV52YinaeSE9YAZw7VCcPNi+PNZC+rSfuWwqLdxrK2sW /7Ox6RW2rre9OdQv15CWv72jUWiBD4/cTkocp1L2iVrmiCdT6GESJ59T7xHZAM3CDfX5mU86cxW BSjQkMY1xsRPxJpN3Vlr0PivO+x1iZJ1HwZxxQF+7AJAMcpVqFJn+Fx8X1oaip/Kq9gGeWD3UEH pZvsuZeb1lxzV3F4ohFBKKx2taojPp8o3KawDguwAxy5Hdz9sb7VVE2NLSrCDWYqT85RBZbysZH xyN3AB6zLYQNbjJQB/7jbJmNUj2PAjH5P4V0K+0FbJodcPp+AuCSGqy6C1KAVznc3bQ0Tt7bR5R DiumovIY+4V6V97DPXw== X-Authority-Analysis: v=2.4 cv=HsN72kTS c=1 sm=1 tr=0 ts=694bad53 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=TrPPj8Ph-2G9coJyck8A:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: QyER3U8JiI19Hu-w8oQ468ckqZHYYZ-3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-24_02,2025-12-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 phishscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512240078 The byte-cntr function provided by the CTCU device is used to transfer data from the ETR buffer to the userspace. An interrupt is triggered if the data size exceeds the threshold set in the BYTECNTRVAL register. The interrupt handler counts the number of triggered interruptions and the read function will read the data from the synced ETR buffer. Switching the sysfs_buf when current buffer is full or the timeout is triggered and resets rrp and rwp registers after switched the buffer. The synced buffer will become available for reading after the switch. Signed-off-by: Jie Gan --- .../ABI/testing/sysfs-bus-coresight-devices-ctcu | 8 + drivers/hwtracing/coresight/Makefile | 2 +- .../hwtracing/coresight/coresight-ctcu-byte-cntr.c | 366 +++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-ctcu-core.c | 103 +++++- drivers/hwtracing/coresight/coresight-ctcu.h | 77 ++++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 18 + drivers/hwtracing/coresight/coresight-tmc.h | 1 + 7 files changed, 562 insertions(+), 13 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-ctcu b/D= ocumentation/ABI/testing/sysfs-bus-coresight-devices-ctcu new file mode 100644 index 000000000000..3230c19dc701 --- /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: Dec. 2025 +KernelVersion: 6.20 +Contact: Tingwei Zhang ; Jinlong Ma= o ; Jie Gan +Description: + (RW) Configure the byte-cntr IRQ register for the specified ETR device + based on its port number. An interrupt is generated when the data size + exceeds the value set in the IRQ register. diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/cores= ight/Makefile index ab16d06783a5..821a1b06b20c 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -55,5 +55,5 @@ coresight-cti-y :=3D coresight-cti-core.o coresight-cti-p= latform.o \ obj-$(CONFIG_ULTRASOC_SMB) +=3D ultrasoc-smb.o obj-$(CONFIG_CORESIGHT_DUMMY) +=3D coresight-dummy.o obj-$(CONFIG_CORESIGHT_CTCU) +=3D coresight-ctcu.o -coresight-ctcu-y :=3D coresight-ctcu-core.o +coresight-ctcu-y :=3D coresight-ctcu-core.o coresight-ctcu-byte-cntr.o obj-$(CONFIG_CORESIGHT_KUNIT_TESTS) +=3D coresight-kunit-tests.o diff --git a/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c b/drive= rs/hwtracing/coresight/coresight-ctcu-byte-cntr.c new file mode 100644 index 000000000000..6842b3d3daa0 --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c @@ -0,0 +1,366 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#include +#include +#include +#include +#include +#include + +#include "coresight-ctcu.h" +#include "coresight-priv.h" +#include "coresight-tmc.h" + +static irqreturn_t byte_cntr_handler(int irq, void *data) +{ + struct ctcu_byte_cntr *byte_cntr_data =3D (struct ctcu_byte_cntr *)data; + + atomic_inc(&byte_cntr_data->irq_cnt); + wake_up(&byte_cntr_data->wq); + + return IRQ_HANDLED; +} + +static void ctcu_reset_sysfs_buf(struct tmc_drvdata *drvdata) +{ + u32 sts; + + CS_UNLOCK(drvdata->base); + tmc_write_rrp(drvdata, drvdata->sysfs_buf->hwaddr); + tmc_write_rwp(drvdata, drvdata->sysfs_buf->hwaddr); + sts =3D readl_relaxed(drvdata->base + TMC_STS) & ~TMC_STS_FULL; + writel_relaxed(sts, drvdata->base + TMC_STS); + CS_LOCK(drvdata->base); +} + +static void ctcu_cfg_byte_cntr_reg(struct tmc_drvdata *drvdata, u32 val, u= 32 offset) +{ + struct ctcu_drvdata *ctcu_drvdata; + struct coresight_device *helper; + + helper =3D tmc_etr_get_helper_device(drvdata, CORESIGHT_DEV_SUBTYPE_HELPE= R_CTCU); + if (!helper) + return; + + ctcu_drvdata =3D dev_get_drvdata(helper->dev.parent); + /* A one value for IRQCTRL register represents 8 bytes */ + ctcu_program_register(ctcu_drvdata, val / 8, offset); +} + +static struct ctcu_byte_cntr *ctcu_get_byte_cntr_data(struct tmc_drvdata *= drvdata) +{ + struct ctcu_byte_cntr *byte_cntr_data; + struct ctcu_drvdata *ctcu_drvdata; + struct coresight_device *helper; + int port; + + helper =3D tmc_etr_get_helper_device(drvdata, CORESIGHT_DEV_SUBTYPE_HELPE= R_CTCU); + if (!helper) + return NULL; + + port =3D coresight_get_in_port(drvdata->csdev, helper); + if (port < 0) + return NULL; + + ctcu_drvdata =3D dev_get_drvdata(helper->dev.parent); + byte_cntr_data =3D &ctcu_drvdata->byte_cntr_data[port]; + return byte_cntr_data; +} + +static bool ctcu_byte_cntr_switch_buffer(struct tmc_drvdata *drvdata, + struct ctcu_byte_cntr *byte_cntr_data) +{ + struct etr_buf_node *nd, *next, *curr_node, *picked_node; + struct etr_buf *curr_buf =3D drvdata->sysfs_buf; + bool found_free_buf =3D false; + + if (WARN_ON(!drvdata || !byte_cntr_data)) + return found_free_buf; + + /* Stop the ETR before we start the switch */ + if (coresight_get_mode(drvdata->csdev) !=3D CS_MODE_DISABLED) + tmc_etr_enable_disable_hw(drvdata, false); + + list_for_each_entry_safe(nd, next, &drvdata->etr_buf_list, node) { + /* curr_buf is free for next round */ + if (nd->sysfs_buf =3D=3D curr_buf) { + nd->is_free =3D true; + curr_node =3D nd; + } + + if (!found_free_buf && nd->is_free && nd->sysfs_buf !=3D curr_buf) { + picked_node =3D nd; + found_free_buf =3D true; + } + } + + if (found_free_buf) { + curr_node->pos =3D 0; + drvdata->reading_node =3D curr_node; + drvdata->sysfs_buf =3D picked_node->sysfs_buf; + drvdata->etr_buf =3D picked_node->sysfs_buf; + picked_node->is_free =3D false; + /* Reset irq_cnt for next etr_buf */ + atomic_set(&byte_cntr_data->irq_cnt, 0); + /* Reset rrp and rwp when the system has switched the buffer*/ + ctcu_reset_sysfs_buf(drvdata); + /* Restart the ETR when we find a free buffer */ + if (coresight_get_mode(drvdata->csdev) !=3D CS_MODE_DISABLED) + tmc_etr_enable_disable_hw(drvdata, true); + } + + return found_free_buf; +} + +/* + * ctcu_byte_cntr_get_data() - reads data from the deactivated and filled = buffer. + * The byte-cntr reading work reads data from the deactivated and filled b= uffer. + * The read operation waits for a buffer to become available, either fille= d or + * upon timeout, and then reads trace data from the synced buffer. + */ +static ssize_t ctcu_byte_cntr_get_data(struct tmc_drvdata *drvdata, loff_t= pos, + size_t len, char **bufpp) +{ + struct etr_buf *sysfs_buf =3D drvdata->sysfs_buf; + struct device *dev =3D &drvdata->csdev->dev; + ssize_t actual, size =3D sysfs_buf->size; + struct ctcu_byte_cntr *byte_cntr_data; + size_t thresh_val; + atomic_t *irq_cnt; + int ret; + + byte_cntr_data =3D ctcu_get_byte_cntr_data(drvdata); + if (!byte_cntr_data) + return -EINVAL; + + thresh_val =3D byte_cntr_data->thresh_val; + irq_cnt =3D &byte_cntr_data->irq_cnt; + +wait_buffer: + if (!byte_cntr_data->reading_buf) { + ret =3D wait_event_interruptible_timeout(byte_cntr_data->wq, + ((atomic_read(irq_cnt) + 1) * thresh_val >=3D size) || + !byte_cntr_data->enable, + BYTE_CNTR_TIMEOUT); + if (ret < 0) + return ret; + /* + * The current etr_buf is almost full or timeout is triggered, + * so switch the buffer and mark the switched buffer as reading. + */ + if (byte_cntr_data->enable) { + if (!ctcu_byte_cntr_switch_buffer(drvdata, byte_cntr_data)) { + dev_err(dev, "Switch buffer failed for byte-cntr\n"); + return -EINVAL; + } + + byte_cntr_data->reading_buf =3D true; + } else { + /* + * TMC-ETR has been disabled, so directly reads data from + * the drvdata->sysfs_buf. + */ + actual =3D drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); + if (actual > 0) { + byte_cntr_data->total_size +=3D actual; + return actual; + } + + /* Exit byte-cntr reading */ + return 0; + } + } + + /* Check the status of current etr_buf*/ + if ((atomic_read(irq_cnt) + 1) * thresh_val >=3D size) + /* + * Unlikely to find a free buffer to switch, so just disable + * the ETR for a while. + */ + if (!ctcu_byte_cntr_switch_buffer(drvdata, byte_cntr_data)) + dev_warn(dev, "No available buffer to store data, disable ETR\n"); + + pos =3D drvdata->reading_node->pos; + actual =3D drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); + if (actual <=3D 0) { + /* Reset flags upon reading is finished or failed */ + byte_cntr_data->reading_buf =3D false; + drvdata->reading_node =3D NULL; + + /* + * Nothing in the buffer, waiting for the next buffer + * to be filled. + */ + if (actual =3D=3D 0) + goto wait_buffer; + } else + byte_cntr_data->total_size +=3D actual; + + return actual; +} + +static int ctcu_read_prepare_byte_cntr(struct tmc_drvdata *drvdata) +{ + struct ctcu_byte_cntr *byte_cntr_data; + unsigned long flags; + int ret =3D 0; + + /* config types are set a boot time and never change */ + if (WARN_ON_ONCE(drvdata->config_type !=3D TMC_CONFIG_TYPE_ETR)) + return -EINVAL; + + /* + * Byte counter reading should start only after the TMC-ETR has been + * enabled, which implies that the sysfs_buf has already been setup + * in drvdata. + */ + if (!drvdata->sysfs_buf) + return -EINVAL; + + byte_cntr_data =3D ctcu_get_byte_cntr_data(drvdata); + if (!byte_cntr_data) + return -EINVAL; + + /* + * The threshold value must not exceed the buffer size. + * A margin should be maintained between the two values to account + * for the time gap between the interrupt and buffer switching. + */ + if (byte_cntr_data->thresh_val + SZ_16K >=3D drvdata->size) { + dev_err(&drvdata->csdev->dev, "The threshold value is too large\n"); + return -EINVAL; + } + + raw_spin_lock_irqsave(&drvdata->spinlock, flags); + if (byte_cntr_data->reading) { + ret =3D -EBUSY; + goto out_unlock; + } + + byte_cntr_data->reading =3D true; + raw_spin_unlock_irqrestore(&drvdata->spinlock, flags); + /* Setup an available etr_buf_list for byte-cntr */ + ret =3D tmc_create_etr_buf_list(drvdata, 2); + if (ret) + goto out; + + raw_spin_lock_irqsave(&drvdata->spinlock, flags); + atomic_set(&byte_cntr_data->irq_cnt, 0); + /* Configure the byte-cntr register to enable IRQ */ + ctcu_cfg_byte_cntr_reg(drvdata, byte_cntr_data->thresh_val, + byte_cntr_data->irq_ctrl_offset); + enable_irq_wake(byte_cntr_data->irq); + byte_cntr_data->total_size =3D 0; + +out_unlock: + raw_spin_unlock_irqrestore(&drvdata->spinlock, flags); + +out: + return ret; +} + +static int ctcu_read_unprepare_byte_cntr(struct tmc_drvdata *drvdata) +{ + struct device *dev =3D &drvdata->csdev->dev; + struct ctcu_byte_cntr *byte_cntr_data; + unsigned long flags; + + byte_cntr_data =3D ctcu_get_byte_cntr_data(drvdata); + if (!byte_cntr_data) + return -EINVAL; + + raw_spin_lock_irqsave(&drvdata->spinlock, flags); + /* Configure the byte-cntr register to disable IRQ */ + ctcu_cfg_byte_cntr_reg(drvdata, 0, byte_cntr_data->irq_ctrl_offset); + disable_irq_wake(byte_cntr_data->irq); + byte_cntr_data->reading =3D false; + byte_cntr_data->reading_buf =3D false; + drvdata->reading_node =3D NULL; + raw_spin_unlock_irqrestore(&drvdata->spinlock, flags); + dev_dbg(dev, "send data total size:%llu bytes\n", byte_cntr_data->total_s= ize); + tmc_clean_etr_buf_list(drvdata); + + return 0; +} + +static const struct sysfs_read_ops byte_cntr_sysfs_read_ops =3D { + .read_prepare =3D ctcu_read_prepare_byte_cntr, + .read_unprepare =3D ctcu_read_unprepare_byte_cntr, + .get_trace_data =3D ctcu_byte_cntr_get_data, +}; + +/* Start the byte-cntr function when the path is enabled. */ +void ctcu_byte_cntr_start(struct coresight_device *csdev, struct coresight= _path *path) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); + struct coresight_device *sink =3D coresight_get_sink(path); + struct ctcu_byte_cntr *byte_cntr_data; + int port_num; + + if (!sink) + return; + + port_num =3D coresight_get_in_port(sink, csdev); + if (port_num < 0) + return; + + byte_cntr_data =3D &drvdata->byte_cntr_data[port_num]; + /* Don't start byte-cntr function when threshold is not set. */ + if (!byte_cntr_data->thresh_val || byte_cntr_data->enable) + return; + + guard(raw_spinlock_irqsave)(&byte_cntr_data->spin_lock); + byte_cntr_data->enable =3D true; + byte_cntr_data->reading_buf =3D false; +} + +/* Stop the byte-cntr function when the path is disabled. */ +void ctcu_byte_cntr_stop(struct coresight_device *csdev, struct coresight_= path *path) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); + struct coresight_device *sink =3D coresight_get_sink(path); + struct ctcu_byte_cntr *byte_cntr_data; + int port_num; + + if (!sink || coresight_get_mode(sink) =3D=3D CS_MODE_SYSFS) + return; + + port_num =3D coresight_get_in_port(sink, csdev); + if (port_num < 0) + return; + + byte_cntr_data =3D &drvdata->byte_cntr_data[port_num]; + guard(raw_spinlock_irqsave)(&byte_cntr_data->spin_lock); + byte_cntr_data->enable =3D false; +} + +void ctcu_byte_cntr_init(struct device *dev, struct ctcu_drvdata *drvdata,= int etr_num) +{ + struct ctcu_byte_cntr *byte_cntr_data; + struct device_node *nd =3D dev->of_node; + int irq_num, ret, i; + + drvdata->byte_cntr_sysfs_read_ops =3D &byte_cntr_sysfs_read_ops; + for (i =3D 0; i < etr_num; i++) { + byte_cntr_data =3D &drvdata->byte_cntr_data[i]; + irq_num =3D of_irq_get(nd, i); + if (irq_num < 0) { + dev_err(dev, "Failed to get IRQ from DT for port%d\n", i); + continue; + } + + ret =3D devm_request_irq(dev, irq_num, byte_cntr_handler, + IRQF_TRIGGER_RISING | IRQF_SHARED, + dev_name(dev), byte_cntr_data); + if (ret) { + dev_err(dev, "Failed to register IRQ for port%d\n", i); + continue; + } + + byte_cntr_data->irq =3D irq_num; + init_waitqueue_head(&byte_cntr_data->wq); + } +} diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hw= tracing/coresight/coresight-ctcu-core.c index 78be783b3cb2..0e5cadaac350 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c @@ -15,6 +15,7 @@ #include #include #include +#include =20 #include "coresight-ctcu.h" #include "coresight-priv.h" @@ -45,17 +46,21 @@ DEFINE_CORESIGHT_DEVLIST(ctcu_devs, "ctcu"); =20 #define CTCU_ATID_REG_BIT(traceid) (traceid % 32) #define CTCU_ATID_REG_SIZE 0x10 +#define CTCU_ETR0_IRQCTRL 0x6c +#define CTCU_ETR1_IRQCTRL 0x70 #define CTCU_ETR0_ATID0 0xf8 #define CTCU_ETR1_ATID0 0x108 =20 static const struct ctcu_etr_config sa8775p_etr_cfgs[] =3D { { - .atid_offset =3D CTCU_ETR0_ATID0, - .port_num =3D 0, + .atid_offset =3D CTCU_ETR0_ATID0, + .irq_ctrl_offset =3D CTCU_ETR0_IRQCTRL, + .port_num =3D 0, }, { - .atid_offset =3D CTCU_ETR1_ATID0, - .port_num =3D 1, + .atid_offset =3D CTCU_ETR1_ATID0, + .irq_ctrl_offset =3D CTCU_ETR1_IRQCTRL, + .port_num =3D 1, }, }; =20 @@ -64,6 +69,88 @@ static const struct ctcu_config sa8775p_cfgs =3D { .num_etr_config =3D ARRAY_SIZE(sa8775p_etr_cfgs), }; =20 +void ctcu_program_register(struct ctcu_drvdata *drvdata, u32 val, u32 offs= et) +{ + CS_UNLOCK(drvdata->base); + ctcu_writel(drvdata, val, offset); + CS_LOCK(drvdata->base); +} + +static ssize_t irq_threshold_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct ctcu_byte_cntr_irq_attribute *irq_attr =3D + container_of(attr, struct ctcu_byte_cntr_irq_attribute, attr); + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + u8 port =3D irq_attr->port; + + if (!drvdata->byte_cntr_data[port].irq_ctrl_offset) + return -EINVAL; + + return sysfs_emit(buf, "%u\n", + (unsigned int)drvdata->byte_cntr_data[port].thresh_val); +} + +static ssize_t irq_threshold_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t size) +{ + struct ctcu_byte_cntr_irq_attribute *irq_attr =3D + container_of(attr, struct ctcu_byte_cntr_irq_attribute, attr); + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + u8 port =3D irq_attr->port; + unsigned long val; + + if (kstrtoul(buf, 0, &val)) + return -EINVAL; + + /* Threshold 0 disables the interruption. */ + guard(raw_spinlock_irqsave)(&drvdata->spin_lock); + /* A small threshold will result in a large number of interruptions */ + if (val && val < SZ_4K) + return -EINVAL; + + if (drvdata->byte_cntr_data[port].irq_ctrl_offset) + drvdata->byte_cntr_data[port].thresh_val =3D val; + + return size; +} + +static umode_t irq_threshold_is_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + struct device_attribute *dev_attr =3D + container_of(attr, struct device_attribute, attr); + struct ctcu_byte_cntr_irq_attribute *irq_attr =3D + container_of(dev_attr, struct ctcu_byte_cntr_irq_attribute, attr); + struct device *dev =3D kobj_to_dev(kobj); + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + u8 port =3D irq_attr->port; + + if (drvdata && drvdata->byte_cntr_data[port].irq_ctrl_offset) + return attr->mode; + + return 0; +} + +static struct attribute *ctcu_attrs[] =3D { + ctcu_byte_cntr_irq_rw(0), + ctcu_byte_cntr_irq_rw(1), + NULL, +}; + +static struct attribute_group ctcu_attr_grp =3D { + .attrs =3D ctcu_attrs, + .is_visible =3D irq_threshold_is_visible, +}; + +static const struct attribute_group *ctcu_attr_grps[] =3D { + &ctcu_attr_grp, + NULL, +}; + static void ctcu_program_atid_register(struct ctcu_drvdata *drvdata, u32 r= eg_offset, u8 bit, bool enable) { @@ -142,11 +229,15 @@ static int ctcu_set_etr_traceid(struct coresight_devi= ce *csdev, struct coresight static int ctcu_enable(struct coresight_device *csdev, enum cs_mode mode, struct coresight_path *path) { + ctcu_byte_cntr_start(csdev, path); + return ctcu_set_etr_traceid(csdev, path, true); } =20 static int ctcu_disable(struct coresight_device *csdev, struct coresight_p= ath *path) { + ctcu_byte_cntr_stop(csdev, path); + return ctcu_set_etr_traceid(csdev, path, false); } =20 @@ -197,7 +288,10 @@ static int ctcu_probe(struct platform_device *pdev) for (i =3D 0; i < cfgs->num_etr_config; i++) { etr_cfg =3D &cfgs->etr_cfgs[i]; drvdata->atid_offset[i] =3D etr_cfg->atid_offset; + drvdata->byte_cntr_data[i].irq_ctrl_offset =3D + etr_cfg->irq_ctrl_offset; } + ctcu_byte_cntr_init(dev, drvdata, cfgs->num_etr_config); } } =20 @@ -209,6 +303,7 @@ static int ctcu_probe(struct platform_device *pdev) desc.subtype.helper_subtype =3D CORESIGHT_DEV_SUBTYPE_HELPER_CTCU; desc.pdata =3D pdata; desc.dev =3D dev; + desc.groups =3D ctcu_attr_grps; desc.ops =3D &ctcu_ops; desc.access =3D CSDEV_ACCESS_IOMEM(base); =20 diff --git a/drivers/hwtracing/coresight/coresight-ctcu.h b/drivers/hwtraci= ng/coresight/coresight-ctcu.h index e9594c38dd91..4ff01f697903 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu.h +++ b/drivers/hwtracing/coresight/coresight-ctcu.h @@ -5,19 +5,26 @@ =20 #ifndef _CORESIGHT_CTCU_H #define _CORESIGHT_CTCU_H + +#include #include "coresight-trace-id.h" =20 /* Maximum number of supported ETR devices for a single CTCU. */ #define ETR_MAX_NUM 2 =20 +#define BYTE_CNTR_TIMEOUT (5 * HZ) + /** * struct ctcu_etr_config * @atid_offset: offset to the ATID0 Register. - * @port_num: in-port number of CTCU device that connected to ETR. + * @port_num: in-port number of the CTCU device that connected to ETR. + * @irq_ctrl_offset: offset to the BYTECNTRVAL register. + * @irq_name: IRQ name in dt node. */ struct ctcu_etr_config { const u32 atid_offset; const u32 port_num; + const u32 irq_ctrl_offset; }; =20 struct ctcu_config { @@ -25,15 +32,69 @@ struct ctcu_config { int num_etr_config; }; =20 -struct ctcu_drvdata { - void __iomem *base; - struct clk *apb_clk; - struct device *dev; - struct coresight_device *csdev; +/** + * struct ctcu_byte_cntr + * @enable: indicates that byte_cntr function is enabled or not. + * @reading: indicates that byte-cntr reading is started. + * @reading_buf: indicates that byte-cntr is reading data from the buffer. + * @thresh_val: threshold to trigger a interruption. + * @total_size: total size of transferred data. + * @irq: allocated number of the IRQ. + * @irq_cnt: IRQ count number for triggered interruptions. + * @wq: waitqueue for reading data from ETR buffer. + * @spin_lock: spinlock of byte_cntr_data. + * @irq_ctrl_offset: offset to the BYTECNTVAL Register. + */ +struct ctcu_byte_cntr { + bool enable; + bool reading; + bool reading_buf; + u32 thresh_val; + u64 total_size; + int irq; + atomic_t irq_cnt; + wait_queue_head_t wq; raw_spinlock_t spin_lock; - u32 atid_offset[ETR_MAX_NUM]; + u32 irq_ctrl_offset; +}; + +struct ctcu_drvdata { + void __iomem *base; + struct clk *apb_clk; + struct device *dev; + struct coresight_device *csdev; + struct ctcu_byte_cntr byte_cntr_data[ETR_MAX_NUM]; + raw_spinlock_t spin_lock; + u32 atid_offset[ETR_MAX_NUM]; /* refcnt for each traceid of each sink */ - u8 traceid_refcnt[ETR_MAX_NUM][CORESIGHT_TRACE_ID_RES_TOP]; + u8 traceid_refcnt[ETR_MAX_NUM][CORESIGHT_TRACE_ID_RES_TOP]; + const struct sysfs_read_ops *byte_cntr_sysfs_read_ops; }; =20 +/** + * struct ctcu_irq_thresh_attribute + * @attr: The device attribute. + * @idx: port number. + */ +struct ctcu_byte_cntr_irq_attribute { + struct device_attribute attr; + u8 port; +}; + +#define ctcu_byte_cntr_irq_rw(port) \ + (&((struct ctcu_byte_cntr_irq_attribute[]) { \ + { \ + __ATTR(irq_threshold##port, 0644, irq_threshold_show, \ + irq_threshold_store), \ + port, \ + } \ + })[0].attr.attr) + +void ctcu_program_register(struct ctcu_drvdata *drvdata, u32 val, u32 offs= et); + +/* Byte-cntr functions */ +void ctcu_byte_cntr_start(struct coresight_device *csdev, struct coresight= _path *path); +void ctcu_byte_cntr_stop(struct coresight_device *csdev, struct coresight_= path *path); +void ctcu_byte_cntr_init(struct device *dev, struct ctcu_drvdata *drvdata,= int port_num); + #endif diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index 18981b6cc172..9440c1cb155d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1173,6 +1173,10 @@ ssize_t tmc_etr_get_sysfs_trace(struct tmc_drvdata *= drvdata, ssize_t actual =3D len; struct etr_buf *etr_buf =3D drvdata->sysfs_buf; =20 + /* Reading the buffer from the buf_node if it exists*/ + if (drvdata->reading_node) + etr_buf =3D drvdata->reading_node->sysfs_buf; + if (pos + actual > etr_buf->len) actual =3D etr_buf->len - pos; if (actual <=3D 0) @@ -1236,6 +1240,20 @@ static void __tmc_etr_disable_hw(struct tmc_drvdata = *drvdata) =20 } =20 +/** + * tmc_etr_enable_disable_hw - enable/disable the ETR hw. + * @drvdata: drvdata of the TMC device. + * @enable: indicates enable/disable. + */ +void tmc_etr_enable_disable_hw(struct tmc_drvdata *drvdata, bool enable) +{ + if (enable) + __tmc_etr_enable_hw(drvdata); + else + __tmc_etr_disable_hw(drvdata); +} +EXPORT_SYMBOL_GPL(tmc_etr_enable_disable_hw); + void tmc_etr_disable_hw(struct tmc_drvdata *drvdata) { __tmc_etr_disable_hw(drvdata); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 7690a70069da..5e827bb00386 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -482,5 +482,6 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, extern const struct attribute_group coresight_etr_group; void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); +void tmc_etr_enable_disable_hw(struct tmc_drvdata *drvdata, bool enable); =20 #endif --=20 2.34.1 From nobody Mon Feb 9 11:36:08 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A10D1624C6 for ; Wed, 24 Dec 2025 09:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567257; cv=none; b=bybSMEBYqIZVWRgsOMoopVzbFUedoK3D4rL/wQSKaOJ1yS5LOAQf4Qbn1Y8YZatSiu5sEAWGYjL958GQQvLvGXPW1kH2eRCe7V6uF9sm5/dF+V2pBgHmuDfZMuGCxA8s1OS3gBE7BE3Drk5nghuWPiKmiBGZdxYLC1q6976w9Qg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567257; c=relaxed/simple; bh=Oy7z+jq/TjNetJ2Zgz+w8FIQKCJz069QL66/p8AMAm8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ia3p2DKcSXrGEwbMwrA0ztZ+F5yrOJWGFQH7EgsXQ/CI7adSa2gQzFTOgHet+qezIuBKeKxt43Wq387LvWRRdgDPbXFsYmBhUjkCJDnYigh/ALQSFHVxzoXIzS6bZh6mIYXWo9zUanD0NxDC4IwaHXaeG2GTXRfWlf0AuBXTNkg= 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=Xc3zRpH8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=g0sb08ch; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Xc3zRpH8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="g0sb08ch" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BO7ki8q1056400 for ; Wed, 24 Dec 2025 09:07:35 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= Vt0RRfM8pFKfBxD6jKeqJVSWMlwtbL7pwYs+oCiP02U=; b=Xc3zRpH8LgHJ/XHO XQ6wcSyKWOHzllg2/iBJ4sR5z6j10AvQc1VrWD7co8MuLS470yXRfYOJbPEURAig vHGn7wabZ6XwZky8aBUY1xO++ZULXeazWZnNF1cu1O6ASXcKHeSCS/JfL11m8JgI VwMHgFasds2JQgfOa6eKNSNzZ37DcZrEjxPqnVizD5xFKb4h9NKFXupTv+t920tP zLYE+h8MTcXTKE001iO0NXO68TNGa9h/GYtG883Sc4JakZkIQA9TERtrKMOivJtx +EAn5njYZjZWcCQVUYiVjTtPCEltZ1YBcNa/Qr+fdlL+jPB0/yB07Se99DE8iDiQ 441LvQ== 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 4b811v1xu7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 24 Dec 2025 09:07:35 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a0fe4ade9eso61563845ad.0 for ; Wed, 24 Dec 2025 01:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766567255; x=1767172055; 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=Vt0RRfM8pFKfBxD6jKeqJVSWMlwtbL7pwYs+oCiP02U=; b=g0sb08chdF6JaWNBsvUk3ysD9Zl/kM8i/K4JvrFqpJZbVScpjIYwBbYkdCbfrwAlJ8 rn2jhnds/N+jZa4bnDZP0TQ2uWPJkci/abqahNIQBcqZ5sNbPJvh1rZxvwqXUOGDkdv8 1eI6emAlbEUObHP2TtHsxGpzYgLQDU9q3baQ/qQSIRtiTSce0dgQUFFZTnRlhtMKQT+Z tdggcj6fAg0+fWz968OwAVhIcPIrdJAdnsPzhY75GXRF05lNpghVBKIWYqWIygqPfjK7 C2DEHgJoTx/ZQOJmAO57Vl5iYxB6ng7MT9ubXoWVL/GFsmlIOaZro/0JNj6sl5AgUoaL eTKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766567255; x=1767172055; 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=Vt0RRfM8pFKfBxD6jKeqJVSWMlwtbL7pwYs+oCiP02U=; b=M8Uin17Sq3Uo5BVp3zddReFAGmMjevv/JOP46e5Ryj7JIUvooTcvDcm8/rxHIHAuCl VELZBlyqCWSWxquI+jcnWBMnkyF1B14cj5FsmUqXEvgMpp3bEeWSopAii5zuhYPria5w JwEASUMVCCzMlVxpmE3Y7dQIxqA1HoQSkhDKdnhvs/CWwqi67aYgC4k4Efvp3DhiU9pi LA404NCaGRCag2g5TS4yzRXXByzLnvcfuOoL5Gcv33lckJA259xP/q+ZH6fclVBzVkM9 mPw/Wy1EHINL6AY2GnNpONurffspaE0Bw6JSHTMusy9EakInSzmTZaCdTyAdwDu4Oubt Z1fQ== X-Forwarded-Encrypted: i=1; AJvYcCXEB6nEASoD2gtRhp3jep2K/82tBMVn3c4Z6xwpGGlQrIbvcGeR8kelmkKQj9YjidigYIWDuX8ttXYtLAE=@vger.kernel.org X-Gm-Message-State: AOJu0YyDfOoWb0p+xCbgAFpl1vnM6fIQcBm44VvjH/58MZg5ds+HLJr/ OSsGtA4CokEGkkv8BlwMyOOU8s2nM5eUGS2UhZ6v35+QGIVEmJJQiSZiGdtjtJDGV9cckrUUJxe 2fdYz+PHDck2V1k/nxgJUhLtOXJUwLBEcl7VZSYK/3BggrrnhL5WiHM0Z0tPsjvp1Vh0= X-Gm-Gg: AY/fxX4GnWXB69Qjke6UsukjbeXiUDW+sK9xLysfCr/+aI/92AiLLtKiLmkps+CSq2+ M0w+QEbYvunwO4MkuS2EWHBtwItV3BigGtPJnmO5VXXKFZ6JwHeRyUgWw8nu3IXVMGCCiTBChH0 hpQ2g9RtWYJlCQNSRxp+A3g0cHD71zXbSoNN0WcBGrjjKRaLF1xSAEK7TgIwjv0x4gMEAb3cg5v CYrWh5Jqd/EFPVZIAY0AP0WU3BWW19EvqZuKp0Rtc2NNCjaxzvRAsdheyWR6T1cGIbx8AipclFm MKcBSDiuAKzmZ6X27g+31/nskB8o3QqQ28uKVo+RV28wYB78OESYT7oAcjM7Go+LxaRAl9osYlU 33okQL9FWzwL/vk9pgWqBlmwxWOvy/dycEnM7RhdtFgdcrTYyA2YEMFoe0eMcpRTa+6oowbBB X-Received: by 2002:a17:903:249:b0:2a0:fb1c:143d with SMTP id d9443c01a7336-2a2f220d70bmr166139445ad.1.1766567254860; Wed, 24 Dec 2025 01:07:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtlDjLrg85QpNs/nDXqL9KQlAfHLs/TEb14kZhD7bfB8JqUkFh5EDf0SN5JVIgyqLXbuFdZw== X-Received: by 2002:a17:903:249:b0:2a0:fb1c:143d with SMTP id d9443c01a7336-2a2f220d70bmr166139015ad.1.1766567254297; Wed, 24 Dec 2025 01:07:34 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c666d5sm148418095ad.21.2025.12.24.01.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 01:07:34 -0800 (PST) From: Jie Gan Date: Wed, 24 Dec 2025 17:06:17 +0800 Subject: [PATCH v9 7/8] coresight: tmc: integrate byte-cntr's read_ops with sysfs file_ops Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251224-enable-byte-cntr-for-ctcu-v9-7-886c4496fed4@oss.qualcomm.com> References: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> In-Reply-To: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766567216; l=3605; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=Oy7z+jq/TjNetJ2Zgz+w8FIQKCJz069QL66/p8AMAm8=; b=uSaM/v/6IGPwFdUgM27elSIz+7592+G9joqAqMykPDiujN0xGFIL3I8ImHLoA3zeBynz6jEHP S7phaA0hB1fDJ0se5c+j5hyfyFqHefa53uPF5zL3nq8KKJlDnROnRz8 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI0MDA3OCBTYWx0ZWRfX9w36rWLFskYr 81W3BdwpBPZQ2BIYIaGbOfBJAVz7lUgSPOoEFJ3FKzhHKyG0GIHP7oASzLn+jkYJjkWawrKxNvh 74dedd9beKTTdE50tGcthtpJA9rCiBFOwtqSHD1Ue9eTSAdaY2BWuUqaQStyIcK3+Qr9Q7JBvR0 xEj5C/EuFiW5+hUtnfa0y0TaE4V+717+UDQ9P94brd6TD041Ib3wWSZFPEOCuMYQPzISAS3A0XD eoaGUMWm4HSJ3/yn3m2HkvSEviecTgIJYILNT/DSVqW/235TsNd65BBFMYhQnmf7u0/0iKFOPmX KYPxPG7tva3yPOvyzjyUCXiOEZLDt26mRYGTiisABBmzQ1bDjHTvpgYGnOgMTII9emNwaU6wK77 8jb7OF6lqLDxWja2msbnMkb0XUATa55+LUJoHL2Q35jZ80/25NvI0XGvysfQOAPfKaDc2dI2r0L LLcVtHSNLkPJND5TXYQ== X-Proofpoint-ORIG-GUID: 9XW4G4cunmEQwl59Pxp_dbZsriCQjd7B X-Authority-Analysis: v=2.4 cv=WegBqkhX c=1 sm=1 tr=0 ts=694bad57 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=i2GxayCjj04of9N-vEoA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-GUID: 9XW4G4cunmEQwl59Pxp_dbZsriCQjd7B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-24_02,2025-12-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512240078 Add code logic to invoke byte-cntr's sysfs_read_ops if the byte-cntr is enabled. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 53 ++++++++++++++++++++= +++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 8b0397a77e57..5e74f33f6a23 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -31,6 +31,7 @@ =20 #include "coresight-priv.h" #include "coresight-tmc.h" +#include "coresight-ctcu.h" =20 DEFINE_CORESIGHT_DEVLIST(etb_devs, "tmc_etb"); DEFINE_CORESIGHT_DEVLIST(etf_devs, "tmc_etf"); @@ -228,15 +229,47 @@ static int tmc_prepare_crashdata(struct tmc_drvdata *= drvdata) return 0; } =20 +/* Return the byte-cntr's sysfs_read_ops if in use */ +static const struct sysfs_read_ops *tmc_get_byte_cntr_sysfs_ops(struct tmc= _drvdata *drvdata) +{ + struct ctcu_byte_cntr *byte_cntr_data; + struct ctcu_drvdata *ctcu_drvdata; + struct coresight_device *helper; + int port; + + helper =3D tmc_etr_get_helper_device(drvdata, CORESIGHT_DEV_SUBTYPE_HELPE= R_CTCU); + if (!helper) + return NULL; + + port =3D coresight_get_in_port(drvdata->csdev, helper); + if (port < 0) + return NULL; + + ctcu_drvdata =3D dev_get_drvdata(helper->dev.parent); + byte_cntr_data =3D &ctcu_drvdata->byte_cntr_data[port]; + if (byte_cntr_data && byte_cntr_data->thresh_val) + return ctcu_drvdata->byte_cntr_sysfs_read_ops; + + return NULL; +} + static int tmc_read_prepare(struct tmc_drvdata *drvdata) { + const struct sysfs_read_ops *byte_cntr_sysfs_read_ops; int ret =3D 0; =20 + byte_cntr_sysfs_read_ops =3D tmc_get_byte_cntr_sysfs_ops(drvdata); + if (byte_cntr_sysfs_read_ops) { + ret =3D byte_cntr_sysfs_read_ops->read_prepare(drvdata); + goto out; + } + if (drvdata->sysfs_ops) ret =3D drvdata->sysfs_ops->read_prepare(drvdata); else ret =3D -EINVAL; =20 +out: if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read start\n"); =20 @@ -245,13 +278,21 @@ static int tmc_read_prepare(struct tmc_drvdata *drvda= ta) =20 static int tmc_read_unprepare(struct tmc_drvdata *drvdata) { + const struct sysfs_read_ops *byte_cntr_sysfs_read_ops; int ret =3D 0; =20 + byte_cntr_sysfs_read_ops =3D tmc_get_byte_cntr_sysfs_ops(drvdata); + if (byte_cntr_sysfs_read_ops) { + ret =3D byte_cntr_sysfs_read_ops->read_unprepare(drvdata); + goto out; + } + if (drvdata->sysfs_ops) ret =3D drvdata->sysfs_ops->read_unprepare(drvdata); else ret =3D -EINVAL; =20 +out: if (!ret) dev_dbg(&drvdata->csdev->dev, "TMC read end\n"); =20 @@ -277,6 +318,12 @@ static int tmc_open(struct inode *inode, struct file *= file) static ssize_t tmc_get_sysfs_trace(struct tmc_drvdata *drvdata, loff_t pos= , size_t len, char **bufpp) { + const struct sysfs_read_ops *byte_cntr_sysfs_read_ops; + + byte_cntr_sysfs_read_ops =3D tmc_get_byte_cntr_sysfs_ops(drvdata); + if (byte_cntr_sysfs_read_ops) + return byte_cntr_sysfs_read_ops->get_trace_data(drvdata, pos, len, bufpp= ); + if (drvdata->sysfs_ops) return drvdata->sysfs_ops->get_trace_data(drvdata, pos, len, bufpp); =20 @@ -300,7 +347,11 @@ static ssize_t tmc_read(struct file *file, char __user= *data, size_t len, return -EFAULT; } =20 - *ppos +=3D actual; + if (drvdata->reading_node) + drvdata->reading_node->pos +=3D actual; + else + *ppos +=3D actual; + dev_dbg(&drvdata->csdev->dev, "%zu bytes copied\n", actual); =20 return actual; --=20 2.34.1 From nobody Mon Feb 9 11:36:08 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5451C330307 for ; Wed, 24 Dec 2025 09:07:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567262; cv=none; b=QsTKpnM4hr+4Su2SIUllLtRAspQ51fwfl28FUXo7+aPpxx9x6UCBpH/wv7gtTN0s1te2fp5liO6P/sXXSHiw3zLyMUU5IeetLOPXBHkVZpifq1mXhXLrA9pCC5j2v4SvX/s097EGbHYgxSU1sw7bG+ScBgM6pfYwKXTeiQuOmSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766567262; c=relaxed/simple; bh=U3SBm8Q4F2Lqg46nftP77Qbyf63TqJWnGptxyfW3r6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BYgQ0205yZ0TOTESbrGtoVfZrBIsX/y9gRX8RA1YGm9w2utZbJ2LzexDDrCb+AT0PCs3kyH9HU0gWekMQUL5VxRitRFL1P5f37tcbvUf1Mcrl6+HfPPPDpsGYJ1s+UBils5DLzSVhxdmNZFXjx0lE1c9iMxpbjddGWr/pJlM8GM= 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=OSrDd3j4; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UF9rzksN; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="OSrDd3j4"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UF9rzksN" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BO3KiuL4133842 for ; Wed, 24 Dec 2025 09:07: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= 2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=OSrDd3j4D1M6iMRF drhYNwsm6BxjHnc+2o8SZUOKM5dsoq5nJTuZqu7/MfOnu7IH/UP268Gp7nNZln6u MrAFzOnChYi9gbtCN5XJFgDIhKX42mGMGxonm3UxGDlguhOpobY9dpSNwzTQ+3KM AYFAdPpA8V2Jgoypqd0rhj/pM/X/7u5vB1y9YAJSiPnWVHknrS6zGJ97OUB6Gsvj E5G3cyqHeVC1vch3h06Va54tlGpwo9GXHdI2q/9WVg5q2cXRvj23UxKl6lpLFps2 92qkss3LHeZvO3nDdpMcB5KregO43FtA25alfaTD4PUciRf33s/S9qNrDTkbxH5A YrRUlQ== 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 4b7x46tjd5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 24 Dec 2025 09:07:40 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-29f8e6a5de4so79709155ad.2 for ; Wed, 24 Dec 2025 01:07:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766567260; x=1767172060; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=UF9rzksNeFTUwS3itGbPR8HoFssSWYwpKWD7TNWhSvwXOzvYNRb+QJAqc+MlU42HGG rzfRUjHVTu9UyUHbxUgX3Thrb5D9TtMKetLf7wPxk8hfaN6KN9exNd9VlINZdg5Roauc HSfgEbcLPbM22hHP87d8BdzsTztQIlUxOgv2h6mIrKcY2D8dPJiorq9ZEouZJMLsLq/l AB37qmlv0XWi/YxR5w6dolDrJALSIIKKu7TfLulfHhKEzgv8xIm9sNsHm+8ABpK+AgoP RcStMjS/HCcANc/Mjb7CABF2uh5BfZ0F43CnhXcoulndd6L3SPctsLky0eVWm6CqHd8B jHRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766567260; x=1767172060; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=HxNRyBuCYe60q5qNDeeegzyy0xts/4hmx/dyKnrN5ZdilOvMsPWg5crsns+35dIwaf JimCmRAemlQbLL3FCEudRRWoQfQgTIfhnzx2waAxFpuu7Rs6KGRy6oZLM0JZn62oNrcZ 8Aaul72BhP2ocuI6Zr/nJ1ByOKRTtYq1rCoJa6k5LSQG0mCYe8hlkJKvXuu2gCc9FFil X89cXNmKVWKrDIVI38HRkMhL0Qtb60CzOY/kwbUXPi7T4mSa/al3f1cjis/DqOnel0Tg McMOqjQAE8r04MbF/7h/B3WZYOF91ZdZmI54+MAQZpC+UBGg9y5SdbkSu37R1ry0XvaY wGqQ== X-Forwarded-Encrypted: i=1; AJvYcCXECI2Fj5YDbsvtYCz8IlO2HlljVMNxwhOxR0UOy6Xhxe30A0g8W+S+g5vLFfh/FVY5oD1VTimtiyANS1U=@vger.kernel.org X-Gm-Message-State: AOJu0YxmFmMf6wUZW6uMfp16ofs/Ui3Y15109SgMMLSVlNxi3j1Ty9tD Ck04JkE0PZDlRfOaq6HmAr4RkOLFffC1742HqbwuXQTxfext8+DOCulWGPACSvcxFVt/ULKKLgR Nqss50jJsegWDIFNLQAk+DMS9LKBacX75SYrWGlyBrgyIaDi1obHUK+OBHan5DrOVdJc= X-Gm-Gg: AY/fxX5JT2oImz4qawMwvRr3P7ldbvgijBGo4u6T9FpdjRwVeKHdpZRdfE2BIVN7SYx lldkZT+tleLnOD/EP/8Ov7pwlRDdqEna/NubkuIgK8fnN/3aqv4qKj8nKMTa42FPCAIQ0btrD7u SPnCL91AxvkKV1XC6hLIL+DjogVHL6d4rTL4TQpdQpF95VlBFvu18NAPCDDbEp2kxphTJCWLMpo 0JHD93zwGx8c7DgmPjuaS7oskMky7Sa/vg8xFRWNjlY82xCfy5gHNIavmeZsl8z2yoHw81VxMfJ 4ddS9Sn3rQaPf/PHapQsxMVzwCi6diacii2lUkh1rHArYFq6ZUzfTz8kV6gBSYaAbvK2YqM+eY9 c3wkY3fumssNcYdPwv79caWQpzuBgRsBzEpWcMG6qvWdngYtms6ow2QE0+fJa18sJLQk9mhl4 X-Received: by 2002:a17:903:240f:b0:298:4ee3:c21a with SMTP id d9443c01a7336-2a2f220d4ebmr190382275ad.2.1766567260056; Wed, 24 Dec 2025 01:07:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFfndQQFrwSQmYqTWg9bPiFI4xmA7WAVtvf5bj4/YDmimFXEhX/VKCH/nn9DarFxK9sBxj5Hw== X-Received: by 2002:a17:903:240f:b0:298:4ee3:c21a with SMTP id d9443c01a7336-2a2f220d4ebmr190382015ad.2.1766567259590; Wed, 24 Dec 2025 01:07:39 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c666d5sm148418095ad.21.2025.12.24.01.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 01:07:39 -0800 (PST) From: Jie Gan Date: Wed, 24 Dec 2025 17:06:18 +0800 Subject: [PATCH v9 8/8] arm64: dts: qcom: lemans: add interrupts to CTCU device Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251224-enable-byte-cntr-for-ctcu-v9-8-886c4496fed4@oss.qualcomm.com> References: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> In-Reply-To: <20251224-enable-byte-cntr-for-ctcu-v9-0-886c4496fed4@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan , Konrad Dybcio X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766567216; l=769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=U3SBm8Q4F2Lqg46nftP77Qbyf63TqJWnGptxyfW3r6I=; b=/7WMljk2g9bMwcAUVum+/8ImzjtIdqkJ6u3LAw/S1RhZMZQVJ9HIbk3/Y9i5dVhdvInLNMczD oObxP7p5avFCgtwV7858IVS3H6cwDqA8doPNQaq74IT4n106PqSnj5E X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: 7Hyh3H4d-ECJ03FBzymEzpIHeolUfjGc X-Proofpoint-GUID: 7Hyh3H4d-ECJ03FBzymEzpIHeolUfjGc X-Authority-Analysis: v=2.4 cv=aOf9aL9m c=1 sm=1 tr=0 ts=694bad5c cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=gBkj9RZkAcI1HbXH1KoA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI0MDA3OCBTYWx0ZWRfX9zUBq3yScOS1 duQ4N5Bv9KP981L80HlYX/r3XUqDIr4o4o4amh/HRIq0mp/mRVOQ9XwpAPR+l3r00FOT4pw4cj1 DL/D8PfJ5ZhAzuXPaO4Zr00N4zEFJg2cQWnX/91kqbwln6/0VpP2p1e7GsKEOn/qpxtibYlbmQS e+AxOY8dKDhlUFFu+p6uhIO0RhUG4dhOJrPX/8WClqh2sJ8c4xHzq3xbEgEF13c7jFQQi/L+FKD jgA+Yj2tORf26OP6KWy19Mut3e7ZHFlghs8N8t3Czsv4qAn6SewH9aCYy+vcdDir08U16Tmnh/K 04PmOuTXc29J/+K0W/AA8nIjAcQhZambz7pl8hvN+N+S4McWPiwltKXHsRmeFJWqSX12v6h0DVl v5TVsyhNvaPKATQye7VsmMmgCd5Yj7wEb2JCI1hUsy2aAmp1j5Jh6ZbJr2QlOqcbp5gAb+rdTM3 xUoY27VtacbUWNjXcOA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-24_02,2025-12-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512240078 Add interrupts to enable byte-cntr function for TMC ETR devices. Reviewed-by: Konrad Dybcio Signed-off-by: Jie Gan --- arch/arm64/boot/dts/qcom/lemans.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qco= m/lemans.dtsi index 0b154d57ba24..75a468ddbf53 100644 --- a/arch/arm64/boot/dts/qcom/lemans.dtsi +++ b/arch/arm64/boot/dts/qcom/lemans.dtsi @@ -2776,6 +2776,9 @@ ctcu@4001000 { clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1