From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A79B41624C5 for ; Mon, 16 Mar 2026 11:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773660057; cv=none; b=G7BbeKUrqXGzvWR01rtrQnGyS3/+A7jQeDdznWvTiPDbTaBkr208em3Ss6QV/nAOnVTcjudAMr2cWcYbusdKML4kBsSH0X5ipvXaxusN+k0tD9e5bf9fzbzRR3yrQiif4pSwBXPwsfxpMJILL1/hVJ8vFru2F2R0pcAmH+ABoZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773660057; c=relaxed/simple; bh=HPalJi49sQYyuO9E4HH2mEtUnhxwFPfaHUyv0V5EOC8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ZX9Hbo0bLPHL/C/Vd6SMLQynfJpR1bgKfNQLhoSB6PMg0Uhcd33jWl8iMmuGueCyfL9IK5Hts36gJpa2iVjODiNsvwUl6zE0E7ZxK0mUleBa6SMl+zXeba0Fo4zgMQACMAqaClp8UlAWOTeYO4WoHT6BeIeEYtoMMGCRSs4Nha8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F38FE1477; Mon, 16 Mar 2026 04:20:48 -0700 (PDT) Received: from [10.57.18.169] (unknown [10.57.18.169]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B1E9F3F778; Mon, 16 Mar 2026 04:20:53 -0700 (PDT) Message-ID: Date: Mon, 16 Mar 2026 11:20:52 +0000 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 Content-Language: en-GB To: 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> From: Suzuki K Poulose In-Reply-To: <8f37ae07-f211-4d43-bc01-4ab17a0d1f32@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 ? 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 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, >> >> >