From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 951713101B6 for ; Tue, 17 Mar 2026 01:33:23 +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=1773711204; cv=none; b=ISbEUi1OEy+2Zqn6qlb7ENoKxkuF4BffOa2sfRaELGxarGp1f0hWGK2hsf2JAdXu34d9viHXKD9pwqbT1h4Dr7P/VHV9QnZGd9jYWhk7IfEeHiCXy6pz3GuEZT0KbTcDlv7Qt148LI5wWVsa1OswIjVeYDV7oZNea26rXubnaZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773711204; c=relaxed/simple; bh=PuI2xZ5odns5o9RlrMAUindDA5Uwoe7OcGS/EUGeWLg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rgPVwz6c0iVjAxrefzaRgHkwgng2BKi1ERRHOJFeFWhnBci1OOJOVVkE+vDb9ugDZnkcwPlo9QkpNey7spMhVoYmmNw3DjCMPQ0/d2NuXKedU7dPRf6r5UxPzZp+O9W5m0Jf08IJr5e6RbqJu2GZD0eU1pS0T13nLFUc/BeiZaQ= 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=ORDYvrvf; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Z5WZxjWc; 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="ORDYvrvf"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Z5WZxjWc" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62GNPfe9795495 for ; Tue, 17 Mar 2026 01:33:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= BSTTg7WrmP4vWV7U3/LWvBJzroo+eR8G0HMjWnSLhR4=; b=ORDYvrvfUOtQ5rIE GXQIzJsQWlOXr1AnMz9BuTWrc3ieWYavytBTQES6Xoo04H4zl2614PCQ0HOScFYs 2YQODQiq1EBoh6dWFPp5kJZYkM/MF7VDWGQFy5jWsVSMy8syzb4jaSqF8tTJVXte EVFmE6FrC4t0hiO58Bm2CsJRTCM8NPE9XbWuQhyAlfRqm68lccDc1NiAcGwtQXIj p102Q6vyHsrLHWvfzGNiyiPE67MehhZVAsCXVzQiRLZs/JqDSRUMvXUt2g+MTrsN PxV9blAIUR7vDbyg9V9O/42QWQorFGTlEWUZRH++5vm0w1RW+eeJaIg+uvb1+JNf YzjjqA== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cxm6d1ukt-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 17 Mar 2026 01:33:22 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b6ce1b57b9cso4003451a12.1 for ; Mon, 16 Mar 2026 18:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773711202; x=1774316002; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BSTTg7WrmP4vWV7U3/LWvBJzroo+eR8G0HMjWnSLhR4=; b=Z5WZxjWc+JbF304IwVmtE7TUcUj37yYCFpj91AtfbHhI02aKc3SNVSkrVxZJI/HLJa ZQsGRzNIDynzSTkbxNK4Gk11D2b8fk9F6xTV3APeRVuDIxTxpxyWGR1OWq+SJrWMAH/+ vI+UUSvw9Ce1jv0f0WXLjKv+i61C4jCjcrV/YzU4Nx5AqGP16Yd7zSzAXcl0WgOBcFkC EQYJ6CQZPkIh8Ehjj2NTjPz7cmAm25rN5yYcRxztwavWRdUIDV8vkXZ/iIbE1a7pNaBo 4E1G6p47poyqXy5rEvkI47PNII+KY6ucsuo2KlGYLR927VonsdeSjVFT6ktb2swya6QU bn7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773711202; x=1774316002; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BSTTg7WrmP4vWV7U3/LWvBJzroo+eR8G0HMjWnSLhR4=; b=c5+Y3Z6YZIQYqzFO3V3X4Fz2gclFgndG2vspqTCgXzQCUKk+U8uRL23bQYUUjmrFZk 9/A4wtbkTw18DKPT7ks3jCa7aOrUrvEVMN5297+88Rvqrlqyu/NFfV0/U9PQKSdwviVy pGRcKBF5RvRqRhUKu9GSMv18lCOGlcV4CqHwjmo356LuFruGmw6RYYDAbmUfsHCf3jhb loRKXIfSHXoLVa/FXfkZOTj3pZI0kGI0YIoH/WTZbAtFcWZ02eKMGFY5OjdjPqTexNoh qmgjmwDvivtjJGeu9z/U9xip3ElP1HQRx23ROF7ez8S/eeJct4bFmho/7jHr2Fe8nSTQ LJVw== X-Forwarded-Encrypted: i=1; AJvYcCXPdeApBvK16bQS2DZZ+tOKJBFi1aLLsjjKVSEdH9sOGWGAVURL2g2gE1iMKYdk51yqc4DAD8nLDc2KfZk=@vger.kernel.org X-Gm-Message-State: AOJu0YzFNJsCpjjLTxTOx1hzvpk9e0784zg6n3+/pxggQQ+qwY4yCwgt lrK9c/5jVsGtWhXJlhRl/0C5lbLIfHT5gPjtSI5ybWIMwO9MSDu8DflNGTn1QrS19Z4imqlejXe mSNAqh5oz6+gGDNdO50qI8jjkXaOy0NQ7Dn+RuSR0FG1l4YI2KvQEg+YM7Afg6huwKyM= X-Gm-Gg: ATEYQzzXYFzeJ5H3GO1QJy3L+gnSSSOHgIaYv7Le9LkCiVE6Wj93ez6p/iS+0UVxOBf /7knKoYPgMST75f9OSG8gX6y074XWBvvxcu/njL9rlkxsCCZszElpjvXzyrJgxJtn62AgdmXiRg aALuqzkW0doQUnHqs59j3iB/CXdK/tzQGvPdOBOoG1AHeeuVPYgtb7wUr573p/nxRVqRbQdt3yC 0kJKcRW1xXe/oXY2E3QVfjp0KVCg/Ac4j2D4hKYFHJjAwEKqvmi4kxgm3FCtBfgEQ5SGTnPFX2N sdBlpLQqyP19aklp67c9DpqOoPokQ0wMLGoZFrqf/hkUHpk+nbqy6c8L7AcfVp0YhmplS0Ii+OL zItK0GiZJAvGsZv4YwQ2s+jo3L+NMpkWUONPRqRaPvvKRWQXRDgiBmNMzGNCiHYtMCcoDqctCym btFkx/+UZP/rw= X-Received: by 2002:a05:6a00:21d4:b0:81e:ef16:b288 with SMTP id d2e1a72fcca58-82a197173cemr12676591b3a.22.1773711201741; Mon, 16 Mar 2026 18:33:21 -0700 (PDT) X-Received: by 2002:a05:6a00:21d4:b0:81e:ef16:b288 with SMTP id d2e1a72fcca58-82a197173cemr12676567b3a.22.1773711201127; Mon, 16 Mar 2026 18:33:21 -0700 (PDT) Received: from [10.133.33.135] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82a0725bfd0sm17779184b3a.14.2026.03.16.18.33.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Mar 2026 18:33:20 -0700 (PDT) Message-ID: Date: Tue, 17 Mar 2026 09:33:13 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] coresight: tpdm: add traceid_show for checking traceid To: Suzuki K Poulose , Jie Gan , 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 References: <20260316-add-traceid-show-for-tpdm-v2-1-1dec2a67e4ed@oss.qualcomm.com> <8f37ae07-f211-4d43-bc01-4ab17a0d1f32@oss.qualcomm.com> Content-Language: en-US From: Jie Gan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=c7+mgB9l c=1 sm=1 tr=0 ts=69b8af62 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=s_LNS3maTIwMnbWpHXAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-ORIG-GUID: EDDKgZgkpy4ilCRli3hjFD-I5ied4_Pp X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE3MDAxMSBTYWx0ZWRfXyjWam8C1bDdA Tfwy4G6+6cdutTuabl1t1OyvntrBe4ONptr2v02KZrOK0BWZYVIROjc8iz3nhGW77Thj6hfVB1Z 8r8U00uMVvFMZJ/JfS6Nyb/SxDh3E9MAFjDAAMhVmJabGSbm8dYp0/X7e+f9sX0bMdo3R9cx2PC H8qEm6i7aB2Lg2k5tjm3SiDI38B/2mlsywu/XstkouFs00P2ylIUtJAWZKRUjE4utGv/tLdQWNb SCEHpbUnjX9M82on72prC/S+CKhMI2QoBv7BkRqxYFLlRWo7a+hZMyArxFi9rrNQxDbvVue/gwl sP6F88OiLNjOkabg2VPg84/7PU67oAFenUUIeQhUU09jgabaMiDtzt9ttVVmfUFp6d81K3Ib3s9 JMJ8GZ4L/SptK89BR6YPb1lc+4Qo3mm5FzJzvvzlboXa+qhxZUSXcaRsY2iEL7vujzViUUfVtOF Grl1X7IiPWCxR5cUD6w== X-Proofpoint-GUID: EDDKgZgkpy4ilCRli3hjFD-I5ied4_Pp 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-16_06,2026-03-16_06,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603170011 Hi Suzuki, On 3/16/2026 7:20 PM, Suzuki K Poulose wrote: > On 16/03/2026 10:29, Jie Gan wrote: >> >> Hi Suzuki, >> >> On 3/16/2026 5:32 PM, Suzuki K Poulose wrote: >>> On 16/03/2026 07:23, Jie Gan wrote: >>>> Save the trace ID in drvdata during TPDM enablement and expose it >>>> to userspace to support trace data parsing. >>>> >>>> The TPDM device’s trace ID corresponds to the trace ID allocated >>>> to the connected TPDA device. >>>> >>>> Signed-off-by: Jie Gan >>>> --- >>>> 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/ >>> >>> Why is this patch required even ? For each TPDM there is a single >> >> It's taking effort to retrieve the trace ID of the TPDA device because >> it's not a source device. The trace ID is required to identify the >> origin of the trace data and is essential for parsing the received data. >> >>> port in a single TPDA in the system where it can reach and that is >>> fixed for a platform. Can we not get this from there ? Also, there >>> is not TraceID technically for a TPDM, right ? It is all a property >> >> Yes, we dont allocate trace ID for a TPDM device. The TraceID is >> allocated to the TPDA device. > > Now if you combine both your responses, don't you think they contradict > each other ? Yes, the expression looks self-contradictory. We cannot locate a specific TPDM device using the trace ID, yet we are attempting to retrieve the trace ID from a device that does not have one. Since each path has only one valid trace ID, and it can be easily retrieved from the source device (as there is only one source device per path), that's the reason why the function was added to the TPDM device for this specific case. Besides, the trace ID is useful to help to identify the originating block. Within a block, each TPDM device(DSB TPDM) outputs only a single type of hardware event (for example, a single bit value from a specific register). Therefore, all TPDM devices in a block can be treated as a single TPDM device, using the TPDA trace ID. > > Also, the TraceID we show is *not valid* if the TPDM was never enabled. > So this is inconsistent, isn't it ? Unless we return an error in this case > Understood, we should only return the valid trace ID. I will add an error check to guarantee it if this patch is acceptable. Thanks, Jie > Suzuki > >> >> Thanks, >> Jie >> >>> of the TPDA ? >>> >> >> >>> Suzuki >>> >>> >>>> --- >>>>   drivers/hwtracing/coresight/coresight-tpdm.c | 31 ++++++++++++++++ >>>> + + +++++++++- >>>>   drivers/hwtracing/coresight/coresight-tpdm.h |  2 ++ >>>>   2 files changed, 32 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/ >>>> hwtracing/coresight/coresight-tpdm.c >>>> index da77bdaad0a4..774a63def817 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) >>>>   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 = dev_get_drvdata(csdev- >>>> >dev.parent); >>>> @@ -497,6 +497,7 @@ static int tpdm_enable(struct coresight_device >>>> *csdev, struct perf_event *event, >>>>       } >>>>       __tpdm_enable(drvdata); >>>> +    drvdata->traceid = path->trace_id; >>>>       drvdata->enable = true; >>>>       spin_unlock(&drvdata->spinlock); >>>> @@ -693,6 +694,26 @@ static struct attribute_group tpdm_attr_grp = { >>>>       .attrs = tpdm_attrs, >>>>   }; >>>> +static ssize_t traceid_show(struct device *dev, >>>> +                struct device_attribute *attr, char *buf) >>>> +{ >>>> +    unsigned long val; >>>> +    struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); >>>> + >>>> +    val = drvdata->traceid; >>>> +    return sysfs_emit(buf, "%#lx\n", val); >>>> +} >>>> +static DEVICE_ATTR_RO(traceid); >>>> + >>>> +static struct attribute *traceid_attrs[] = { >>>> +    &dev_attr_traceid.attr, >>>> +    NULL, >>>> +}; >>>> + >>>> +static struct attribute_group traceid_attr_grp = { >>>> +    .attrs = traceid_attrs, >>>> +}; >>>> + >>>>   static ssize_t dsb_mode_show(struct device *dev, >>>>                    struct device_attribute *attr, >>>>                    char *buf) >>>> @@ -1367,6 +1388,12 @@ static const struct attribute_group >>>> *tpdm_attr_grps[] = { >>>>       &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[] = { >>>> +    &traceid_attr_grp, >>>>       NULL, >>>>   }; >>>> @@ -1425,6 +1452,8 @@ static int tpdm_probe(struct device *dev, >>>> struct resource *res) >>>>       desc.access = CSDEV_ACCESS_IOMEM(base); >>>>       if (res) >>>>           desc.groups = tpdm_attr_grps; >>>> +    else >>>> +        desc.groups = static_tpdm_attr_grps; >>> >>>  >       drvdata->csdev = coresight_register(&desc);>       if >>> (IS_ERR(drvdata->csdev)) >>>>           return PTR_ERR(drvdata->csdev); >>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/ >>>> hwtracing/coresight/coresight-tpdm.h >>>> index 2867f3ab8186..befecbb896f4 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. >>>>    */ >>>>   struct tpdm_drvdata { >>>> @@ -313,6 +314,7 @@ struct tpdm_drvdata { >>>>       struct cmb_dataset    *cmb; >>>>       u32            dsb_msr_num; >>>>       u32            cmb_msr_num; >>>> +    u8            traceid; >>>>   }; >>>>   /* Enumerate members of various datasets */ >>>> >>>> --- >>>> base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900 >>>> change-id: 20260316-add-traceid-show-for-tpdm-88d040651f00 >>>> >>>> Best regards, >>> >>> >> > >