From mboxrd@z Thu Jan 1 00:00:00 1970 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 D18F62DF144 for ; Mon, 13 Oct 2025 05:49:46 +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=1760334588; cv=none; b=QjK9fSg8gTOz89lGAdiL48l2+Ybk8oSJ2WddUOW2QCxvwU9pMWbVeLaGs9ruBlMbY8cL4hfiCV2uC9FPICRT+jZnqCxI8TrA2n4/5kbyn6bKv0dX8/jH9Fd4iMVFxJvj41PFV2oRlRf8cSNY2lhJpk2L1xbkgwu3yAwWMhVTow0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760334588; c=relaxed/simple; bh=TNF6l0ahOzbwrs5of0KBvmnTCNoj347m7R5JdZkuHQo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ft+Hcs4YqhBy7rz2J73KPP0JlESgMtz5u1TkskQDKrGTyK2om9Ik8Ecp9Aig+l6h7kb1nQ5XC+ahzel8Sa4VY+Ju7cvVzeABTyYKasguH6qGHuX/Wp87MrKFPK019COh45VY6v2MCDejN0I8xfqwZdH4gqO1fOY0QDjH4K4AjPE= 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=QdWPfY6W; 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="QdWPfY6W" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59D2nEHN000955 for ; Mon, 13 Oct 2025 05:49: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= DeeXfQmF8BPY/Rrm9uGgR/SHD9DlxJ2y7BO/a91fj7Y=; b=QdWPfY6WJ1hpiq5o wogpTE47+bgJE3v3KXHoaOO0lKnzQmTlmpHwX79mcPVuVGYr2DN511iaifwM0eXc Qfoj2MaNjTAc9GmdEtAw7s9XYgMY6pTbIp8ydMW0DDmK2P+2cHBf9XerSHNGiwVZ tn2u+36CyYH4ymcF+EEN69rSwUo9AOPRDzUfq7oHOv7+nXeRWrcROKpltML31G1o NtRenOdIpuOQJHbVLkkKN+bwOCtQcnVKy1kdE2Glnc7s93tG82NHE/QmYCCflZ0l cfJg/a99jGVmmyAyX6O7pazwPNNthy8DlsN/+eehgn/9rKMelYca/6OUPaAvrH+n 3AR3ng== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49qfd8ud45-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 13 Oct 2025 05:49:46 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b630753cc38so12254027a12.1 for ; Sun, 12 Oct 2025 22:49:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760334585; x=1760939385; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DeeXfQmF8BPY/Rrm9uGgR/SHD9DlxJ2y7BO/a91fj7Y=; b=gVDAcO4seX8FsJ+Qy/jAlsQrOwdyS/mkgBT8vd8r71Zhin2s7209gtKzWwoevBCD/U Tt0B6Z2Q4udezUqsAs0hV9YfzupafAPaGhWxOk9OsEX1V68mO+P8pL1bg/8AnfXmC8YT d0PGR78WZIkXtMI20QupsOtI7Zj1WGcazo/olQ8/PKTKuDvgZbtpuvoX9U4qiTQNv/WJ NGCZBHyUHSfQIzv4wQlCd3ZpLkVBnlBQrdDTdY7ANoKuyWu5hLbBPDF0VtlXsL1apT/8 aeZ7LHyGJ2BoFqlXM5Cni4BLJ7LlSG1kt7nkqclGLrKGDduYjjL4KCF/vz/ls9uLvvx/ CfgQ== X-Forwarded-Encrypted: i=1; AJvYcCX+LoXCrbIiIwb/ma5qQJYaJTcRm2RxitHZvKqHGs6aSyJi6A5pDMJIw++wzrBGnov6pTSE+ANmu+y8@vger.kernel.org X-Gm-Message-State: AOJu0Yz83sKaV/KL6al8xYrXpZGrZWBppBGyvfmudLVdz7hDp5o50KHK rPkGMdxJ15l2fnz1kWYi3w0i8PTwmRufh7r83yd+W7wo3TdXd1c11088dh6Kb85l3eWmtd5hUVn e5ENLxmxxfMg//bzQOfDO3uP02yM45VR0HYI/bfHEI4Rqw4pNjUtH4HA6FdxXahI0 X-Gm-Gg: ASbGncspMz+xPciIyjQOgTjUOTrZNeV55Pcxrb/27VCqAw6+RFvOuy7Edtq0M8/My8q qQBztsh9N0QCg8ABFfVlbW6Zkid3Joswf4YNvWpBJm6+e903KAMRCo67b+raJKzbl30HQ2Dmp0L +GfumAEVoXm3+4C44QQaoJY60e5aXhdeIRKZg2XTHzcm/CHEy85ZIXKkSn54sRZzGCLA87eKTHo avhXPT/NDmMTmK01VXEC4z1H8auNwSMfBG7L+rWRwjoBYzzBJz11K+ZjP1o0FUoOMzhQ9SOc+rd 8NgdILnv/4BJSu/aMWD3wDoQ86iWCPr1v8NYLVZ/PdyRCDXDQv1e8ZptAz9n7CaL1SjQw2wey5t xjzCrqeRfSJTYQz7513U940tsq8E= X-Received: by 2002:a05:6a20:72a0:b0:308:60dc:921b with SMTP id adf61e73a8af0-32da845e6d1mr29695080637.40.1760334585335; Sun, 12 Oct 2025 22:49:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVkjFqXs8bvUpUlp8Y+og5WHqeIfUqxH8cxjvddLFNSJXsysOI+7Y6qqFqb0ax99cu7rPxfg== X-Received: by 2002:a05:6a20:72a0:b0:308:60dc:921b with SMTP id adf61e73a8af0-32da845e6d1mr29695057637.40.1760334584857; Sun, 12 Oct 2025 22:49:44 -0700 (PDT) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0e1336sm10129898b3a.59.2025.10.12.22.49.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Oct 2025 22:49:44 -0700 (PDT) From: Jie Gan Date: Mon, 13 Oct 2025 13:49:11 +0800 Subject: [PATCH v7 2/9] coresight: core: add a new API to retrieve the helper device Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251013-enable-byte-cntr-for-ctcu-v7-2-e1e8f41e15dd@oss.qualcomm.com> References: <20251013-enable-byte-cntr-for-ctcu-v7-0-e1e8f41e15dd@oss.qualcomm.com> In-Reply-To: <20251013-enable-byte-cntr-for-ctcu-v7-0-e1e8f41e15dd@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Yuanfang Zhang , Mao Jinlong , Jie Gan , 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=1760334567; l=2649; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=TNF6l0ahOzbwrs5of0KBvmnTCNoj347m7R5JdZkuHQo=; b=PHSldDPpoF/wpmvV2sLnTsJX+MgzplFa6X/gwHk2llThVTACGdXyUFYe+8TWszelXY/cUPzgc 9cthysiLb/+B9DfJ5rLuaaPKY10Q01WdXFkMX8moHxvcqRGw72C+A5s X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Proofpoint-ORIG-GUID: Se9gPdczv9yd8oAjBKlAKyMiTInKYsaT X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDExMDAxOCBTYWx0ZWRfXzAMGd3WL942f 8XU2JssfX7KZWW2i816a2r6w36cjXM2I6wyzV0Qx7putGy+nOJNGZvfEunxIJlCVjFcM+FO0uKk SyGRVcTZpR5eSNzIl93tcoThA1K7XjuFEiRiUrrL085bQWCBqs632cRSSzqX1VK225AeBXKckTL QfE8+t9bdZ1jJHzeq4F2Ps02VVLViYhidm2mgKueR8GVYLanrtucbbRgiNqRxDlk18PGwz/NNud WmRm4p591UhlYL/LfiRsq5mzPKbvhdAklbyhP0nisODiGojsBzQlc01kBNgEsbL/Xuz8rbgv8hc jyiwojUSM2P3LrED9BXsq6uE3rIGHmndkVf5awEquMts6jDrR+I1grrni9MWXcm7bXdQnPMrGRg e7Yx4TiO7ovn9IXxbUvFI9tWaLUcaQ== X-Proofpoint-GUID: Se9gPdczv9yd8oAjBKlAKyMiTInKYsaT X-Authority-Analysis: v=2.4 cv=PdTyRyhd c=1 sm=1 tr=0 ts=68ec92fa cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=WErVAGsNQcrMbPXGsVkA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-13_02,2025-10-06_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 bulkscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510110018 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/hwtracing/coresight/coresight-core.c index eb6870425abc..27d306b23260 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -581,6 +581,41 @@ struct coresight_device *coresight_get_sink(struct coresight_path *path) } EXPORT_SYMBOL_GPL(coresight_get_sink); +/** + * 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 *csdev, + int type) +{ + int i; + struct coresight_device *helper; + + /* protect the connections */ + mutex_lock(&coresight_mutex); + for (i = 0; i < csdev->pdata->nr_outconns; ++i) { + helper = csdev->pdata->out_conns[i]->dest_dev; + if (!helper || !coresight_is_helper(helper)) + continue; + + if (helper->subtype.helper_subtype == type) { + mutex_unlock(&coresight_mutex); + return helper; + } + } + mutex_unlock(&coresight_mutex); + + return NULL; +} +EXPORT_SYMBOL_GPL(coresight_get_helper); + /** * coresight_get_in_port_dest: get the in-port number of the dest device * that is connected to the src device. diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index e51b22b8ebde..f80122827934 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -158,6 +158,8 @@ void coresight_path_assign_trace_id(struct coresight_path *path, enum cs_mode mode); int coresight_get_in_port_dest(struct coresight_device *src, struct coresight_device *dest); +struct coresight_device *coresight_get_helper(struct coresight_device *csdev, + int type); #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) int etm_readl_cp14(u32 off, unsigned int *val); -- 2.34.1