From nobody Wed Apr 1 12:37:23 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81C403EC2FD for ; Tue, 31 Mar 2026 10:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774951569; cv=none; b=NNQoWls1O8z/CqyTl/zd3zxfEFV12ZpgVYKkbpVnscgWRxRNwCmZdXtId0iAvYzzJBNgV93zV3aHxeryf85du6URzDfNfGifKA54O13VBHEHSEkn0jTXrogcgTIhpw3Z/mO5S7DYjzPm54DME9ZUI3uJJw1EVe9ri+QzzZWKDPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774951569; c=relaxed/simple; bh=N3pEciTN7LAj4w8dB8lZ5jPdogjT7WW8uSDNMu9Z0wU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=mPLvh6WyQ4JUR3K68D9rvoZmU5tLfj1ddt3dEA8v9odwFujX5zRL4SYyDr1dVPkN1vLHSZXRwfsOfKNi8yuKFSckXs1HbA/eymZKkCemLTvk7+wPt8KLsN88dkf5uuUEQc9MHMgaxTZBON19HyCrWinRhOTYuHKMf0Y6HlEyfYU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=UDeFoYZC; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=L6mZJkoA; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="UDeFoYZC"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="L6mZJkoA" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62V6xvaQ2164270 for ; Tue, 31 Mar 2026 10:06:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=l6uIHY7AmL+0WdJn9rZatH TazNJPyFlb2TAmFbFEpLY=; b=UDeFoYZC3vcD31EiLbfQi89OF9MATHU+rjmMU9 9eeD7JQGENuuHLVoYJfJZdg1zwbtQInLcS4/SYH56PtokNpjocrGT30NCQqtzhTz 50U0O4Dvf9KJqQ56Ya7unr+d8IZB8ahG/JTfF78ONrga8uqDjGPbIbhIhhQBdFsL NZbWkbIGpLOUIZE8fmdib9fYcL7Izd+Duebavff9qg6oiHNXmt7jiMBKOsVCIdnE ow8PNDx0xWq5dzJhEEWD6XYIl2dDtnURQoJthYe685ghOyVLZbJcuupN5mBxDpmk FkTQdEllsXWlIGLK6nDJTNBmk6ffhPEeHaIEEF+gkigU649w== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d89ga0tcd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 31 Mar 2026 10:06:06 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-354bc535546so5786867a91.3 for ; Tue, 31 Mar 2026 03:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774951566; x=1775556366; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=l6uIHY7AmL+0WdJn9rZatHTazNJPyFlb2TAmFbFEpLY=; b=L6mZJkoAW09wFdhkHv+9MNIU1R7eC9T6Oaz1NO5yl/So7fr/t5MNHNnwrx4RKO0hm9 q73m92BysWdb+1T+MZMgy3tpgYffmN9p0mWq59wfcd9HjXrNjBvAK9If3VYnPmKa2Dk7 Yk2OR56H+PlKgZIKl9A+zUyNEJhujt+8YVK+iW1NP1YinTA9Y1hDafQSLEqyi8NlZA+9 1rQEoiqYP7faXIz3v0dacYGeMHAElBtdszdYHsBeQd6eUNpzCOgLwtIneLEESuGSp/Wz FacR01dUnXvxqXKsXp4fle60/5OXhD/rjUTpcRhifGUAeeFy06WVuvXZDKeOz94Qri1N /Ztw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774951566; x=1775556366; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=l6uIHY7AmL+0WdJn9rZatHTazNJPyFlb2TAmFbFEpLY=; b=fztrIx1lBpuGzTVQ3f+JI+aoiz7kxZkXXV4dBQl7ex05Ii23DMBkDWmMzMjHD3AI7e b4GBxsoZvXhFWshgSolJQ7mKk3JhPWRVCvp9lVnV5uopjqcxfMNIYWRRX0PYlbvmE6B9 KNQKb/ZxQPlKoWVKFBiZnnXQxPeC69AuvBucqwJu+EPbLda6nRDphgby1DgUta6Kv7hS /MZiAusqapioFHZRxXYh5+NJeB8SwJ1n2OKMSr6V1INrPUzGFNRRT7J+rSLLjkQeI37R Ga9OZV7HPgHeWT+2eqJqHk5y3Fj3SQiBeLfvuBAIVjxNrwbLI9or4gqr4HeLVw2wNcaT Jjqw== X-Forwarded-Encrypted: i=1; AJvYcCVC5Y2hYR/HukgieecL0Dqq9mo4l5l/Vxu4vzGhn6d+9VPQ8ym9CUfjQQDNaAvhM7B7ArG6d3xmpkeiThc=@vger.kernel.org X-Gm-Message-State: AOJu0YxZZtcAnjz//EnCXl9EUIWfvjR4ZkUutBo218U3TIu/wq0F+2vU rc+5pNM32dDyAf/C5TWMnzlpIsJpfPva7wdSu8G2i13GaWTa797hm5lUZF0CNDs+jkpExajwHOm cFERSrCjuB70oZLe1ECkMH9kXs/kQJYf9aFeUujwq+coI4fSYbLpM8iUMY5QvnSgfU7w= X-Gm-Gg: ATEYQzxTO9yAcz4W7DtX0DNidueHZaJ2oP9vaIEZRsWBkEA2Xzdl8VB6O91YfhAhuCq 6407wn00xaX83Ni61n2a+5HO9fZLj0xFzsDgujhyRnWaI7hyBhEWUZqu43cXtAKRfWF1uLJPcv8 XRwFHqGz8y209w050+oCtDLxxf13cYHfCCD246c10msh1MlKXFGrrbAbL6TaAL18DV6h4ekDEaJ PPSLBwIRbm7SK/aXPDBU7qHg/7Zp0grCX5n2VkOc2EBcd49KhwdUzQU3t6SX+VD1wVOX0OZTevq ZBlEJoiOEqh9V+hJU+YmApTw53G+LxTODQvtuG4GYs7rh4cALkat4NSFjnm+kHp96LINa8ULqTp SLA9pabWG7hMW1qoLUZ8KuPv9xmsPSlRkdPMgvuHHX7QOXoyCuOXEYIoi7ky8GbJ23EJI6L3KKJ wmtCSY4m0M X-Received: by 2002:a17:90b:4b0e:b0:359:8e5e:43de with SMTP id 98e67ed59e1d1-35c300c19d2mr14606005a91.22.1774951565890; Tue, 31 Mar 2026 03:06:05 -0700 (PDT) X-Received: by 2002:a17:90b:4b0e:b0:359:8e5e:43de with SMTP id 98e67ed59e1d1-35c300c19d2mr14605975a91.22.1774951565385; Tue, 31 Mar 2026 03:06:05 -0700 (PDT) Received: from jiegan-gv.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35dbe41b11fsm1113255a91.0.2026.03.31.03.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2026 03:06:04 -0700 (PDT) From: Jie Gan Date: Tue, 31 Mar 2026 18:05:22 +0800 Subject: [PATCH v4] coresight: tpdm: add traceid_show for checking traceid Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260331-add-traceid-show-for-tpdm-v4-1-ed3dda24a562@oss.qualcomm.com> X-B4-Tracking: v=1; b=H4sIAGOcy2kC/43NwQ6CMAyA4VchO1sytjGJJ9/DeJhrkSXicMOpI by7g5MHY7w0+Zv068QiBUeR7YqJBUouOn/NoTYFs525ngkc5maCC81lpcEgwhiMJYcQO/+A1gc YB+yhaZArruuq5Zzl+yFQ656rfTjm7lwcfXitr5JYtv+oSUAFFZIVRm9JEe59jOXtbi7W932ZB 1vwJD9AUf8CZQY5nRqpUZGV/As4z/Mbp/m/qhoBAAA= To: Suzuki K Poulose , Mike Leach , James Clark , Leo Yan , Alexander Shishkin , Tingwei Zhang Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jie Gan , Mao Jinlong X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774951561; l=5112; i=jie.gan@oss.qualcomm.com; s=20250909; h=from:subject:message-id; bh=N3pEciTN7LAj4w8dB8lZ5jPdogjT7WW8uSDNMu9Z0wU=; b=JIRXGEOZII6vFBJQCfyfjhy6mSdjZwdCWfIt2FORY+p3PAa3p/u3a6c3eLt7aTXHOt55otoKk fjlgFqwEs2BCOguBldvjeQ+XPffXxMdIiCDPdhsLLzPm02NFRiyj2x7 X-Developer-Key: i=jie.gan@oss.qualcomm.com; a=ed25519; pk=3LxxUZRPCNkvPDlWOvXfJNqNO4SfGdy3eghMb8puHuk= X-Authority-Analysis: v=2.4 cv=KJpXzVFo c=1 sm=1 tr=0 ts=69cb9c8e cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=COk6AnOGAAAA:8 a=XokCWNFOrc6Ss69DZKAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: BWy0lIExKO_oTswlQtP-QnLrgRcSy7Nk X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMxMDA5NyBTYWx0ZWRfX+AWqz26oA9LU k5Ev7lRA2hLx1rIhLBAgZlqwjblQf2dsctyG4bUBtOaXaDOsmxcwf6DUR363lWij52vMdeo0+rs 1S2I/KMUNdSNV0dV6AO+W9bbwI5g+N7LliqN/RbSbeL20aZA3eKnImuJ/Q5SSvlqzla1FtncqHl UuVJ0GudlV8jjmpJkepNI2N9mPt3/SOMmiBbcpa+Z1enIDesT4kPI7TfxlLGpW0zAiDMAt36kZu dcnN9ZQ7ymSdykqRqEb2lrFFBHf/CdaK89KouWq3NEMsQro+W0l5I8CR02R4qdvkjqFMcqqhuTZ R/L5SBAaPe4sr56sIPO8U8Xvl6RShh/BqtIpdXo5HaH5xjzicRJj4ERavnSFmfaJR+jlsUYQ3om rML/gj4ZzRn1bIv32PooYSRo6/auQyEhFju4LY63utyOfiEPLgQLp0g8UPV4j+EBGuUQmMr8rvg IDoaSee3OTjIpa3Y+fg== X-Proofpoint-ORIG-GUID: BWy0lIExKO_oTswlQtP-QnLrgRcSy7Nk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-31_02,2026-03-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 adultscore=0 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603310097 Save the trace ID in drvdata during TPDM enablement and expose it to userspace to support trace data parsing. The TPDM device=E2=80=99s trace ID corresponds to the trace ID allocated to the connected TPDA device. Signed-off-by: Jie Gan Reviewed-by: James Clark --- Changes in v4: 1. Return -EINVAL if the traceid is 0. - Link to v3: https://lore.kernel.org/r/20260325-add-traceid-show-for-tpdm-= v3-1-0eb836d4ec30@oss.qualcomm.com Changes in v3: 1. Only allow user to read the traceid while the TPDM device is enabled. - Link to v2: https://lore.kernel.org/r/20260316-add-traceid-show-for-tpdm-= v2-1-1dec2a67e4ed@oss.qualcomm.com Changes in V2: 1. Use sysfs_emit instead of sprintf. Link to V1 - https://lore.kernel.org/all/20260306-add-traceid-show-for-tpdm= -v1-1-0658a8edb972@oss.qualcomm.com/ --- .../ABI/testing/sysfs-bus-coresight-devices-tpdm | 10 +++++++ drivers/hwtracing/coresight/coresight-tpdm.c | 34 ++++++++++++++++++= +++- drivers/hwtracing/coresight/coresight-tpdm.h | 2 ++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm b/D= ocumentation/ABI/testing/sysfs-bus-coresight-devices-tpdm index f8016df64532..bc36ba32c900 100644 --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm @@ -278,3 +278,13 @@ Date: Aug 2025 KernelVersion 6.18 Contact: Mao Jinlong Description: (Read) Show hardware context information of device. + +What: /sys/bus/coresight/devices//traceid +Date: March 2026 +KernelVersion: 7.1 +Contact: Jie Gan +Description: + (R) Show the trace ID that will appear in the trace stream + coming from this TPDM. The trace ID is inherited from the + connected TPDA device and is fixed for the lifetime of the + device. Returns -EINVAL if the device has not been enabled yet. diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtraci= ng/coresight/coresight-tpdm.c index da77bdaad0a4..9b16f368a58b 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -481,7 +481,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_path *path) + struct coresight_path *path) { struct tpdm_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); =20 @@ -497,6 +497,7 @@ static int tpdm_enable(struct coresight_device *csdev, = struct perf_event *event, } =20 __tpdm_enable(drvdata); + drvdata->traceid =3D path->trace_id; drvdata->enable =3D true; spin_unlock(&drvdata->spinlock); =20 @@ -693,6 +694,29 @@ static struct attribute_group tpdm_attr_grp =3D { .attrs =3D tpdm_attrs, }; =20 +static ssize_t traceid_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned long val; + struct tpdm_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + + val =3D drvdata->traceid; + if (!val) + return -EINVAL; + + return sysfs_emit(buf, "%#lx\n", val); +} +static DEVICE_ATTR_RO(traceid); + +static struct attribute *traceid_attrs[] =3D { + &dev_attr_traceid.attr, + NULL, +}; + +static struct attribute_group traceid_attr_grp =3D { + .attrs =3D traceid_attrs, +}; + static ssize_t dsb_mode_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -1367,6 +1391,12 @@ static const struct attribute_group *tpdm_attr_grps[= ] =3D { &tpdm_cmb_patt_grp, &tpdm_cmb_msr_grp, &tpdm_mcmb_attr_grp, + &traceid_attr_grp, + NULL, +}; + +static const struct attribute_group *static_tpdm_attr_grps[] =3D { + &traceid_attr_grp, NULL, }; =20 @@ -1425,6 +1455,8 @@ static int tpdm_probe(struct device *dev, struct reso= urce *res) desc.access =3D CSDEV_ACCESS_IOMEM(base); if (res) desc.groups =3D tpdm_attr_grps; + else + desc.groups =3D static_tpdm_attr_grps; drvdata->csdev =3D coresight_register(&desc); if (IS_ERR(drvdata->csdev)) return PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/hwtraci= ng/coresight/coresight-tpdm.h index 2867f3ab8186..11da64e1ade8 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.h +++ b/drivers/hwtracing/coresight/coresight-tpdm.h @@ -300,6 +300,7 @@ struct cmb_dataset { * @cmb Specifics associated to TPDM CMB. * @dsb_msr_num Number of MSR supported by DSB TPDM * @cmb_msr_num Number of MSR supported by CMB TPDM + * @traceid Trace ID of the path. */ =20 struct tpdm_drvdata { @@ -313,6 +314,7 @@ struct tpdm_drvdata { struct cmb_dataset *cmb; u32 dsb_msr_num; u32 cmb_msr_num; + u8 traceid; }; =20 /* Enumerate members of various datasets */ --- base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900 change-id: 20260316-add-traceid-show-for-tpdm-88d040651f00 Best regards, --=20 Jie Gan