From nobody Sun Feb 8 22:35:14 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2A421DEFE7 for ; Tue, 3 Feb 2026 05:51:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097915; cv=none; b=MhLZJUDBxSoJ2AEp66faEPPsWhnvIVoAPe5KwhjvFbven9Htgg4q9tWLK/L3RktoXPfi4ZAaor6B5vI50aYtdZhKbMxz/3e4rmAaPVLkLrLsmAbYYJZQJk0Bfo/NHVDCfZpss3WenaGJCUVgryh2OXeJeQSfXSaDlN8QfvYqjHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770097915; c=relaxed/simple; bh=nzaF2yP3ATiqQC37LSxmXVL9MqWLOY4wwOUNTmvz/UA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K1DuRAvChUA0C0UUHtHiJ1rvlQrsScSGOwLwSzt1t7tEiAwm9ZUjRQCyieZCSJQ/fBoINubayDrlztaCpnnYnLhBYmofTSbxM+tM7uN24FACB1QdIRQ2XzkfIPQmik1zzA1obXsyI/hJjROwGOuwT5Wkzvwl+HB9701N7SX0WTg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Kc5+5Aid; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Xw5zyeba; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Kc5+5Aid"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Xw5zyeba" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 612Je25u3459151 for ; Tue, 3 Feb 2026 05:51:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= V/JNJXfM7FDohbLniT/dm0wA/+qShrtEurl8w70+rXY=; b=Kc5+5Aidb3REAC1G ke09e+x+zNjfgc3Myt2Df455wKfo6lNGhf1VNCeY5wj4zedcyDghrniCw4v2+vcB 281+jmmbfFaBBEwNcjywDZxJSv5L1vyOJym4SObSqDHdKlunznDcSNup4w4w6LCr IC/YCsMSe4l8+oVj+gy3gJJZlp5abIxub8zL8LG9OmnhcveQ3xWSyyBL/oAeVRvN IMEzORnDEI843D3VElopMBndhoGAWw7Dj8kW1pchrj86CWB0ANgMUmJnhWtZORI9 gPjreJDR6iX05Yv41esSyssUW2UkYp1jQ83UBeBnfXPqEtIU3sw75vnyhIQO9f12 0bVUQQ== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c2trbk1f1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 05:51:52 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2a7701b6328so139156425ad.2 for ; Mon, 02 Feb 2026 21:51:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770097912; x=1770702712; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=V/JNJXfM7FDohbLniT/dm0wA/+qShrtEurl8w70+rXY=; b=Xw5zyebadIGjRZhYeyH7ixIyeqkhD4bCjnk0sYsWe3LEm1AtN6Q8Hoa3EJbp1Es85H Xoc0Rzaq2f32OBlKLjl24kVpV1cAMUL99GQhO9th9pK4hPGg4MSWl0d2qlzM7nuxZ/1T qKxZJU2sfuMV97iAKqZinuQEyiHIbpqPyfoEjUctfs4HXRRYFq3LsQt5iupM1tXN8QGI cE8zE70s+P7HpKPhYtX4o6L5qEVOi7+/bKiTUOVBn32UZwcrVpTr63eTpwo7HzeQvw5j 5V62N57E7K9kvGf+IZl3sVRMrEO+hYBw+9IWcD2+UmFvCOxNIc91x4sSwZ8x0uJjePSy qrpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770097912; x=1770702712; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=V/JNJXfM7FDohbLniT/dm0wA/+qShrtEurl8w70+rXY=; b=Teeia21VPEyozMk9EnIlz56BsGXzILYTvS32eSqNKWq7mPxDBqhlFW6O/9i+YOVoUV 3yOepUmQiFABzLtF6K23b0X4TcesDLTLR74+K6eUDsIJh7TNrTjjzV56JxpMCyKVl5PD qdx9Uzt8gw9QEczL1tnepYt+29A4N8Ukk+7BWoa6vgReF8sxWssXLA82mIvo8mWqQDWG 6LJznBJdDARijywOWDzSuWq57fv6j8yKqjP1Rd/l+Uy55RiyyHE5XhAx2qLpQBP6nwfW cdnniY37SPxhfU5YThhnj0hjOt76a6ibResXqieVOjfFVf65DqbqlgdwEapLhr3ye77H U3rw== X-Forwarded-Encrypted: i=1; AJvYcCU7NVKjUIO/vOxJjgUjzrHo/CdQl1ld20lIqs1p2c0j2bhq/NB0M57AvFUYGV1QPlauNUIS5SntgprFLKI=@vger.kernel.org X-Gm-Message-State: AOJu0YwXS/sKFfPfVNJA7Tt23pcL6I8WBr3tg0pew9oKkmDmkI+K9zID cV569XZ8B0xG1gKgYobJgfC9FL/jzzM59NSxjU6MocaVoyPw9hneNuavmsDPAZeAsiRh6aj8ajO puJPuE6EpA+hD75291wDpr6dwfZBqvzLmS0M0AtUKHZ4gLk5qQk5GDuOK55bW67jI8lo= X-Gm-Gg: AZuq6aJdv3biVwZqnitkvVYtIahN8RrCn2/MQ8Uc1ERV7CY3c96tlcavg4LgCAJRH// +WzufEuAJiqVFq0Nyw3/ocnkqNIyUiYZn+8EDat04Wdym48j37YDH+uJ9FTdIwARFUglsd4nBcr Bqr0Al0yJMcifERSn8M3LI7HOZId8bzNv8Yeqw5PkJdlnvm+WB4mjETA9xfAAI2UmlzN/dHSa7R Y3zIOENTXtrfJlNonCr+ZPwykvrnO1TVc9O55Rrth2NYxxdbDyGge3nTrNfNc4ADAHjxsS+Gb6c mLunWkbob+/vLDrWxqwwhJvqWK5JwvZJjrL8nmR+EN7G6sUYZJfoF/d3v3xm+Xd+6Tnmmp7JLAU aB9gHOpTyeLimuImx5B4S6E3P7FuYe3huw+jcx8tbsC9KY3UBG66PHJf39mhvgHZ3LyYkTPnI X-Received: by 2002:a17:903:3e15:b0:290:c516:8c53 with SMTP id d9443c01a7336-2a8d994f3a3mr92432405ad.40.1770097911517; Mon, 02 Feb 2026 21:51:51 -0800 (PST) X-Received: by 2002:a17:903:3e15:b0:290:c516:8c53 with SMTP id d9443c01a7336-2a8d994f3a3mr92432175ad.40.1770097911032; Mon, 02 Feb 2026 21:51:51 -0800 (PST) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a88b6e4189sm157424735ad.83.2026.02.02.21.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 21:51:50 -0800 (PST) From: Jie Gan Date: Tue, 03 Feb 2026 13:51:17 +0800 Subject: [PATCH v12 1/8] coresight: core: Refactoring ctcu_get_active_port and make it generic Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260203-enable-byte-cntr-for-ctcu-v12-1-7bf81b86b70e@oss.qualcomm.com> References: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> In-Reply-To: <20260203-enable-byte-cntr-for-ctcu-v12-0-7bf81b86b70e@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jie Gan X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770097896; l=3771; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=nzaF2yP3ATiqQC37LSxmXVL9MqWLOY4wwOUNTmvz/UA=; b=pWy43CaYoKueLn4k+QHMpLlbjvhPJdeqt0RH1YtNLHBUD5VRBzTiVeUCJeC3H6dSaokWtzCPc /0ltV4l8ISEAGDviAXJSq5VJuQ9V/sIUpTvPn+F4d+9g8UsK4JfocOf X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: JFBpctKMAH9M4XYO6_lpWP970xgjoofO X-Authority-Analysis: v=2.4 cv=dcmNHHXe c=1 sm=1 tr=0 ts=69818cf8 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=qQZ2XtAyJf2dEkEvaVsA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: JFBpctKMAH9M4XYO6_lpWP970xgjoofO X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA0NCBTYWx0ZWRfXyckyqPLw+Oaq /c061DNXYemIPKTSmCDLF5Mkk/DDfJyEFdhLKKa71NC270fdTKZ3pHxji2IF32hiugbFExybl/g eYng+fxacTBXMnMjc1vc2aTgk/7fSCYRSAjhE6PAWBICZV3KzJunKaTpbTjyWmVJEGdgXstoCIw 68PetWPadkbUpuXfwb3EVzX4Sj+69lufoNCdxRLFY92vVCIikmI12cAUaHLWMFqk3ZpLcYP2IQ6 6hgh/tdsryybx6TFjga8s4P2+4IPUXLzpn6JmtlXFv8+HPE7JJZxyn78pOKAoYiwZydHIrCYDGK VO2NyM8yUvcsrP2Cru9bNBvMmIpKEaQ+4TjBAi2Ud5o3HIf7+pdByJf5pJJx2ygr8Pe5zIuAJhu 0n/5wFuMp0yT33ODOx6wgarXWn7CzrY0N4YFmR7SjK797KFaNzbZM5aEurwETUE4fHNI/d6k8Gt 8QixTWYDYZSxbmflYHg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-03_01,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030044 Remove ctcu_get_active_port from CTCU module and add it to the core framework. The port number is crucial for the CTCU device to identify which ETR it serves. With the port number we can correctly get required parameters of the CTCU device in TMC module. Reviewed-by: Mike Leach Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-core.c | 24 +++++++++++++++++++= ++++ drivers/hwtracing/coresight/coresight-ctcu-core.c | 19 +----------------- drivers/hwtracing/coresight/coresight-priv.h | 2 ++ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index c660cf8adb1c..5f55f0c510e4 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -585,6 +585,30 @@ struct coresight_device *coresight_get_sink(struct cor= esight_path *path) } EXPORT_SYMBOL_GPL(coresight_get_sink); =20 +/** + * coresight_get_in_port: Find the input port number at @remote where the = @csdev + * device is connected to. + * + * @csdev: csdev of the device. + * @remote: csdev of the remote device which is connected to @csdev. + * + * Return: port number upon success or -EINVAL for fail. + */ +int coresight_get_in_port(struct coresight_device *csdev, + struct coresight_device *remote) +{ + struct coresight_platform_data *pdata =3D remote->pdata; + int i; + + for (i =3D 0; i < pdata->nr_inconns; ++i) { + if (pdata->in_conns[i]->src_dev =3D=3D csdev) + return pdata->in_conns[i]->dest_port; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(coresight_get_in_port); + u32 coresight_get_sink_id(struct coresight_device *csdev) { if (!csdev->ea) diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hw= tracing/coresight/coresight-ctcu-core.c index abed15eb72b4..78be783b3cb2 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c @@ -118,23 +118,6 @@ static int __ctcu_set_etr_traceid(struct coresight_dev= ice *csdev, u8 traceid, in return 0; } =20 -/* - * Searching the sink device from helper's view in case there are multiple= helper devices - * connected to the sink device. - */ -static int ctcu_get_active_port(struct coresight_device *sink, struct core= sight_device *helper) -{ - struct coresight_platform_data *pdata =3D helper->pdata; - int i; - - for (i =3D 0; i < pdata->nr_inconns; ++i) { - if (pdata->in_conns[i]->src_dev =3D=3D sink) - return pdata->in_conns[i]->dest_port; - } - - return -EINVAL; -} - static int ctcu_set_etr_traceid(struct coresight_device *csdev, struct cor= esight_path *path, bool enable) { @@ -147,7 +130,7 @@ static int ctcu_set_etr_traceid(struct coresight_device= *csdev, struct coresight return -EINVAL; } =20 - port_num =3D ctcu_get_active_port(sink, csdev); + port_num =3D coresight_get_in_port(sink, csdev); if (port_num < 0) return -EINVAL; =20 diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtraci= ng/coresight/coresight-priv.h index fd896ac07942..cbf80b83e5ce 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -155,6 +155,8 @@ void coresight_remove_links(struct coresight_device *or= ig, u32 coresight_get_sink_id(struct coresight_device *csdev); void coresight_path_assign_trace_id(struct coresight_path *path, enum cs_mode mode); +int coresight_get_in_port(struct coresight_device *csdev, + struct coresight_device *remote); =20 #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) int etm_readl_cp14(u32 off, unsigned int *val); --=20 2.34.1