From nobody Thu Dec 18 19:09:28 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 55B05254AED; Wed, 26 Feb 2025 04:14: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=1740543283; cv=none; b=F84d6VQU8b/ZDwHd0gmA3RWKgfok/5n+DDQjpx11GjDFg5X8vHbIKXTIGnjkYPXM66JJr0Y8ml/b4HTbql3pbSDeJRYB6K1fLiHGPePdd/v04Vg778hCpZiA5/M80JMh1+UdoJ+raajBO9m/HlYnBX0TzMieJ9M/13ZQZpOmHd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543283; c=relaxed/simple; bh=avuDxrX+bDgNvLafMJuvmb3oYf4uTe94mdHy6Nw7USo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ix+IJeU5JLNZEv0zsLDlArmhTtQ4xAuj6qqunaAHMcNcTN4bxHpdAEc+G/1R05e5breWHGH3uBMUAwe4I4ElNjs9sZBLDlQD+h/LnAp3wHz0Z05lg4yu+gjPyiFgz/0onHfsPzzdmgZHwg9E3HQPx6y+WZ9/Q5E0l10NYp96JSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=ZhA4fQo2; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ZhA4fQo2" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMXJYD015804; Wed, 26 Feb 2025 04:14:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= qQMOQZffzsMfKn3CfdTJ9UbXMyLWAPH3pYBo3aDkzCI=; b=ZhA4fQo2KOF+T+uo /qsqalIzYaqqt0CuFnyPl9TDFzeIWZCic0e5e94EuC5M1WRU7Od6K1aJAvL2O1pH qyE4R4P0+4e90tWz9ErHmiWo+tl40iCJ71EXmEynFvDqyF2jGhPHcj4VizQJVLrZ vaUtVIndR3eQIdE0oqXxMBjsUOvG8Vu1u8QqkDROQN5VPH+2qTCXljWjv+EL3Ufg VjH/JgXZatA/mPETj0wocujr6gNcou7D1d4st1gDfOzHkwiX8Ks0tOaStyp/FKIr vPBP11MsBmIH19CuimFj15fteZXrC0wD5BVlUMG7bH2A7w8pkQGnS1UBGGdG4LhE bhoMmQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451prngp3v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:11 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4EA9a004978 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:10 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:04 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 01/10] Coresight: Add support for new APB clock name Date: Wed, 26 Feb 2025 12:13:33 +0800 Message-ID: <20250226041342.53933-2-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: axoU75cAB6q7tFnV5R5IkvgkwnuGIpQb X-Proofpoint-ORIG-GUID: axoU75cAB6q7tFnV5R5IkvgkwnuGIpQb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 mlxscore=0 mlxlogscore=899 bulkscore=0 adultscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 clxscore=1015 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260031 Content-Type: text/plain; charset="utf-8" Add support for new APB clock-name. If the function fails to obtain the clock with the name "apb_pclk", it will attempt to acquire the clock with the name "apb". Reviewed-by: James Clark Signed-off-by: Jie Gan --- include/linux/coresight.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 17276965ff1d..157c4bd009a1 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -459,8 +459,11 @@ static inline struct clk *coresight_get_enable_apb_pcl= k(struct device *dev) int ret; =20 pclk =3D clk_get(dev, "apb_pclk"); - if (IS_ERR(pclk)) - return NULL; + if (IS_ERR(pclk)) { + pclk =3D clk_get(dev, "apb"); + if (IS_ERR(pclk)) + return NULL; + } =20 ret =3D clk_prepare_enable(pclk); if (ret) { --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 E4CE425D537; Wed, 26 Feb 2025 04:14:43 +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=1740543285; cv=none; b=A4BI3K6Drz+b7NpqTGrM8IZxzoRg/BQGbZV2fgqwDZfVJDvuqhbmV8vMbFnG+NlbVA0Ytd8J0y5wsWXEf/au0J40C8qMiUEh6hEEOWTUImGL9/F4bWnu7k4WM5OBNIk2cUOQJbrs2RbfaycM+P8ngq4yfZSfzCxdr2vi29w22K4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543285; c=relaxed/simple; bh=Yi6uJB/X0TPkspG5zboHUjDTtvWR8kZKlDe4whglfHM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NyZEH+7MX2ejvCPF61ZNmr9bQLz9qcUHH2/1+Z+MF8xtmjPNCyhaLWicu0pntvg+YYdkcdgqWzMHOsuVfz3EAdocUh7gRCrZAzrtPuSSph4rq9xZmldlmcEYQZMBrSZHo1jhLa9w3y1rcbf7+Bqk1jAYyfwCoBr97Ma9lmEYWLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=bgEvjRWp; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="bgEvjRWp" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMj9gf019515; Wed, 26 Feb 2025 04:14:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= axKp4o1jJc/Pq6RiX+tIoTVzrpQ00apZ1RLBzcZ/kW0=; b=bgEvjRWpL6JGHJZy jg9wgVeODq9UeWFl+b6JRNJxkfiowM+nuzMNlpXKsH1U6ZWWK9+rGUXyiU8h6BJS rS7wm0+U/aRg6M07Nv/qBtPSQI/d8rMLzQ+8OCCmqJvIfhaxsDfcO7rpJZri1Xwm KPI+Rg7KeE1PyXnhaj4o5CVHAKgYAOG++Yj/j2Yr9u8c3MK8+w8gNsV4RuQbNpit jO+6lswUJr2/qCuRcrjdHrIed0/bqe4cFTPCnn2CKnlHJ2IDvU5WfGGn67BRsIyf CQDWyiJeVN9rzyj6PGCd4u9qRIegTxgvC0fEhFsL1Z8kuvVRS8s80T/KIp5h4Lt+ 7obHgA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451px40n82-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:16 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4EF43006463 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:15 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:10 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 02/10] Coresight: Add trace_id function to retrieving the trace ID Date: Wed, 26 Feb 2025 12:13:34 +0800 Message-ID: <20250226041342.53933-3-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: oK3UpeH-sn1Lomu7zs6kP7jOHpLyw1vS X-Proofpoint-ORIG-GUID: oK3UpeH-sn1Lomu7zs6kP7jOHpLyw1vS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260030 Content-Type: text/plain; charset="utf-8" Add 'trace_id' function pointer in coresight_ops. It's responsible for retr= ieving the device's trace ID. Co-developed-by: James Clark Signed-off-by: James Clark Reviewed-by: James Clark Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-core.c | 27 +++++++++++++++++++ drivers/hwtracing/coresight/coresight-dummy.c | 13 ++++++++- .../coresight/coresight-etm3x-core.c | 1 + .../coresight/coresight-etm4x-core.c | 1 + drivers/hwtracing/coresight/coresight-stm.c | 11 ++++++++ drivers/hwtracing/coresight/coresight-tpda.c | 11 ++++++++ include/linux/coresight.h | 5 ++++ 7 files changed, 68 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index 0a9380350fb5..6cad777757f3 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -23,6 +23,7 @@ #include "coresight-etm-perf.h" #include "coresight-priv.h" #include "coresight-syscfg.h" +#include "coresight-trace-id.h" =20 /* * Mutex used to lock all sysfs enable and disable actions and loading and @@ -1515,6 +1516,32 @@ void coresight_remove_driver(struct amba_driver *amb= a_drv, } EXPORT_SYMBOL_GPL(coresight_remove_driver); =20 +int coresight_etm_get_trace_id(struct coresight_device *csdev, enum cs_mod= e mode, + struct coresight_device *sink) +{ + int trace_id; + int cpu =3D source_ops(csdev)->cpu_id(csdev); + + switch (mode) { + case CS_MODE_SYSFS: + trace_id =3D coresight_trace_id_get_cpu_id(cpu); + break; + case CS_MODE_PERF: + trace_id =3D coresight_trace_id_get_cpu_id_map(cpu, &sink->perf_sink_id_= map); + break; + default: + trace_id =3D -EINVAL; + break; + } + + if (!IS_VALID_CS_TRACE_ID(trace_id)) + dev_err(&csdev->dev, + "Failed to allocate trace ID on CPU%d\n", cpu); + + return trace_id; +} +EXPORT_SYMBOL_GPL(coresight_etm_get_trace_id); + MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Pratik Patel "); MODULE_AUTHOR("Mathieu Poirier "); diff --git a/drivers/hwtracing/coresight/coresight-dummy.c b/drivers/hwtrac= ing/coresight/coresight-dummy.c index 9be53be8964b..b5692ba358c1 100644 --- a/drivers/hwtracing/coresight/coresight-dummy.c +++ b/drivers/hwtracing/coresight/coresight-dummy.c @@ -41,6 +41,16 @@ static void dummy_source_disable(struct coresight_device= *csdev, dev_dbg(csdev->dev.parent, "Dummy source disabled\n"); } =20 +static int dummy_source_trace_id(struct coresight_device *csdev, __maybe_u= nused enum cs_mode mode, + __maybe_unused struct coresight_device *sink) +{ + struct dummy_drvdata *drvdata; + + drvdata =3D dev_get_drvdata(csdev->dev.parent); + + return drvdata->traceid; +} + static int dummy_sink_enable(struct coresight_device *csdev, enum cs_mode = mode, void *data) { @@ -62,7 +72,8 @@ static const struct coresight_ops_source dummy_source_ops= =3D { }; =20 static const struct coresight_ops dummy_source_cs_ops =3D { - .source_ops =3D &dummy_source_ops, + .trace_id =3D dummy_source_trace_id, + .source_ops =3D &dummy_source_ops, }; =20 static const struct coresight_ops_sink dummy_sink_ops =3D { diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/h= wtracing/coresight/coresight-etm3x-core.c index c103f4c70f5d..c1dda4bc4a2f 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -704,6 +704,7 @@ static const struct coresight_ops_source etm_source_ops= =3D { }; =20 static const struct coresight_ops etm_cs_ops =3D { + .trace_id =3D coresight_etm_get_trace_id, .source_ops =3D &etm_source_ops, }; =20 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index 2c1a60577728..cfd116b87460 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1067,6 +1067,7 @@ static const struct coresight_ops_source etm4_source_= ops =3D { }; =20 static const struct coresight_ops etm4_cs_ops =3D { + .trace_id =3D coresight_etm_get_trace_id, .source_ops =3D &etm4_source_ops, }; =20 diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracin= g/coresight/coresight-stm.c index b581a30a1cd9..aca25b5e3be2 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -281,12 +281,23 @@ static void stm_disable(struct coresight_device *csde= v, } } =20 +static int stm_trace_id(struct coresight_device *csdev, __maybe_unused enu= m cs_mode mode, + __maybe_unused struct coresight_device *sink) +{ + struct stm_drvdata *drvdata; + + drvdata =3D dev_get_drvdata(csdev->dev.parent); + + return drvdata->traceid; +} + static const struct coresight_ops_source stm_source_ops =3D { .enable =3D stm_enable, .disable =3D stm_disable, }; =20 static const struct coresight_ops stm_cs_ops =3D { + .trace_id =3D stm_trace_id, .source_ops =3D &stm_source_ops, }; =20 diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtraci= ng/coresight/coresight-tpda.c index 189a4abc2561..68079169b11b 100644 --- a/drivers/hwtracing/coresight/coresight-tpda.c +++ b/drivers/hwtracing/coresight/coresight-tpda.c @@ -241,12 +241,23 @@ static void tpda_disable(struct coresight_device *csd= ev, dev_dbg(drvdata->dev, "TPDA inport %d disabled\n", in->dest_port); } =20 +static int tpda_trace_id(struct coresight_device *csdev, __maybe_unused en= um cs_mode mode, + __maybe_unused struct coresight_device *sink) +{ + struct tpda_drvdata *drvdata; + + drvdata =3D dev_get_drvdata(csdev->dev.parent); + + return drvdata->atid; +} + static const struct coresight_ops_link tpda_link_ops =3D { .enable =3D tpda_enable, .disable =3D tpda_disable, }; =20 static const struct coresight_ops tpda_cs_ops =3D { + .trace_id =3D tpda_trace_id, .link_ops =3D &tpda_link_ops, }; =20 diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 157c4bd009a1..ce89ad24c2a2 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -335,6 +335,7 @@ enum cs_mode { CS_MODE_PERF, }; =20 +#define coresight_ops(csdev) csdev->ops #define source_ops(csdev) csdev->ops->source_ops #define sink_ops(csdev) csdev->ops->sink_ops #define link_ops(csdev) csdev->ops->link_ops @@ -410,6 +411,8 @@ struct coresight_ops_helper { }; =20 struct coresight_ops { + int (*trace_id)(struct coresight_device *csdev, enum cs_mode mode, + struct coresight_device *sink); const struct coresight_ops_sink *sink_ops; const struct coresight_ops_link *link_ops; const struct coresight_ops_source *source_ops; @@ -697,4 +700,6 @@ int coresight_init_driver(const char *drv, struct amba_= driver *amba_drv, =20 void coresight_remove_driver(struct amba_driver *amba_drv, struct platform_driver *pdev_drv); +int coresight_etm_get_trace_id(struct coresight_device *csdev, enum cs_mod= e mode, + struct coresight_device *sink); #endif /* _LINUX_COREISGHT_H */ --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 E333625B675; Wed, 26 Feb 2025 04:14: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=1740543285; cv=none; b=Dq9pAPu9YNCCJIw26wxGmd+7hZjrVC2XLan2EqXy0P87bqAoB2jTiT3DFU3ZrLjIDVgFGDYhtHtLqVhcQ5Qbd3tHZG6Vxt5r6w7R/DdD6RcYl92UG39wi7MR+O66P+6wyAyanGheeMdDV5G+8vXYdaUQkh7oGZLZeIQMWcxX05k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543285; c=relaxed/simple; bh=SgfwcNAGtGysz8w5ImfVW71Vm+58S1DAXlJz7MZp4Vc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mqRKI3R4OVmn8r40XUx0iOsOtmVsX9LhyM0bR4ZZC7BrtDb/Xwuw7t8GwqHJWgTiEAAl92MEcnZY7XZRh/tjrMiIkftNZCL6J+Td+81OAlngXELYkwwoFiGQ2U9Yjd1t9v+wpWpI+OBzKeL/AP+AHhCZzjp3rENyhlsyFjrOQfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Fg8/A2UC; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Fg8/A2UC" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMWxxa012328; Wed, 26 Feb 2025 04:14:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 9cyWBbkGS49vwWOjICuYMJBNYDFOfeu+z9/asngCMic=; b=Fg8/A2UC6VFoO/e/ mHhyZ3EjwHAtl3yeEkkZ8wgZ0hlnJaI0GJkJBE9e4xmDFUA2AhOvk4/CygahQGUn DqTdml8Il8eOeoBChHQMPLRWMkTB0nCw+xIf4DdgmpZFODTJ9Fb9OzwtSMEyDulP smpAr9c+2cBH015gPv4Bzw79hs14ITFe6VzVCCeSVraFnrdxT2dYIY2nY1a1Ntjy qbL4KDzOQnoXdcMTksNmC1+9yqQ/Md/dhDqLxa+WfBFAOgyVKBFhRBpBiHgJ6MbT 3Ouser7Pcee2aDe5XMLHgOFg6e6tv5KPf/4Bt/pA0MD2pvBpHrZ7l9t/vm6xCerQ gzrQbg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451prk0p0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:22 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4ELfh001970 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:21 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:15 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 03/10] Coresight: Use coresight_etm_get_trace_id() in traceid_show() Date: Wed, 26 Feb 2025 12:13:35 +0800 Message-ID: <20250226041342.53933-4-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 65VUx2CLG7DSOFUQaIHQKTTx0SYc_38J X-Proofpoint-ORIG-GUID: 65VUx2CLG7DSOFUQaIHQKTTx0SYc_38J X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=783 malwarescore=0 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260031 Content-Type: text/plain; charset="utf-8" From: James Clark Use the new API, coresight_etm_get_trace_id, to read the traceid of the ETM device when call traceid_show via sysfs node. Signed-off-by: James Clark Reviewed-by: James Clark Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-etm3x-sysfs.c | 3 +-- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c b/drivers/= hwtracing/coresight/coresight-etm3x-sysfs.c index 68c644be9813..b9006451f515 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c @@ -1190,10 +1190,9 @@ static DEVICE_ATTR_RO(cpu); static ssize_t traceid_show(struct device *dev, struct device_attribute *attr, char *buf) { - int trace_id; struct etm_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + int trace_id =3D coresight_etm_get_trace_id(drvdata->csdev, CS_MODE_SYSFS= , NULL); =20 - trace_id =3D etm_read_alloc_trace_id(drvdata); if (trace_id < 0) return trace_id; =20 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/= hwtracing/coresight/coresight-etm4x-sysfs.c index c767f8ae4cf1..e5216c0f60da 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -4,6 +4,7 @@ * Author: Mathieu Poirier */ =20 +#include #include #include #include @@ -2402,10 +2403,9 @@ static ssize_t trctraceid_show(struct device *dev, struct device_attribute *attr, char *buf) { - int trace_id; struct etmv4_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + int trace_id =3D coresight_etm_get_trace_id(drvdata->csdev, CS_MODE_SYSFS= , NULL); =20 - trace_id =3D etm4_read_alloc_trace_id(drvdata); if (trace_id < 0) return trace_id; =20 --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 AF684267709; Wed, 26 Feb 2025 04:14:44 +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=1740543286; cv=none; b=RpCh7pREV8oLbwZUw4LBUe5stKdGUdWxzoTFp6SbCTxdgMEgyCIbF9ATvebgzHtX9BVC5oTK4ejnwfl9fWrtpcoqG0ASVJ9LmubG6zOQKOgpgWWXb2Gnk6fzPlV0qml79rRQm+i+74Ohonn25TLwYmQnkculvWZXheRjakuhk4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543286; c=relaxed/simple; bh=+IQVYAwyWJKNhTYDndNTSQX0FSeCf74KhGopBm/TzeI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IIwQC0pbJF/7UzmhV92WN1GpAM2ofgPO8sQDt8BmDBPYmbc3t9zXNzoegaeGNPI66K96eFVQ0ggs0atbAGYbnTfqzum6CuA741bgmgkL8dGG1uZ1yUJ9U0yehY8N5HIgf6yRVJa6zw7iA5g4TZu+p/m41X9/IFzulsqs6eHpuRY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Pky5kA6X; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Pky5kA6X" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMXN2g008490; Wed, 26 Feb 2025 04:14:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= eB5NRc0KxfruKQSb7TzkawpegiIZlyjKAz6VbMEbflw=; b=Pky5kA6XCwaodCdj YRJazIXhHZNviQehpMuxGv+wJjObkAczkHS9odt+GUzw+HLnqMfR3vECi5tBsfA6 KVYuv7Or1HKH14hLH5c/PlLEFZGKTS4oAiFQ8nivap9rilzPFlW5tATSq+ym+StV 2dkJz9Q8YNNXWZI0WXJ4xQmNjcnWXIFuPqG4DJd3EJs5hGk2DFDsz4uPk7xYxiJl NuJb5PTqPUaTaHUqR9tXtrdoTSVe49RlOYhzkYkxOPcNIsAQhkb7WiAwEjtiABam SvENDAOWc7nZz4kZ0o3GVdM4dGm0ez60omrfJXFiqbPoQHUvCfT2GVmEBwAL/xE+ g/IATQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451prmrnud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:27 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4EQ7u002031 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:26 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:21 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 04/10] Coresight: Introduce a new struct coresight_path Date: Wed, 26 Feb 2025 12:13:36 +0800 Message-ID: <20250226041342.53933-5-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: E5NfrUz_fbZx5ke2x2ihaP3Vm5iU-5__ X-Proofpoint-ORIG-GUID: E5NfrUz_fbZx5ke2x2ihaP3Vm5iU-5__ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 malwarescore=0 impostorscore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260031 Content-Type: text/plain; charset="utf-8" Introduce a new strcuture, 'struct coresight_path', to store the data that utilized by the devices in the path. The coresight_path will be built/relea= sed by coresight_build_path/coresight_release_path functions. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-core.c | 16 +++++----- .../hwtracing/coresight/coresight-etm-perf.c | 30 ++++++++++--------- .../hwtracing/coresight/coresight-etm-perf.h | 2 +- drivers/hwtracing/coresight/coresight-priv.h | 6 ++-- drivers/hwtracing/coresight/coresight-sysfs.c | 12 ++++---- include/linux/coresight.h | 10 +++++++ 6 files changed, 44 insertions(+), 32 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index 6cad777757f3..9c2a088a28d8 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -669,7 +669,7 @@ static void coresight_drop_device(struct coresight_devi= ce *csdev) static int _coresight_build_path(struct coresight_device *csdev, struct coresight_device *source, struct coresight_device *sink, - struct list_head *path) + struct coresight_path *path) { int i, ret; bool found =3D false; @@ -722,25 +722,25 @@ static int _coresight_build_path(struct coresight_dev= ice *csdev, return -ENOMEM; =20 node->csdev =3D csdev; - list_add(&node->link, path); + list_add(&node->link, &path->path_list); =20 return 0; } =20 -struct list_head *coresight_build_path(struct coresight_device *source, +struct coresight_path *coresight_build_path(struct coresight_device *sourc= e, struct coresight_device *sink) { - struct list_head *path; + struct coresight_path *path; int rc; =20 if (!sink) return ERR_PTR(-EINVAL); =20 - path =3D kzalloc(sizeof(struct list_head), GFP_KERNEL); + path =3D kzalloc(sizeof(struct coresight_path), GFP_KERNEL); if (!path) return ERR_PTR(-ENOMEM); =20 - INIT_LIST_HEAD(path); + INIT_LIST_HEAD(&path->path_list); =20 rc =3D _coresight_build_path(source, source, sink, path); if (rc) { @@ -758,12 +758,12 @@ struct list_head *coresight_build_path(struct coresig= ht_device *source, * Go through all the elements of a path and 1) removed it from the list a= nd * 2) free the memory allocated for each node. */ -void coresight_release_path(struct list_head *path) +void coresight_release_path(struct coresight_path *path) { struct coresight_device *csdev; struct coresight_node *nd, *next; =20 - list_for_each_entry_safe(nd, next, path, link) { + list_for_each_entry_safe(nd, next, &path->path_list, link) { csdev =3D nd->csdev; =20 coresight_drop_device(csdev); diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index ad6a8f4b70b6..b0426792f08a 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -136,13 +136,13 @@ static const struct attribute_group *etm_pmu_attr_gro= ups[] =3D { NULL, }; =20 -static inline struct list_head ** +static inline struct coresight_path ** etm_event_cpu_path_ptr(struct etm_event_data *data, int cpu) { return per_cpu_ptr(data->path, cpu); } =20 -static inline struct list_head * +static inline struct coresight_path * etm_event_cpu_path(struct etm_event_data *data, int cpu) { return *etm_event_cpu_path_ptr(data, cpu); @@ -197,6 +197,7 @@ static void free_sink_buffer(struct etm_event_data *eve= nt_data) int cpu; cpumask_t *mask =3D &event_data->mask; struct coresight_device *sink; + struct coresight_path *path; =20 if (!event_data->snk_config) return; @@ -205,7 +206,8 @@ static void free_sink_buffer(struct etm_event_data *eve= nt_data) return; =20 cpu =3D cpumask_first(mask); - sink =3D coresight_get_sink(etm_event_cpu_path(event_data, cpu)); + path =3D etm_event_cpu_path(event_data, cpu); + sink =3D coresight_get_sink(&path->path_list); sink_ops(sink)->free_buffer(event_data->snk_config); } =20 @@ -226,11 +228,11 @@ static void free_event_data(struct work_struct *work) cscfg_deactivate_config(event_data->cfg_hash); =20 for_each_cpu(cpu, mask) { - struct list_head **ppath; + struct coresight_path **ppath; =20 ppath =3D etm_event_cpu_path_ptr(event_data, cpu); if (!(IS_ERR_OR_NULL(*ppath))) { - struct coresight_device *sink =3D coresight_get_sink(*ppath); + struct coresight_device *sink =3D coresight_get_sink(&((*ppath)->path_l= ist)); =20 /* * Mark perf event as done for trace id allocator, but don't call @@ -276,7 +278,7 @@ static void *alloc_event_data(int cpu) * unused memory when dealing with single CPU trace scenarios is small * compared to the cost of searching through an optimized array. */ - event_data->path =3D alloc_percpu(struct list_head *); + event_data->path =3D alloc_percpu(struct coresight_path *); =20 if (!event_data->path) { kfree(event_data); @@ -352,7 +354,7 @@ static void *etm_setup_aux(struct perf_event *event, vo= id **pages, * CPUs, we can handle it and fail the session. */ for_each_cpu(cpu, mask) { - struct list_head *path; + struct coresight_path *path; struct coresight_device *csdev; =20 csdev =3D per_cpu(csdev_src, cpu); @@ -458,7 +460,7 @@ static void etm_event_start(struct perf_event *event, i= nt flags) struct etm_ctxt *ctxt =3D this_cpu_ptr(&etm_ctxt); struct perf_output_handle *handle =3D &ctxt->handle; struct coresight_device *sink, *csdev =3D per_cpu(csdev_src, cpu); - struct list_head *path; + struct coresight_path *path; u64 hw_id; u8 trace_id; =20 @@ -494,12 +496,12 @@ static void etm_event_start(struct perf_event *event,= int flags) =20 path =3D etm_event_cpu_path(event_data, cpu); /* We need a sink, no need to continue without one */ - sink =3D coresight_get_sink(path); + sink =3D coresight_get_sink(&path->path_list); if (WARN_ON_ONCE(!sink)) goto fail_end_stop; =20 /* Nothing will happen without a path */ - if (coresight_enable_path(path, CS_MODE_PERF, handle)) + if (coresight_enable_path(&path->path_list, CS_MODE_PERF, handle)) goto fail_end_stop; =20 /* Finally enable the tracer */ @@ -534,7 +536,7 @@ static void etm_event_start(struct perf_event *event, i= nt flags) return; =20 fail_disable_path: - coresight_disable_path(path); + coresight_disable_path(&path->path_list); fail_end_stop: /* * Check if the handle is still associated with the event, @@ -558,7 +560,7 @@ static void etm_event_stop(struct perf_event *event, in= t mode) struct etm_ctxt *ctxt =3D this_cpu_ptr(&etm_ctxt); struct perf_output_handle *handle =3D &ctxt->handle; struct etm_event_data *event_data; - struct list_head *path; + struct coresight_path *path; =20 /* * If we still have access to the event_data via handle, @@ -599,7 +601,7 @@ static void etm_event_stop(struct perf_event *event, in= t mode) if (!path) return; =20 - sink =3D coresight_get_sink(path); + sink =3D coresight_get_sink(&path->path_list); if (!sink) return; =20 @@ -643,7 +645,7 @@ static void etm_event_stop(struct perf_event *event, in= t mode) } =20 /* Disabling the path make its elements available to other sessions */ - coresight_disable_path(path); + coresight_disable_path(&path->path_list); } =20 static int etm_event_add(struct perf_event *event, int mode) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwt= racing/coresight/coresight-etm-perf.h index 744531158d6b..5febbcdb8696 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -59,7 +59,7 @@ struct etm_event_data { cpumask_t aux_hwid_done; void *snk_config; u32 cfg_hash; - struct list_head * __percpu *path; + struct coresight_path * __percpu *path; }; =20 int etm_perf_symlink(struct coresight_device *csdev, bool link); diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtraci= ng/coresight/coresight-priv.h index 76403530f33e..27b7dc348d4a 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -139,9 +139,9 @@ struct coresight_device *coresight_get_sink(struct list= _head *path); struct coresight_device *coresight_get_sink_by_id(u32 id); struct coresight_device * coresight_find_default_sink(struct coresight_device *csdev); -struct list_head *coresight_build_path(struct coresight_device *csdev, - struct coresight_device *sink); -void coresight_release_path(struct list_head *path); +struct coresight_path *coresight_build_path(struct coresight_device *csdev, + struct coresight_device *sink); +void coresight_release_path(struct coresight_path *path); int coresight_add_sysfs_link(struct coresight_sysfs_link *info); void coresight_remove_sysfs_link(struct coresight_sysfs_link *info); int coresight_create_conns_sysfs_group(struct coresight_device *csdev); diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtrac= ing/coresight/coresight-sysfs.c index a01c9e54e2ed..cb4c39732d26 100644 --- a/drivers/hwtracing/coresight/coresight-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -22,7 +22,7 @@ static DEFINE_IDR(path_idr); * When operating Coresight drivers from the sysFS interface, only a single * path can exist from a tracer (associated to a CPU) to a sink. */ -static DEFINE_PER_CPU(struct list_head *, tracer_path); +static DEFINE_PER_CPU(struct coresight_path *, tracer_path); =20 ssize_t coresight_simple_show_pair(struct device *_dev, struct device_attribute *attr, char *buf) @@ -167,7 +167,7 @@ int coresight_enable_sysfs(struct coresight_device *csd= ev) { int cpu, ret =3D 0; struct coresight_device *sink; - struct list_head *path; + struct coresight_path *path; enum coresight_dev_subtype_source subtype; u32 hash; =20 @@ -209,7 +209,7 @@ int coresight_enable_sysfs(struct coresight_device *csd= ev) goto out; } =20 - ret =3D coresight_enable_path(path, CS_MODE_SYSFS, NULL); + ret =3D coresight_enable_path(&path->path_list, CS_MODE_SYSFS, NULL); if (ret) goto err_path; =20 @@ -251,7 +251,7 @@ int coresight_enable_sysfs(struct coresight_device *csd= ev) return ret; =20 err_source: - coresight_disable_path(path); + coresight_disable_path(&path->path_list); =20 err_path: coresight_release_path(path); @@ -262,7 +262,7 @@ EXPORT_SYMBOL_GPL(coresight_enable_sysfs); void coresight_disable_sysfs(struct coresight_device *csdev) { int cpu, ret; - struct list_head *path =3D NULL; + struct coresight_path *path =3D NULL; u32 hash; =20 mutex_lock(&coresight_mutex); @@ -297,7 +297,7 @@ void coresight_disable_sysfs(struct coresight_device *c= sdev) break; } =20 - coresight_disable_path(path); + coresight_disable_path(&path->path_list); coresight_release_path(path); =20 out: diff --git a/include/linux/coresight.h b/include/linux/coresight.h index ce89ad24c2a2..00404ba19352 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -329,6 +329,16 @@ static struct coresight_dev_list (var) =3D { \ =20 #define to_coresight_device(d) container_of(d, struct coresight_device, de= v) =20 +/** + * struct coresight_path - data needed by enable/disable path + * @path: path from source to sink. + * @trace_id: trace_id of the whole path. + */ +struct coresight_path { + struct list_head path_list; + u8 trace_id; +}; + enum cs_mode { CS_MODE_DISABLED, CS_MODE_SYSFS, --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 79A502690CB; Wed, 26 Feb 2025 04:14: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=1740543289; cv=none; b=F7R2KDKfMERpcgqcN3lnmQ6S/CsXXFxuXujbfjwzik/FvDS3MBtvz63XOKEahMZGOZI/JCHdKutPOBZyYrgFL8A+0G522sNgRWQQr0PMnjsVQLMODptB1xZiz7SXF6PPYoLQ9BPSzTXEq+57no6cOwVXK1yWwrzZaUNfJ/6jeaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543289; c=relaxed/simple; bh=cWvGsEIe/w8DhX3H2sGbeyXeEpekLGcBKP11PnDj5zE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Tx5M/WBHXBf0JWf9YhQFMf37/k4BtmgTs7TTVfiX33WV+aV1KOfzmuEqam1+V7TP0WYx7rrULZyx+ZtPqCMNp7LO6B9tysB2OLmIdMGD4hkdXk6H0Qf8hkr4oxJjV7nM0npzAaZl1ts+XB/NU7GmIfYLPgm2OQ9wggBHFaGYO9Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=k5oaiJyf; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="k5oaiJyf" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMWsKA011784; Wed, 26 Feb 2025 04:14:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Tvd6PQOHZ0J27DnYpXhsT0IWck9Gufflc7RPhPz54ao=; b=k5oaiJyfrQ5iR8ge 0lhQ4oT9Hko0ZLzfEuMUg1tJQc8GwoQ8agTP6JRr4FgLTnf/KIOCz0CROuiOQTbt Kll6HzR8qnUtIP1WsPvNYAOx3vgVQZ1P6i0ngyV5BWFxF6D5/J62SjJLH0kyD2ue oYqOKPEuJ6KW+OwCB04beKsjHC7JDByil4V6BrPgCL4zWllMMlPVJ738W/TjIH7c HiN3aiIjamQZi9wW4znCu0MdgVE3EZgUFk1E8vu3xOAD7a90AlrXiodRUu/9zVmH YmCzRCr1OgfP9n87qMJOPtGkUnPU5Pzn0Pu8bsUG7OU3V/CpzdLtvzxSoC/xtmC6 rbAmfA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451prmgp29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:33 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4EWXl006603 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:32 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:27 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 05/10] Coresight: Allocate trace ID after building the path Date: Wed, 26 Feb 2025 12:13:37 +0800 Message-ID: <20250226041342.53933-6-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: uhjetGmKCrHoEbEJA0dMGOAeTV5zi65L X-Proofpoint-GUID: uhjetGmKCrHoEbEJA0dMGOAeTV5zi65L X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 impostorscore=0 adultscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260031 Content-Type: text/plain; charset="utf-8" The trace_id will be stored in coresight_path instead of being declared everywhere and allocated after building the path. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-core.c | 44 +++++++++++++++++++ .../hwtracing/coresight/coresight-etm-perf.c | 5 +-- drivers/hwtracing/coresight/coresight-priv.h | 2 + drivers/hwtracing/coresight/coresight-sysfs.c | 4 ++ 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index 9c2a088a28d8..7d010d996f01 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -654,6 +654,50 @@ static void coresight_drop_device(struct coresight_dev= ice *csdev) } } =20 +/* + * coresight device will read their existing or alloc a trace ID, if their= trace_id + * callback is set. + * + * Return 0 if the trace_id callback is not set. + * Return the result of the trace_id callback if it is set. The return val= ue + * will be the trace_id if successful, and an error number if it fails. + */ +static int coresight_get_trace_id(struct coresight_device *csdev, + enum cs_mode mode, + struct coresight_device *sink) +{ + if (coresight_ops(csdev)->trace_id) + return coresight_ops(csdev)->trace_id(csdev, mode, sink); + + return 0; +} + +/* + * Call this after creating the path and before enabling it. This leaves + * the trace ID set on the path, or it remains 0 if it couldn't be assigne= d. + */ +void coresight_path_assign_trace_id(struct coresight_path *path, + enum cs_mode mode) +{ + struct coresight_device *sink =3D coresight_get_sink(&path->path_list); + struct coresight_node *nd; + int trace_id; + + list_for_each_entry(nd, &path->path_list, link) { + /* Assign a trace ID to the path for the first device that wants to do i= t */ + trace_id =3D coresight_get_trace_id(nd->csdev, mode, sink); + + /* + * 0 in this context is that it didn't want to assign so keep searching. + * Non 0 is either success or fail. + */ + if (trace_id !=3D 0) { + path->trace_id =3D trace_id; + return; + } + } +} + /** * _coresight_build_path - recursively build a path from a @csdev to a sin= k. * @csdev: The device to start from. diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index b0426792f08a..134290ab622e 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -319,7 +319,6 @@ static void *etm_setup_aux(struct perf_event *event, vo= id **pages, { u32 id, cfg_hash; int cpu =3D event->cpu; - int trace_id; cpumask_t *mask; struct coresight_device *sink =3D NULL; struct coresight_device *user_sink =3D NULL, *last_sink =3D NULL; @@ -409,8 +408,8 @@ static void *etm_setup_aux(struct perf_event *event, vo= id **pages, } =20 /* ensure we can allocate a trace ID for this CPU */ - trace_id =3D coresight_trace_id_get_cpu_id_map(cpu, &sink->perf_sink_id_= map); - if (!IS_VALID_CS_TRACE_ID(trace_id)) { + coresight_path_assign_trace_id(path, CS_MODE_PERF); + if (!IS_VALID_CS_TRACE_ID(path->trace_id)) { cpumask_clear_cpu(cpu, mask); coresight_release_path(path); continue; diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtraci= ng/coresight/coresight-priv.h index 27b7dc348d4a..2bea35bae0d4 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -152,6 +152,8 @@ int coresight_make_links(struct coresight_device *orig, void coresight_remove_links(struct coresight_device *orig, struct coresight_connection *conn); u32 coresight_get_sink_id(struct coresight_device *csdev); +void coresight_path_assign_trace_id(struct coresight_path *path, + enum cs_mode mode); =20 #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) extern int etm_readl_cp14(u32 off, unsigned int *val); diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtrac= ing/coresight/coresight-sysfs.c index cb4c39732d26..d03751bf3d8a 100644 --- a/drivers/hwtracing/coresight/coresight-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -209,6 +209,10 @@ int coresight_enable_sysfs(struct coresight_device *cs= dev) goto out; } =20 + coresight_path_assign_trace_id(path, CS_MODE_SYSFS); + if (!IS_VALID_CS_TRACE_ID(path->trace_id)) + goto err_path; + ret =3D coresight_enable_path(&path->path_list, CS_MODE_SYSFS, NULL); if (ret) goto err_path; --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 F37B9260A53; Wed, 26 Feb 2025 04:14:53 +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=1740543295; cv=none; b=B6QE+WyPHMPeslPZhRhcMk4wVAXNsdIG7ECnT/sAQIl4JgHgZjbf7aVPQf3yq6WtJH/DWB45KsldK2gqaaTDRMTLaa9ehzvnKXdpsO5Gov9mJr880LiBM0TH4dIdbnm09cJmjretu+WjrMqPxqgunsbjRNzGXCa6PMxOfVC0+mQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543295; c=relaxed/simple; bh=w4599f7LGkI+L4vpdVojy1e1AZHo4RgI4o0GldKp0sI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ADjxiGygAZWMNROD5ESWBoEr49c6k5UsSj5UWfzdreHUsCInAMoFJK4PyPlNuzgFDA+y0X7z1N0TZymxq1x13xCi+ISm+ULL9ig/5gi94DwBfGCjHuGweFn/B+1ydp0Zlmmglgfcqs0ErmlxfsHbkp6tC5LST4hET8MvQFTHOEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=ZQKUWuyJ; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ZQKUWuyJ" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMWqTn011761; Wed, 26 Feb 2025 04:14:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= JfSFcWfa6ezTimO1/jNj4dZcW5ADuPMOfL/fo3PVBGA=; b=ZQKUWuyJ/OQdlvoi 7dAP+Vx8J2m1ophISgit5Q0LTSzazh82bAmFl2rOhaZwXcvQmnjhKNRI5Vhj9M65 kwlNybB6n9oxsyLsMxEvwjnadGQZa4QLX7BfnUVbtx8Q2kJjto5dPEToio6S8vvd XEKmJ9W9JWe2x3gx8nnfze4wgzrg61Yf/y7zVIMLGwmKBT8X3AuZM82O5Ol/lbXo TfpDcs0sp9H8DHRX17VEnBGZXtH7wdHvdmp1p4uqfb7s46eZ5XmOefFZl2UDf0iT zuvZuHkeM7Y1j/4wIjGmvFhWpUT5sipuLdUdU5H6YPvsDCXuuVrv1mPLKqKYG3Al YCa9hA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451prmgp2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:38 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4Ect7031290 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:38 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:32 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 06/10] Coresight: Change to read the trace ID from coresight_path Date: Wed, 26 Feb 2025 12:13:38 +0800 Message-ID: <20250226041342.53933-7-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: VM20HspqsoCE2-osMIOIUSk2LP8V3aAz X-Proofpoint-GUID: VM20HspqsoCE2-osMIOIUSk2LP8V3aAz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 impostorscore=0 adultscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260031 Content-Type: text/plain; charset="utf-8" The source device can directly read the trace ID from the coresight_path which result in etm_read_alloc_trace_id and etm4_read_alloc_trace_id being deleted. Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-dummy.c | 2 +- .../hwtracing/coresight/coresight-etm-perf.c | 8 +-- drivers/hwtracing/coresight/coresight-etm.h | 1 - .../coresight/coresight-etm3x-core.c | 54 +++---------------- .../coresight/coresight-etm4x-core.c | 54 +++---------------- drivers/hwtracing/coresight/coresight-etm4x.h | 1 - drivers/hwtracing/coresight/coresight-stm.c | 2 +- drivers/hwtracing/coresight/coresight-sysfs.c | 7 +-- drivers/hwtracing/coresight/coresight-tpdm.c | 2 +- include/linux/coresight.h | 2 +- 10 files changed, 25 insertions(+), 108 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-dummy.c b/drivers/hwtrac= ing/coresight/coresight-dummy.c index b5692ba358c1..aaa92b5081e3 100644 --- a/drivers/hwtracing/coresight/coresight-dummy.c +++ b/drivers/hwtracing/coresight/coresight-dummy.c @@ -24,7 +24,7 @@ DEFINE_CORESIGHT_DEVLIST(sink_devs, "dummy_sink"); =20 static int dummy_source_enable(struct coresight_device *csdev, struct perf_event *event, enum cs_mode mode, - __maybe_unused struct coresight_trace_id_map *id_map) + __maybe_unused struct coresight_path *path) { if (!coresight_take_mode(csdev, mode)) return -EBUSY; diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index 134290ab622e..300305d67a1d 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -461,7 +461,6 @@ static void etm_event_start(struct perf_event *event, i= nt flags) struct coresight_device *sink, *csdev =3D per_cpu(csdev_src, cpu); struct coresight_path *path; u64 hw_id; - u8 trace_id; =20 if (!csdev) goto fail; @@ -504,8 +503,7 @@ static void etm_event_start(struct perf_event *event, i= nt flags) goto fail_end_stop; =20 /* Finally enable the tracer */ - if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF, - &sink->perf_sink_id_map)) + if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF, path)) goto fail_disable_path; =20 /* @@ -515,13 +513,11 @@ static void etm_event_start(struct perf_event *event,= int flags) if (!cpumask_test_cpu(cpu, &event_data->aux_hwid_done)) { cpumask_set_cpu(cpu, &event_data->aux_hwid_done); =20 - trace_id =3D coresight_trace_id_read_cpu_id_map(cpu, &sink->perf_sink_id= _map); - hw_id =3D FIELD_PREP(CS_AUX_HW_ID_MAJOR_VERSION_MASK, CS_AUX_HW_ID_MAJOR_VERSION); hw_id |=3D FIELD_PREP(CS_AUX_HW_ID_MINOR_VERSION_MASK, CS_AUX_HW_ID_MINOR_VERSION); - hw_id |=3D FIELD_PREP(CS_AUX_HW_ID_TRACE_ID_MASK, trace_id); + hw_id |=3D FIELD_PREP(CS_AUX_HW_ID_TRACE_ID_MASK, path->trace_id); hw_id |=3D FIELD_PREP(CS_AUX_HW_ID_SINK_ID_MASK, coresight_get_sink_id(s= ink)); =20 perf_report_aux_output_id(event, hw_id); diff --git a/drivers/hwtracing/coresight/coresight-etm.h b/drivers/hwtracin= g/coresight/coresight-etm.h index e02c3ea972c9..171f1384f7c0 100644 --- a/drivers/hwtracing/coresight/coresight-etm.h +++ b/drivers/hwtracing/coresight/coresight-etm.h @@ -284,6 +284,5 @@ extern const struct attribute_group *coresight_etm_grou= ps[]; void etm_set_default(struct etm_config *config); void etm_config_trace_mode(struct etm_config *config); struct etm_config *get_etm_config(struct etm_drvdata *drvdata); -int etm_read_alloc_trace_id(struct etm_drvdata *drvdata); void etm_release_trace_id(struct etm_drvdata *drvdata); #endif diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/h= wtracing/coresight/coresight-etm3x-core.c index c1dda4bc4a2f..8927bfaf3af2 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -455,26 +455,6 @@ static int etm_cpu_id(struct coresight_device *csdev) return drvdata->cpu; } =20 -int etm_read_alloc_trace_id(struct etm_drvdata *drvdata) -{ - int trace_id; - - /* - * This will allocate a trace ID to the cpu, - * or return the one currently allocated. - * - * trace id function has its own lock - */ - trace_id =3D coresight_trace_id_get_cpu_id(drvdata->cpu); - if (IS_VALID_CS_TRACE_ID(trace_id)) - drvdata->traceid =3D (u8)trace_id; - else - dev_err(&drvdata->csdev->dev, - "Failed to allocate trace ID for %s on CPU%d\n", - dev_name(&drvdata->csdev->dev), drvdata->cpu); - return trace_id; -} - void etm_release_trace_id(struct etm_drvdata *drvdata) { coresight_trace_id_put_cpu_id(drvdata->cpu); @@ -482,38 +462,22 @@ void etm_release_trace_id(struct etm_drvdata *drvdata) =20 static int etm_enable_perf(struct coresight_device *csdev, struct perf_event *event, - struct coresight_trace_id_map *id_map) + struct coresight_path *path) { struct etm_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); - int trace_id; =20 if (WARN_ON_ONCE(drvdata->cpu !=3D smp_processor_id())) return -EINVAL; =20 /* Configure the tracer based on the session's specifics */ etm_parse_event_config(drvdata, event); - - /* - * perf allocates cpu ids as part of _setup_aux() - device needs to use - * the allocated ID. This reads the current version without allocation. - * - * This does not use the trace id lock to prevent lock_dep issues - * with perf locks - we know the ID cannot change until perf shuts down - * the session - */ - trace_id =3D coresight_trace_id_read_cpu_id_map(drvdata->cpu, id_map); - if (!IS_VALID_CS_TRACE_ID(trace_id)) { - dev_err(&drvdata->csdev->dev, "Failed to set trace ID for %s on CPU%d\n", - dev_name(&drvdata->csdev->dev), drvdata->cpu); - return -EINVAL; - } - drvdata->traceid =3D (u8)trace_id; + drvdata->traceid =3D path->trace_id; =20 /* And enable it */ return etm_enable_hw(drvdata); } =20 -static int etm_enable_sysfs(struct coresight_device *csdev) +static int etm_enable_sysfs(struct coresight_device *csdev, struct coresig= ht_path *path) { struct etm_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); struct etm_enable_arg arg =3D { }; @@ -521,10 +485,7 @@ static int etm_enable_sysfs(struct coresight_device *c= sdev) =20 spin_lock(&drvdata->spinlock); =20 - /* sysfs needs to allocate and set a trace ID */ - ret =3D etm_read_alloc_trace_id(drvdata); - if (ret < 0) - goto unlock_enable_sysfs; + drvdata->traceid =3D path->trace_id; =20 /* * Configure the ETM only if the CPU is online. If it isn't online @@ -545,7 +506,6 @@ static int etm_enable_sysfs(struct coresight_device *cs= dev) if (ret) etm_release_trace_id(drvdata); =20 -unlock_enable_sysfs: spin_unlock(&drvdata->spinlock); =20 if (!ret) @@ -554,7 +514,7 @@ static int etm_enable_sysfs(struct coresight_device *cs= dev) } =20 static int etm_enable(struct coresight_device *csdev, struct perf_event *e= vent, - enum cs_mode mode, struct coresight_trace_id_map *id_map) + enum cs_mode mode, struct coresight_path *path) { int ret; struct etm_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); @@ -566,10 +526,10 @@ static int etm_enable(struct coresight_device *csdev,= struct perf_event *event, =20 switch (mode) { case CS_MODE_SYSFS: - ret =3D etm_enable_sysfs(csdev); + ret =3D etm_enable_sysfs(csdev, path); break; case CS_MODE_PERF: - ret =3D etm_enable_perf(csdev, event, id_map); + ret =3D etm_enable_perf(csdev, event, path); break; default: ret =3D -EINVAL; diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/h= wtracing/coresight/coresight-etm4x-core.c index cfd116b87460..1ed957f5df61 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -233,25 +233,6 @@ static int etm4_cpu_id(struct coresight_device *csdev) return drvdata->cpu; } =20 -int etm4_read_alloc_trace_id(struct etmv4_drvdata *drvdata) -{ - int trace_id; - - /* - * This will allocate a trace ID to the cpu, - * or return the one currently allocated. - * The trace id function has its own lock - */ - trace_id =3D coresight_trace_id_get_cpu_id(drvdata->cpu); - if (IS_VALID_CS_TRACE_ID(trace_id)) - drvdata->trcid =3D (u8)trace_id; - else - dev_err(&drvdata->csdev->dev, - "Failed to allocate trace ID for %s on CPU%d\n", - dev_name(&drvdata->csdev->dev), drvdata->cpu); - return trace_id; -} - void etm4_release_trace_id(struct etmv4_drvdata *drvdata) { coresight_trace_id_put_cpu_id(drvdata->cpu); @@ -788,9 +769,9 @@ static int etm4_parse_event_config(struct coresight_dev= ice *csdev, =20 static int etm4_enable_perf(struct coresight_device *csdev, struct perf_event *event, - struct coresight_trace_id_map *id_map) + struct coresight_path *path) { - int ret =3D 0, trace_id; + int ret =3D 0; struct etmv4_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); =20 if (WARN_ON_ONCE(drvdata->cpu !=3D smp_processor_id())) { @@ -803,22 +784,7 @@ static int etm4_enable_perf(struct coresight_device *c= sdev, if (ret) goto out; =20 - /* - * perf allocates cpu ids as part of _setup_aux() - device needs to use - * the allocated ID. This reads the current version without allocation. - * - * This does not use the trace id lock to prevent lock_dep issues - * with perf locks - we know the ID cannot change until perf shuts down - * the session - */ - trace_id =3D coresight_trace_id_read_cpu_id_map(drvdata->cpu, id_map); - if (!IS_VALID_CS_TRACE_ID(trace_id)) { - dev_err(&drvdata->csdev->dev, "Failed to set trace ID for %s on CPU%d\n", - dev_name(&drvdata->csdev->dev), drvdata->cpu); - ret =3D -EINVAL; - goto out; - } - drvdata->trcid =3D (u8)trace_id; + drvdata->trcid =3D path->trace_id; =20 /* And enable it */ ret =3D etm4_enable_hw(drvdata); @@ -827,7 +793,7 @@ static int etm4_enable_perf(struct coresight_device *cs= dev, return ret; } =20 -static int etm4_enable_sysfs(struct coresight_device *csdev) +static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresi= ght_path *path) { struct etmv4_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); struct etm4_enable_arg arg =3D { }; @@ -844,10 +810,7 @@ static int etm4_enable_sysfs(struct coresight_device *= csdev) =20 spin_lock(&drvdata->spinlock); =20 - /* sysfs needs to read and allocate a trace ID */ - ret =3D etm4_read_alloc_trace_id(drvdata); - if (ret < 0) - goto unlock_sysfs_enable; + drvdata->trcid =3D path->trace_id; =20 /* * Executing etm4_enable_hw on the cpu whose ETM is being enabled @@ -864,7 +827,6 @@ static int etm4_enable_sysfs(struct coresight_device *c= sdev) if (ret) etm4_release_trace_id(drvdata); =20 -unlock_sysfs_enable: spin_unlock(&drvdata->spinlock); =20 if (!ret) @@ -873,7 +835,7 @@ static int etm4_enable_sysfs(struct coresight_device *c= sdev) } =20 static int etm4_enable(struct coresight_device *csdev, struct perf_event *= event, - enum cs_mode mode, struct coresight_trace_id_map *id_map) + enum cs_mode mode, struct coresight_path *path) { int ret; =20 @@ -884,10 +846,10 @@ static int etm4_enable(struct coresight_device *csdev= , struct perf_event *event, =20 switch (mode) { case CS_MODE_SYSFS: - ret =3D etm4_enable_sysfs(csdev); + ret =3D etm4_enable_sysfs(csdev, path); break; case CS_MODE_PERF: - ret =3D etm4_enable_perf(csdev, event, id_map); + ret =3D etm4_enable_perf(csdev, event, path); break; default: ret =3D -EINVAL; diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtrac= ing/coresight/coresight-etm4x.h index 1119762b5cec..2b92de17b5a2 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -1066,6 +1066,5 @@ static inline bool etm4x_is_ete(struct etmv4_drvdata = *drvdata) return drvdata->arch >=3D ETM_ARCH_ETE; } =20 -int etm4_read_alloc_trace_id(struct etmv4_drvdata *drvdata); void etm4_release_trace_id(struct etmv4_drvdata *drvdata); #endif diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracin= g/coresight/coresight-stm.c index aca25b5e3be2..26f9339f38b9 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -195,7 +195,7 @@ static void stm_enable_hw(struct stm_drvdata *drvdata) =20 static int stm_enable(struct coresight_device *csdev, struct perf_event *e= vent, enum cs_mode mode, - __maybe_unused struct coresight_trace_id_map *trace_id) + __maybe_unused struct coresight_path *path) { struct stm_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); =20 diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtrac= ing/coresight/coresight-sysfs.c index d03751bf3d8a..3ac5b52413a6 100644 --- a/drivers/hwtracing/coresight/coresight-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -53,7 +53,8 @@ ssize_t coresight_simple_show32(struct device *_dev, EXPORT_SYMBOL_GPL(coresight_simple_show32); =20 static int coresight_enable_source_sysfs(struct coresight_device *csdev, - enum cs_mode mode, void *data) + enum cs_mode mode, + struct coresight_path *path) { int ret; =20 @@ -64,7 +65,7 @@ static int coresight_enable_source_sysfs(struct coresight= _device *csdev, */ lockdep_assert_held(&coresight_mutex); if (coresight_get_mode(csdev) !=3D CS_MODE_SYSFS) { - ret =3D source_ops(csdev)->enable(csdev, data, mode, NULL); + ret =3D source_ops(csdev)->enable(csdev, NULL, mode, path); if (ret) return ret; } @@ -217,7 +218,7 @@ int coresight_enable_sysfs(struct coresight_device *csd= ev) if (ret) goto err_path; =20 - ret =3D coresight_enable_source_sysfs(csdev, CS_MODE_SYSFS, NULL); + ret =3D coresight_enable_source_sysfs(csdev, CS_MODE_SYSFS, path); if (ret) goto err_source; =20 diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtraci= ng/coresight/coresight-tpdm.c index c38f9701665e..fec49a537658 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -440,7 +440,7 @@ static void __tpdm_enable(struct tpdm_drvdata *drvdata) =20 static int tpdm_enable(struct coresight_device *csdev, struct perf_event *= event, enum cs_mode mode, - __maybe_unused struct coresight_trace_id_map *id_map) + __maybe_unused struct coresight_path *path) { struct tpdm_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); =20 diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 00404ba19352..8f76e7c45b38 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -400,7 +400,7 @@ struct coresight_ops_link { struct coresight_ops_source { int (*cpu_id)(struct coresight_device *csdev); int (*enable)(struct coresight_device *csdev, struct perf_event *event, - enum cs_mode mode, struct coresight_trace_id_map *id_map); + enum cs_mode mode, struct coresight_path *path); void (*disable)(struct coresight_device *csdev, struct perf_event *event); }; --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 D69562676F6; Wed, 26 Feb 2025 04:14:58 +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=1740543300; cv=none; b=NkOf8sXUtoWfC1k84gtJ5vL+6hU+SS10xtMo3pCiS1CL19wsv2PVYQv94dLko0KXaGA7bjKaQ5VcV8qq92y+e+3p48q6PJZXozK0Atp2wLsZOSX0Fpak5RYteOWdXM3iqyLJtW19EnjNqHxpiYW40s+C1v7eJOFjxAh7STgcEaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543300; c=relaxed/simple; bh=TGXlSOwsy7HcbM6xqbBEjNbtzL6eitKFdlCCcwuATyk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EEl7Oe6rlCGnIMVXQSFp0McP77KVjNF7n51PfCUQ1BXxs4pElS635OlMTljegF7MjDAvAtfp06Z9oYLvBOa4vEjUVVygGsUvnYE1jPX0SBsT6HLUKEBapyxKuR0IiiK9oK7orRvwnaWcoWfW/mDfQej8C1ALkcK1plRgyw2fqpo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=kd6PvYVj; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="kd6PvYVj" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMXK4K017866; Wed, 26 Feb 2025 04:14:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= +7Pui+rSrzfyAYzTgN53hbQvni7Vbo2yC3MzFb04d9I=; b=kd6PvYVj1oH741J3 yUC0VWgsrMSJViASdCqXMghnNqCwVrC8Bu73tq1pG4/r0gOlDbL1kdXKl9eOYttP A1nWX4FeXXjRrDwEs44ujy2xT5L/HI3kykdUL2JA4k763EcYqjcZ+VPWMhdkBL/U ndno68ortaLgu53dOCwW+e389Dr0/2TTg6/eoZebJsex454WaN1I7UlCfTQq4yP1 VcmL71ef1SJ5K4Y69BuwpeMN75dDoCnK2uG4BTBmv/0iddhppJL0e6kKX/GA5GSw nae6pFNBFnzx7zQl8gadFH1XgO6uGNJIYKv+crQPDQbBIInZB3Uu0u7DIjfXH/ua I+cRBQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451prn0p38-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:44 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4EhTD006746 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:43 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:38 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 07/10] Coresight: Change functions to accept the coresight_path Date: Wed, 26 Feb 2025 12:13:39 +0800 Message-ID: <20250226041342.53933-8-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 5p5oUviXLOO6mcc7NaMYLknDNIYwgjof X-Proofpoint-GUID: 5p5oUviXLOO6mcc7NaMYLknDNIYwgjof X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 clxscore=1015 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260030 Content-Type: text/plain; charset="utf-8" Modify following functions to accept the coresight_path. Devices in the path can read data from coresight_path if needed. - coresight_enable_path - coresight_disable_path - coresight_get_source - coresight_get_sink - coresight_enable_helpers - coresight_disable_helpers Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++--------- .../hwtracing/coresight/coresight-etm-perf.c | 16 ++++---- drivers/hwtracing/coresight/coresight-priv.h | 6 +-- drivers/hwtracing/coresight/coresight-sysfs.c | 6 +-- 4 files changed, 32 insertions(+), 33 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index 7d010d996f01..395798ac4181 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -76,14 +76,14 @@ struct coresight_device *coresight_get_percpu_sink(int = cpu) } EXPORT_SYMBOL_GPL(coresight_get_percpu_sink); =20 -static struct coresight_device *coresight_get_source(struct list_head *pat= h) +static struct coresight_device *coresight_get_source(struct coresight_path= *path) { struct coresight_device *csdev; =20 if (!path) return NULL; =20 - csdev =3D list_first_entry(path, struct coresight_node, link)->csdev; + csdev =3D list_first_entry(&path->path_list, struct coresight_node, link)= ->csdev; if (!coresight_is_device_source(csdev)) return NULL; =20 @@ -332,12 +332,12 @@ static int coresight_enable_helper(struct coresight_d= evice *csdev, return helper_ops(csdev)->enable(csdev, mode, data); } =20 -static void coresight_disable_helper(struct coresight_device *csdev) +static void coresight_disable_helper(struct coresight_device *csdev, void = *data) { - helper_ops(csdev)->disable(csdev, NULL); + helper_ops(csdev)->disable(csdev, data); } =20 -static void coresight_disable_helpers(struct coresight_device *csdev) +static void coresight_disable_helpers(struct coresight_device *csdev, void= *data) { int i; struct coresight_device *helper; @@ -345,7 +345,7 @@ static void coresight_disable_helpers(struct coresight_= device *csdev) 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)) - coresight_disable_helper(helper); + coresight_disable_helper(helper, data); } } =20 @@ -362,7 +362,7 @@ static void coresight_disable_helpers(struct coresight_= device *csdev) void coresight_disable_source(struct coresight_device *csdev, void *data) { source_ops(csdev)->disable(csdev, data); - coresight_disable_helpers(csdev); + coresight_disable_helpers(csdev, NULL); } EXPORT_SYMBOL_GPL(coresight_disable_source); =20 @@ -371,16 +371,16 @@ EXPORT_SYMBOL_GPL(coresight_disable_source); * @nd in the list. If @nd is NULL, all the components, except the SOURCE = are * disabled. */ -static void coresight_disable_path_from(struct list_head *path, +static void coresight_disable_path_from(struct coresight_path *path, struct coresight_node *nd) { u32 type; struct coresight_device *csdev, *parent, *child; =20 if (!nd) - nd =3D list_first_entry(path, struct coresight_node, link); + nd =3D list_first_entry(&path->path_list, struct coresight_node, link); =20 - list_for_each_entry_continue(nd, path, link) { + list_for_each_entry_continue(nd, &path->path_list, link) { csdev =3D nd->csdev; type =3D csdev->type; =20 @@ -418,11 +418,11 @@ static void coresight_disable_path_from(struct list_h= ead *path, } =20 /* Disable all helpers adjacent along the path last */ - coresight_disable_helpers(csdev); + coresight_disable_helpers(csdev, path); } } =20 -void coresight_disable_path(struct list_head *path) +void coresight_disable_path(struct coresight_path *path) { coresight_disable_path_from(path, NULL); } @@ -447,7 +447,7 @@ static int coresight_enable_helpers(struct coresight_de= vice *csdev, return 0; } =20 -int coresight_enable_path(struct list_head *path, enum cs_mode mode, +int coresight_enable_path(struct coresight_path *path, enum cs_mode mode, void *sink_data) { int ret =3D 0; @@ -457,12 +457,12 @@ int coresight_enable_path(struct list_head *path, enu= m cs_mode mode, struct coresight_device *source; =20 source =3D coresight_get_source(path); - list_for_each_entry_reverse(nd, path, link) { + list_for_each_entry_reverse(nd, &path->path_list, link) { csdev =3D nd->csdev; type =3D csdev->type; =20 /* Enable all helpers adjacent to the path first */ - ret =3D coresight_enable_helpers(csdev, mode, sink_data); + ret =3D coresight_enable_helpers(csdev, mode, path); if (ret) goto err; /* @@ -510,20 +510,21 @@ int coresight_enable_path(struct list_head *path, enu= m cs_mode mode, goto out; } =20 -struct coresight_device *coresight_get_sink(struct list_head *path) +struct coresight_device *coresight_get_sink(struct coresight_path *path) { struct coresight_device *csdev; =20 if (!path) return NULL; =20 - csdev =3D list_last_entry(path, struct coresight_node, link)->csdev; + csdev =3D list_last_entry(&path->path_list, struct coresight_node, link)-= >csdev; if (csdev->type !=3D CORESIGHT_DEV_TYPE_SINK && csdev->type !=3D CORESIGHT_DEV_TYPE_LINKSINK) return NULL; =20 return csdev; } +EXPORT_SYMBOL_GPL(coresight_get_sink); =20 u32 coresight_get_sink_id(struct coresight_device *csdev) { @@ -679,7 +680,7 @@ static int coresight_get_trace_id(struct coresight_devi= ce *csdev, void coresight_path_assign_trace_id(struct coresight_path *path, enum cs_mode mode) { - struct coresight_device *sink =3D coresight_get_sink(&path->path_list); + struct coresight_device *sink =3D coresight_get_sink(path); struct coresight_node *nd; int trace_id; =20 diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index 300305d67a1d..f4cccd68e625 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -197,7 +197,6 @@ static void free_sink_buffer(struct etm_event_data *eve= nt_data) int cpu; cpumask_t *mask =3D &event_data->mask; struct coresight_device *sink; - struct coresight_path *path; =20 if (!event_data->snk_config) return; @@ -206,8 +205,7 @@ static void free_sink_buffer(struct etm_event_data *eve= nt_data) return; =20 cpu =3D cpumask_first(mask); - path =3D etm_event_cpu_path(event_data, cpu); - sink =3D coresight_get_sink(&path->path_list); + sink =3D coresight_get_sink(etm_event_cpu_path(event_data, cpu)); sink_ops(sink)->free_buffer(event_data->snk_config); } =20 @@ -232,7 +230,7 @@ static void free_event_data(struct work_struct *work) =20 ppath =3D etm_event_cpu_path_ptr(event_data, cpu); if (!(IS_ERR_OR_NULL(*ppath))) { - struct coresight_device *sink =3D coresight_get_sink(&((*ppath)->path_l= ist)); + struct coresight_device *sink =3D coresight_get_sink(*ppath); =20 /* * Mark perf event as done for trace id allocator, but don't call @@ -494,12 +492,12 @@ static void etm_event_start(struct perf_event *event,= int flags) =20 path =3D etm_event_cpu_path(event_data, cpu); /* We need a sink, no need to continue without one */ - sink =3D coresight_get_sink(&path->path_list); + sink =3D coresight_get_sink(path); if (WARN_ON_ONCE(!sink)) goto fail_end_stop; =20 /* Nothing will happen without a path */ - if (coresight_enable_path(&path->path_list, CS_MODE_PERF, handle)) + if (coresight_enable_path(path, CS_MODE_PERF, handle)) goto fail_end_stop; =20 /* Finally enable the tracer */ @@ -531,7 +529,7 @@ static void etm_event_start(struct perf_event *event, i= nt flags) return; =20 fail_disable_path: - coresight_disable_path(&path->path_list); + coresight_disable_path(path); fail_end_stop: /* * Check if the handle is still associated with the event, @@ -596,7 +594,7 @@ static void etm_event_stop(struct perf_event *event, in= t mode) if (!path) return; =20 - sink =3D coresight_get_sink(&path->path_list); + sink =3D coresight_get_sink(path); if (!sink) return; =20 @@ -640,7 +638,7 @@ static void etm_event_stop(struct perf_event *event, in= t mode) } =20 /* Disabling the path make its elements available to other sessions */ - coresight_disable_path(&path->path_list); + coresight_disable_path(path); } =20 static int etm_event_add(struct perf_event *event, int mode) diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtraci= ng/coresight/coresight-priv.h index 2bea35bae0d4..82644aff8d2b 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -132,10 +132,10 @@ static inline void CS_UNLOCK(void __iomem *addr) } while (0); } =20 -void coresight_disable_path(struct list_head *path); -int coresight_enable_path(struct list_head *path, enum cs_mode mode, +void coresight_disable_path(struct coresight_path *path); +int coresight_enable_path(struct coresight_path *path, enum cs_mode mode, void *sink_data); -struct coresight_device *coresight_get_sink(struct list_head *path); +struct coresight_device *coresight_get_sink(struct coresight_path *path); struct coresight_device *coresight_get_sink_by_id(u32 id); struct coresight_device * coresight_find_default_sink(struct coresight_device *csdev); diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtrac= ing/coresight/coresight-sysfs.c index 3ac5b52413a6..feadaf065b53 100644 --- a/drivers/hwtracing/coresight/coresight-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -214,7 +214,7 @@ int coresight_enable_sysfs(struct coresight_device *csd= ev) if (!IS_VALID_CS_TRACE_ID(path->trace_id)) goto err_path; =20 - ret =3D coresight_enable_path(&path->path_list, CS_MODE_SYSFS, NULL); + ret =3D coresight_enable_path(path, CS_MODE_SYSFS, NULL); if (ret) goto err_path; =20 @@ -256,7 +256,7 @@ int coresight_enable_sysfs(struct coresight_device *csd= ev) return ret; =20 err_source: - coresight_disable_path(&path->path_list); + coresight_disable_path(path); =20 err_path: coresight_release_path(path); @@ -302,7 +302,7 @@ void coresight_disable_sysfs(struct coresight_device *c= sdev) break; } =20 - coresight_disable_path(&path->path_list); + coresight_disable_path(path); coresight_release_path(path); =20 out: --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 DC5CE26BDA3; Wed, 26 Feb 2025 04:15:02 +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=1740543304; cv=none; b=V31kCYpD03CvpDt4z/0sqZ9jlXTCf1J4PqbD4g9tGFO5M92h/Rl93E1Lg6LCG+PBJiCX1cF0A7UIpiO+KRf6GesVglvgO1kbPTkb1jEM7JemNYI7enJMPkkVQVJx3C4j80+0PW3d2ZsePBNSc2I0bvRPaEALzwaQVX5uLsL+tZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543304; c=relaxed/simple; bh=8ZzmsjtWLz2Ib3s6u/sHI6jUHeEUNHtK30Gt9wBNlPo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WMMfvu68SnaoHZkJnzaN+CZ22RDhQ2Ga4Wuf2OzRFSLNunOR+4QfK6lr9U7pdgpfJfftLr9bllP3BQ+fzCBZ3iqIESXqnAgSTVk7vXtA9WTtl4vahsplitwL701Wlai3AIiFifk+W2V8RzgCciv9u9SfGeuRqfM3/8J7070soM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=GfaiHWDt; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GfaiHWDt" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMcft1000780; Wed, 26 Feb 2025 04:14:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= L4yuKIyeTLs4ef1WFib+KL4Rb5A7xpdSToFgPoRRraI=; b=GfaiHWDtfIAWZkhO FmdlXgx+C9I4OG7yuXZoCpAPRNUgfwaLpyhP+Azohv/Ng8d/sVVsaGKKQtHs7XB/ b2R56DnWDklNI7RXoWe15uTjgPbo119dJAVWQOuR3nCSklKYGKYgWDhhGa//77fn j4JfKab5ZKzkmY2QQ9qk8W/B9b4SzMYkcsLMpen4jN/yvn0bc89EwTEsBeshI6wQ w2F9mmW9beQSpgGL+TK8gck+Rd6y2rRMbqdLWiKyjRriei0/zJXbrKOYdaDR65d0 k7zZ6JMa6D5iD0CbTOtreIH/e9e5fj0At4dYqelHR6OpPlZC3e/XtcajV0wjqdQ2 XApMBw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451pu98nfm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:49 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4EnBk007221 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:49 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:43 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 08/10] dt-bindings: arm: Add Coresight TMC Control Unit hardware Date: Wed, 26 Feb 2025 12:13:40 +0800 Message-ID: <20250226041342.53933-9-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 9zIr254IIulvzPX3ruTpnwHYvT5aBdfY X-Proofpoint-ORIG-GUID: 9zIr254IIulvzPX3ruTpnwHYvT5aBdfY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=2 spamscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260030 Content-Type: text/plain; charset="utf-8" Add binding file to specify how to define a Coresight TMC Control Unit devi= ce in device tree. It is responsible for controlling the data filter function based on the sou= rce device's Trace ID for TMC ETR device. The trace data with that Trace id can= get into ETR's buffer while other trace data gets ignored. Reviewed-by: Rob Herring (Arm) Signed-off-by: Jie Gan --- .../bindings/arm/qcom,coresight-ctcu.yaml | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-ct= cu.yaml diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml= b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml new file mode 100644 index 000000000000..843b52eaf872 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-ctcu.yaml @@ -0,0 +1,84 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/qcom,coresight-ctcu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: CoreSight TMC Control Unit + +maintainers: + - Yuanfang Zhang + - Mao Jinlong + - Jie Gan + +description: | + The Trace Memory Controller(TMC) is used for Embedded Trace Buffer(ETB), + Embedded Trace FIFO(ETF) and Embedded Trace Router(ETR) configurations. + The configuration mode (ETB, ETF, ETR) is discovered at boot time when + the device is probed. + + The Coresight TMC Control unit controls various Coresight behaviors. + It works as a helper device when connected to TMC ETR device. + It is responsible for controlling the data filter function based on + the source device's Trace ID for TMC ETR device. The trace data with + that Trace id can get into ETR's buffer while other trace data gets + ignored. + +properties: + compatible: + enum: + - qcom,sa8775p-ctcu + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: apb + + in-ports: + $ref: /schemas/graph.yaml#/properties/ports + + patternProperties: + '^port(@[0-1])?$': + description: Input connections from CoreSight Trace bus + $ref: /schemas/graph.yaml#/properties/port + +required: + - compatible + - reg + - in-ports + +additionalProperties: false + +examples: + - | + ctcu@1001000 { + compatible =3D "qcom,sa8775p-ctcu"; + reg =3D <0x1001000 0x1000>; + + clocks =3D <&aoss_qmp>; + clock-names =3D "apb"; + + in-ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + ctcu_in_port0: endpoint { + remote-endpoint =3D <&etr0_out_port>; + }; + }; + + port@1 { + reg =3D <1>; + ctcu_in_port1: endpoint { + remote-endpoint =3D <&etr1_out_port>; + }; + }; + }; + }; --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 4297726BDB2; Wed, 26 Feb 2025 04:15:08 +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=1740543311; cv=none; b=TydCbHYgejDz63r+TmnvQtN0Ak6Z4o+CWLNjcHgiuwL+AOLxoHVjtbgUFiXkc3XU377kgn4ApRJKlf5JofBSrGdaYUohz03sGLBp7MGhYUPzUxPT5gN8GaxHaBHnqcJXDwmrsFYZc0J8T1xMj1RC4kKIQp9KhRr3XuofHY9Krgw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543311; c=relaxed/simple; bh=y85//oC/yGzaaxLJsaBg4Vehqf1nDLfciH6ofRu28UI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VlyIzFh9XIJeOeo3z8e48KR7j7UuU5AMVZmgKtwKthLoVPpoboVxRpR9ZJzHRH2DAMB6lUmH2C4xXAVjamqHTgY9rgoAsD+HNPYRFaBT+BKmPhekUYvTjtDpii24WqWJWZcJt9ai3+qtZpCcLjc0K/M6g8iRImMH+3xATh2ln5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=jYuL5XmC; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="jYuL5XmC" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMXInP021807; Wed, 26 Feb 2025 04:14:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 1uMjkSOKRjs4aAHaT1+xl2UcPQjWXKAKxxuz986Q/Hw=; b=jYuL5XmCR6S8NYs5 twZjBOZV0MM99AO/nsmIzIAmZesmE7bqjD0WYX4I0cYdULVE1VBxkSCo4VbbNNle /cHJkwyIHWC2aKXmaJxTRRnTpPr3BsugRpQzOq++TNUu2DovFhvZ3E4e5ZGBRc9O gjJ33Z3NWhXraWWqNvkMDQEBBj3SJ9YKHJEnUbvI6REEfTRLjnHvK7t5pPZnAilP FBBJLGxOW4P/SpHjmaly/7it8aF2oaMiwtfCCuZJwhDBpkKchB3KnBkHlFLDX6O3 0HRrvZXBPUujQ6rC07BE/kjrYIkXFOsVICgZthHdqeRNeIaqqA3SOYghxAF75E7f AQOPJw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451prkgnjq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:55 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4EsUZ005931 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:14:54 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:49 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , Subject: [PATCH v14 09/10] Coresight: Add Coresight TMC Control Unit driver Date: Wed, 26 Feb 2025 12:13:41 +0800 Message-ID: <20250226041342.53933-10-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: rm3Hyj2Heuq2VodOXTZw4ZMj4RjzTNtj X-Proofpoint-ORIG-GUID: rm3Hyj2Heuq2VodOXTZw4ZMj4RjzTNtj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260031 Content-Type: text/plain; charset="utf-8" The Coresight TMC Control Unit hosts miscellaneous configuration registers which control various features related to TMC ETR sink. Based on the trace ID, which is programmed in the related CTCU ATID register of a specific ETR, trace data with that trace ID gets into the ETR buffer, while other trace data gets dropped. Enabling source device sets one bit of the ATID register based on source device's trace ID. Disabling source device resets the bit according to the source device's trace ID. Reviewed-by: James Clark Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/Kconfig | 12 + drivers/hwtracing/coresight/Makefile | 2 + .../hwtracing/coresight/coresight-ctcu-core.c | 326 ++++++++++++++++++ drivers/hwtracing/coresight/coresight-ctcu.h | 39 +++ include/linux/coresight.h | 3 +- 5 files changed, 381 insertions(+), 1 deletion(-) create mode 100644 drivers/hwtracing/coresight/coresight-ctcu-core.c create mode 100644 drivers/hwtracing/coresight/coresight-ctcu.h diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresi= ght/Kconfig index 06f0a7594169..ecd7086a5b83 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -133,6 +133,18 @@ config CORESIGHT_STM To compile this driver as a module, choose M here: the module will be called coresight-stm. =20 +config CORESIGHT_CTCU + tristate "CoreSight TMC Control Unit driver" + depends on CORESIGHT_LINK_AND_SINK_TMC + help + This driver provides support for CoreSight TMC Control Unit + that hosts miscellaneous configuration registers. This is + primarily used for controlling the behaviors of the TMC + ETR device. + + To compile this driver as a module, choose M here: the + module will be called coresight-ctcu. + config CORESIGHT_CPU_DEBUG tristate "CoreSight CPU Debug driver" depends on ARM || ARM64 diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/cores= ight/Makefile index 4ba478211b31..6cff472a9517 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -51,3 +51,5 @@ coresight-cti-y :=3D coresight-cti-core.o coresight-cti-p= latform.o \ coresight-cti-sysfs.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 diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hw= tracing/coresight/coresight-ctcu-core.c new file mode 100644 index 000000000000..da35d8b4d579 --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c @@ -0,0 +1,326 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights res= erved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "coresight-ctcu.h" +#include "coresight-priv.h" + +DEFINE_CORESIGHT_DEVLIST(ctcu_devs, "ctcu"); + +#define ctcu_writel(drvdata, val, offset) __raw_writel((val), drvdata->bas= e + offset) +#define ctcu_readl(drvdata, offset) __raw_readl(drvdata->base + offset) + +/* + * The TMC Coresight Control Unit utilizes four ATID registers to control = the data + * filter function based on the trace ID for each TMC ETR sink. The length= of each + * ATID register is 32 bits. Therefore, an ETR device has a 128-bit long f= ield + * in CTCU. Each trace ID is represented by one bit in that filed. + * e.g. ETR0ATID0 layout, set bit 5 for traceid 5 + * bit5 + * ------------------------------------------------------ + * | |28| |24| |20| |16| |12| |8| 1|4| |0| + * ------------------------------------------------------ + * + * e.g. ETR0: + * 127 0 from ATID_offset for ETR0ATID0 + * ------------------------- + * |ATID3|ATID2|ATID1|ATID0| + */ +#define CTCU_ATID_REG_OFFSET(traceid, atid_offset) \ + ((traceid / 32) * 4 + atid_offset) + +#define CTCU_ATID_REG_BIT(traceid) (traceid % 32) +#define CTCU_ATID_REG_SIZE 0x10 +#define CTCU_ETR0_ATID0 0xf8 +#define CTCU_ETR1_ATID0 0x108 + +static const struct ctcu_etr_config sa8775p_etr_cfgs[] =3D { + { + .atid_offset =3D CTCU_ETR0_ATID0, + .port_num =3D 0, + }, + { + .atid_offset =3D CTCU_ETR1_ATID0, + .port_num =3D 1, + }, +}; + +static const struct ctcu_config sa8775p_cfgs =3D { + .etr_cfgs =3D sa8775p_etr_cfgs, + .num_etr_config =3D ARRAY_SIZE(sa8775p_etr_cfgs), +}; + +static void ctcu_program_atid_register(struct ctcu_drvdata *drvdata, u32 r= eg_offset, + u8 bit, bool enable) +{ + u32 val; + + CS_UNLOCK(drvdata->base); + val =3D ctcu_readl(drvdata, reg_offset); + if (enable) + val |=3D BIT(bit); + else + val &=3D ~BIT(bit); + + ctcu_writel(drvdata, val, reg_offset); + CS_LOCK(drvdata->base); +} + +/* + * __ctcu_set_etr_traceid: Set bit in the ATID register based on trace ID = when enable is true. + * Reset the bit of the ATID register based on trace ID when enable is fal= se. + * + * @csdev: coresight_device of CTCU. + * @traceid: trace ID of the source tracer. + * @port_num: port number connected to TMC ETR sink. + * @enable: True for set bit and false for reset bit. + * + * Returns 0 indicates success. Non-zero result means failure. + */ +static int __ctcu_set_etr_traceid(struct coresight_device *csdev, u8 trace= id, int port_num, + bool enable) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); + u32 atid_offset, reg_offset; + u8 refcnt, bit; + + atid_offset =3D drvdata->atid_offset[port_num]; + if (atid_offset =3D=3D 0) + return -EINVAL; + + bit =3D CTCU_ATID_REG_BIT(traceid); + reg_offset =3D CTCU_ATID_REG_OFFSET(traceid, atid_offset); + if (reg_offset - atid_offset > CTCU_ATID_REG_SIZE) + return -EINVAL; + + guard(raw_spinlock_irqsave)(&drvdata->spin_lock); + refcnt =3D drvdata->traceid_refcnt[port_num][traceid]; + /* Only program the atid register when the refcnt value is 1 or 0 */ + if ((enable && !refcnt++) || (!enable && !--refcnt)) + ctcu_program_atid_register(drvdata, reg_offset, bit, enable); + + drvdata->traceid_refcnt[port_num][traceid] =3D refcnt; + + return 0; +} + +/* + * 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) +{ + struct coresight_device *sink =3D coresight_get_sink(path); + u8 traceid =3D path->trace_id; + int port_num; + + if ((sink =3D=3D NULL) || !IS_VALID_CS_TRACE_ID(traceid)) { + dev_err(&csdev->dev, "Invalid sink device or trace ID\n"); + return -EINVAL; + } + + port_num =3D ctcu_get_active_port(sink, csdev); + if (port_num < 0) + return -EINVAL; + + dev_dbg(&csdev->dev, "traceid is %d\n", traceid); + + return __ctcu_set_etr_traceid(csdev, traceid, port_num, enable); +} + +static int ctcu_enable(struct coresight_device *csdev, enum cs_mode mode, = void *data) +{ + struct coresight_path *path =3D (struct coresight_path *)data; + + return ctcu_set_etr_traceid(csdev, path, true); +} + +static int ctcu_disable(struct coresight_device *csdev, void *data) +{ + struct coresight_path *path =3D (struct coresight_path *)data; + + return ctcu_set_etr_traceid(csdev, path, false); +} + +static const struct coresight_ops_helper ctcu_helper_ops =3D { + .enable =3D ctcu_enable, + .disable =3D ctcu_disable, +}; + +static const struct coresight_ops ctcu_ops =3D { + .helper_ops =3D &ctcu_helper_ops, +}; + +static int ctcu_probe(struct platform_device *pdev) +{ + const struct ctcu_etr_config *etr_cfg; + struct coresight_platform_data *pdata; + struct coresight_desc desc =3D { 0 }; + struct device *dev =3D &pdev->dev; + const struct ctcu_config *cfgs; + struct ctcu_drvdata *drvdata; + void __iomem *base; + int i; + + desc.name =3D coresight_alloc_device_name(&ctcu_devs, dev); + if (!desc.name) + return -ENOMEM; + + drvdata =3D devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + pdata =3D coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + dev->platform_data =3D pdata; + + base =3D devm_platform_get_and_ioremap_resource(pdev, 0, NULL); + if (!base) + return -ENOMEM; + + drvdata->apb_clk =3D coresight_get_enable_apb_pclk(dev); + if (IS_ERR(drvdata->apb_clk)) + return -ENODEV; + + cfgs =3D of_device_get_match_data(dev); + if (cfgs) { + if (cfgs->num_etr_config <=3D ETR_MAX_NUM) { + 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->base =3D base; + drvdata->dev =3D dev; + platform_set_drvdata(pdev, drvdata); + + desc.type =3D CORESIGHT_DEV_TYPE_HELPER; + desc.subtype.helper_subtype =3D CORESIGHT_DEV_SUBTYPE_HELPER_CTCU; + desc.pdata =3D pdata; + desc.dev =3D dev; + desc.ops =3D &ctcu_ops; + desc.access =3D CSDEV_ACCESS_IOMEM(base); + + drvdata->csdev =3D coresight_register(&desc); + if (IS_ERR(drvdata->csdev)) { + if (!IS_ERR_OR_NULL(drvdata->apb_clk)) + clk_put(drvdata->apb_clk); + + return PTR_ERR(drvdata->csdev); + } + + return 0; +} + +static void ctcu_remove(struct platform_device *pdev) +{ + struct ctcu_drvdata *drvdata =3D platform_get_drvdata(pdev); + + coresight_unregister(drvdata->csdev); +} + +static int ctcu_platform_probe(struct platform_device *pdev) +{ + int ret; + + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + + ret =3D ctcu_probe(pdev); + pm_runtime_put(&pdev->dev); + if (ret) + pm_runtime_disable(&pdev->dev); + + return ret; +} + +static void ctcu_platform_remove(struct platform_device *pdev) +{ + struct ctcu_drvdata *drvdata =3D platform_get_drvdata(pdev); + + if (WARN_ON(!drvdata)) + return; + + ctcu_remove(pdev); + pm_runtime_disable(&pdev->dev); + if (!IS_ERR_OR_NULL(drvdata->apb_clk)) + clk_put(drvdata->apb_clk); +} + +#ifdef CONFIG_PM +static int ctcu_runtime_suspend(struct device *dev) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev); + + if (drvdata && !IS_ERR_OR_NULL(drvdata->apb_clk)) + clk_disable_unprepare(drvdata->apb_clk); + + return 0; +} + +static int ctcu_runtime_resume(struct device *dev) +{ + struct ctcu_drvdata *drvdata =3D dev_get_drvdata(dev); + + if (drvdata && !IS_ERR_OR_NULL(drvdata->apb_clk)) + clk_prepare_enable(drvdata->apb_clk); + + return 0; +} +#endif + +static const struct dev_pm_ops ctcu_dev_pm_ops =3D { + SET_RUNTIME_PM_OPS(ctcu_runtime_suspend, ctcu_runtime_resume, NULL) +}; + +static const struct of_device_id ctcu_match[] =3D { + {.compatible =3D "qcom,sa8775p-ctcu", .data =3D &sa8775p_cfgs}, + {} +}; + +static struct platform_driver ctcu_driver =3D { + .probe =3D ctcu_platform_probe, + .remove =3D ctcu_platform_remove, + .driver =3D { + .name =3D "coresight-ctcu", + .of_match_table =3D ctcu_match, + .pm =3D &ctcu_dev_pm_ops, + .suppress_bind_attrs =3D true, + }, +}; +module_platform_driver(ctcu_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("CoreSight TMC Control Unit driver"); diff --git a/drivers/hwtracing/coresight/coresight-ctcu.h b/drivers/hwtraci= ng/coresight/coresight-ctcu.h new file mode 100644 index 000000000000..11201e8266ff --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-ctcu.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights res= erved. + */ + +#ifndef _CORESIGHT_CTCU_H +#define _CORESIGHT_CTCU_H +#include "coresight-trace-id.h" + +/* Maximum number of supported ETR devices for a single CTCU. */ +#define ETR_MAX_NUM 2 + +/** + * struct ctcu_etr_config + * @atid_offset: offset to the ATID0 Register. + * @port_num: in-port number of CTCU device that connected to ETR. + */ +struct ctcu_etr_config { + const u32 atid_offset; + const u32 port_num; +}; + +struct ctcu_config { + const struct ctcu_etr_config *etr_cfgs; + int num_etr_config; +}; + +struct ctcu_drvdata { + void __iomem *base; + struct clk *apb_clk; + struct device *dev; + struct coresight_device *csdev; + 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]; +}; + +#endif diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 8f76e7c45b38..51f858b925d8 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -71,7 +71,8 @@ enum coresight_dev_subtype_source { =20 enum coresight_dev_subtype_helper { CORESIGHT_DEV_SUBTYPE_HELPER_CATU, - CORESIGHT_DEV_SUBTYPE_HELPER_ECT_CTI + CORESIGHT_DEV_SUBTYPE_HELPER_ECT_CTI, + CORESIGHT_DEV_SUBTYPE_HELPER_CTCU, }; =20 /** --=20 2.34.1 From nobody Thu Dec 18 19:09:28 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 F3FCD26E64E; Wed, 26 Feb 2025 04:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543315; cv=none; b=gvIAGmLogE/yT3Kt9do3Z2TJ1B/F+HZFhmJM6v+/EdE2SOQ6gzeqW0UV53DflRRlw2GLEiOlir/8up1JTIBvodJm4GIXrZf3xOtF8rHtOUTtxwaFRA3hNRcd7naXVirXm/iHtRZchd7h8EBJjZDtUPcSecgUqhnyN/LIEE9vnWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740543315; c=relaxed/simple; bh=tYFvJAC+E6lq1I465BOU8f0pSMGntQzDYaPmWQtwSuc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ljx9fVKMQJJyI0a6ACmOXZgHC02Uy6hbonlbDNf3TAmVohmylO8YZyxzMO+hwJhkxbaLzL9mwEW0c9W32MtXtar0/AdcD0XbjEa3yiI9pMT/gZDrdbSLT+fmHXqVkr4eiQIaj8KSOOysfTGEOcIKj81l2mzBEMb7t5h2bwzLEcQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=moh/UfHq; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="moh/UfHq" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51PMXAuO031989; Wed, 26 Feb 2025 04:15:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= FrWpXWtpt+ZULEbiR2Up6sVFlN84+mzhnBc7WKp2O/Q=; b=moh/UfHqHAuDtfHt Qguuomb00glWAvHbIfvlsboWOAuiGJXEA+TgMe/nCe5KuJazW0J6o1GQhRii9SBQ FVyqs6dj0UyVk+B9nukzwSAFpVbu56yZYqUOtHOh5JZtDFo7jZs/grDrTMdw23Ez WGccYOm2TomKPmQ+23L4RaZtY101ljSzSFVObxavylQ/ms/3AVboThra5SBPDCAQ 0lYbZSghFjrJ/rigH4VvIAP7m4o1vqAcaF1q3Y9yDivHBGISq7buCDF+ex8NTMbu SojGoL6CAw8ugWDvTKajSe672SvilBm4za1bNjfZGtoolCmo1Ig42WyFacSXNNJI 4ygkXw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 451prjgnqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:15:01 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51Q4F0R2032060 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Feb 2025 04:15:00 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Feb 2025 20:14:54 -0800 From: Jie Gan To: Suzuki K Poulose , Mike Leach , James Clark , "Alexander Shishkin" , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Tingwei Zhang , Jinlong Mao , , , , , , , Konrad Dybcio Subject: [PATCH v14 10/10] arm64: dts: qcom: sa8775p: Add CTCU and ETR nodes Date: Wed, 26 Feb 2025 12:13:42 +0800 Message-ID: <20250226041342.53933-11-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226041342.53933-1-quic_jiegan@quicinc.com> References: <20250226041342.53933-1-quic_jiegan@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 3hgYboh58Apaqwljd-umbY_UZmjAsBlW X-Proofpoint-GUID: 3hgYboh58Apaqwljd-umbY_UZmjAsBlW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-25_08,2025-02-25_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 malwarescore=0 clxscore=1015 impostorscore=0 adultscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502260031 Content-Type: text/plain; charset="utf-8" Add CTCU and ETR nodes in DT to enable related functionalities. Reviewed-by: Konrad Dybcio Signed-off-by: Jie Gan --- arch/arm64/boot/dts/qcom/sa8775p.dtsi | 153 ++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sa8775p.dtsi b/arch/arm64/boot/dts/qc= om/sa8775p.dtsi index 3394ae2d1300..31aa94d2a043 100644 --- a/arch/arm64/boot/dts/qcom/sa8775p.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8775p.dtsi @@ -2429,6 +2429,35 @@ crypto: crypto@1dfa000 { interconnect-names =3D "memory"; }; =20 + ctcu@4001000 { + compatible =3D "qcom,sa8775p-ctcu"; + reg =3D <0x0 0x04001000 0x0 0x1000>; + + clocks =3D <&aoss_qmp>; + clock-names =3D "apb"; + + in-ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + + ctcu_in0: endpoint { + remote-endpoint =3D <&etr0_out>; + }; + }; + + port@1 { + reg =3D <1>; + + ctcu_in1: endpoint { + remote-endpoint =3D <&etr1_out>; + }; + }; + }; + }; + stm: stm@4002000 { compatible =3D "arm,coresight-stm", "arm,primecell"; reg =3D <0x0 0x4002000 0x0 0x1000>, @@ -2633,6 +2662,122 @@ qdss_funnel_in1: endpoint { }; }; =20 + replicator@4046000 { + compatible =3D "arm,coresight-dynamic-replicator", "arm,primecell"; + reg =3D <0x0 0x04046000 0x0 0x1000>; + + clocks =3D <&aoss_qmp>; + clock-names =3D "apb_pclk"; + + in-ports { + port { + qdss_rep_in: endpoint { + remote-endpoint =3D <&swao_rep_out0>; + }; + }; + }; + + out-ports { + port { + qdss_rep_out0: endpoint { + remote-endpoint =3D <&etr_rep_in>; + }; + }; + }; + }; + + tmc_etr: tmc@4048000 { + compatible =3D "arm,coresight-tmc", "arm,primecell"; + reg =3D <0x0 0x04048000 0x0 0x1000>; + + clocks =3D <&aoss_qmp>; + clock-names =3D "apb_pclk"; + iommus =3D <&apps_smmu 0x04c0 0x00>; + + arm,scatter-gather; + + in-ports { + port { + etr0_in: endpoint { + remote-endpoint =3D <&etr_rep_out0>; + }; + }; + }; + + out-ports { + port { + etr0_out: endpoint { + remote-endpoint =3D <&ctcu_in0>; + }; + }; + }; + }; + + replicator@404e000 { + compatible =3D "arm,coresight-dynamic-replicator", "arm,primecell"; + reg =3D <0x0 0x0404e000 0x0 0x1000>; + + clocks =3D <&aoss_qmp>; + clock-names =3D "apb_pclk"; + + in-ports { + port { + etr_rep_in: endpoint { + remote-endpoint =3D <&qdss_rep_out0>; + }; + }; + }; + + out-ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + + etr_rep_out0: endpoint { + remote-endpoint =3D <&etr0_in>; + }; + }; + + port@1 { + reg =3D <1>; + + etr_rep_out1: endpoint { + remote-endpoint =3D <&etr1_in>; + }; + }; + }; + }; + + tmc_etr1: tmc@404f000 { + compatible =3D "arm,coresight-tmc", "arm,primecell"; + reg =3D <0x0 0x0404f000 0x0 0x1000>; + + clocks =3D <&aoss_qmp>; + clock-names =3D "apb_pclk"; + iommus =3D <&apps_smmu 0x04a0 0x40>; + + arm,scatter-gather; + arm,buffer-size =3D <0x400000>; + + in-ports { + port { + etr1_in: endpoint { + remote-endpoint =3D <&etr_rep_out1>; + }; + }; + }; + + out-ports { + port { + etr1_out: endpoint { + remote-endpoint =3D <&ctcu_in1>; + }; + }; + }; + }; + funnel@4b04000 { compatible =3D "arm,coresight-dynamic-funnel", "arm,primecell"; reg =3D <0x0 0x4b04000 0x0 0x1000>; @@ -2708,6 +2853,14 @@ out-ports { #address-cells =3D <1>; #size-cells =3D <0>; =20 + port@0 { + reg =3D <0>; + + swao_rep_out0: endpoint { + remote-endpoint =3D <&qdss_rep_in>; + }; + }; + port@1 { reg =3D <1>; swao_rep_out1: endpoint { --=20 2.34.1