From nobody Tue Dec 16 16:38:44 2025 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 D0C3422157B for ; Thu, 11 Dec 2025 06:11:37 +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=1765433499; cv=none; b=ASWCBPA/2cw4OSOG8MsVUwrzlw+X7L01PubS/C5ty59knNe0esxwldCmyxo6uc3DVlEk8LEg4bn3U62Yk5KgVbTGyPJ4j6pzT/GULgGvi97bCBs2vkAKvurW6/ApDxZjtYjM43hzEBH0U4ZcKUPvYCcLqKzxxuy9i/JAirV0Iik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433499; c=relaxed/simple; bh=x79EOx0VHbHe/nWXls6UDtNS83yDuFtih92LzPbC2MY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F4AMbNAcrYmsAzW6RNdTaoUVP1zJhB3C4wv5MKXONAEMGyBKDg6dMw5kJWhjg630bXtvlmwuD2nDdB6tchCuJ1+aZvqt4yT/zHD5KZ1O3lRfYkWG7uzARaauiwlNo+KjkK7BnhtiS8TG0WJRXiVxW0vK5f8Dx/F8iUX9Jo5lc5c= 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=ElMS7GCH; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=L6gKAPJ/; 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="ElMS7GCH"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="L6gKAPJ/" 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 5BALRPHm3701221 for ; Thu, 11 Dec 2025 06:11:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= TjPxjq1G/MyM9wZuLe71IZ2aZxQ93j8UibxFtFmopSw=; b=ElMS7GCH9V2NN20v UjfaBr6dwotk2cyymZgw6NjUcYo2cM8nlRKfmX/k3WNYZQuDmqedoB5d/WLmwxtv pMoOIvn4ULR6xU/DzBz+ntckwWzx5pAlPevjRMmFjvElWyeGs0Dfls33ExFOvRKo cLfed7IV4skiBnkbhpgglHc1kRcZyYLa4+Kix5fTqVqz0xHRTPTOsnfcDzo0czYZ g/QS81oHoND02CNnpZWznLN+d3YEI7Ji26Eweq20svagQg90vVbvco4l0peFphrg v7hyPJSEs3cF05gM9TmrhWgfkSn5UfzO2gNJNSMLyVDcBJT0Nur/vJnFyvmyuifS vKnBEA== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4aygsx17ux-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 06:11:36 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-7b90740249dso1125143b3a.0 for ; Wed, 10 Dec 2025 22:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765433496; x=1766038296; 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=L6gKAPJ/fTjVp8QbaqvzjoDk2pFsE9ENPKO/JFCuIYsKwRPJ6pYA0LNljx8FD/cQfp oU6QEfQ6o9VYgAGqwNpUjn0rjVJi4J+CQW8kI+XvKmmEfQPyOLllXM8JmDklxAmdmu5a 1iXqeC9ghz0pLFOXj1fkgVI0llMlbNr13OfDoCQf/N4BWVb0TeCP6kp9PP/cZtiBYV1z vl2HySqXgDIblP2aAE4l7uFp55jvVXA8ragHmlhG8HUqPINflSaGSIs3PHBPGkwWu66Y sZc6Ek4OrnRF/N89VPI56nihwKqXzDwAq5qgq2Z9qFVmpU3sEeck4oBmplkVPOk1wWjr E0fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433496; x=1766038296; 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=nmMQqTE3S1gLLK0AkZXt1SGjWLQ+lpMqx+utXW0IJDHqi84dbL5DxkfhrJ6aztsgss rf1DQbd6Pbf7g68pzXSQf7DV8zJAiTIhKRDykNv4BTse2QPEzCwyIWdh4xp3pwM4+ebz G2/LgQbRijQk/FPQPWlp43/MHyJByDUKC3QS9xMKBCegFDblrhuxhU8Iym8pXVx+T74c EgI8qwWfXG1oBXA7OVdezqiCt6E5Kx70hylQj/nSpgcjwPw8pwDMi/oVa7gzaJzZri6k iOH+nSrqIrX7oyGGFJ2QZqNbvk8skXMEBGjOEqYB8QH1dIizB8DozR03Qgp9suGhrD0R Z0Ag== X-Forwarded-Encrypted: i=1; AJvYcCWPDOnNPXLs32j8OH/CKUwo9PWHv61dbIuMntwJ2wUNrSPOt+NiA/YiI19PhxHFjk8TOYr316mlNIkkTpE=@vger.kernel.org X-Gm-Message-State: AOJu0YwAwEx/xugPbJa3ouhS7hjKS8TaFdcW49zsgHvWGMqOq4IuZKqW nNRz2wqLVepXtczEfYzWkPdXBI+xgG5/sVhB7Tqo6bGGo+QB97Stl0wVStx48kgad5waAqJSe3e 0doOq/02pGmpW/Mi/mXQ3nYsC7Gj+cMbqEIPGxe+EG+gGJpVMhoDgBBpGwur7/DMoEGQ= X-Gm-Gg: AY/fxX6pWdSNi6EMcy0TDgmyZDw39ccQrPzK4zlzYkEcbarH05LwnQwSFHEJlUXL/sg DtdvKYPma7Il2q59FOYCqQsBsOFYpGFq4Zi8tMde1zL/rm2xi3kim/u/4kNtJaiuvSMLLtnQB0W pHzlGFw4ot1C6uHy4I0/VP933R9mIozHDhhAGEeP3QL9s+H5pEtC8uWOLJsxu0gWsbPwsPV0CxF EkuQnIt/nktpRCi0OPwTbDsb0C8pFSYAVCw7ucyLHsFVKKU++i4Wb/FUwM1IQitlaf795m4tFSG pmbL76EqmJGxQtwcTGwCHL/zQtZ5akzdR9UR1wZq/HkQ93D03+/AdBBVytnsYP8pofkNIrvlBvH s9q5gSTxHMFog1XuD/wCmYyNq04afYM+vXBOvEcALhxdYoRFxjuf6KMZmjvWbmMUa7XzJKjCf X-Received: by 2002:a05:6a20:2453:b0:35f:6e12:1862 with SMTP id adf61e73a8af0-366e0de828dmr5308166637.19.1765433496089; Wed, 10 Dec 2025 22:11:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRbnY2BMcR/og395k0ubhGGjQJkENmpxSKjCoZ3XqllWWOS9akD1cLgbfkWaMN6h6ZrKAbmA== X-Received: by 2002:a05:6a20:2453:b0:35f:6e12:1862 with SMTP id adf61e73a8af0-366e0de828dmr5308138637.19.1765433495590; Wed, 10 Dec 2025 22:11:35 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29eea065186sm11725945ad.89.2025.12.10.22.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 22:11:35 -0800 (PST) From: Jie Gan Date: Thu, 11 Dec 2025 14:10:40 +0800 Subject: [PATCH v8 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: <20251211-enable-byte-cntr-for-ctcu-v8-1-3e12ff313191@oss.qualcomm.com> References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> In-Reply-To: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@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=1765433484; l=3769; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=x79EOx0VHbHe/nWXls6UDtNS83yDuFtih92LzPbC2MY=; b=sagTWu5bEdNT35gpTyGdfKMRuJGqVH+fwNnNQgi3O6oNgG0bn+Zs93u6Acp8YFmnH/6Zcn2wW n77eva9bZwOCl4qhBVRZCRPUTa0lqxGR8cmgO3CQj+HsxQgciqmsfUj X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: -1Kx0ahkkK5ds1PJGHUx6yXusa_ZPUyl X-Authority-Analysis: v=2.4 cv=d974CBjE c=1 sm=1 tr=0 ts=693a6098 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=qQZ2XtAyJf2dEkEvaVsA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA0MiBTYWx0ZWRfX3huiZkpqe6Hn 6aE6/83MSvIcNrOD5uB88wdPXADsqoLQAE3y8v/vnhpN/GhXZf+ixegDXwY+6Vu5gTLbIHg9kNW N1liZj6N1tc5QC86eYgYWkG2FDUsxnLDDp9OuCt2Np4aXL+hRqNajnVXtsLd2ewAFXkmS1mDFvt AgXOeepz0bIbv5k2TgY9lt5l4+MsxIy42SnMqeJLAma7aoUbWjiOSRkAZcd0JyWXQN54vhSCbca hB/ydbQXWiuvsl7rWKjq7JQdqnTJO7/I2bcF4fTh2+hfnEO1X1zww/2L+jogezZbQ93anMlwWXu QFMsIP9uz9tsUrxoFsrvKEjMHemMjncV6NjhS3HwE4jvhEW0zs/1wjPbxi9zOsA6N6gz3egwDjo CEEh86x8ghyfAWRWRkzxzcxGGI1/+Q== X-Proofpoint-ORIG-GUID: -1Kx0ahkkK5ds1PJGHUx6yXusa_ZPUyl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 impostorscore=0 spamscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512110042 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 Tue Dec 16 16:38:44 2025 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 17D572874FF for ; Thu, 11 Dec 2025 06:11:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433505; cv=none; b=qU6QJj7J/wC3q0xCfMMCOyr/EFnbSOSWJKLqv9uFNv0MEYgOAr8kUOPJ7C7Aavdkkec41JdLrGMMSqKjmbuh2LFM/A4m2uOvMAtmT9xVwLipK6KfvM5+g3YsbR+FPgGf9auVDNAcp8rTZ/Bs1yArT7asD97a98SNHXLU45Vc7Xs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433505; c=relaxed/simple; bh=V1yqLgVyRYM0PUluEeNsvfvMV9kESqLqhRAs3x4U+UY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EAdVhzdPvcCNyjnS1XNn36wlGxy6kawFeqr99l6U/H1YL0sZ9lvGUIgCQvhsck62bIhuQJ9lMngstcWaS5L4Sl6qMBZDJ+b/MS6y1XjBaTV1vONMQOydS4lLbzh8yM4J/ZMlrpOEyzo84g+QOedI0jvOjNct4/tUNdOtb0bxp1o= 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=BAHuHfzt; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jeZtYhFr; 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="BAHuHfzt"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jeZtYhFr" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BB1GbD63927045 for ; Thu, 11 Dec 2025 06:11:42 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= H37x9ua3ePA/7qaC/cjVE28usIUyXzLi30yOiv+YEFA=; b=BAHuHfztQk7DX8Vo +WTpDE6Q5vy1zofvvcra0c/15iJijCSGpOsJAmNeOs97IBaY1wMg8ZtgnVoObgtV wHaucBwFBmKI5O3ew3+Xj0exx6gqziM5zCsUtLWFUncqb4soIG7tzxOSY8nCy5w8 Mrfu1k7Rh/bjr1r3Y3d3bGSPPFzv3kRwxFNeMSEMOQ84hIfZBLZIgwHUewb1RBcU kHdCutVvIkuJoj4pR5oxp5XC3eP1sRHYHK3owEsSPlIID1YIWy57QaUslWBQel/d zC9WcpZn38WrCH5peH4sz87HlgbYH9dAWOholV6BhgBeIKImPQpe+quHb6fNj4Bs dhwyHw== 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 4aym580pva-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 06:11:41 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2955f0b8895so16562035ad.0 for ; Wed, 10 Dec 2025 22:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765433501; x=1766038301; 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=H37x9ua3ePA/7qaC/cjVE28usIUyXzLi30yOiv+YEFA=; b=jeZtYhFrgWRXJZpr2N0XnyMZMqHCJnVOQHu08RzNkhbHWd4GtoTt+GFOCODDGLmErA WG2+GliLzWYmqtlthHBrg+cKc4P7SPQN9q0O0DR/hwT1JbLhOB1teZdoxCy7pbk2wH9y wexRROnjnqPgkigknUc3uXlyc32X7v/oOTRtILmdS+FeDclvEFip0BDe2FWAfdmHaCO/ OOm7RaEnL/jd5C+lCaFub5egh9J5Om5wM56ngVI5YZdeu8Q+ZXNe11FN8aEd2oJQV2E/ s7d5DW/NyQwNv4bET9lnJJvpJlz/9EdtA8jKKk+8VTL8RNaw+rUsFELC++zLePZkP2HC ql7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433501; x=1766038301; 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=H37x9ua3ePA/7qaC/cjVE28usIUyXzLi30yOiv+YEFA=; b=bJzf0uoLzrX8qCPu19TrsDiZp0k5S3mpWZS0Y5zREQ8rW/kY8+ptAz3+ywLh/pzMWR b6ZpA2AdZqFG6oASQftiOVu84rN/IC7pGjqrIJH8ZfIpwFpskGhrioVyuWHNOugy/yGg NsfBWvNzddsljf1iU+Wv9yNgF1FXAbdZIDF9QouBw+HeeJzxfSmursuR6K+J52mU1oLP /6n3kCwF0fgRx6zVy1T6nA0fhLClk2XT0+K3JKX+Nl4m+g7BSs5PBBh6Rkdw6sAZLg2T csj+QDweDnv4LrTyBV8RTpxnmdUrU82URojbix4C93Px5Z35wppjJaF+hiaM2E89cQOt GLVw== X-Forwarded-Encrypted: i=1; AJvYcCXd68hqxjQLELeiSEdMrvp43JG17jFO2r/ZlJPhCtaxz9yW9bdu3RmsVaQjQ7ebwpXgLmzHTUW2R5pdKQ4=@vger.kernel.org X-Gm-Message-State: AOJu0Yyw0yMRapF0/INLLtctUg+dBkdjRTKp5WkWhEGPMXhIEs7HFplM lbKkhuag09B0AOjb/yf8oIWpK1gcC5XpVf9UhRgVuJm8wtSCvZhR0rwhXgOT6fgPdvVT/KRAHOw KjDPo7jbB4WRp/NthgkvmxDXth/owSd5xvmCtKpqYW5JOvId8qKuFGqnYZSuPjx0ELwk= X-Gm-Gg: AY/fxX7pHJgq2HA1oLhhxi6Q5dieN217PTJmmCnmZFvHr1KmCe8idaSptt7FAYUZovg 890eRG0eySseVMp80yP12wFe4MN31YgAJTjIjC0p4U1eIJy5AaEFprgIACt6VXPYJBAtvFSFT70 q2v4V1qtPUHdde8rhdfu14Ysgc7YaUuJ+VJd0uFQX6Mij/OA61cJUDJ2l3HGG8u3PSPGpIptJkK wmoQoVPGSv6mv9C3naKT8Ev0b3iMcO0gPfz0bJuwVLyDmsH5ocqNTS+CeYcGS6AZd0eLDRlgi1f IxyOPBnihbpAwyo80qgxcKJzIGLLtcnMZ06aFm242Z/s/UwtsXgDTUXa6rQGTnVjL6jjjhhi4dK z/5TzBojI6mkE48aCbbg81GwEEtD1zWMjJqcB+IMzwmWxwvN+a5zWcWzsDlMojHJCqe4C48VC X-Received: by 2002:a17:903:1547:b0:299:dc97:a6c9 with SMTP id d9443c01a7336-29eeebfe83dmr12700295ad.20.1765433500944; Wed, 10 Dec 2025 22:11:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGwYgKqzGeqU7toBB3FXsS20/zU0kWSROq2OAeA21VHW7Aj231W3vxDpdsEaA0jyBj4HPae/Q== X-Received: by 2002:a17:903:1547:b0:299:dc97:a6c9 with SMTP id d9443c01a7336-29eeebfe83dmr12700075ad.20.1765433500442; Wed, 10 Dec 2025 22:11:40 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29eea065186sm11725945ad.89.2025.12.10.22.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 22:11:40 -0800 (PST) From: Jie Gan Date: Thu, 11 Dec 2025 14:10:41 +0800 Subject: [PATCH v8 2/8] coresight: core: add a new API to retrieve the helper 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: <20251211-enable-byte-cntr-for-ctcu-v8-2-3e12ff313191@oss.qualcomm.com> References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> In-Reply-To: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@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=1765433484; l=2705; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=V1yqLgVyRYM0PUluEeNsvfvMV9kESqLqhRAs3x4U+UY=; b=8bi2aJgwsd3U0FCI77yLrfMBwxWS5FP25X0Ek9isQ9rjD9FpLTnLlZ+eJ5y7aHJ2RNUNOBFFk 6rOoVUCe+mICa+ydcW1naz7MEek9HQMlbNOYZ4gaZV32mTlwUl4sMTy X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-GUID: D7C_az5TQhvz4YNCi79JIkFkf7Uc1fIV X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA0MiBTYWx0ZWRfX4KJ6hIn2ya3P bA1m0+JAPmuxIzuLj87xIiGFflmt8XJtICmdGjzc+3xiuWOd45q06/jwvmQjYX/cxtcNU83tLj1 2Y890Idg+meUkxrxQWpTBKkJCBvynjh0YXYBp6oMd4Iyz76JNVgtmtdLSgihN1BHHSgdi3kpXw9 5cT6HqEKTgvJK6Y7EES4mv53vM8YWgtFObnlINhgDPT8bMZCF6Mz+zVur0I7cc6optroaQdLPIo yi+0q5Yx1HdkCbeoUlhko0+/xLSCkx4yO3eDZIa+sBoFKylzl/Q9+7Np4nYgozq5WLh2Rt5/RQx dOHFTBdb/CR1AaNjMwc7o5HLCQHsOAixpN8RADjDJyNo3R627xZ0W972eoV4ID5RNHlNX5s+Sdz oE8PTeOgofe0eGRyIHzMnhFDEvX0sw== X-Authority-Analysis: v=2.4 cv=FYU6BZ+6 c=1 sm=1 tr=0 ts=693a609d cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=AzIya3-Hz0U1LB2V40wA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: D7C_az5TQhvz4YNCi79JIkFkf7Uc1fIV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 phishscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 bulkscore=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-2510240001 definitions=main-2512110042 Retrieving the helper device of the specific coresight device based on its helper_subtype because a single coresight device may has multiple types of the helper devices. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-core.c | 35 ++++++++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-priv.h | 2 ++ 2 files changed, 37 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index 0e8448784c62..667883ccb4b7 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -585,6 +585,41 @@ struct coresight_device *coresight_get_sink(struct cor= esight_path *path) } EXPORT_SYMBOL_GPL(coresight_get_sink); =20 +/** + * coresight_get_helper: find the helper device of the assigned csdev. + * + * @csdev: The csdev the helper device is conntected to. + * @type: helper_subtype of the expected helper device. + * + * Retrieve the helper device for the specific csdev based on its + * helper_subtype. + * + * Return: the helper's csdev upon success or NULL for fail. + */ +struct coresight_device *coresight_get_helper(struct coresight_device *csd= ev, + enum coresight_dev_subtype_helper subtype) +{ + int i; + struct coresight_device *helper; + + /* protect the connections */ + mutex_lock(&coresight_mutex); + for (i =3D 0; i < csdev->pdata->nr_outconns; ++i) { + helper =3D csdev->pdata->out_conns[i]->dest_dev; + if (!helper || !coresight_is_helper(helper)) + continue; + + if (helper->subtype.helper_subtype =3D=3D subtype) { + mutex_unlock(&coresight_mutex); + return helper; + } + } + mutex_unlock(&coresight_mutex); + + return NULL; +} +EXPORT_SYMBOL_GPL(coresight_get_helper); + /** * coresight_get_in_port: Find the input port number at @csdev where a @re= mote * device is connected to. diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtraci= ng/coresight/coresight-priv.h index cbf80b83e5ce..8e39a4dc7256 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -157,6 +157,8 @@ void coresight_path_assign_trace_id(struct coresight_pa= th *path, enum cs_mode mode); int coresight_get_in_port(struct coresight_device *csdev, struct coresight_device *remote); +struct coresight_device *coresight_get_helper(struct coresight_device *csd= ev, + enum coresight_dev_subtype_helper subtype); =20 #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) int etm_readl_cp14(u32 off, unsigned int *val); --=20 2.34.1 From nobody Tue Dec 16 16:38:44 2025 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 A41FF28C5AA for ; Thu, 11 Dec 2025 06:11:47 +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=1765433509; cv=none; b=YtdDoab/5LYUte4/wk1Apq3buZ/MsV3VHR69NK3OeWnBoVeJMPz4C7r2nGQsI5VBrcQPJvEf7SOOKNMIWObhtrTInYhIeCk41VvW948MmYGmoUzlupfFUTJ+Q0TQWlcuDxkF4qt48nHnL9cZDWFF2dBkIksjoCO3PHnUNvm4qTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433509; c=relaxed/simple; bh=DQTHwrw5ZG2QGJ8ed13ET3tSu6napM1SixB2aelNLzY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pQtyLE6TVxww0MpN4oE4rh+/UmUL3xHbejpzJKCVxCiFxasX/xuaRztDRFBSWR+2sqRMUg+Pv9C7mD9/SeumF/rPR732r5aQxbGYbQxtFvhRF+l9ah8BHOIBl81edlKaSAhIzOZ/OqAr/fdUXQYrqJzunuZV7WsvQwrkAFIyqFk= 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=HTkJrmAr; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=S3u14t3r; 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="HTkJrmAr"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="S3u14t3r" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BB32mYT3683145 for ; Thu, 11 Dec 2025 06:11:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= yJrhvTjKt1gwCDmMIJvxf5jwPN8hV2K72Dpp7uCkoXc=; b=HTkJrmArXClaos7w JjNQ7XvcPeP15C4UtLIUu/Qe209BOCYhpdXS5z8zcKMZG1JHkeu/5sXDKKpFSyYB VWtNOeFGNA0h1qM2m9XthzunymYW1lJ8vh7NB5lhOSOM1H+k6GJcLrJoC7xKGepe iQZnu0vzw26jXpHIwo4FKW1DcL0pKEzLc0c5ruRAZxzod7LESH93B9st97j4ot35 9Lo6n3gorcTQdu3rfAhMxxJO/EuYZgzB/SLpiGcI0PBjM1BplMWZZBpCjKJhLlHy sKhUcL85vynIU30/H649kOL0VdSsfAjbSJ2XTtKHJ6qwv5z45CIFyfa562TpXB9Q Iklxfw== 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 4aynpvrep3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 06:11:46 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-299ddb0269eso8828985ad.0 for ; Wed, 10 Dec 2025 22:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765433506; x=1766038306; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yJrhvTjKt1gwCDmMIJvxf5jwPN8hV2K72Dpp7uCkoXc=; b=S3u14t3rfAeY2nmJJbzgx8v9VDkbr6YIwxl8EjoCpOiveOqpNkYZvB+r3+DEgFBct6 kxj/AXbeIffgkCEJDZgeu91EJIqui7SMmcKhFC5z1m197FnL7dkZ40EcfBEHgyNWAkvq b5JMdPaZY1pbUxrEIIckTaJsyoHGZ3CqJmVVaOka8jSub74/H7giebqzyys8+EBlp0Qh IS8yl6WFstWOjwLhaF3+NDC3SqJ+Ioq0JXyGk0R6s9hAvswfppA56ulN09S7LSSuG0ry VO2A2CQU6BjHdV79bp+Sc+wmgC9GRs8rhWI3fMi2JLa1j8I2r0LRPcWo6kAG/YsQbs2a 1nOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433506; x=1766038306; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=yJrhvTjKt1gwCDmMIJvxf5jwPN8hV2K72Dpp7uCkoXc=; b=Kkk+WkPw/KG1RDCBtQGVeCfMRwLNVC+DRnSoyC1DkwNZ+D8PTcTxzLLK9SbhpUHHFc AL4aD9j2SC7i0hVekzUCzcCEj+F0vKzjiUfj40KdislKFsHY8sxkjWo4U76LenOqfYUo n7Nnd6sgVMMHPG2FaD3Lv22yKuLVORzxiVAnudOhQl2ar+Aqotyj4D8lPuLUru7L/Zin HNPttErqxnINPHiYXOI7M3rB6lwDZMu3yPJWgzUIs0wuS/nzqbOM/TwZipWz4hGdFWfU NojfJPU5z8u8oqmAFUDpqLz2MHXTFxo8mUwln6pfcahQabL3/vTJGpAjePUcpl0zhuG5 IL5g== X-Forwarded-Encrypted: i=1; AJvYcCV72FMLxBBrHs6z8sdANhiw9t1uwPqOodnCpW7Gn7zNnVlP9sPEt/cd3GMnhkdqntKkcHC1ykMxUKyy2F4=@vger.kernel.org X-Gm-Message-State: AOJu0YzHsLEOzptjmstmE7+1LThodGYg+zo7nrJ/wc7yBTPV7wkW9BLN jj0bxiT2Nr67F1DHbVGxKTE//G8G8u5+JPaQDO/Z5ixz1VVo1/U7opQywehDdyxJTsXcRnl+Jjb 7EFu/LcQtxoE7e/7CdO87VdsuV4TPHDhUJfEi+LkqLXWJv/in49x3nshG7iLSTUas3zI= X-Gm-Gg: AY/fxX7kypIqptL5KIhopJfcZ6q0aikPqHnd7W1tVmUIQOkYhASrjZydujr8xwdr4he fYCPUoUUqA3zBev4u3hAc9ftNVOmFgXoJOB7t1dzX8DvpbJ1sw+6Qujz48hejJMOpzppuRrLOQh AHn7bMXiVKySFDJMz2sUtkYI05K4q8oAHiIUBte79JU01WVqO1LpXy8JbZuD36vu9Ylb4AxSAYE EThUY91Tivbp2lBwJV4L9u1fzgUBzZ+YYcxvjuNLAyKsylxXvqefMJgY6LZM3CHJpOlQSVkfwuB mcjcqRQxBNqxjJhiveRe6/J8MxCDnmkv7D4srTo2ETbU6oenIgeDaU8zQrjjxzONt9d099dBZrl nMkHbvQcCLC+tu4hlpKtGJvWp0/E5gh+5NIwLJFlQ5JHd2xBAk6n3NPD75pw+LJkex0fhJy/9 X-Received: by 2002:a17:902:f78a:b0:29e:9407:a8c6 with SMTP id d9443c01a7336-29ec21c39fbmr55048775ad.0.1765433505720; Wed, 10 Dec 2025 22:11:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmhJey7P5OEZrYWh7Wf9CUrfd97GYN8XgIXtdEl7Uj684vfnW3hEsU0thBw5cWALdWdhY73g== X-Received: by 2002:a17:902:f78a:b0:29e:9407:a8c6 with SMTP id d9443c01a7336-29ec21c39fbmr55048425ad.0.1765433505189; Wed, 10 Dec 2025 22:11:45 -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-29eea065186sm11725945ad.89.2025.12.10.22.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 22:11:44 -0800 (PST) From: Jie Gan Date: Thu, 11 Dec 2025 14:10:42 +0800 Subject: [PATCH v8 3/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: <20251211-enable-byte-cntr-for-ctcu-v8-3-3e12ff313191@oss.qualcomm.com> References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> In-Reply-To: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@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=1765433484; l=6191; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=DQTHwrw5ZG2QGJ8ed13ET3tSu6napM1SixB2aelNLzY=; b=KHUcIR//SRmrw3mm6deFgt+0KSEPsXQ3gzPI5c/pvQ5SC3KRSF/PqAfEsQTtz2AiWcOvmgPp5 FqXVtMzprI+A6OZK9SX1hmRkFq6IH659oF6mhec6Rh67Sj3zmGYKGd2 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA0MiBTYWx0ZWRfX5q6GKqhDP1mt KKSM/oCbT/P6EZjqagGnRJ+7WjGtuq9F00pNdqCRwyL/63KMbDMPRIaVxGHsk10oSWsqPx5wUgL z/oRDhhlQRu9jk67Vo6oS86VeB0z68sb2BEC4p6l+KBYzTnweGWcFS41jkPCXMYe+WuPNPLOfWR Bm1jZICuoOuIbnzqTkNO2Ql8fS55O7mQsMpFTNDvfrAJiD+hvYAkrkpWsQdsgCteaV2185WJz23 vvx98md5qwPGELyC4iJHAPdfwEWhOk+nb7Ft47/L0mewMNSldV1cx11vcpz5SjBnGm94/CUdUvN FAWW2sIPLiu5sxVTQwHKX9SDUp4eK1wiC+epI1kVrTuU2nJ4dU9YON37ve4DhdIPUiSJlcTEWwh zNcN/e07N/9k42xX26wIm1XTu/HVNA== X-Proofpoint-GUID: 0pi6YMWSiKTGt6J3zvG9b3xX2uJR-XNN X-Authority-Analysis: v=2.4 cv=C6nkCAP+ c=1 sm=1 tr=0 ts=693a60a2 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=AScg1gZdVb1XvqdcXssA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: 0pi6YMWSiKTGt6J3zvG9b3xX2uJR-XNN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 impostorscore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512110042 Introduce functions for creating and inserting or removing the etr_buf_node to/from the etr_buf_list. The byte-cntr functionality requires two etr_buf to receive trace data. The active etr_buf collects the trace data from source device, while the byte-cntr reading function accesses the deactivated etr_buf after is has been filled and synced, transferring data to the userspace. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tmc-core.c | 1 + drivers/hwtracing/coresight/coresight-tmc-etr.c | 94 ++++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-tmc.h | 19 +++++ 3 files changed, 114 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwt= racing/coresight/coresight-tmc-core.c index 36599c431be6..1ea255ffa67c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -840,6 +840,7 @@ static int __tmc_probe(struct device *dev, struct resou= rce *res) idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list =3D &etr_devs; + INIT_LIST_HEAD(&drvdata->etr_buf_list); break; case TMC_CONFIG_TYPE_ETF: desc.groups =3D coresight_etf_groups; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index e0d83ee01b77..2b6ca1f8bed2 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1919,6 +1919,100 @@ const struct coresight_ops tmc_etr_cs_ops =3D { .panic_ops =3D &tmc_etr_sync_ops, }; =20 +/** + * tmc_clean_etr_buf_list - clean the etr_buf_list. + * @drvdata: driver data of the TMC device. + * + * Remove the allocated node from the list and free the extra buffer. + */ +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata) +{ + struct etr_buf_node *nd, *next; + + list_for_each_entry_safe(nd, next, &drvdata->etr_buf_list, node) { + if (nd->sysfs_buf =3D=3D drvdata->sysfs_buf) { + if (coresight_get_mode(drvdata->csdev) =3D=3D CS_MODE_DISABLED) { + drvdata->sysfs_buf =3D NULL; + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + } + list_del(&nd->node); + kfree(nd); + } else { + /* Free allocated buffers which are not utilized by ETR */ + list_del(&nd->node); + tmc_free_etr_buf(nd->sysfs_buf); + nd->sysfs_buf =3D NULL; + kfree(nd); + } + } +} +EXPORT_SYMBOL_GPL(tmc_clean_etr_buf_list); + +/** + * tmc_create_etr_buf_list - create a list to manage the etr_buf_node. + * @drvdata: driver data of the TMC device. + * @num_nodes: number of nodes want to create with the list. + * + * Return 0 upon success and return the error number if fail. + */ +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes) +{ + struct etr_buf_node *new_node; + struct etr_buf *sysfs_buf; + int i =3D 0, ret =3D 0; + + /* We dont need a list if there is only one node */ + if (num_nodes < 2) + return -EINVAL; + + /* We expect that sysfs_buf in drvdata has already been allocated. */ + if (drvdata->sysfs_buf) { + /* Directly insert the allocated sysfs_buf into the list first */ + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) + return PTR_ERR(new_node); + + new_node->sysfs_buf =3D drvdata->sysfs_buf; + new_node->is_free =3D false; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + while (i < num_nodes) { + new_node =3D kzalloc(sizeof(struct etr_buf_node), GFP_KERNEL); + if (IS_ERR(new_node)) { + ret =3D PTR_ERR(new_node); + break; + } + + sysfs_buf =3D tmc_alloc_etr_buf(drvdata, drvdata->size, 0, cpu_to_node(0= ), NULL); + if (IS_ERR(sysfs_buf)) { + kfree(new_node); + ret =3D PTR_ERR(new_node); + break; + } + + /* We dont have a available sysfs_buf in drvdata, setup one */ + if (!drvdata->sysfs_buf) { + drvdata->sysfs_buf =3D sysfs_buf; + new_node->is_free =3D false; + } else + new_node->is_free =3D true; + + new_node->sysfs_buf =3D sysfs_buf; + list_add(&new_node->node, &drvdata->etr_buf_list); + i++; + } + + /* Clean the list if there is an error */ + if (ret) + tmc_clean_etr_buf_list(drvdata); + + return ret; +} +EXPORT_SYMBOL_GPL(tmc_create_etr_buf_list); + int tmc_read_prepare_etr(struct tmc_drvdata *drvdata) { int ret =3D 0; diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracin= g/coresight/coresight-tmc.h index 95473d131032..9b3c4e6f0a5e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -208,6 +208,19 @@ struct tmc_resrv_buf { s64 len; }; =20 +/** + * @sysfs_buf: Allocated sysfs_buf. + * @is_free: Indicates whether the buffer is free to choose. + * @pos: Position of the buffer. + * @node: Node in etr_buf_list. + */ +struct etr_buf_node { + struct etr_buf *sysfs_buf; + bool is_free; + loff_t pos; + struct list_head node; +}; + /** * struct tmc_drvdata - specifics associated to an TMC component * @atclk: optional clock for the core parts of the TMC. @@ -243,6 +256,8 @@ struct tmc_resrv_buf { * (after crash) by default. * @crash_mdata: Reserved memory for storing tmc crash metadata. * Used by ETR/ETF. + * @etr_buf_list: List that is used to manage allocated etr_buf. + * @reading_node: Available buffer_node for byte-cntr reading. */ struct tmc_drvdata { struct clk *atclk; @@ -273,6 +288,8 @@ struct tmc_drvdata { struct etr_buf *perf_buf; struct tmc_resrv_buf resrv_buf; struct tmc_resrv_buf crash_mdata; + struct list_head etr_buf_list; + struct etr_buf_node *reading_node; }; =20 struct etr_buf_operations { @@ -445,5 +462,7 @@ struct etr_buf *tmc_etr_get_buffer(struct coresight_dev= ice *csdev, enum cs_mode mode, struct coresight_path *path); extern const struct attribute_group coresight_etr_group; +void tmc_clean_etr_buf_list(struct tmc_drvdata *drvdata); +int tmc_create_etr_buf_list(struct tmc_drvdata *drvdata, int num_nodes); =20 #endif --=20 2.34.1 From nobody Tue Dec 16 16:38:44 2025 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 37C76283FDB for ; Thu, 11 Dec 2025 06:11:52 +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=1765433515; cv=none; b=AKmYKseNcpICZ7TB7qu3mbJcPm8Y1zr9jnIgpdJfMhBN47sRftGORPxalSa/NCRosiq0C2sWsgpTeWJswsIhnzWRZ/531yzQgjOVQEFeSOfTrAKpAc6kml5DRHK+X9XdWTZNVsbAe+0zlDMFfMjACbjlV9sSBdt9xSTRCgxmTJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433515; c=relaxed/simple; bh=adb+NstK0OrGdQHboby6lmZs7rWs2zBc775hVSg6Ay8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e28N1DJAFNsk6aIrmHG7yCU92AJafAfHuPZuJkEHN91jTkMYJdAu6mctGXgExU8JzALjVSfYR1I0XS7xTyL9fB+7o+bygVDtf4IZiZqong2R4O0Au7Zl8RJl912ltlzyJuErM7L7m/5eWwzAL0CpMUEz+DAB2HJuR0LqNeam9lo= 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=KurbiStB; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=gEQeU9yA; 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="KurbiStB"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="gEQeU9yA" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BALSar13563582 for ; Thu, 11 Dec 2025 06:11:51 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=KurbiStBBVL8b/jP OukJyoI+qoID3RDab0vbpy1BDR815qU2UERO7MBo8ddJwMgQLKJ3eiufYlmgQ6/B 4mzTKSQdfLBRkPE4klWvtTHx2DCx9zV3zSEHlfv9IjUiKc8gMmGoAyTwp3kBBjxD 5dmG/FH+wnIhblUZSKnFU2EUXfxJJxNGe/sg8m/hIHNCBKDINUxNIXXwIZLWFf2o guswoNOu71t3H1hKzwYUEsVLoEWu09AG1aLFdUTkIW2M7QGLZef99KwXTEDJyUTk Ef60pnlKg3QrZNKpeIJjkQfLg3VjAPhBsU+U4y0hkRTQplGfNX5ndndVwlF3f7oG ZIsB2Q== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4aygtfh6u3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 06:11:51 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-29ea258c1d8so18091895ad.3 for ; Wed, 10 Dec 2025 22:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765433511; x=1766038311; 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=gEQeU9yArVad5Z/KQnFwnROP2eMlkpSfW5RZFjOvpoZC3VdF07mnqK3uesB02DeqHN MtJ4N20k70GJPAaDeKBTQBwi3nrBs7h86EoekmsjAQiIAkn7lHWcMEtRqImvLIIXD/A0 4adYegR17iTr5l+GiHr7jps3CRDKnZ06gH6P0zVn1CfW7fLi2q+tKmSBc7d8fyfP+Wzi K9kRJ9ZK2T4snOhM0xHZJX4CjjFh9zHgeRXkHxOUgAd54WjOo/NSV/Q5ztnV9Ke3za34 yDVGgq87mF5ihK01uISvPLpWENCxtMwp5nLEUm1MPcZJ9d/Q92pWTbgPMi/cxuD+Trz7 Pvog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433511; x=1766038311; 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=bYkWf0oYv6edYZN/CsyuH353f8QzT+yGF30ZnGRZs4LxHPfrjbFuJPZrJvnAQso/SK L93FW29qPZlmTqdh1zK84+BxOboeVcYpRxevbOYPVL/82jpyVn9kzYrwbp9k6z2yj7VF j6jGTvGIZ3hU53OS1BU9GibUiyxF7s/2UH7RJby76g14wvac4X5PRTXo+bhJYR1uUqy/ jbMMUKWh/mm+2rNKE3qgNYgBE80PnOfytkclQhVsdoP9Z6oT2Jp6z/aSYn4TNMLKWRy8 skNR6rYBrOiWPEpTFxoGyiMyLUQ1kLyeBT+QIT7CCwjH/p9ikL1q2d/ZARf/GcgIyAEz twmw== X-Forwarded-Encrypted: i=1; AJvYcCUduJlucRxXCktw2TVftM5sMt7Eoo13z9DQSziT/sRpiUCrVz6SKLiacipdfVWDHYOHLlvUkY5jWJRRKiU=@vger.kernel.org X-Gm-Message-State: AOJu0YxGz/CMNVCy+JsKf+AMwZZXWQHBJ7wCcL+Zv2iyNcLboZyN65NA JNx/eFsqLJzDbX7Bi4isfwkTDWYZLz0SO0INGcleLN6AB76rph1VfJTdA0IwlXGmS37gqLQVQs5 tnYHvES1U+dcGDhvWsvEIWjih06fOst1HHDbJTz2FcGIZJe96mJEqaDel+7+lbvR5kxs= X-Gm-Gg: AY/fxX6kFX2oJB9qcR4+VisTzYjK8zm5YsTKHTUyPOoUsnUEnDy/1sNerPJmx+syJ4Z KgaZB0qNQ98IPUTqxO0DuQ/39mQTmA279Wl0seUXp78xxiVc8ZyIQP6WgR+nIVFPRgNvCV0W76u 5GZ9wbZ2UqqmO7NRfGP8/vIedIdsEvssPWOc8HoWcycK8oTirHEq/Nh4bhQwtt7WnfEZLTjvkuD TbEGvGL97T/tayUNDh0g52GnPpxUrBxZ/b0onVyhvUXDDDiH9QHB2iI8I1aOwB1mhCBfWgt5D5o vCmXFIAWGC8Deu0HFCbrXK7gtcOzx0hyIUUdz5SVgTvODFk+WF0M4YiC96D/dQhIn7sIh/qeGnV S6TMCXWZNeA188ejPxxyFakpkpZfPy+YXCAjS0jruhqNyOy9AuBOx3omIoI71LXVyxxthHp/w X-Received: by 2002:a17:902:ef46:b0:29e:e925:1abb with SMTP id d9443c01a7336-29ee9251c57mr20447195ad.27.1765433510599; Wed, 10 Dec 2025 22:11:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlea653ROQml/NDqmt5Qi7x7FLFp59TsrT6XIC7awP3CpQ6dicUKXcpTFHchhmY95IxLT6Mw== X-Received: by 2002:a17:902:ef46:b0:29e:e925:1abb with SMTP id d9443c01a7336-29ee9251c57mr20446935ad.27.1765433510148; Wed, 10 Dec 2025 22:11:50 -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-29eea065186sm11725945ad.89.2025.12.10.22.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 22:11:49 -0800 (PST) From: Jie Gan Date: Thu, 11 Dec 2025 14:10:43 +0800 Subject: [PATCH v8 4/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: <20251211-enable-byte-cntr-for-ctcu-v8-4-3e12ff313191@oss.qualcomm.com> References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> In-Reply-To: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@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=1765433484; l=5450; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=adb+NstK0OrGdQHboby6lmZs7rWs2zBc775hVSg6Ay8=; b=pNNGCo2sKcw17OfdCXYJbjXP6WA9w9ppuOEMl8czhsU9OnxyxSNPtIoM96fqchgeR8rCnn2Sz +lIREvdb64qDQogHnx7wEYF3nw4ZAiIaDryE1VaKklJFSn+qzXyQfwC X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=At7jHe9P c=1 sm=1 tr=0 ts=693a60a7 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=JzqEjpkVlBH90HjAhVoA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: uFNNFaFkLsXnL4jJNyWp944uhBX7anrn X-Proofpoint-GUID: uFNNFaFkLsXnL4jJNyWp944uhBX7anrn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA0MiBTYWx0ZWRfXzDvw0DYlrxKp nY2sk4pY5oicbaJja/8FP1RGkEZ+z1/VXEkGR0+kjR3baXmJgXlNl2m/fYqRUCdR4TYmj5wSmF7 DZHIt8cex5d5fptiIU3DPcWDK2kKUhmZteBv+L0RflK5Y5OBKstG23MVHdyRmE2njlzzrdDRGya eW9vvl+zJltWbGpZXuGAYX5qXK5bNXPBT0k6ze6ZW7QjNFBuw+ciesqletEKyPnSU0EWSrBlxdM uurbs9WQxdJzNkfiBCZHbp5JGDFqOeX9vj6apGnqM4YoLHD0mXlmWKRzsiLQieZJ03wud6viivh /5xMmTTKCaAIihAWSgRb1gS4NOapsntOlU+3+Qy+mV5/zi6WtQRnS/0Rrcujcym/IiGSA81rgD5 wDmoQQINgCYuo2L97p5g0fs9YRvmCQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512110042 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 Tue Dec 16 16:38:44 2025 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 F150422A4CC for ; Thu, 11 Dec 2025 06:11:56 +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=1765433518; cv=none; b=A6a3zyc4SKyfHsxvLse1sa1HMhCzWP/UNRGWfaGl/VzLDUfQJikGVuQdf6tzF2BxHwds2xvF6DJH5yfBnD99cXsL3Uf73G8rfvxTd+XV1jDBqLX9krtWwVrr92BTHxNE4WjPf1Q3ClTUm7X9PwHc6Gum3nlEzhp27vqARISU8i4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433518; c=relaxed/simple; bh=uQDnFuWQfa6/Sdi9CzMqAfsP0M704DoHSxLv9wulLd8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wau2Vh1PO5MguuYvjPQRl1FEBFeeZFJguLatA3Hg5CtKjY5HKONjnBzrLIQIOFtBmdPEOmrk+dtnJsVzMM+Wa0yWcEYZ5nOHnAAi4Ht5ZQyRIJtBD9oVGnU/nX4M2hGihPywNvJhoZIV2n7R9Obzrj+Hk1s3pu2mpOfWJBdXkGI= 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=Dzz6tUlg; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=USmQiym0; 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="Dzz6tUlg"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="USmQiym0" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BALT01W3564282 for ; Thu, 11 Dec 2025 06:11:56 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= xU390iYPL1F5Qvsi5RSyIsOPJpo2qp2MU5IZ2qkkcq0=; b=Dzz6tUlgHM9oRnM+ 1u0bVdPsY5B7Yyyj85RUUJ8mF2HzOAXFR8pifp9/jTFcyDjD5gAtQ2cAPqDJfILe KMBQerBP3IpnKrd6UCCfBbSL6IOb3SRrnkgl3XA4aVVEChTzKnq0buC6qTdyDx85 CoQsp+0TfYZ5JN9CZi49rvV9JwDfA8BxdqXqAye4coOBHv6NTWmbB2OUmvJPXIPH RF2Z9YVXdBRW1isJv3BepGiqECPNOWMVZ10M3+cPSwg1dpZbIy/KAMfncLsZBoL4 6KMpQ1hHtG6yU2qyH6eg+58Sf5rDail4/I4fwi3DAnewgdxM3CfKA+Wqaz6Npsfc HACERg== 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 4aygtfh6ug-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 06:11:56 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-297e1cf9aedso6668195ad.2 for ; Wed, 10 Dec 2025 22:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765433516; x=1766038316; 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=xU390iYPL1F5Qvsi5RSyIsOPJpo2qp2MU5IZ2qkkcq0=; b=USmQiym0MnZGgWWs1p7XM1svWs39F560ys4uGhWCDItWyzgoG3ZJtHnAsKBn1vnuBr Kd6RcLNN0mF5KBUbjh7SPTWMNScDGe/puMI/WMEyCs4EdrSr2W2//K2e+0VQvQN9L75c Hih+tvyqgeoRKd/jd/uvneGAncCoC7ugJcmyOiOz9xN7e+4zduF7IZEBMpTNwUxxyArA pSCAcAsx/FS8bASutdsXLjDRIpgC0GVcqet+2oXgzLzXdRGZSKLp5UbzjVrwywGRYiF7 Ot2604kcqi7Zi1L1ImR5HOlQKg982+izpkZyCVD1t4UM/HX71Ynk/Wu1+1ONx9RM1fGV LNSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433516; x=1766038316; 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=xU390iYPL1F5Qvsi5RSyIsOPJpo2qp2MU5IZ2qkkcq0=; b=cHejNEhBsR0dM+R9TKclCJaAMJanrcQz3VvYHzG7pdEqvck/QHA0+JZlsdFQN8/d5t JQ3etai8thrWyjVr5F9h9WFj/i0RCLeAQIRlrD6sfJ3aSIi+2jJK1mC7y87FtEUrONhE dBebAJMCDSkR4eR8OnJIOWs0MgxKPX8eO1DqTnQbmnVf4HiaaOkX/FrB0idMtKyaecCF QRI68sWJYmZSKdjJqGB0LelfV1pZ+f8/TZl/5PhM/2sU5IMuMx9BrYTIAZKeQcMr80TE sURqAAMZoQDLnSWQAG/HRRTDdOcJKBi0fEEXt1Lk2d8UdMT/bPmfKAva5PCV/s8mpaXG SZ1Q== X-Forwarded-Encrypted: i=1; AJvYcCXdauz7hJDelVDhj3oxLf9HR9Ds2GKm9+z+u5Ti7kM8/swVnyoVYW4w7HdlhnZfkBJSJNB7EZjkP8Beyr8=@vger.kernel.org X-Gm-Message-State: AOJu0YwNyDBj63VZ+YQ2JlsfSlaDL1LW+kdA/C3hzqutqgJtrRLag0w/ mDJ5epmj+ZveZcZFqjSSCPtKRN5GngNFecuDbSA4phQ+kOyGbRHDiKZI+Mg6p4qSUPlNNOttJYg GC0tyy86pjWZBBALLrqv5kCoj81oMxQA7VGsVlvkVZIzYVB8DfrdqjBpKc0LelDMFQ9w= X-Gm-Gg: AY/fxX5SPu5i5ViYfDICOznCdTNO/5qnUhAWHztaU4csZ5WnIXr7hX+ZRrosEhUOdv0 QCa6kDE60N2ELXLWmpH7nZk6OYItVLpJcuWfrwNoo8EPYaTeC4M9dQvaIkiYhvnc9CO3BBAnEyY i0VxBQt2NBz9sOU5yaBEtZ7cGj3koklIpBCo8Sfb1yGDZmYMri3VwMViNe+ElQagkmr1RQKHYnb WTYea1MjxmAM5lWXaVUvSpQAmchKJb5nk/GcZtLgtI6mTgLjIs6FG6TGDWQv3FYCCAdjfNY5oe6 8gzN4yDyP+KCX69YjVUUYF/FbtJVD2RuUrVW3AyOiplI8z87riq/k/SqCGFJ5yRX/H5wgFzlHtw B8Dg93vjPCQMEdf8smUE1N6cEAywSnV9LhthRDXSItS2l1WIb/V2FMSCZW36I/K2FeXSKMVtl X-Received: by 2002:a17:903:37d0:b0:298:2616:c8e2 with SMTP id d9443c01a7336-29ec2d931f7mr51328765ad.53.1765433515648; Wed, 10 Dec 2025 22:11:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEC7bCdOk7ZZttMBSYSwTYu8QQ9vzK9ZaiuFjyDfhihxVmRGXaykxQavGYy0vsVQsfZbu8EXA== X-Received: by 2002:a17:903:37d0:b0:298:2616:c8e2 with SMTP id d9443c01a7336-29ec2d931f7mr51328505ad.53.1765433515178; Wed, 10 Dec 2025 22:11:55 -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-29eea065186sm11725945ad.89.2025.12.10.22.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 22:11:54 -0800 (PST) From: Jie Gan Date: Thu, 11 Dec 2025 14:10:44 +0800 Subject: [PATCH v8 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: <20251211-enable-byte-cntr-for-ctcu-v8-5-3e12ff313191@oss.qualcomm.com> References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> In-Reply-To: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@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=1765433484; l=1903; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=uQDnFuWQfa6/Sdi9CzMqAfsP0M704DoHSxLv9wulLd8=; b=dtvZNc7Ql0EIwNVK3ZcPR/UHLvwtntV81rVMcD579qhYkfIauSpGzGIQ9h1H5xKu53Dcm3DyS wO0rLQgmlE2CxIwwevSyhyC18zapssNyQIas2ur7G7AJhcj3Kq4sEs1 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=At7jHe9P c=1 sm=1 tr=0 ts=693a60ac cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=gSyxy6DGYGa4b6s9XCEA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: 0IWhroZBdqR4It4O2Zo-_raqN0HpwsBe X-Proofpoint-GUID: 0IWhroZBdqR4It4O2Zo-_raqN0HpwsBe X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA0MiBTYWx0ZWRfX1E0aVnSwTHkP vzaGWZLN7HIY3Y30ktuWTAuFZz2wrsdVK2qPkAFTj+PNOtQ3fJ/4OPx9TdxVU+tf/3+ow7+ceEv jf5nqzq/LGiO0gwgxaYmm9sQGJaTZnfy5ZRaJ81/2nrVEjnz/mV/Jesgl3TaKNiU3dYbhCbQSZn i58YsSUdQIYYGVFo5feTKFrQWYluK2VuRzEXvFJuzofyQpr7eulrJQxiFtF8QfLwb9kX17ZAXQA lT/FKdi0emd0NfUI0nNWjbt4p2R5L6fsDLZimiaB2UdTO+42Ba18x96NVcpbHoFF2Dr5bdS+jLZ 7kytY3iEuAOc9fgmg8zUTLZgXchS+fLofV9tO/rNYbKfuDcooRYIPuDSlzWHvDx9xq2YQzMXWTb 1LO4IrrzGXbuUjezQcqB/eF0tjMxyw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512110042 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 --- .../devicetree/bindings/arm/qcom,coresight-ctcu.yaml | 17 +++++++++++++= ++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml= b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml index c969c16c21ef..90f88cc6cd3e 100644 --- a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml @@ -39,6 +39,16 @@ properties: items: - const: apb =20 + interrupts: + items: + - description: Byte cntr interrupt for the first etr device + - description: Byte cntr interrupt for the second etr device + + interrupt-names: + items: + - const: etrirq0 + - const: etrirq1 + label: description: Description of a coresight device. @@ -60,6 +70,8 @@ additionalProperties: false =20 examples: - | + #include + ctcu@1001000 { compatible =3D "qcom,sa8775p-ctcu"; reg =3D <0x1001000 0x1000>; @@ -67,6 +79,11 @@ examples: clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + interrupt-names =3D "etrirq0", + "etrirq1; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1 From nobody Tue Dec 16 16:38:44 2025 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 A44E222A4CC for ; Thu, 11 Dec 2025 06:12:03 +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=1765433525; cv=none; b=uzxGX+wUCQXr7CdrfWWw/VXTMNASrMhkTJ0tSzLzxhK/o7BN26nx3xXh3oSz/EiNGP6dAIAMoPmgx6ELbEuC4Qq1rXGz2c+zS7C3sDndL0MOW43VRlIUxfFn6GaDyASFfC9WUiCg3KCiFNjZtk3q390ianzSQHUxclo1Gm7uqfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433525; c=relaxed/simple; bh=iumPiiWiRYG1vDwM/OC0sa5uUpH9IpnWer2ItaYihe0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P06T1VEalm99oVVmTW3TRfS23gouOkxcNuCmGBXICual13TkqOgzkskaXWnOehtFHhLuLW1nrXD15VlMmDcGNAI+yP9f7rB5CboYg2HDi1u03WBnG++dQNOwH1ZDyNGj2x3CBA7wzEgBUeS0ZmDEzIDaLc9BCl2w2SAkUZXAgBc= 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=YJMc4Zmx; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=iTnr+wgX; 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="YJMc4Zmx"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="iTnr+wgX" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BALPIDe3735627 for ; Thu, 11 Dec 2025 06:12: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= tplEe/La5uzIGTJUq3hsV0ezY5j0pg2Bg5uy65iUxO0=; b=YJMc4Zmxf7y7RYn6 sQDBCHSbsvj+b76mwJFEC/TsSsjo6xaIWbKPKzNF25+eHcIg3PvChOY1e8RBd0+d 4yyoRwWoKY94mDHv6C0qD5zW1PtA2cGbeFkNcW+aoEBXbk0r1lp9jgvK1jDUGpVr U8ZMmljJrycg0lEIqZWsBjRZhSULXI9z1bDz0dVERSj1ZxKgjjXBCXSR2zxGrXKl 9b8kLcT97wYf8Xjn8nyi5/lENhTTC9PUXP7YrrzN4C53KVkbpWL2ItaweLwV9P9I OE4vrcAswUEQR+zVdZ9MGy6gtdyLfSL1q1pAAR5x9XGWVO04Pn04qsVmODDV2s4U 4lTT/Q== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ayg0psbd3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 06:12:02 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-29d7b9e7150so6534755ad.0 for ; Wed, 10 Dec 2025 22:12:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765433522; x=1766038322; 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=tplEe/La5uzIGTJUq3hsV0ezY5j0pg2Bg5uy65iUxO0=; b=iTnr+wgXkZgwXPKlwHVMr0rFo+yLm9qNKbsP1M/o9GEdgTgY4HA3tfDHPwufN85b2f pW75whxqVyA4oG+OMqU9jJHPWfmdU91C63eTrzZZb7gkkdDsKnaRgNfxveXu4YfXgjX8 8G3jooDODAbiAHJBNP73NqBQtU6DliL7riyn+JDE7i0cxwzWDnp88Q8+dJpvf/79jC/j gMA6ymsnhC0UWrlvo30SOoU7LpHOpVTzX3/2iE7Djy1HIjtRhs/GYdMToskKmUjiHzB6 sDPwWNDSnXhKWGb5qqoLYsKcIGnm9HgFJK2BoRjxLNqo8acpyYmrFeOwfdheYQEo6EMV LVQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433522; x=1766038322; 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=tplEe/La5uzIGTJUq3hsV0ezY5j0pg2Bg5uy65iUxO0=; b=d7FgvEa7ttyOI9aew+bOvVJnZuVW+rZlwg+ikYKLOePtBsw8HY+6SJuikclMrHxi9F 3F/eTGNqGrXePjrqvN3ceclRsbnp/8qTmA9VI+YbidnKz/lvSGmRSPlEymngaFHblxn3 NhEqb/+UjOijaJmFIFnyUrcOqO4hjzOfev/dWIUnGviX72HTmDCtHIxCMuc/vcW+uRhY eL+3+2fzvaKzFQQqNV74tZ5a4Uf9niWFpmHo0UPSMSgIr/5XFoQmv+N5sp7bo/WD7UlN kfN/NBR+aFZpx/RRj2WENbTptrf7LhdogZhgZfaggZGeNamBLwINiYja7Qsg5DPIQCny BUXQ== X-Forwarded-Encrypted: i=1; AJvYcCUo8H9GRbqQd1ZYaUZmt65zS+z+S24dOtuU7VHewN1EDDa4kAl7TEdx73/AOwXaouIyDGPjEIzsP0cX1Os=@vger.kernel.org X-Gm-Message-State: AOJu0YzCTCnosJU0lda43BCL9uoMHt9MqMgUPS+Sm4Uq8TL+C9Kzyee0 XNV4K9ncnEUDLmSUzbP20AozXkzl4l+y28VX6YKCC6IvTE4p7nPOmzUGUT/MerHjTCOWAcEpoL5 jnD/szEJT2k3PtaQIxBKDU/jhgc5S751P/32+r3dYWqf5YlD6wXSddddnWZzub4ACdDs= X-Gm-Gg: AY/fxX6k4laAqffJuruPCY51iSHkjRGONwy0DDCYNThyeN3hmpJY6J3P5T2E9Kfu11f lffGYOjuNrT8pk+j83ZZjXP0BZftEpSgnJOfwRDWtdTp+Pnbf2ao+eKfGOmcqKWs+QccGDTGEs2 wcotXK7JNscA+kv5IHy05TDyfInanxh+FRfIHtZuIS2Mb7zLb1XDgsVHG7/wQ79pXyJD1mEqE9C OFzITBP1IEM4MUxEbXwiKQxx2bgSaqCYpq/zRA6R6Qi8jSvEF3/+ZYD0ajTJn5lVasrDDurms/S WQhfCAykrhxxZX28R8nL591gPbKCAUidoXI4v7ruyQ4i8y6Ep3UJ5MsJMxVA+15XaQWJqqJHyYL NLmCdVP5laidaLLDvhDlsQ13OWFLPfRgf4fEf54oOb8ERIYjx4LSfLGJyrrDwbxvP7ltYnzJq X-Received: by 2002:a17:902:ef4e:b0:297:db6a:a82d with SMTP id d9443c01a7336-29ec27bf14bmr55131425ad.26.1765433521386; Wed, 10 Dec 2025 22:12:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZPQjRYm6lUf/Vh2g2S0T+KW1Fb66s9NlKYzVf895jPFsdG1KTIKdawkBRY0U+egdfsg9B7A== X-Received: by 2002:a17:902:ef4e:b0:297:db6a:a82d with SMTP id d9443c01a7336-29ec27bf14bmr55131195ad.26.1765433520774; Wed, 10 Dec 2025 22:12:00 -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-29eea065186sm11725945ad.89.2025.12.10.22.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 22:12:00 -0800 (PST) From: Jie Gan Date: Thu, 11 Dec 2025 14:10:45 +0800 Subject: [PATCH v8 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: <20251211-enable-byte-cntr-for-ctcu-v8-6-3e12ff313191@oss.qualcomm.com> References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> In-Reply-To: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@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=1765433485; l=23695; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=iumPiiWiRYG1vDwM/OC0sa5uUpH9IpnWer2ItaYihe0=; b=6DejGdnWh09Ye9Y/bon+CVncux99nqbD61XLvNnQ3Mu9agpEf3rAOtrvyJFhXAX311Ld+49X/ OMsM8a99tODD4UUzN1VuRxy8AI5DBRuceLrlo2e4POOGyW7iz3mijGi X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: xPvGsgH0TD5BF68ZTTek-dNU5AF0GoXA X-Authority-Analysis: v=2.4 cv=b46/I9Gx c=1 sm=1 tr=0 ts=693a60b2 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=qkhKFYCmI9jF0lKWm-MA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA0MiBTYWx0ZWRfX91PYBCKBRbG/ 68X0PGVoW6GXe2+qcjoMl4jyIkEi0CDQoPBm7/sf6BhEFgQbPPCdeswDmDVDMz54Q+PNqsL7U5G Zc5iDO+TiqVl9Ik36uv0J8oIE5payzMyCM9d1MLrj2EmYGLIVyZdTGEDNP7p8PCcHYZbXxtzlb5 OYC7oopcJBxK/U6FEbTlLkUqaGGyqHyZDQrtBn2laIYqfBBFZSKhPLePHg6FzMflE3wMfi3yYJV jBCJJSMGdHeDvk+uFh7uljcwabDJpAzkObiejlHH+UxrkQp7ABWYt6LiHEar3nS7Gbo9NWt2Tfq Q1z99CG74Eh8FP/rre+e18kUq2iWNbXr/pS6frZDVc5sXNY5vQ3T1/MwcpEF2cCl7xHJJ8EFB/G X/SQA/a9exbnSBjBwBSuLLmDwaZv6g== X-Proofpoint-GUID: xPvGsgH0TD5BF68ZTTek-dNU5AF0GoXA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 adultscore=0 priorityscore=1501 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512110042 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 | 6 + drivers/hwtracing/coresight/Makefile | 2 +- .../hwtracing/coresight/coresight-ctcu-byte-cntr.c | 368 +++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-ctcu-core.c | 88 ++++- drivers/hwtracing/coresight/coresight-ctcu.h | 62 +++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 18 + drivers/hwtracing/coresight/coresight-tmc.h | 1 + 7 files changed, 532 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..de1e87b4a72e --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-ctcu @@ -0,0 +1,6 @@ +What: /sys/bus/coresight/devices//irq_threshold +Date: Dec. 2025 +KernelVersion: 6.19 +Contact: Tingwei Zhang ; Jinlong Ma= o ; Jie Gan +Description: + (RW) Configure the IRQ value for byte-cntr 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..99a871c5585c --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c @@ -0,0 +1,368 @@ +// 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 coresight_get_helper(drvdata->csdev, CORESIGHT_DEV_SUBTYPE_HEL= PER_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 coresight_get_helper(drvdata->csdev, CORESIGHT_DEV_SUBTYPE_HEL= PER_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_byname(nd, byte_cntr_data->irq_name); + if (irq_num < 0) { + dev_err(dev, "Failed to get IRQ from DT for %s\n", + byte_cntr_data->irq_name); + 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 %s\n", + byte_cntr_data->irq_name); + 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..44dbd43f5382 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,23 @@ 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, + .irq_name =3D "etrirq0", + .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, + .irq_name =3D "etrirq1", + .port_num =3D 1, }, }; =20 @@ -64,6 +71,70 @@ 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_attrib= ute *attr, + char *buf) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + int i, len =3D 0; + + for (i =3D 0; i < ETR_MAX_NUM; i++) { + if (drvdata->byte_cntr_data[i].irq_ctrl_offset) + len +=3D scnprintf(buf + len, PAGE_SIZE - len, "%u ", + drvdata->byte_cntr_data[i].thresh_val); + } + + len +=3D scnprintf(buf + len, PAGE_SIZE - len, "\n"); + + return len; +} + +static ssize_t irq_threshold_store(struct device *dev, struct device_attri= bute *attr, + const char *buf, size_t size) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + u32 thresh_vals[ETR_MAX_NUM] =3D { 0 }; + int num, i; + + num =3D sscanf(buf, "%i %i", &thresh_vals[0], &thresh_vals[1]); + if (num <=3D 0 || num > ETR_MAX_NUM) + return -EINVAL; + + /* Threshold 0 disables the interruption. */ + guard(raw_spinlock_irqsave)(&drvdata->spin_lock); + for (i =3D 0; i < num; i++) { + /* A small threshold will result in a large number of interruptions */ + if (thresh_vals[i] && thresh_vals[i] < SZ_4K) + return -EINVAL; + + if (drvdata->byte_cntr_data[i].irq_ctrl_offset) + drvdata->byte_cntr_data[i].thresh_val =3D thresh_vals[i]; + } + + return size; +} +static DEVICE_ATTR_RW(irq_threshold); + +static struct attribute *ctcu_attrs[] =3D { + &dev_attr_irq_threshold.attr, + NULL, +}; + +static struct attribute_group ctcu_attr_grp =3D { + .attrs =3D ctcu_attrs, +}; + +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 +213,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 +272,11 @@ 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_name =3D etr_cfg->irq_name; + 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 +288,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..21938a201dbb 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu.h +++ b/drivers/hwtracing/coresight/coresight-ctcu.h @@ -5,19 +5,28 @@ =20 #ifndef _CORESIGHT_CTCU_H #define _CORESIGHT_CTCU_H + +#include #include "coresight-trace-id.h" +#include "coresight-tmc.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; + const char *irq_name; }; =20 struct ctcu_config { @@ -25,15 +34,52 @@ 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. + * @irq_name: IRQ name defined in DT. + */ +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; + const char *irq_name; +}; + +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 +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 2b6ca1f8bed2..3aeb0cbc720a 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1163,6 +1163,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) @@ -1226,6 +1230,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 c9a82ff6cd00..36f82e012fc6 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -481,5 +481,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 Tue Dec 16 16:38:44 2025 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 C7F2427FD54 for ; Thu, 11 Dec 2025 06:12:07 +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=1765433529; cv=none; b=mW2jhmHBWGgPjsYvKDb3qASxmnOq89cSYbiYeaOfPzXBD5PHuXFqVuiSCJiMsKEbLkeOZcevsK8SS/yaJJlG9CqW5t+ZeehlY2phpMoJ8/9FmP/Hz8BzRpKYc2MF1+yMkV+H0NQcuGejBydiykGdObeIrmIR2wOfSaFj1KeYngo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433529; c=relaxed/simple; bh=xJnis8AYP6mUACqX8hrlzR6o4WFt5DY5g2nwBMuPaFg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YslHQrV6cu1GIrjwEklh2jU6/gEVtM01q4tsIlpivMHmlqMGlm10dF+4mFVVygt//LdHHPGpKEFNzPVkWhrk88DA1azh5i1psHAEw0OVBTURkSvdz+dVCRfLVdcldLOw2gCmBg0b+LK9tsnYEDbrIdPe/fsPURyuxKvO9Bi2FLA= 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=cqZFi+VN; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=EbmY0EsB; 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="cqZFi+VN"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="EbmY0EsB" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BALSar43563582 for ; Thu, 11 Dec 2025 06:12: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= CiBtz0qC1MDsW7WxZbfp2FTkcuI+8Qu6DtaIpmNwpuU=; b=cqZFi+VNhTVteuRA OaTq6rL4MYQPmkffBoJYBxfC7fkwfug2tDIaXMOWejFGqNRV8B8qliNOc9stmqUf hpEIBiisViaVNYCkhV/VrVUlLqEyXPsMTHJ7RpRCFV8lGAilDG6TnD6uMYkz+jWy LmEsjVMTxUnIXrnoYjy+Aq0r+OospBkc6J2QsRk1edcONkGcoDS6HUfuogFn1Y68 FaE2Vkbd9F153uP1+IEbMubGFYt3pP9H1KnCQgWFbSNQEdDOLkW3dIeI4LqmW0Q8 dPkZHowfpQeqB9xQw1DpmhEu0fplvtf4vTSlfqJlQFu7+pqM8CKv2lqZFvDyPsPg 1cfWtA== 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 4aygtfh6v6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 06:12:06 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-29557f43d56so9004745ad.3 for ; Wed, 10 Dec 2025 22:12:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765433526; x=1766038326; 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=CiBtz0qC1MDsW7WxZbfp2FTkcuI+8Qu6DtaIpmNwpuU=; b=EbmY0EsBdh4VaPliIewkWf9tVwFHhPenX0TplFVU7Iz4+lfNRPMhCxD4wydvVSQ9r7 krp82Aq0yE5uoLnS0jmyXS+6kb3CxQdsNI4IvwOqs8cB8e4+k5eBywIPjm8DlQ7a0Y6m UUayq3uvnmLfumO8hAWnpQ96qkOnBACNv4aivu/UZvhcprNOSZveC2BrR4NqdbaFC2RH 5k15g2DiqUGiR7Arz4PZ0DzYjsf+jRaYMAP3ym75LIkkDpp7yTQGJVljnpyFNT60pR/q pVpKEGAa0LQgUEWFfknhwAThdLGMORh5AesOaHOMY0zKidEVZBESUccCk88lMQ8W14YG 7L2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433526; x=1766038326; 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=CiBtz0qC1MDsW7WxZbfp2FTkcuI+8Qu6DtaIpmNwpuU=; b=VI95/SSDdWO/yEPS3RNs1dVJYNl6ubTTlI6Yp6waA2cz587RnPAJkYi19S5zzbedRo JqmKvXW7cQRcXp3VD/fg2E8gzYiDv+kUCHeXGeSV3wcN+xyT8gW2OnBFPUGSpdaSxrz3 16eerZds1ek798ME37zDWeVD+rvacrvKHdtD4OgWV33QcPejI2tKP3jI2B59q49hdEkW m396pR07O5FJBvU+wJiWGO9OecWrcO42lGABXZKVz89OlTkwYEWZ27ujGz1IW1nT56x7 ncKInnu0/DTwqX6dVdEHIGDWgsM75XfId6C48nYW9auH05V14GTztrMvcNrS7ZlFKxw4 n0Uw== X-Forwarded-Encrypted: i=1; AJvYcCXajl7omOK2KauODIG+F1Qm+nD9dpCW6YRXXO8Gu7VoLCeM6Z3EkSyxVOTh3VSF5JBQo190p+KOUQQ7HRI=@vger.kernel.org X-Gm-Message-State: AOJu0Yz243oeziRMPfp71LghTYMYZEoJ58TpNxBe8ihfUrYz52glNFB5 JP1I1sfcJxPBhQ29IdCG1P1tVz13wha+pWq/Udch/xA9NnTZAgaXSEmqIjZC/LdEjPLTa4nCDmu aLLf9oTn+DEVuEj9vpKJBefEdTwgCa1Kfvj+d8S4zVZjwy6LbnpaFYHlvZz4c7AeZE7Y= X-Gm-Gg: AY/fxX5RQShtMcipctRJdTba2yEqWAt+0eKPvBNbpwv0xFjaUAMJsj02OwiYVnrbWUU /c5sY9gtrr9ODWcNKlemHoT+oV/1T7u9IF2gX0yM3jyH5FnW1bQnMSi+W19tVhiKkbOBSD3d3js 48jRy2k/MDOBwJP/7Z/8r7kf30D3rj+tg2SqUqdwc/arA7sprSecv1gQN+l86wFAzv6EGLUo5Lr 3Yp+dk1UU2zWjpAYsTmBoLnw/JwDx/tAR2eNUGIjhehqzuwM9yppeIIxWM8Lpq0ypm5ZsA3aXZD wBrNakR0JWUiYgzO02PfGBfvvKn4EUVaPOcnlQWqMFxLSw47YQRnidn25Ssv8yqZEXJLoOlumwI AfSrJQy9dxp1a/LaslURCoNRHssOmAbmtEtOoXeY/55QME5gci893oTLq/lMM2OsGQoqH+POI X-Received: by 2002:a17:903:3d10:b0:295:5d0b:e119 with SMTP id d9443c01a7336-29ec233651fmr48988405ad.26.1765433526149; Wed, 10 Dec 2025 22:12:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6fC3G9cRxZnPr7R0wcUAZMWDvoLAxRPfLPw1ivs4Rflap0o6zBIzu42QGY9pF+eM4UFiEAw== X-Received: by 2002:a17:903:3d10:b0:295:5d0b:e119 with SMTP id d9443c01a7336-29ec233651fmr48988055ad.26.1765433525664; Wed, 10 Dec 2025 22:12:05 -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-29eea065186sm11725945ad.89.2025.12.10.22.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 22:12:05 -0800 (PST) From: Jie Gan Date: Thu, 11 Dec 2025 14:10:46 +0800 Subject: [PATCH v8 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: <20251211-enable-byte-cntr-for-ctcu-v8-7-3e12ff313191@oss.qualcomm.com> References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> In-Reply-To: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@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=1765433485; l=3607; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=xJnis8AYP6mUACqX8hrlzR6o4WFt5DY5g2nwBMuPaFg=; b=XZKk6u6O8/W+/NKO3AjRcEidZmfWuImieEybj0q21Sad2eq2N8OitNcpHtzKGjthFpgvrpY9s h1fyVyKmYXdAH0DgyQQqpXNScBCrkDcNTfHx0curg8bHL4Eu37uSgJf X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=At7jHe9P c=1 sm=1 tr=0 ts=693a60b6 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=i2GxayCjj04of9N-vEoA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: RAMPRQ2Qwc9RWDsu7Z3rzYrAXxEIZlcO X-Proofpoint-GUID: RAMPRQ2Qwc9RWDsu7Z3rzYrAXxEIZlcO X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA0MiBTYWx0ZWRfX9bwNUO6PnWxo mMOCKHHh5AfC1fT9s+utHhMUkQfSDtFagcPh1II/rYH4D5dFj5Wh21Lg+EbinDv8a/u1dvO7GLU 538rwepGeziom5D/UmhByxMIuA3iLXhxeBKFinx1e2VFPipDZwqrKqvPx5XYA0TfB9Pd2eZQ2ZW uOk7KR7Wxj+5uxQCUlrI0CCfNgzrz+RKAffMfWeAUBXShS/byTGdD45ulm174ebXTCf+J/JaVBV wu7J3YHRLs3oaMq1BZek+RgrfoJxV8hyV52k/NyVr37Y8gMl8/Fi97gS1UhSX0DTkchZ7xoeAHR GKM63UW/sehghZWPXHzgOvR2a4n4Ai6qaulrzfCMleHB2PO0xdxSZ1YhKOLW+4HaSthBmJGEg1T PQZ1bBqEEctKLLv7ETQy9tp9cPDSng== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512110042 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..41ac99b35a84 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 coresight_get_helper(drvdata->csdev, CORESIGHT_DEV_SUBTYPE_HEL= PER_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 Tue Dec 16 16:38:44 2025 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 5BA63296BB8 for ; Thu, 11 Dec 2025 06:12:13 +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=1765433535; cv=none; b=aoYIrIjaoe2/fSaUKZyUbuOhWuGUIb38PXorlFAWKEeZvxp5hLLkif1WVKYTNeewOwRLvCcmdes3c4IEsDb9d0pvhhEYXUxF0PPqNh5AupuO54khRqc7QkNwEXmdn5LvtVwf2WImn4n4EJ43JxTojOedHDI8fzKH5L20YTeu5qY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765433535; c=relaxed/simple; bh=TYSRWgmxRNSLt2fH+36XKupwzsybh26yro/HGps6z3Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JqS8j/GEnO8HloaJjpi3/3cBsjyrF1Sr9wulyHvkQv+StR/KQzP7bQjPeKf0bazpjSsLeMtmzxOUZNvKutvQmAE7XTDZv0wlzat9+n2tfRqYhfRpg+QgPVnpCuH4g4E+8VkgFDFY2/FTDzfGNYJDX8WmtVADVV8rRRK01LRqOkw= 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=cqPBoDkP; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Um9wdTyQ; 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="cqPBoDkP"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Um9wdTyQ" 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 5BALP2aL097636 for ; Thu, 11 Dec 2025 06:12:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= A4JiDGHmMEDPcD2wgDRhLge5WYsd8FkCL+2ifcxAdQk=; b=cqPBoDkPQS276QEC 8w7jNdNzsYxlAy/ps/9Qh0U2H+cQWG31QZ+LUBvrw+bbkSJPMOAiEzngYmg4YTwY IdE+WJHSoD9pFYQMiAmH4HkJQWElLsNyWwM9y7bEk1HS8yLC7tbuFZMWNdU9PzJh 30KoNTi6cINKQWaivw9/R9Mv6suGIR2ieOi0OT2zNO/dvdaqFYPwBzmSQN8qbSXa nTvV1YsFsuqWiHCCiG2QQhwcLP59NwubxH9DF8Fo+aUN+IUoFc2IlIzEwOenHy+z unLdg1n0NmgiNItAaowcDBOpKvcuF3uclZN96mjQyjoUXg19NYWBD3hruQsDAwA7 CSBYkA== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ayes1hhpa-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 06:12:12 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2956a694b47so9055165ad.1 for ; Wed, 10 Dec 2025 22:12:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765433531; x=1766038331; 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=A4JiDGHmMEDPcD2wgDRhLge5WYsd8FkCL+2ifcxAdQk=; b=Um9wdTyQXt3qG769K1A906luOFKvQ5reChsrSadD1vLTaqJFsiBSf4i0QV/eRsbfyD BGlbgVMttDJUW26w3EyzX9tPMSctNKLBvYRNYZL/WtmOIftfbYSFsDWlQy+m69jDKXOr C9kEbljXHTFSAlYogxCQ3FVcB1KhBClVZ8DHFGCTNecW8ka2JZQOO2U+Kqtrobu0+yZh h6X+1FAv2DW4lR0JeCOUoc68cYS4sB1LcjZBYCWJ2S5Eqsrh50ctu5i4ciFbgClj9gXK cSgJdKmsEeaE1hMr0K98zFkJ1qMUQli4ZnImY1t2HyA9FgauuiBYQqn/qWGktz+omv25 /eRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433531; x=1766038331; 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=A4JiDGHmMEDPcD2wgDRhLge5WYsd8FkCL+2ifcxAdQk=; b=PhHkx1OsvJ5JpAgJGZp9QOMNO78JRmB/sOsdksdP7W5o8A8Dt2VouQIXK5jyrTxxlj 2dbtELecQ4TbcabE0EATiJvFBtWoxUsTuHZvl7s/JEfJCY0vULWHrhdqfu0MVGvOKvOA naYnlrDOsfYfj1DHWaVBX4p01+gPqfUoBU8L5htnOSc95LOh+KCGrAAZgnn/p6qtVatK LNuDkluBpQxMNmbIfnInHYcijuRxKa3/s//KkV7SCh88tkg4uM9yRD2gUPS+OMYRDxGJ Hb/EVcpKOLh7tf0svd89j1GNzIM7u5R0o4aZwvVXgtYmvT5d4KdPI3VRzou5EXihvF3k zC/g== X-Forwarded-Encrypted: i=1; AJvYcCUphLgHZTSZ3fPEYLh5I9X/6RLmgHcvM2eIe1XbVUbhPGBDQGI3ugysXvPgNpaXYGX4hevWuKRLe+OTAyA=@vger.kernel.org X-Gm-Message-State: AOJu0Yzsznp139wIR2IZTHZdJZI5o6duCVceaBqKg54Dx+ydBxFF0l/4 gZYoOMMsRg7Z22lylZG1hkFfL2Yvgf5/YIQq6s3JTGojXg5KeoCrWRrMVVl58wuTV13uwaPLn3Y qOQgh/png9MT86vjdu6XNHe1+hZStgDHBoSnSVGf/3AWgOr/NBFZqRNLtg3QhRZybpNs= X-Gm-Gg: AY/fxX4XRyBA61Zr1WXhMO/IxG+c4w08vGstxg1eBoeV1Jzt8T0eWvmo4ueVvd1FDpJ /8D/j3I/aFPUKsdBP7e1BcK4OBqvJs/CMNK3PUdws2VCchwg9Y0dBrLatqCqSUlYUVZ/9Ga7l8p 8MDgdsqkF+EuETSHpgD/7C+vGcnX+fP/kqZu6/p+NN40GH35SUjeen9aWjoN5GHuz1G265yxQ8L vVE+uWKZBBmaI/KTqc9QwaWZiR2ZE/Mx0b7wYN/Z+dztbEAnGHxKvfOEW9NvRXheR5RrvBK37Pi XDcDKZwdPQvEYiy9+XuSHseVGst4gbF48KlAzv6RVhftHHq3/n1LkAAFVGeUtqCMDojEas0mDdb tzYNXSHvSjX+tOZyTY+t5hre+R+08oV2lgtEuHbtX7StFyPhyW3nMe+tPviCkB68ko8//Idot X-Received: by 2002:a17:902:da8c:b0:295:3ad7:948a with SMTP id d9443c01a7336-29ec22caca3mr46292605ad.16.1765433531088; Wed, 10 Dec 2025 22:12:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwpyeBJog8A/y6aFNZOvOQS7CL5HjLOWRtqjKGI3ThqTrSkk6w7Ru+P//VRVWCIf7gX5e7pQ== X-Received: by 2002:a17:902:da8c:b0:295:3ad7:948a with SMTP id d9443c01a7336-29ec22caca3mr46292275ad.16.1765433530616; Wed, 10 Dec 2025 22:12: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-29eea065186sm11725945ad.89.2025.12.10.22.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 22:12:10 -0800 (PST) From: Jie Gan Date: Thu, 11 Dec 2025 14:10:47 +0800 Subject: [PATCH v8 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: <20251211-enable-byte-cntr-for-ctcu-v8-8-3e12ff313191@oss.qualcomm.com> References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> In-Reply-To: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@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=1765433485; l=826; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=TYSRWgmxRNSLt2fH+36XKupwzsybh26yro/HGps6z3Q=; b=Ux3XflkTrrUJHp+u7FIF254VmIX3iOfhW+NkBHok+c3zuJeA5LieWfVOFHPokKhPaZCUr783/ 7nAw//SIn3rCaw1MyLtijaWEIOLpdIrDfw9bpgsjr955vjm58gSoAvp X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: IhRnrNYigHHYKwB9TctlXmlFkSnA4MU2 X-Authority-Analysis: v=2.4 cv=KqBAGGWN c=1 sm=1 tr=0 ts=693a60bc cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=gBkj9RZkAcI1HbXH1KoA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: IhRnrNYigHHYKwB9TctlXmlFkSnA4MU2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA0MiBTYWx0ZWRfX9aAfuC01Mdb1 MJwywzHj2cSzRdxzLUoN0ITeC6NjchyHCdvmGibjxFzJnEb/ytQmJlssLdi/V5WGiZ5eEAKu9dL IiUBEdPfMfnkeX7mwF6ttE7S6/h8GWUIRJV/cjwmpU3lldYKttb5eW2a0kd2yVbtlTW0rnZki1v wHMKPCWQCMGku3bn14g3r1D0hmZb+149dWPAr4iO0uszwoc7oeYhbzaGV9EoH9IKsoTZPBJQZ58 Ef+OQQ9gjJK6fwlxPwr8UfGqRTjZZt5wryCEAFmlXPxX4Ryu3CzMm9SRf4ZmKxlkYLWuni1fSv1 5uOad1ZoP0ZTU3X+7lLGI0aXn5No3xtfiDpLfDUQxTYXmWbjs0XZa+PMJ/c49vOeyDbNhiUDTUv hybBdFlkUfvgkpZ7iwn40OX2PAmelw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 phishscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512110042 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qco= m/lemans.dtsi index 0b154d57ba24..3c4633e044d9 100644 --- a/arch/arm64/boot/dts/qcom/lemans.dtsi +++ b/arch/arm64/boot/dts/qcom/lemans.dtsi @@ -2776,6 +2776,11 @@ ctcu@4001000 { clocks =3D <&aoss_qmp>; clock-names =3D "apb"; =20 + interrupts =3D , + ; + interrupt-names =3D "etrirq0", + "etrirq1"; + in-ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.34.1