From nobody Mon Feb 9 01:26:58 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 E614236AB57 for ; Thu, 22 Jan 2026 02:08:48 +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=1769047731; cv=none; b=CoI1QVOiAF0t9f5hIRB/sF6El+Wh3oZwuDOe/LDdd8K670gpbcu2x3J/rJhMydodgzIc7znrUH6/n1z4baYEI00944AJhprO7o/mJbbZH2wRaLg0bcsYWfSG5ZsPoy2pb3fi0PrLkGtGYo6VOx49kWNGn2fWoRqmGz8P81gxOfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047731; c=relaxed/simple; bh=x79EOx0VHbHe/nWXls6UDtNS83yDuFtih92LzPbC2MY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qyh+5kVE/6oYPtoxFtN82bKtKTG2LYSO+FykvvGc2umrOYl5qpLHSoNRpFKqZ50XpZfteviufiBWb6TQWxcy/55xiNX625p/JqkF2tsLiJ6VP9G+q6eSRqMeaZCPga7WJasVdKaBh/Ucx0/rYUNAJaTJbE6C9zjL0GODHW8pN/k= 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=Y3e+qvmO; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=WA+1cW2K; 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="Y3e+qvmO"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="WA+1cW2K" 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 60LLOv4j108536 for ; Thu, 22 Jan 2026 02:08:48 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=Y3e+qvmOABrmij41 JOMJ1xcI+z1A3PEf7mUNHEKZWXIPEe4/IiERPan8DWauvLF2k1MoWg+njmRNjGgb jQsFTGM70UEKDihd6rJP5arUYXQR7ChJMf+VR94CgDg4XYMhMInwSKJD3XbVwIb7 gXdGmQt0J7Uvu3UmkrZFa/pyNp3gqsTfWvW+nMaNybfSvTawpKuGDLL7W59xGkRw ddSyJlnMLvD21mSuH8RhHbzEt3Eg3khAYdZY/vSY/4c1ZPXLy8PW8n07ybGns/8L NQB0ABAbLzb8+8NlwQqlDBgxJf5Uxuhe9vg3KKBZzWHr3zb29nO9xo8JITwioqe3 sypJtw== 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 4bu6pgrn9n-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 02:08:47 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a090819ed1so2941175ad.2 for ; Wed, 21 Jan 2026 18:08:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769047727; x=1769652527; 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=WA+1cW2Krg54MltkiuZ3jvD2M7/El41UWAH3OJVp5Dn8wXD5WcYBvd50/wPe86dybZ oR2vOSQzZI1ia0ViyX3UcSSYXlcTAuCSmU6IUl4eodYfR8D0CKPw/PbfsJIKrZf47L6T b6Z3FSByLNRvFzR7dBMrh48a00HHc6aDmoX3tFTdLt2I2pkMQJGN9CW6OGyDf66UO/N0 UOjPspHdazz81bPR3iunSKbDBY53xnLYkhGvhFhJVYMKrOBiNIkGAyTsrlg2W4vcFMvj 3FsRuzIQwV+3C1youPP597MuJxVksukIUWHu/Sh4S0WmTKaqbqbA+VMonD+UhyX29rVI keNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769047727; x=1769652527; 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=ipdzQ62DbtDy9S2LZE8QSJJBgiqwI/VuorfQ51OepofPguGes7a0iySQViGp0SOJFo Q7m0PoVrJhz5jxw6MKnJjvEZXEWtmryc4cpaaUswXtzfS/Go2kwexmwqDlEDYvQAQSYn ua761KciEHbH4oEBc6XqRxYlyZJmrU25VnfsArTe9oSTGeNM+iemMfjn5AIWeapQ1Mw5 8pcPOxOTPbl646q1QyVJO19n+MTtX/oGB202IeTNEQe6fkAi11nrEf0tdqXNxUn3gidA C2tyuzSsezhUDvQ5tA/CZKfINzrNe62JLxqJeZiBxnyP9LHW5+EzS9MtDkBNHZP3saS8 5aRg== X-Forwarded-Encrypted: i=1; AJvYcCVgRAxjix5ixkTw3d4x7A8Tw3oN6wNCvPHls4DdwDdYJntnf2vP8sbg+0ieDatK5hzSaokXHifUcQX+SQ8=@vger.kernel.org X-Gm-Message-State: AOJu0YxgFSdL8Mgz5zWmE9XE5sUbxdxY3uoRWumVeFRIRHpBfmDPJlA5 fgdH0yBjiYMewrcYmqZqdcTEFYzksBNVTa4LWo5wOtkwnnYH3nbRZWXdJzzDXb8JxMJTHM6XSJ6 IaIwEl5q1MDD735QgsHmNcmJmiTvN66Ur0JYRJIji/sOfgLgzwsA1wLDVgyC0yMEs5a4= X-Gm-Gg: AZuq6aLeSwAuQxkNLcvdLipf7lZ/r/Sjgna9o5mIw3N6q+sYSiJJX2oBEhk+faymt4r +zWQ66wnQbC6TXpXpYGWJ8fNqxBpUrtV+UWDscFw9IQDdoNs1JLL/MayC3eizrQXjeuXYWVMAkP hfVKPZvW2yeYUbm1dqV0Oy6e4McgeTa4tRWfHgYE2xA6dhs5csy3YrbxSr6GO4IxgJ0COmo0idv r4+ZS9ezzMYHUubThli9gYjfNR3RFPo/Ultes+sutqoCoXHhmc83ix4SF/aZ7ws6sCWVLylzRuv fHQVWLtsRcFrPXCPR5v9zK/4Lk0yi882WAdZRuGM/Zc3lwEH0msv0DqD9s3TWYpYNEh4yqUDWOy S1uytt/rRObhJL7J/bhA0GbKgAj0P0nyIF6eVxO4c0T/DytgUtwg2zt5Di7Kjtof7E1/MS/+L X-Received: by 2002:a17:903:2b0f:b0:2a0:8966:7c94 with SMTP id d9443c01a7336-2a769336c65mr63150885ad.20.1769047726738; Wed, 21 Jan 2026 18:08:46 -0800 (PST) X-Received: by 2002:a17:903:2b0f:b0:2a0:8966:7c94 with SMTP id d9443c01a7336-2a769336c65mr63150565ad.20.1769047726186; Wed, 21 Jan 2026 18:08:46 -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-2a780a4631csm49710305ad.18.2026.01.21.18.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 18:08:45 -0800 (PST) From: Jie Gan Date: Thu, 22 Jan 2026 10:08:14 +0800 Subject: [PATCH v10 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: <20260122-enable-byte-cntr-for-ctcu-v10-1-22978e3c169f@oss.qualcomm.com> References: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@oss.qualcomm.com> In-Reply-To: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@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=1769047715; l=3769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=x79EOx0VHbHe/nWXls6UDtNS83yDuFtih92LzPbC2MY=; b=yaflaOS4YWqXOYMcpMUjHpYf2iFkhRxjAfa9CSFqnu4+U3hr1I9kbq3e9zZPFVsc1VebrCeJO db5p1pJP5dNDiY+FWpA7zei6q1qBqYzNNcXPMJk/fyYkJ/NmJKZ+lAU X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDAxNSBTYWx0ZWRfXx/C9dCL787C0 Bf/R+gnWjXP/a7xFCQi5tV/f8oTlpXGb6QON8FRcqBxdWygU7aolMCLFdvL2lLXyTlkKS3YdIGB XLe8Cvy0rfSf9UG/AAG9cit3jL5/r/z/bwlopVwpr36dJKtRqmai0CbAfclGz6ox3b3WB2U+UGj /7j+LiD2oqaOCiwnCIfkt2iHKaJGdlw4yIbyEO7PowXFJrgizmJZi98MAkOY8k+C5njC62a1X8p f6rK7gyFFUFTf9BClw91piPoAIR7qBpE4Y3JtWUtDEHlitK5fv/8vSaJkUCEhvALA7wot2ZxP44 c8dUPc0/0+Iyu8wKpFY6DWnWS9H20zGR05Oju0dfwInBP2tPU/TZLqC2uKEXYtvV5QPuDP78GwB KPccG/4xIM2O06gr/pbsN+TgCaH1u3AzAQOiC7pQ9lfPIId56dS95quHc2eYTH9jb3H8FJTYmOa qm+0WQvmzcaKFiTUJ/A== X-Authority-Analysis: v=2.4 cv=OZGVzxTY c=1 sm=1 tr=0 ts=697186af cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=qQZ2XtAyJf2dEkEvaVsA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: Lvqnsb0u10rIZSgVbR0R3ua1mtkFUFEt X-Proofpoint-GUID: Lvqnsb0u10rIZSgVbR0R3ua1mtkFUFEt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_04,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 adultscore=0 suspectscore=0 clxscore=1015 phishscore=0 spamscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220015 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 01:26:58 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 DE396368290 for ; Thu, 22 Jan 2026 02:08:54 +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=1769047737; cv=none; b=Dhmba9njEzkFvKLfq0hUmXYzhvCNzchm1NMJp9MjwtZOk71KvNLYjUjXMYlbdOpl1mR+C1zt5R06kyMgQPLgOEJlIU+YYVDFJUTnxVqtDBWinpyTCnoCkAdhOryGVcp11NN/eIgiFJJhZudbeXxs5kFOsT7VbbbfcceiHHt32us= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047737; c=relaxed/simple; bh=iOBlKE7wcNNqdQg697EHs/307n7EmzHjJxd5G5rMLIU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ccpAwKeqqFjCanV9usCs//VoGmCSyl5NPEt9ZuhWUGbA48/YE3/aKsU4AZJKjkSCSolDk4JYVBL27EqIOXA8w/+y7JUwMMzqDgfUpwTUbWpto1ZbkHAFcQRbWGD01ipiYd6NDZB7zc1INKsWS3I5/zqU2RRoSnY/o1IhbiZGLFU= 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=jOTKGa0k; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=N0arxgzH; 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="jOTKGa0k"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="N0arxgzH" 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 60LNT6A82727071 for ; Thu, 22 Jan 2026 02:08:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=jOTKGa0kbLdt4M3S ss4f2RVWpeRnYfiOZRvKwAa65qoXvAYFlW2vC2XW6m3E9B4RBbcg9CT0USwV/F91 nmi2jJimwFA29KGkF6mu+Y0cPhfkUjKDs6GSZTvGS35C1tR0iVmpelljY9un9Uzi MFAkcmO87emgRINJfGBL2hBqzouHHK7c0XV/AKrJd/NXs9xAFR9s6nI3FlIdx288 2Ev6b8LsIivRUp0l3wOrsvACF5VwgDs8nxIX5QZVUOlYGwnJXdUHtvWsU6UdAAZZ yDB3ulQI62FtnPdYhwW2j7tMyTCa6RzVwzOewZCW1SxovYRA4RLBQ5GPPXlDB5Xw /oZ9/g== 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 4btysft6tk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 02:08:53 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2a377e15716so9164805ad.3 for ; Wed, 21 Jan 2026 18:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769047733; x=1769652533; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=N0arxgzHuSn01W9a+vgbWr6+0uE4gJ6OvQm4pBN3Pq/IF81BsBI/2aTD+fCGUr2XuU a70tAqbuAE5gcvtSD8VOGryzR4iIeE491lj5WurxOiwntKuffi7D11RsLLXMiu8vvL+b KBzPyMWn7s1rylCW/kxIqg/eIOH+qCctFVTUOfIffr1BxYlX33HzL0eqtUvsG5B8IHY5 UoNk7e5sIHo86wHpMdITcGwz7WFkPr4wJHTj6oohEtseeMjtXSK9kFuNQ1GRFLlwVHlG UhI9/oM8QV9jGjIVQvsbGzD/26K5L39ip1oKw5hDYjYtqAFi+vqG+ADAZ5Z96HYEk/LM Snzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769047733; x=1769652533; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4Jay9EfBX3UpMTwsvQnGvQgNS5FLBeKOwQWuoZ1I2KI=; b=Q/s4j43LzlfiquKtZt9XsF3JeGNnJr72bbi9baqPDELA/O7tJq1EAqFbeZr0QSsn6v KSik9ZWrPs1NqIIHrCltjtjnCr8HNCcrEJ49OESrwS5hTKExawX8nmvlAQErASe8nm8H P8IcIxSDt1II5DwvxSO+rwXEGAhxFjA4X/ELKC+FS066Dn+kfW+UwUl8DOujJ70S19IN txRFV/WruGh103S0ovF3VaMgw9Yy9WjCE70ek/0Vfw1ft5zLYa8wNw7C4tKrd3f140zl bQnvN27DJda4I+rD1J1qXtFEmy8cfUorNKeena+MQXg6/po+9/S6rxKPEUE5KjSrZTLA TY1Q== X-Forwarded-Encrypted: i=1; AJvYcCWsER1tWtuaOVwOLFQFaS2b8aJncShpbccxHi+GV9GOuH8qpq92bln6tBeRDCwO6PPmG7uQuIOH3zNBdYU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx97OGMDLwOuNLNfUm/l29vu+O0YmtBYrWVoCVN5z7s8hAFXMI+ KfM1+U4FUJiBmoZpU7M7krVPCZls9BOgoSe00E3rvFmqf9Li2I6l6/N6qJDFe6QhjwlmBe6Y/2/ 0f7zcysw5YwEwPv54KWOfA7JtcTCHm7ML+fogRWNKiuyaaBWHt7Qz0jQT1GWsNGww9E0= X-Gm-Gg: AZuq6aKyRWXZP34luWbGVLlLZ1YdJlNgfmIl5SRDnYeYgj2qHnS8aWQayWlULiUNfUD KIe/LBVVLXsez9LATwxOgeNMIyprWSmEAQQ1nfHyf2vHng1zfGf1j7STQMeUbmTnyV40YNvVk9A g8O64mpbeOY5vnPI2yGKVQFg2rOjrPPhYDzahPvSDYxvT/IVfUahuY8fYMd1a3yRZCBre9mSzmq 8zyqfdbeBLjfp+zaGl5tJFnQ0HKtYKUoVIrRiT16j+S6ToQHgr1O1INzBl2Vo9pKiJCDjGUvkUP iiVFgiecZVMkdm2Wm6c1zDwPUCD81TdL3g8F/wuMv1LZsNxNN8I4XLkBlASzlGk+dysuV+iBGDA ua3U+YT8Qxn8GMgEcNdpC+BWMC2caOBfrPp3NPIIe845fqWQHBQ9JB2p12epslrQypW8PrSdG X-Received: by 2002:a17:902:d50e:b0:2a0:d7f6:e030 with SMTP id d9443c01a7336-2a7188f7fc8mr194760405ad.29.1769047732472; Wed, 21 Jan 2026 18:08:52 -0800 (PST) X-Received: by 2002:a17:902:d50e:b0:2a0:d7f6:e030 with SMTP id d9443c01a7336-2a7188f7fc8mr194760195ad.29.1769047731908; Wed, 21 Jan 2026 18:08:51 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a780a4631csm49710305ad.18.2026.01.21.18.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 18:08:50 -0800 (PST) From: Jie Gan Date: Thu, 22 Jan 2026 10:08:15 +0800 Subject: [PATCH v10 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: <20260122-enable-byte-cntr-for-ctcu-v10-2-22978e3c169f@oss.qualcomm.com> References: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@oss.qualcomm.com> In-Reply-To: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@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=1769047715; l=6192; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=iOBlKE7wcNNqdQg697EHs/307n7EmzHjJxd5G5rMLIU=; b=jzEtsNMGYZsrezqPbkw/udFfJW0/Nm0vvbpPfSfQrPo9FocDTUoW4Gq9F64MOuJTwGaKjv/CS /Wey+mTfDgkBfANVJnQTGDzMuaCQqpeYVBl1+4BFFYZCRlJjG5tA5BD X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=N8Ik1m9B c=1 sm=1 tr=0 ts=697186b5 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=AScg1gZdVb1XvqdcXssA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: JjsprnzZyKHzU4Zf6lqR6Lsg7W4pvFaG X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDAxNSBTYWx0ZWRfXx3W3UOOW+8Ps o984YVIW7NVFVwSo5yMyC69UbauSZiaWPNTh41V3rxN5Nvrb86XlSbZLXYeXPgGWQPb3slVyLw6 E9+H8ZdNeOgwGtApEFwbp521LA/DfWfFH7kdkWK1AZqiVZppgGMYA1g1nvtFQXke3Gh6kUe+4kL cncACF+u/oGvFv0HVFDwrPYbNoNFCTNkf7f2I5dCdKE3XOvKuwdnCiuqO8tJ/4qSYK4gyjWvjXR gquf/qpYxclbb8FZLRE/FPVnwbOpiy08F1FozvGYtxgX9xUtwsH7W6VdpUzUieOAQoJOFkk4YUB mED2GGSLDFOo8IQXaMXyTRh0scM6lCJNgULDdFhB7GYB03jXt8ZgfLW5nROtiq8wYm1kVkwNNdr Y9hQZj7BtKcucstlbI/kudcaIt9ZC6siZ3TLhzcabTZkzZEf78jsvt/N5A7FSEEwpcEjV/2cjoX btDTYNrE5ZMDAD6PFjA== X-Proofpoint-ORIG-GUID: JjsprnzZyKHzU4Zf6lqR6Lsg7W4pvFaG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_04,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220015 Introduce functions for creating and inserting or removing the etr_buf_node to/from the etr_buf_list. The byte-cntr functionality requires two etr_buf to receive trace data. The active etr_buf collects the trace data from source device, while the byte-cntr reading function accesses the deactivated etr_buf after is has been filled and synced, transferring data to the userspace. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 1 + drivers/hwtracing/coresight/coresight-tmc-etr.c | 94 ++++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-tmc.h | 19 +++++ 3 files changed, 114 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 36599c431be6..1ea255ffa67c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -840,6 +840,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list =3D &etr_devs; + INIT_LIST_HEAD(&drvdata->etr_buf_list); break; case TMC_CONFIG_TYPE_ETF: desc.groups =3D coresight_etf_groups; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index e0d83ee01b77..cbbb15648fb7 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1919,6 +1919,100 @@ const struct coresight_ops tmc_etr_cs_ops =3D { .panic_ops =3D &tmc_etr_sync_ops, }; =20 +/** + * tmc_clean_etr_buf_list - clean the etr_buf_list. + * @drvdata: driver data of the TMC device. + * + * Remove the allocated node from the list and free the extra buffer. + */ +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata) +{ + struct etr_buf_node *nd, *next; + + list_for_each_entry_safe(nd, next, &drvdata->etr_buf_list, node) { + if (nd->sysfs_buf =3D=3D drvdata->sysfs_buf) { + if (coresight_get_mode(drvdata->csdev) =3D=3D CS_MODE_DISABLED) { + drvdata->sysfs_buf =3D NULL; + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + } + list_del(&nd->node); + kfree(nd); + } else { + /* Free allocated buffers which are not utilized by ETR */ + list_del(&nd->node); + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + kfree(nd); + } + } +} +EXPORT_SYMBOL_GPL(tmc_clean_etr_buf_list); + +/** + * tmc_create_etr_buf_list - create a list to manage the etr_buf_node. + * @drvdata: driver data of the TMC device. + * @num_nodes: number of nodes want to create with the list. + * + * Return 0 upon success and return the error number if fail. + */ +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes) +{ + struct etr_buf_node *new_node; + struct etr_buf *sysfs_buf; + int i =3D 0, ret =3D 0; + + /* We dont need a list if there is only one node */ + if (num_nodes < 2) + return -EINVAL; + + /* We expect that sysfs_buf in drvdata has already been allocated. */ + if (drvdata->sysfs_buf) { + /* Directly insert the allocated sysfs_buf into the list first */ + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) + return PTR_ERR(new_node); + + new_node->sysfs_buf =3D drvdata->sysfs_buf; + new_node->is_free =3D false; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + while (i < num_nodes) { + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) { + ret =3D PTR_ERR(new_node); + break; + } + + sysfs_buf =3D tmc_alloc_etr_buf(drvdata, drvdata->size, 0, cpu_to_node(0= ), NULL); + if (IS_ERR(sysfs_buf)) { + kfree(new_node); + ret =3D PTR_ERR(sysfs_buf); + break; + } + + /* We dont have a available sysfs_buf in drvdata, setup one */ + if (!drvdata->sysfs_buf) { + drvdata->sysfs_buf =3D sysfs_buf; + new_node->is_free =3D false; + } else + new_node->is_free =3D true; + + new_node->sysfs_buf =3D sysfs_buf; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + /* Clean the list if there is an error */ + if (ret) + tmc_clean_etr_buf_list(drvdata); + + return ret; +} +EXPORT_SYMBOL_GPL(tmc_create_etr_buf_list); + int tmc_read_prepare_etr(struct tmc_drvdata *drvdata) { int ret =3D 0; diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 95473d131032..9b3c4e6f0a5e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -208,6 +208,19 @@ struct tmc_resrv_buf { s64 len; }; =20 +/** + * @sysfs_buf: Allocated sysfs_buf. + * @is_free: Indicates whether the buffer is free to choose. + * @pos: Position of the buffer. + * @node: Node in etr_buf_list. + */ +struct etr_buf_node { + struct etr_buf *sysfs_buf; + bool is_free; + loff_t pos; + struct list_head node; +}; + /** * struct tmc_drvdata - specifics associated to an TMC component * @atclk: optional clock for the core parts of the TMC. @@ -243,6 +256,8 @@ struct tmc_resrv_buf { * (after crash) by default. * @crash_mdata: Reserved memory for storing tmc crash metadata. * Used by ETR/ETF. + * @etr_buf_list: List that is used to manage allocated etr_buf. + * @reading_node: Available buffer_node for byte-cntr reading. */ struct tmc_drvdata { struct clk *atclk; @@ -273,6 +288,8 @@ struct tmc_drvdata { struct etr_buf *perf_buf; struct tmc_resrv_buf resrv_buf; struct tmc_resrv_buf crash_mdata; + struct list_head etr_buf_list; + struct etr_buf_node *reading_node; }; =20 struct etr_buf_operations { @@ -445,5 +462,7 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, enum cs_mode mode, struct coresight_path *path); extern const struct attribute_group coresight_etr_group; +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); =20 #endif --=20 2.34.1 From nobody Mon Feb 9 01:26:58 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 EE20536A008 for ; Thu, 22 Jan 2026 02:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047743; cv=none; b=FMpuaaBr5ItjYGlQHhGmNLgTcDPV0TBRXPyXetTAyakai8BqlMjKcAV8DixNhqLpW+AayJ7So5owSpbAbmtsI/LiteKy1ER4JbOJE1pesS5c7Co8fvwVlxrjD3OYoyLB6mNksqfZsv+CnZncGzYzwjiN1/DosZeVX66QSs4E4+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047743; c=relaxed/simple; bh=adb+NstK0OrGdQHboby6lmZs7rWs2zBc775hVSg6Ay8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sJuI04tpWe7Pfd3Pbwc4wkA1rbopPeWN8QcMv1KvkitvlVDcpqfJhMCBrVgAyzzIJVKqgrED7fO2U8s1hitnRi740j6JnooTJm8ZXQIFXt1e5OiRvNhuTk1PJabeLzWzuPJkhQ9aqUJvky6weHygqzZOJUI2cOeHW4laB5bba9o= 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=GNSVCC1G; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ifFT5dac; 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="GNSVCC1G"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ifFT5dac" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60M08MQj3463701 for ; Thu, 22 Jan 2026 02:08:58 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=GNSVCC1Ga7J8TSot zNDR0RW+ICcJAGgI9B9Ri99awN6nVDURWz1RpPbNTcLaTUnn3JYPU1e4ZjW5DPuJ Qe2E6c8Rqb0ECwElqOW53gLg0NHSn2Y48NIAsVO4R0D4ZFSSZvAFjjNPbGQMs3UH I9xQVI3CLR7648IqVHZt2+RJHxYCB/fz/rIxQsiKnAusRbApB7l/ltjD0AQsySG+ CEJQFTFyKhXrC33C0m0iv2VxlAdAT+cOuwK8xts6t3530jl0oPRzeWD+gM5Dr1em +bx3E0cYlhzgEvdTNg7CmGbqhIWX1DGxg8DfQRrvWdhJG+yi+3oltUN9r6kd9sL2 49s1aw== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bu06523jp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 02:08:58 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-34c5d203988so893595a91.3 for ; Wed, 21 Jan 2026 18:08:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769047737; x=1769652537; 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=ifFT5dac3lD3t/D7cywhR8Zeiv69diTRLIN5aMvcEJUT8DVR/UvWBqaIuYoR9Fa07M RIMHNXyXlSpEAKC858QDYdOEa4UdfJgmmer5Qaz9/S2KR3lAnD6BB8XTW5tYNySUovkG KdkUEu/ug6zGDFFQ4p1puZxmNIZqm/h4rIDi4W1UERAIIWNHPg27KCuRYMAvd2Q/feBe 46mjbS6HwQeqM5MgFvjaP4B5pIsUnpgZRQMBqHH/mJT/Wr80n15QsqVnxYQRZYjxTzoK h5XTXSplx4Sumk3vogVoL6j+W33GgZhOspBFVKzWZE31kNuUghT+KdhPQQqxUqL662uY cLbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769047737; x=1769652537; 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=Iq7zLu5WC95x/4ie7bOfT6PnnnXKEFZnjz7oIbt+RIB06PWu33QSN/9s+VlqE946a5 zcYL2t4nD7k52oHZETGrw2fh4LqN+d7n7XZ+NingvcqUVt5dLWaZgfle+xNGdf5+8WVq EK7Z8maSnDCsIuQgxNY8JobjObe3c9sjpmLi6pl/KDck+cjsS0z+s1CzcAoEO8A0HIOl SGKtYVoUsZpuFWHHVrOEK66YlJrbjeVQ9H4zqmPEL6xncrabutgw5m7pPGNeQ5wCsjdu dxVST+6FYcoLqbdZ3+Q5QOedIrUFoo4uzYjLo7Z2gr3cA+1J9OBVs820To9e+FfAKtac A/OQ== X-Forwarded-Encrypted: i=1; AJvYcCV8U0y2M3Ph44wYByALx3xehm2zHj8MhjW9ttybdcW/Zgey9qmTHjyu/DsOmuhxHgr2XVyEqsss5wMyDis=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4zWg/M3nzF64V6cRyOINHCs086Ps95Hzt8QUwOjF5r4NRH2+6 s0efkM1gu98NWwJ0RqvIeeqYVvjVzv9ArIUTNQK/bOk3N/f5n/ptdzmLbY8bbQWQRdxvX80cJLs dkGj8SKprwhi6E+lHhSYZebQ6WSzrgihZVEaIa1Dc6IIfbVjsygWTVVP98fypDwfuwhI= X-Gm-Gg: AZuq6aLZ37onVNIMWXb6xWWMp+8R0bn+LuZufOHq4Ta4jzNr30E/+T8yfc6NplX/7oV SCRK+fYHTAISpKwaVSOuQuGXPaha9JvJejKNbNv4sxVfgh3wWY9dzIaq3qayMBTlvE8OBG3aZ/6 KQ+g76hOsD+qu/qVeJa1VU8ZcTO/FQxZF1SiRqfFY+fV53K3Y6rxvcJHoP31YNNeH6IdWAQp3bJ JXU2g5OwgqI5nfOBmvD9sG6Ffr6Tfc+WrlkfdxmFLdPvlu1vL6Z038KJE9GYDVzX+jxEyrX9KWh ZoAU6t9qxX8T/x11Vdk+ltqUKhqKMexeWPXNrt7VdK+G8wgWz0jm6V0gKerr4uDXfSHbEFyirOI WoIgI5XTSJfjd6kdV+YwcPkzJpnGf/d77L8iMhWEO6sAFWsOiv5kGICAndZb39rEco+WgMoBJ X-Received: by 2002:a17:902:e74c:b0:2a0:97d2:a25d with SMTP id d9443c01a7336-2a717516415mr181775435ad.15.1769047737416; Wed, 21 Jan 2026 18:08:57 -0800 (PST) X-Received: by 2002:a17:902:e74c:b0:2a0:97d2:a25d with SMTP id d9443c01a7336-2a717516415mr181775235ad.15.1769047736896; Wed, 21 Jan 2026 18:08:56 -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-2a780a4631csm49710305ad.18.2026.01.21.18.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 18:08:56 -0800 (PST) From: Jie Gan Date: Thu, 22 Jan 2026 10:08:16 +0800 Subject: [PATCH v10 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: <20260122-enable-byte-cntr-for-ctcu-v10-3-22978e3c169f@oss.qualcomm.com> References: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@oss.qualcomm.com> In-Reply-To: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@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=1769047715; l=5450; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=adb+NstK0OrGdQHboby6lmZs7rWs2zBc775hVSg6Ay8=; b=rf8eEkX6xeEuQxudEYmOmXgRoN92u1XmNwp5u00r7XMrpm6LzyuxgLLZ8Lo+mYOuaJZKZBuJH /WrVbjKjsbFClTLEWHl+Ay3vgW9n4BYJjwh4rGYY6dPKEpVTDE58045 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=HOHO14tv c=1 sm=1 tr=0 ts=697186ba cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=JzqEjpkVlBH90HjAhVoA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: e4KaLHx_BH9MpOvS6mP1-ipkUWzIOWaJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDAxNSBTYWx0ZWRfXxxWSwQ4nqxtR dmhqae7uUIrXRVLdIJV2DRlqsiDEyigBnIXEJmZhKW9vmEYk1efgGTw2D37kl6vAEKowBrTrjTd 2EnUruKcFd1ofxS6p73LKGiEohLf0tk6jnaV6r+5cOD5D9PYQM3GwjzlFS98XEGNx+K7lorKpvb W+fDukdRQjwkWfzdek93LmL552EAYdzX2+qnlVpfsqdDOCWt8fxTjRTPlz/PZbAaDuLG/jJ0mhc kF6wYnIPUOUumh3HHflX85EH46Vn6HRriBAtcgOnp9n/fKNSALfwsDcqSez7hBDarge4ItbvNp7 O1nqpHJkD7wu3Beaet5HadrGUXDHtOvZL5kXxKIJZAQ35NFJrbNaeiPgwnMFbW8FJjxYv+24g6c cVPulV8BcdOCb913+Ksg2EkrEIym9jbnBJuJetjx5T2ZQjIn3b0QCxvz3d/JWcQ7sU3rV8Tl2Aw y6e0T9+tneAlSjuCNGA== X-Proofpoint-GUID: e4KaLHx_BH9MpOvS6mP1-ipkUWzIOWaJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_04,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 spamscore=0 bulkscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220015 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 01:26:58 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 0A13936AB74 for ; Thu, 22 Jan 2026 02:09:04 +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=1769047748; cv=none; b=KxEfk3bBTELav87hlmKqC19CCpFN3WtKCUzMXiI/ftztCLEeLXrwJBWXUyJN+SGR3UBueCf/2BJtq9lEgPmm+e8IWu82Ien6Kn7T0/n12tQ7icARFGgBArZYU895mhfC+hWnxu7FptLO2WdPMj1l52bXgK3QmSCSpYKL4c4alFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047748; c=relaxed/simple; bh=1Yd4/OeyiYY49Es4IJlY73zV9yzGJi6c/ilE5vOhlX0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oNy60rImJGU3MLNnozxM/Ov/ag7OtYyuGgcS10vIhClVw75R9jXcb9eMuxNCoUA9/SqkVZxNzgXFJfVdzH5bt5g4J7Rlvh+7h3/FiQPomXj3/kY5GMwQZArQbe1FgL4CnkcJfSGkPLB3P1bJdCuRZCxz1e90sFR874BGW07Yibg= 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=LmvrmMfS; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=YUH+VOe3; 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="LmvrmMfS"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="YUH+VOe3" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60LNGlk53463810 for ; Thu, 22 Jan 2026 02:09:03 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= rDoLTMZ0B/5YJB6UPqg6ddrMGqlIPrOwvKMKnhBl/fg=; b=LmvrmMfS2MrkO5Yr D9+fraziqK8OC/qlIsjMNuADn9dWfkkC/pM2MR++/zttxhAaynddedc0enbKgUUe JceSPg4vGN66jYll6F7yD5c30ldhuuaothl0H2z0HzsQvu0F91tLmqBm4cu1fYCi cpWWSTC0PV0oHFUDwPDVRX9FfHCqWvGjkZ6VcYMytwnquZKpwB1Bqwx0FXkFW2xZ gf2Z867zNFZD86ovIPzrodVdBhrAKC5+SgoyFohX6MnJVttQzwWGrdEK8GSLswaV bHmaChElXYpRJ3NZLpGHzvySZDAY4lT+aq7HzuTFNeqC4l8OrCya12+sEgau67vp +JinXg== 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 4bu06523jy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 02:09:03 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2a0a4b748a0so8833925ad.1 for ; Wed, 21 Jan 2026 18:09:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769047742; x=1769652542; 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=rDoLTMZ0B/5YJB6UPqg6ddrMGqlIPrOwvKMKnhBl/fg=; b=YUH+VOe3JIulcmvvwISTIERe+wIjF/kyHRDk+6rxoaTfeTY3h4exep65BPoioXlT86 BM3vE7HnI6hJf/nEiEMxjgW33JU1NYuf6/cV15iTrO4jnmrkEBZh4DBKpzxV6BxQv7hS pz4ijmaTfAKzjOhf3Sf1zt+sefy+ZPLKFe5fU3QzHo1XlPp2mfR60vjV/gMwpTo3Qff1 jKZp5WHq4TXSuH3dI+Y+mBPY6l8kWWj3uMmmWVQeYKCxhTwrC5oEKJczwOLc9QeLGWRw hNcNQfJDe/KUWQ1jgk2vNsgp6lLTsAvSwWoa5rVQvKVRY1M8f357YBxMsH8z69DdkT5J 4wkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769047742; x=1769652542; 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=rDoLTMZ0B/5YJB6UPqg6ddrMGqlIPrOwvKMKnhBl/fg=; b=FTz+SjeIqBhkKrASJD42H7YFJOMkCvPcAjeL3yCLxuOGqbgD4JZ813/AyaIk6QvGN1 KyFvGqSA8wJF4L5B7qykRtj3dww12gANP2fDRSLESFiObflmrGFEz8vwHl5ThYpT1ESr 2e5rael+kN2vCCHXfANyrYRNbvG8PS4vH4HDz35acH2kGo3tC38wySQBPAhB654hbQaC 7srPikeLPVWRVA8EXHDnQS2OHZPhcMz5iqxGJn6QBSprMkw6rV9efXBWvQOqG6vt3Bhh qfIIQ/qDEaABI0Da/HXMw6d8BSqj3IJq0QbOR5x+wus8XNkIXPnokO4IPP8Z07qizrP9 uzYw== X-Forwarded-Encrypted: i=1; AJvYcCU1YIYszPJS85UfpDn0z0wZScNecsHrEi1XheesyA8zQ8Jz1siOAY9R4CGsCSLbMrnzuhgFxEBrGEwGxwo=@vger.kernel.org X-Gm-Message-State: AOJu0YztjJdV+Ml4Bq3g70mBH3riMyWShuLEzBXUU16Pt+Sst03BU2i1 aWlkbTa4sRj4Ie9KBF01ITRmbWtiJReR0rlaHy7tZpx9CKoPRyxl+vGZu04CmzEezkDZ+nCN5xX cPxr/bVkwPalTCNx75i/mZpV4U7JVkXoAI/yR88pNWCd2LVUACqVEBE/WZNo5fs82dos= X-Gm-Gg: AZuq6aJIWJtEzpZCYZG3lEODSc5kFxjhSdhbIExMjnVMusGa+GbLoXlJa3GXfiZzg9y 0+9YlYfoxUq23xYt3insVw9qklljB8Y8HrwRnlgzC9guhRzehw9EkbelVJ5ddDQtuXGLJixRgX3 pEsHqcbNhUY+QfNsVLEAx2wGSY1T9le8U6ao9DclUDhnu3QArnXt9KX3KpmBEzAnuesPMiePnRy RnfrjBIJMht8+lhuAyGbdjTunkwySx4Cq6Py6nmrJ0IMzuoqVaDUF+57YhRPsh9fyUD7zxcBRFm +uJXCgGQN6sBYDN+6vARoKRRWuucVFRv9HjWxNEm2CpL2ZZZXobWA97UMNVjVq8AtXVDog6XwPw U1gzCZmjviKprcEH7Tr5qs73v3nZwSBpZnAVZa6s+5Ib9QZ1UKHjpeMuJ/SObeNmPWXehr4CP X-Received: by 2002:a17:902:ec8e:b0:2a7:5171:921a with SMTP id d9443c01a7336-2a751719312mr78653745ad.54.1769047742041; Wed, 21 Jan 2026 18:09:02 -0800 (PST) X-Received: by 2002:a17:902:ec8e:b0:2a7:5171:921a with SMTP id d9443c01a7336-2a751719312mr78653315ad.54.1769047741481; Wed, 21 Jan 2026 18:09:01 -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-2a780a4631csm49710305ad.18.2026.01.21.18.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 18:09:01 -0800 (PST) From: Jie Gan Date: Thu, 22 Jan 2026 10:08:17 +0800 Subject: [PATCH v10 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: <20260122-enable-byte-cntr-for-ctcu-v10-4-22978e3c169f@oss.qualcomm.com> References: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@oss.qualcomm.com> In-Reply-To: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@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=1769047715; l=4412; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=1Yd4/OeyiYY49Es4IJlY73zV9yzGJi6c/ilE5vOhlX0=; b=DTMOiYD2h4vVx6W7jK2n596Ajp+2RBJ2ATsqrncV6tq1QOz6iBHg/9UDdHvW6nYw1ldjPJNES MDZgoyGPZoICgwR8/fUlFokUpybl7HsS3KUdGcqsENSUfvZyFr37SVJ X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=HOHO14tv c=1 sm=1 tr=0 ts=697186bf cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=-ozbsww5GKt6_lkPIaMA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-ORIG-GUID: uqIWEdYbwSkeCYah3rvSLeKtH8TAjgJ3 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDAxNSBTYWx0ZWRfX128QBSYm0uyK 0mTE/K0raFhcqN0KUWUxXza8huy23V6hc9pEXhJfG1X3cQRVeoihI1mzIWF8mo3GJshk35I7m+9 kqAUNnncE2OyrbgNBDsHEjBdBn25U9BOGwfMN3ufP048itjnDHyz2kHh72fDozxh3WsqOI2Q8s+ kRZavYJALlt8eFmIl8jsw+HMAAhLljZlaDKhDj+Xw6cYEPkF+Bb0/LOq3q/qdY2sakRPRi13mWs t5yio7E880J4PGUY42+evPGbtOEk7ISGpHZqV6XTZ/K6UyE/wTJFwv7v/sU8LDax9dGKMIQH71j XF6bTFu0rk0YrbSaqP+HKhkZ8yXiJq21y60t3on4DeAiT7q+mPdIyxP0rGVQTyE55zIgC6xGNF4 RPID57JEoab1cNL1swJZrcpKjkh2k5jRudxbtecmvEXo8jcQTlMQEBl2VkqdROPJiobt2lfMp9Q raUiagjtc8EYKrJ8hkw== X-Proofpoint-GUID: uqIWEdYbwSkeCYah3rvSLeKtH8TAjgJ3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_04,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 spamscore=0 bulkscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220015 Refactor tmc_etr_get_catu_device to retrieve the helper device connected to the TMC ETR based on helper_subtype. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-catu.c | 3 ++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 32 ++++++++++++++++-----= ---- drivers/hwtracing/coresight/coresight-tmc.h | 3 ++- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtraci= ng/coresight/coresight-catu.c index 69b36bae97ab..d3972619cc96 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -334,7 +334,8 @@ static int catu_alloc_etr_buf(struct tmc_drvdata *tmc_d= rvdata, struct tmc_sg_table *catu_table; struct catu_etr_buf *catu_buf; =20 - csdev =3D tmc_etr_get_catu_device(tmc_drvdata); + csdev =3D tmc_etr_get_helper_device(tmc_drvdata, + CORESIGHT_DEV_SUBTYPE_HELPER_CATU); if (!csdev) return -ENODEV; catu_buf =3D kzalloc(sizeof(*catu_buf), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index cbbb15648fb7..16a4562533d5 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -844,28 +844,37 @@ static const struct etr_buf_operations etr_sg_buf_ops= =3D { }; =20 /* - * TMC ETR could be connected to a CATU device, which can provide address - * translation service. This is represented by the Output port of the TMC - * (ETR) connected to the input port of the CATU. + * TMC ETR could be connected to the helper device, which can provide addr= ess + * translation service(CATU) or data filter function(CTCU). This is repres= ented + * by the Output port of the TMC (ETR) connected to the input port of the = helper. * - * Returns : coresight_device ptr for the CATU device if a CATU is found. + * @drvdata : drvdata of the TMC device + * @subtype : helper_subtype of the helper device + * + * Returns : coresight_device ptr for the helper device if a helper is fou= nd. * : NULL otherwise. */ struct coresight_device * -tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) +tmc_etr_get_helper_device(struct tmc_drvdata *drvdata, + enum coresight_dev_subtype_helper subtype) { struct coresight_device *etr =3D drvdata->csdev; - union coresight_dev_subtype catu_subtype =3D { - .helper_subtype =3D CORESIGHT_DEV_SUBTYPE_HELPER_CATU + union coresight_dev_subtype helper_subtype =3D { + .helper_subtype =3D subtype }; =20 - if (!IS_ENABLED(CONFIG_CORESIGHT_CATU)) + + if (subtype =3D=3D CORESIGHT_DEV_SUBTYPE_HELPER_CATU && + !IS_ENABLED(CONFIG_CORESIGHT_CATU)) + return NULL; + else if (subtype =3D=3D CORESIGHT_DEV_SUBTYPE_HELPER_CTCU && + !IS_ENABLED(CONFIG_CORESIGHT_CTCU)) return NULL; =20 return coresight_find_output_type(etr->pdata, CORESIGHT_DEV_TYPE_HELPER, - catu_subtype); + helper_subtype); } -EXPORT_SYMBOL_GPL(tmc_etr_get_catu_device); +EXPORT_SYMBOL_GPL(tmc_etr_get_helper_device); =20 static const struct etr_buf_operations *etr_buf_ops[] =3D { [ETR_MODE_FLAT] =3D &etr_flat_buf_ops, @@ -913,7 +922,8 @@ static void get_etr_buf_hw(struct device *dev, struct e= tr_buf_hw *buf_hw) =20 buf_hw->has_iommu =3D iommu_get_domain_for_dev(dev->parent); buf_hw->has_etr_sg =3D tmc_etr_has_cap(drvdata, TMC_ETR_SG); - buf_hw->has_catu =3D !!tmc_etr_get_catu_device(drvdata); + buf_hw->has_catu =3D !!tmc_etr_get_helper_device(drvdata, + CORESIGHT_DEV_SUBTYPE_HELPER_CATU); buf_hw->has_resrv =3D tmc_has_reserved_buffer(drvdata); } =20 diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 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 01:26:58 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 5C3C7378D94 for ; Thu, 22 Jan 2026 02:09:10 +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=1769047757; cv=none; b=IoacO3m+xSz0P3bUe266WutF9gyNSNv9tiaI8SM0bIF3c5Lp+hUW1Q9vJOK27uuU3lGVSQZLHEAUg1SF7gqhqb8djugkGDxiKjzZ37YDAEwydLOmi6Xw/fV9F3J/PM8yLBJkWUs1NxolspG7tq3rEcCKYzhW2bPiuDBrvcO8qxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047757; c=relaxed/simple; bh=D10EnaHvzxc5IcCAThb9a/AzzqWooUS88J0GgYqXhUw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PXYFNuVHIrBy24WQtohI7Lt8sQB7uJol0ypcPKwVl9zIT25iqs7egpX+vNBzTd9rUsPRYZzPTzcgoWaGLDKrMjhpJevDGVUffDNWP1iatLiv9QJuLo6vnxKqnwlZQyX6fCs/CN7/o4lyQC1H5UVoIQQkVhK/vGM/1WR3RFog0jY= 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=E5WLRRyN; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=gy77Xceg; 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="E5WLRRyN"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="gy77Xceg" 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 60LMuxgV2727319 for ; Thu, 22 Jan 2026 02:09:07 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=E5WLRRyNcki3om0y W+UWAkV7kgO0zhfb1tQkhrwV3Wb6mfiAheyRLqTFfE0m8icRRAVZmGQgDu/6by7B KZB4SlsOeqENd6Sp2Pz57SZWPZHmp4h/97/fJyV2oCPgfZXRxR6NOOCou6ijkuna U1eyi2O5YoYxthuyu7+2s3U6Gv873F+S/1ttytcYw3Y3YQ6zbfeyTifbjkIf5aON +oio1d3fedzzBTDThGeZaiJMVyxmX6i45K4vpDBe7CVqBhWaS9uqlc0t9bubXDwy kbAvjMfB1K0ORqtJSt8QkJ0V7eWWGheu4fMHXORWdM/xk5aoagn81zgyd9QTAxzs cnxDhw== 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 4btysft6ue-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 02:09:07 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a7701b6328so9014885ad.2 for ; Wed, 21 Jan 2026 18:09:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769047747; x=1769652547; 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=gy77XcegmpJPb3AVamwYE5XkWxz87z4etA0x2x6xTf0yknOo7zJIIx9zW80tLLJtCM p9TP47IsiaVTsNLmgZy7SSUyujrOmG9lshsMmWy9QwzrldOeITppyH9f28f+TS/p72JE RVyfe+N0ombDx3LOvVR4IsTFMQe05ZLyJT8+oNsXOr0POpDiSH5sYlh6CDzQ15+thkW3 /SZ7/5cVuF7QpxyKtyLBBAZWPeESZKgb9VCJBC30P/dsxpb+gqHKdaYy4Jo+vyR89/VJ utrazp7jw6r9uuBTdw/w7OB+SFmx1wMKCVKhzXwZzKTFDBYpw/4TYiprgyDUYT1c01ZO QREA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769047747; x=1769652547; 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=kdHNB3f3GPdFWTz56AUtbqrIt41RhB9EU5cTQa53dOYqOqK2y2StwjfDzrb8sfilUg kSsi7aDBlnDOoAX2VHDqNJ92lbfzReyArpEZ0gJUI2zCd4kMyxVwCHiKI8xmT7WiSIiY tP/rMuGL9mi/hU3V4cFwUKCtkJusYwvhb6XP32JNMDg/N48EuUZ+59hEOgtaj73M0+4C mNjHSiXfI4Zwqzgw7LkpquSM1kAAKRzXvX3OBjjcwZgLtwTzqo0SpTfNOVMsE0yZffF9 noDp9urUhjRqkIsXkOajb8xbHEfYfPBn1lDwQH/D/WYvgivEpS3ML9olQHZaa9b3QUTv D9vQ== X-Forwarded-Encrypted: i=1; AJvYcCWhM6n7vLDWRZdO3su3eSGvCuynudUftq/kLW0NndTtYqPt9Aip4lp/50unAdwptVGpoCsL0QFnVI+Pl0I=@vger.kernel.org X-Gm-Message-State: AOJu0YwRPVdPg4+xpPUOnjjOyP4YrDMDFxob9YeK2GncxYCaqFBFvx/5 c5YzIjgeF6j3Lw031yHwfb8IzF901myHMWTZF0/W/2RQ89ErmNZmE6XcYrUzNrZrVqnNFV/rfQ4 xzPDyMhBjzgEntQIxxB/V4DWCG65zKv3bhraYQ1Wbd+VkytjzNQlRYdUAdwBEVi3vofA= X-Gm-Gg: AZuq6aKLlryRr6i7J3qahpaVsFOcevSupJmrIUiyRTfypM7tQNP9uy4RnpmQHLAH7Z9 GD5b2gZqoEs3jDgPm+Dsdd1WDttIMgknCOBO4MLqtUNp+Vasut3gp1vEF1e2rm0RtEVGTXK/FT1 SelMd/4lh7a5/LKEXYjQAa0VYuMbgb848fETVDvWyu7bIxhKt3wM+1EuZ4QsaPLbD7Juf/wzB/a MieuwnXJrBryoz+maCMj/l5FnKvPRvQaTFW7NGrF3Bcr1qVBJeicVYCWTrindHytLrS2RiehLOj fNZwaL+PkQJIucWLFaPBL+54Sj9PAEBmqxW7cvGwI9ybM+Mlmw9M7S9qwpEKJ1bwF3S7cvkzjvt VP7iHfP8C+DONjv3VZTHgjtRo27P27IVXUxa+KT9BW7YaDAd2GKTFZrr6GH0GlmQfIfjs8Mzb X-Received: by 2002:a17:902:f688:b0:2a0:9ecc:694a with SMTP id d9443c01a7336-2a76ad5c3b2mr66689585ad.37.1769047746719; Wed, 21 Jan 2026 18:09:06 -0800 (PST) X-Received: by 2002:a17:902:f688:b0:2a0:9ecc:694a with SMTP id d9443c01a7336-2a76ad5c3b2mr66689235ad.37.1769047746185; Wed, 21 Jan 2026 18:09: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-2a780a4631csm49710305ad.18.2026.01.21.18.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 18:09:05 -0800 (PST) From: Jie Gan Date: Thu, 22 Jan 2026 10:08:18 +0800 Subject: [PATCH v10 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: <20260122-enable-byte-cntr-for-ctcu-v10-5-22978e3c169f@oss.qualcomm.com> References: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@oss.qualcomm.com> In-Reply-To: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@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=1769047715; l=1751; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=D10EnaHvzxc5IcCAThb9a/AzzqWooUS88J0GgYqXhUw=; b=PWRV+OSxdyrgtlPlA/88c+zwxtpmLqdGmkgVUwG5GAA4FUiVev4B+usVORsZujvgNYb6XuyVN X743Pihp9HoBYSojQw1lDVFuTtCvvgoNzPqUQUjjgZhrXLAVA5GLOZw X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=N8Ik1m9B c=1 sm=1 tr=0 ts=697186c3 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=gSyxy6DGYGa4b6s9XCEA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: vIb2sbTSuYzZbPydDgP6GdXTaDbaD6Oy X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDAxNSBTYWx0ZWRfX2GarIJUO5PTW 2+kVALGFnMOVIMPQ2fPe4ZnwnTJQf5c4efIxeWRcoSKTpBb8jtpt81vSVDzdzZmi69aFrRgMkTb 9wEt4AvBDolOD/bY1sq6cqyBIWQygGRz7iD4wCmhgYie80u3CEZnnaXtHETxSwImyeHJOwWqCHj I9seBOFXD2Ers/NATg+H7g0m04BqbrAX9kkUbHy4RP8Eir8iuJDAqEB7Hdrtz9DN6VPWnn0RnWg UqeTwewMecKfxXXIaTnGi40EwvyUzWTUZrDTXCnCzV2sn5aYtqJ4CYGKf6fGyFN7ANLPdUSSf46 K/vTnX9ds6lGf6/qgI033ELt6iV2UHWxRePwvXBnSdws/dzlGRtfOL4hkPp4U/6ZTGymJGEsd9z me/xRUDo6rkJXDPWdNPvVAGaN+ROuQe75oiunWZnMzQUgUEky5IV8FwkMh+xh2YU7p8dzFOSOAf Bl99DNgAKQldUGRNUBA== X-Proofpoint-ORIG-GUID: vIb2sbTSuYzZbPydDgP6GdXTaDbaD6Oy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_04,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220015 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 01:26:58 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 651C7378D75 for ; Thu, 22 Jan 2026 02:09:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047763; cv=none; b=E9HR5Nrqqnpj4liDaH6iczMXvZlxnpIpWvY3x8XLQqcQbybvlr80BX1MAhgd9vaiaC4RbCZOMcRqybYYTomx3Ak4FC5Glnr94F5uBSAahZotDwgUiZP1AiUX+8Iar2N2T/Nqvc33+7OjHUGCJTq6MYJTHhnuTGPurkaZ6/om9S4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047763; c=relaxed/simple; bh=p/EYgKAxaaL5UJIsoMUBZ8xaXQZIc8SFlYxM5KXNFS4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Cd6dBxorVXZY8Lxv8kbZ8RqziJHAuZDihelHjSdqbBFJgj4xAeZe42opqXhl9LzDvWlo+qD005QsbbvJhOnsSLJwAsRhRQHJ/ddr3z9HYtsyuAEWYu/UlEz+6AyUJXe/Kg+AEDab/++HQRJ9fYQCaaC9BXjR51pZm3+RYGjcpyU= 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=Qwvvpq2z; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=E618Xsu0; 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="Qwvvpq2z"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="E618Xsu0" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60LLqjtU3868713 for ; Thu, 22 Jan 2026 02:09:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 5RMmw5T3DJEfd2oLZA9PjRoPTI6iYtYJvdsfO6CIsIo=; b=Qwvvpq2zIX5vMahK 3EpUkUevLl+wNvOei9WWJ6WwhQ0niWW1BrbsAzq++KSPUI47sK+oDsbT5Zm1mZyj MYHHuqNIzyA1sHVzDvPddinM15Ed0Qh0QYESYQQMfDDceej6P9NYvhjh/9UR7rKW pZatQeDjE/jAQZNR0tWqjPBXhQ4QWPt6g14c64g4Jgrd4dk85JhYLgDAx++oapks nbZJs+EAOwlUbaNoE/aLBv8v/dD1/k46xPpraXHZKAKuzLZcmLNFvwQoLrQ198SK njDdnDGrH0NjpLdacO+e1m3gKi+QVv24Xk4tAsPpXdzU6+6WaZIRJxzy2wURR3S8 or8D1g== 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 4btyrpj8xg-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 02:09:13 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2a773db3803so3764985ad.1 for ; Wed, 21 Jan 2026 18:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769047752; x=1769652552; 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=5RMmw5T3DJEfd2oLZA9PjRoPTI6iYtYJvdsfO6CIsIo=; b=E618Xsu09yv4utM3hrU/agIr8CqHtjR0zMncvqUEuNiRgSRYJcEeqM/exNav+2GsKb FMLEzEv4fc/KUt8dOi6jnH2n3k7ka26/j96ilL6VgyBCyyy8jIt69izd/2coBq+dJ2mu p6ZoGnsxurlc+KnDqCI8AKQLeoEY1cJhKU579QQTrL5QNMDbkjE6b2wcezKbmxsPJiMI GL1208cvrXqH7lY/BrbrfaqwuTbYb8IPUdreSrBiS0D93xlb8yWMO6nYfYcmy2VuBQeJ 8zwZbXYHvRlEEq3cumUwdkfLOtoN/X1DUA8Ff9xZtrWC/A39AgiUhEHSyZuVGRFEq0aB /p+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769047752; x=1769652552; 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=5RMmw5T3DJEfd2oLZA9PjRoPTI6iYtYJvdsfO6CIsIo=; b=nP+RvFTGQtvwaht/S6SgZj/2YkFtQ9gTIYwSqNq+1+ZMikMTWP3g8oc1XK5sMk5nuu OW1oC5o/D+UVqXP478TdYiYS99/z2lZEyotbmYGLFSu7RIDLrF7N9d+k7meRJ4QnR0VL qq4VV4WoinGjcNofmHBg2Hi0WKVi7cH3b3+CW5GjAfzRk8WBAY6JxXPvKwkgmAWJ0Qxh kqjUuI1cG6hHzXX8gihc5zOdWDVNCojkVT4EYD3UQKCfzPnJQIZ8oKDyM40WW13VV7U2 5aQoVsk0uynb3n69AxYWVhl9rM+sGO6HnmIaIW1GlVkVHzBMVrjd35aejZ9Ul/1Fcb2A Rk9w== X-Forwarded-Encrypted: i=1; AJvYcCWR1CJWbiywSQrUVKGbbEpismSmexleONDMBlVIcDkOGpfr6H+qqYlFhk39e+9F94z1QaNfpG+bRBm0U3E=@vger.kernel.org X-Gm-Message-State: AOJu0YzaZP+5ebGICsjKroe4Y9h66cDl/WRbDZLndQxHEgUsRqGYgh3j UgZ9JGLpUoK04ZJBijzPlEjI1AnBlb4+a9pWAQs9yhUP8Tyi2RK/rZK0l394QvBR8wA8OjfXLe4 giK4DOtB111HYV6vAcRRBqR8a5hxOC50IbPBdTEyKxjj2DLE47G1A1MILdCNTusGtUK0= X-Gm-Gg: AZuq6aJ0KKsmPdaLiZzUBJejQdm3fq/ezor2IN9NcT/SoAitmeUu6GyNAVUBrsc2/Dx 6Uqj9gPg9NkRtv+9dYtm1TA8veW/9+a8wN/16dnLWmbfXHlYLAZa8gqI/a/g8jxJYTjmwdDF3N+ FE6n7Rb5LS9BEBafKcds0B1HyYrIgY3UMkjejjOFbBfAxkVMd8MKdMKcvc/GpdCZ6vzJjBVp3r1 FWLzHLsRQRBLjVIOzpZGBqChlADUaSKp07uGRBcDymL2ZhhcfmD11c8EBfMqtN0EHc7ZNmolw/2 TL/xd8vX6mxOvYDN2WLAdy+/eM6t5etE9DsF/U+8vGA5FsXu0eLTIXMl6IO3+h7HdrdvvYHPiUK 6BHCwgMFtWI6u30Vd0BaX/DnlDIXY4slD+NcTJXbLI9hQLKNwRCcZ64b7xI6Sy9zB467de7DR X-Received: by 2002:a17:902:d583:b0:2a7:682b:5098 with SMTP id d9443c01a7336-2a7682b5178mr55720305ad.9.1769047751600; Wed, 21 Jan 2026 18:09:11 -0800 (PST) X-Received: by 2002:a17:902:d583:b0:2a7:682b:5098 with SMTP id d9443c01a7336-2a7682b5178mr55719925ad.9.1769047750947; Wed, 21 Jan 2026 18:09:10 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a780a4631csm49710305ad.18.2026.01.21.18.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 18:09:10 -0800 (PST) From: Jie Gan Date: Thu, 22 Jan 2026 10:08:19 +0800 Subject: [PATCH v10 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: <20260122-enable-byte-cntr-for-ctcu-v10-6-22978e3c169f@oss.qualcomm.com> References: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@oss.qualcomm.com> In-Reply-To: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@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=1769047715; l=24608; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=p/EYgKAxaaL5UJIsoMUBZ8xaXQZIc8SFlYxM5KXNFS4=; b=89uaxEC14CDwM5QyF8v5LPz5AumGN9Kx19PBT64oH22DFfVVNMx6CyATnQhF95KGSMc9NS/wc 7iU5/yDEakjANBht+/EcbWtwVFQ+u0kkxD6GLDORuVqjnwyxKe8tFrH X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: _WQjipIyB4xgPQV7VXkhqjBy8hlfmKKh X-Proofpoint-GUID: _WQjipIyB4xgPQV7VXkhqjBy8hlfmKKh X-Authority-Analysis: v=2.4 cv=KpdAGGWN c=1 sm=1 tr=0 ts=697186c9 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=TrPPj8Ph-2G9coJyck8A:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDAxNSBTYWx0ZWRfX8jjMaTDkanQj +sGx3d4Erbk9HGRe7L6JpiXvuy3J1vcVujSFv63jB+UZG4hjG+4wOq9Tn+6SCVfqspo2Z36OIzv YSlMphUmoehuhvKR8984MeV+RCJJDsK0iLxCKCXXXobzFpGOMJZocnoWsHRNGPBN5VSxplUdeL9 JvTj1WXtSPA+fY7cBn563VePGVrblqUA+vLMdVmn4Fal/Ve0/exj8lnJEULHMsOE/QJTBcT4rKK dDz6GH1Y0ZgOSOyP9rTEN55qNj694o7g1tYvgodHRLtooWqwDvX05tWGvTc5EAmciknOiv8l7R9 W/xu+Oe0b/CUy/nyeRwLtLwvbnGiWxiPlIk4D9aSk2ngpjU7cICy2gucImcz75f8IC8zcgMdgDG erdCmeWwrlYc97eLJwqiZDccN5r/U9zmYJAX78aGFqxDhpN2v1NQqoqtUN8yTos4zrzoIQ7FH+/ kr45jU1fYAZQl4hNGZw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_04,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220015 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 16a4562533d5..417ac536af5c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1173,6 +1173,10 @@ ssize_t tmc_etr_get_sysfs_trace(struct tmc_drvdata *= drvdata, ssize_t actual =3D len; struct etr_buf *etr_buf =3D drvdata->sysfs_buf; =20 + /* Reading the buffer from the buf_node if it exists*/ + if (drvdata->reading_node) + etr_buf =3D drvdata->reading_node->sysfs_buf; + if (pos + actual > etr_buf->len) actual =3D etr_buf->len - pos; if (actual <=3D 0) @@ -1236,6 +1240,20 @@ static void __tmc_etr_disable_hw(struct tmc_drvdata = *drvdata) =20 } =20 +/** + * tmc_etr_enable_disable_hw - enable/disable the ETR hw. + * @drvdata: drvdata of the TMC device. + * @enable: indicates enable/disable. + */ +void tmc_etr_enable_disable_hw(struct tmc_drvdata *drvdata, bool enable) +{ + if (enable) + __tmc_etr_enable_hw(drvdata); + else + __tmc_etr_disable_hw(drvdata); +} +EXPORT_SYMBOL_GPL(tmc_etr_enable_disable_hw); + void tmc_etr_disable_hw(struct tmc_drvdata *drvdata) { __tmc_etr_disable_hw(drvdata); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 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 01:26:58 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 3EFA8378D9A for ; Thu, 22 Jan 2026 02:09:21 +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=1769047768; cv=none; b=O5kAAqE/UQZv5nOGx/Oc0k6z5CcJdec+jMfeNTtodq+JF3mnfu5sW/B6pqWaHcbybLRaQ7zcB/GV4yJ9EecYPcy5/YGZu+y0oB3Hd8wSSHronFLSDQHlpntB4HDDdiAljFgeFrR+V+C14lb2RYoimQj/2kNppV6/mr/2wdAaYtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047768; 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=kHeqcCOkYXlWmaSv/59ZeGLUgy0Vr6e/NEjHmOdF1Rg+nULNotB6FYXKPpopyP9UP2tCZrlkva8KZ0NatnKn8XScIo9BcwDL5NVP9KY5HVi+F+5fHkL1vv1Pw9Jy2z3TVa6n0IubXWRzZFlgsO5a5NSEyn2F3omFByL0oXDvv3Q= 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=KIgsA6gf; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=biZ5pFSe; 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="KIgsA6gf"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="biZ5pFSe" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60LLuT2e3867600 for ; Thu, 22 Jan 2026 02:09: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= Vt0RRfM8pFKfBxD6jKeqJVSWMlwtbL7pwYs+oCiP02U=; b=KIgsA6gf/++GLgnp yOzQIrL5u5xTxvm6RuyMuCAtvzKPCIybMa0Ia6ipu38y5fCfcfQaELKBAWTAmsDc 1TEZDvmNYem/9SdNrZSz+tXTDWqIHqDVdd42FRBr0b3KUHsVG1gjBgG81HXBDz3e UifqyGIQxwmbccWNhp7omAwQiunrOPMZf0ME5Gvzgk7z8kmIYsUEf/dZyuePp46V EDiPu5QWgvBHtHNiRmGOlH4uq1oK4ew3Agc5DPIEavlcgTGV7xTYeduqHJhoca6F eEVIQKWDGlZS9V3MS1jilDMj2t9KZjOawMJjHFX/jvr6Xb4yLxEQ5LfNCifivwNy hu4CZA== 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 4btyrpj8xn-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 02:09:17 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2a79164b686so4622785ad.0 for ; Wed, 21 Jan 2026 18:09:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769047756; x=1769652556; 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=biZ5pFSejzpNyHAhmxfHLsfzYmj7egpwQutE5jjXop/f+sQG1JezcCzA8Jvr/9oNmW V3KdVJ54Fy1GIPkzGjwTKLNfuX/IejICBlmJU3ozlHVkfZMlF9J8hAm7XJeu9r02IF0w zU3T5uQwD4tHqhn+FsXXx2pYK2nCSBDfcR0jcq2iYcBFcMOTDSPgBuvRc0DdU0U8b8Jn DM8FtonONZ2zqoVgvSV/ynroff6tTKW1YUY2O7ZpnOnik4wyYklcJMD5lgoPlbCy19Qy ctLaRea3GxoUClOQ/2K2M8hEKiylujHyxPCYtCjfo11TaP560Uf4VqZsWSfCVj+KMUlD DWww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769047756; x=1769652556; 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=Wmh7gVsR9B7bfernMnqF+4q0nciYTVAMxfnLj5VnHkfpM66m1lFqlOwQZsLf9rYVKV W4tXcnJO0pPtUd+v08dLCzM9bBhrbUbvViaJu6yQP6nHuc9XT4e1XIJhdQElgZisaW9s BWWXUV50BAtFMgEu5sw85q1/8jdHrh1eERnT2Dt/B7XftZ5YeB4qsKQhh6ud4d04GDTi akHciecmzTyjQcLP9l0U0HklMtKW5hexqWOlUQ09DMJFTC7AVnnaewppMgF7dMz5Jfqv Psx8z4VJ0i9XK/8KVv/FxKRxbiaGYV5rlPA6dHzritcampnb15D9RoB+LA9QXRAfso06 YQpA== X-Forwarded-Encrypted: i=1; AJvYcCX7su41gu2tJXX8Lqsa60HOlj5xh/q59qU1m9wXD8XBdECKxW3aYd9708wYSSq+Gws9PPCAtEdOKZ2snKU=@vger.kernel.org X-Gm-Message-State: AOJu0Yws4GnnmNhQM9QQY1T7OGTVKzkHarzLBDARigxBi+c7P/LuANsF W8WuvYKiNgmhhbXgnTF3wnNlIXBraXCuOh2ThoofgwMgvhYYfiXjE3HvgAxE4QYYgd4FCpgguRJ MBaITlD4pcMtcFJIrUusbzG9sk8xxaWYmwshmapxX3DvS1VtL7Kkuxl34vOYIwBUzyyM= X-Gm-Gg: AZuq6aJFwr5xN8+uYVxV+vHX4jpTLOCxy5NTaWVHd05dHcyCWOk/opFVXAkIU/C59zL VJfNnv4Ds4urzZMjA283H6VWwM4lFeJgf4IlvsQ0pZzcuLtpIMre8/ROYrowsyXAfKauWIgjkaL TntmU8FiAUU2z7CzWfjvsyET70266LLfNUVIRt58gsRbV8ViRfjCTxKfIyAXngf6RfPbU5hAtPq YC5PUcRr0KD/t3Ns1DKCXfH/bFDgK5LnvLIxmK3Z7LB0zXf93IIHPwAnayesEHwk0g6qxUPnnK7 XR9rb5fyTkjamq17sw8L6afjDeFJQ+GtwOMcxNFzbHZn1R8psrLLiICSAuZezj3V3OyLiE+k4Dt dSwfKe2QowWHwYfxQNYWsouvC4eX01HETImzaNwQfqmdMwrBOrWg0et2NagroTeRcq3p7cwCI X-Received: by 2002:a17:902:ea02:b0:2a2:f0cb:dfa2 with SMTP id d9443c01a7336-2a7698f854bmr65694955ad.13.1769047756513; Wed, 21 Jan 2026 18:09:16 -0800 (PST) X-Received: by 2002:a17:902:ea02:b0:2a2:f0cb:dfa2 with SMTP id d9443c01a7336-2a7698f854bmr65694615ad.13.1769047755874; Wed, 21 Jan 2026 18:09: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-2a780a4631csm49710305ad.18.2026.01.21.18.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 18:09:15 -0800 (PST) From: Jie Gan Date: Thu, 22 Jan 2026 10:08:20 +0800 Subject: [PATCH v10 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: <20260122-enable-byte-cntr-for-ctcu-v10-7-22978e3c169f@oss.qualcomm.com> References: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@oss.qualcomm.com> In-Reply-To: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@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=1769047716; l=3605; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=Oy7z+jq/TjNetJ2Zgz+w8FIQKCJz069QL66/p8AMAm8=; b=zE/jK9UyRQbvKpqffm83KuM46KoAYI0VPJL922Np2j6tW1PMB3kyKxwvTMB133OMVD6OegYk+ SqkWTifXQahDLNDYnWSxW4vIOOKm8qRn7epsNrqh/MCR7f8AqHpK8iV X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: rvbV3nN2hkky84pDxOEohRPwvKI-jcqN X-Proofpoint-GUID: rvbV3nN2hkky84pDxOEohRPwvKI-jcqN X-Authority-Analysis: v=2.4 cv=KpdAGGWN c=1 sm=1 tr=0 ts=697186cd cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=i2GxayCjj04of9N-vEoA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDAxNSBTYWx0ZWRfX2CEYytenGa6E 8zWpeGzRgcb3vZFhzsIValoLTMaici+yLQb/kJzyovZzDzF2wGzDcBRb5DgXyT9pHOBgIodDlFR 5mTGSR/hgdw4J9n4SrAmB2qeyzcDEly7r3fOaJiRekjWoAV4GeU9WGUlNsXl9Moltte/TQJzkQe HvHCsOjqNVCsCIBhkF1IHnkHMOJg/1QIb4A+kmDy1WtBSNzsSeFp400tYIZXqYc7ot59RxzNT8w C8oTpfw/i4kvsFLhGoJHKTcbWybWgzLwpc4muZk4Rm01g7QGYVPS/Z49FX8a8n47Z/Ei61nLyIK y1YjlBSXi5WSG3p0pvnDNI1G/VfJt22Owx+Fs40Iz9OL7O/3sHC4IfYZaQNCyfSUf9OvC91maUf bIVBlmxDyTpEdh828pltDqOggUTSs0YLNnI2bsiq7ZE+2W1nn0ctcAQS+BFjlYo6V0JlBpPN/rB 07Sq21tCz+1DtDxbnnQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_04,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220015 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 01:26:58 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 977F236AB6B for ; Thu, 22 Jan 2026 02:09:25 +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=1769047769; cv=none; b=lRs+J9pd1HRIfrPmrHDy/+aNEqlO03HBHXaTuWuXMg/Pv1B2Vws6Lj5Oo09yG5QFrECMZNfwPL2tAZRrge6LWafCtiyZ2AZzQrBtYvPLORWbyOm9j4Q1mIa3Wd4c8NPPEz+FNAZcQ/i05NLv7EfTWZmXiMw3kfbrbFhrhwEVNlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047769; c=relaxed/simple; bh=U3SBm8Q4F2Lqg46nftP77Qbyf63TqJWnGptxyfW3r6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kcCfx4fBvC4kHGCesqnu/dYy5ojn+F49J6on168Fo8jDnJXhdFkJlQAKc7vjhVK6LhseL8wlnsefxnHC4RLtuEgN3oursMpKcXlXFamKRh3VxASe4wobrtDzTbFqLnuJTPrBDZ2JnkdID9V5iMllKZXSwjPkcYOVaHTc5pui0kI= 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=BZMT8Z6a; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=AvcLSG21; 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="BZMT8Z6a"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="AvcLSG21" 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 60LJ1RmZ3902080 for ; Thu, 22 Jan 2026 02:09:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 2hUWnOSTgpb39HiN4iScZAjggx5kZGetEG2O1nLvCqo=; b=BZMT8Z6aMJtCZ+DZ wUklgb+eqJn24hQv0mrEEtwD7crXLJ6a/eRC63tiFNslClsoD58FML5FJmCgLPml +V4f3R/4f7IUhJEEvDsmom518hdnVAyzFZILBU9DekztZoGZZaYsxKeTWIgkWYVy Y+xOvKS1algFUWKM4Et3pkWLcMMPe9TBu9jLGFXVK+GEsThGuwAXMtNMrnpBqRQC cYGlhPS7yYd0QUIi5BeG4XRfCcRlhIVeGpL9Mgvh9cVpJQIyz2UayEF5vZiLSR2Z /wDNKY102NxP+Ikyp4blk2IuzQ1iH1mJLdFEh9jnJOTdGPlP6J6GI8BMV0ymE6I/ vGcL4w== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bu4khh1t6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 02:09:22 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2a7a98ba326so4656345ad.1 for ; Wed, 21 Jan 2026 18:09:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769047761; x=1769652561; 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=AvcLSG21TshtbJL0SaLulxFmjnvVvx+bGg+e112a0iE6JxdNn6FjpBWK54/JgPx2/X 4F5HwB1MH4VUQclIJ6YFYyoU7qcO7DLIyquDRzbtfhx5UetDzjNF8w0k+i4FvPLQiOSD y8gGzkAxAtfbLtqlav7N5zGWe0ojzvZZVry5d6UA8KguOLQEpcTokf8M5rWB87iVsQc7 VosiGYziAaOunyN4Ct2En2HoYAwKzimiK+N8Gl9+/IUZfirCc0ieG9zN/yld5a/7p5uW eRbjaI6TmtzdUGY6VljMA1kGWqPwJLDUTlxCBzGOsnPSvizQ56wPS3hfP+KXbq3gSAHP rvyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769047761; x=1769652561; 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=EkMmEIVRNQ+5R3aH+dQ43xLUWR0bROTnVAPuB8obYykR8P+NxGwIhbZR0pHVFUCgDl V5Oo/rRoPYWUnm1SmdL/TMguSYKBEP8GfewOIV7THBImI2uLDaCYLSa9C6eryB9GwGDX OBSgwyrd3Y6oyHPy3AqvyujnIsuRg7NMUF2SZKgVVD7zuetgz0pH5ahSskNnRF6bF+xK 8U/lmYxUJ4sFmsQba/RNWT8WXQOlrrvY+cMb0UkEyKKjk4EKxisqRMAMMtotFAAAJKDk oWjs07U4uhcNjqpWMnO6eFOqaA/qrctGeopOZSVg2weG0+LkoJMDnP/OentTpr2PibVy SOYQ== X-Forwarded-Encrypted: i=1; AJvYcCU64caT1tiJB1mfmtGHhw/v9NcvTCiaPo7bRVwT36H5zsQkWUdueAypSEUhUZnsvvUtOc+WQnkOEBfN8TE=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7+26BjaxUIQCL9DR/gZzdCH4RKGWdKleUfYUE7b8Rh+SVWahX lm+ZDtFJ3VFvFWGwQhZOsde4lpYjSC9qysskukeAM1Mofuu2+702Y7L4MJkHBL6bQ9kyIofosrA mw1CFUD9YgSrbJiLCRghrQz900smaymiqvHSpaGzgOIGcq12Ygd9I9iIXXDXamsc4SPtzC0MIf1 c= X-Gm-Gg: AZuq6aJMyk2jKLnYXJ2FNnMOunGclLIdHPV0H7zB9AfDqSrC+5GFeHA0vipp73XDSFL KbjIhUNpjd4nq0gYJf6iLM8bKwoKNPP5o+zGw63db8Q/18/XmTkVhQxkiOmXTp3T/6ij3pSaBxt BAcAJMjgbXBxVUY5aoEIzluNrXqChHmoULVGIN5TnwwYpLsuo8BEfrPM1VDQblsy9klMgZK4M4P I8xZ+P7ZGWv9PqltGkzO2S9SSsWbyGSr+OFB2FzSzkaFEme9TuZtilU2NpKvi0DaiY8Jit1TaBD dIqU9Pa6OqgwYScrsPLJTUJgqGQa2eWiYCBhv8RzjrPjunwR4cDds2PEjIPYChVhIutuZtywDdP MQ2pahSMhiqSO+UBe3VKTNWZVgfEx+Ao4PMka9MYCVDicoCMfOR7evYQcatU10EciBlo3gzaC X-Received: by 2002:a17:903:2ac4:b0:2a7:a6fa:eddf with SMTP id d9443c01a7336-2a7d2f47348mr14195205ad.17.1769047761103; Wed, 21 Jan 2026 18:09:21 -0800 (PST) X-Received: by 2002:a17:903:2ac4:b0:2a7:a6fa:eddf with SMTP id d9443c01a7336-2a7d2f47348mr14194925ad.17.1769047760623; Wed, 21 Jan 2026 18:09: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-2a780a4631csm49710305ad.18.2026.01.21.18.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 18:09:20 -0800 (PST) From: Jie Gan Date: Thu, 22 Jan 2026 10:08:21 +0800 Subject: [PATCH v10 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: <20260122-enable-byte-cntr-for-ctcu-v10-8-22978e3c169f@oss.qualcomm.com> References: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@oss.qualcomm.com> In-Reply-To: <20260122-enable-byte-cntr-for-ctcu-v10-0-22978e3c169f@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=1769047716; l=769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=U3SBm8Q4F2Lqg46nftP77Qbyf63TqJWnGptxyfW3r6I=; b=b0vwksCJSZDVDR3oLaXtrkBBvR0U8dzLyYweInT8NsLxQOJVcZxRM7jEzAoSzriNC6jVcmj4I hz9WDiif8OjAXAC7wlDvD7OgH5Qyw+hXKLUZ4uHJM9F3pTHesvINDnY X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDAxNSBTYWx0ZWRfXy8/paLveD/d/ hNdRZMlZBJY+UXbsLwbV36tdJTfuwZKXH1FsX43xQLzaaoeI8Tlg8npnuJWExfu33IifBS0c+3o Gjq1ajjSsnPAv5Suzm6F4+hiiz0DyWhH+0AmTd4lxNIUHVtq/WeRp3tezI/QoLMZkQ1lHwbsMvT 2JoztsgB9jAS857JxFAgQfL4nUfzjd3FPLHsoqr9zsVdlT56fUbj9MYaTi5GTAIRUdErOHrMmgg bhNYP5W9/7hU/k+fAIAesQJ5fqBt7cGLlu3IywhJ6x3fRRCAJcUzgZC/z7pBrXwSscRwJBR86bA rHVJjsnwbagzPYzrWAheeMeG7xDDZNshsy8ygJGOxaGXJL30S5tGIHO/bWMn6Y8uxu9GBfSCC3i 5gHw4a6/prWn4dE5clRyq7AqVu3nvsOg15kmpZCnbCraiUc+lD6C3Gps+m2t8Xefh7iBY4MF4HY r7xwx1oByAVu/nGoZSA== X-Proofpoint-ORIG-GUID: pdFHBS5bzULs-j-e29hRxi0QbkVLOQRc X-Authority-Analysis: v=2.4 cv=UOjQ3Sfy c=1 sm=1 tr=0 ts=697186d2 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=gBkj9RZkAcI1HbXH1KoA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-GUID: pdFHBS5bzULs-j-e29hRxi0QbkVLOQRc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_04,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220015 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