public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Jie Gan <jie.gan@oss.qualcomm.com>
To: Yeoreum Yun <yeoreum.yun@arm.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, suzuki.poulose@arm.com,
	mike.leach@arm.com, james.clark@linaro.org,
	alexander.shishkin@linux.intel.com, leo.yan@arm.com
Subject: Re: [PATCH v5 04/12] coresight: etm4x: exclude ss_status from drvdata->config
Date: Thu, 16 Apr 2026 15:20:31 +0800	[thread overview]
Message-ID: <750c7a05-76a3-4992-a539-fb3c41b56ec7@oss.qualcomm.com> (raw)
In-Reply-To: <aeCHnToKG43oKQNF@e129823.arm.com>



On 4/16/2026 2:54 PM, Yeoreum Yun wrote:
> Hi Jie,
> 

Hi Yeoreum,

>>
>>
>> On 4/16/2026 12:55 AM, Yeoreum Yun wrote:
>>> The purpose of TRCSSCSRn register is to show status of
>>> the corresponding Single-shot Comparator Control and input supports.
>>> That means writable field's purpose for reset or restore from idle status
>>> not for configuration.
>>>
>>> Therefore, exclude ss_status from drvdata->config, move it to etm4x_caps
>>> and rename it to ss_smp.
>>>
>>> This includes remove TRCSSCRn from configurable item and
>>> remove saving in etm4_disable_hw().
>>>
>>> Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
>>> ---
>>>    .../hwtracing/coresight/coresight-etm4x-cfg.c |  1 -
>>>    .../coresight/coresight-etm4x-core.c          | 19 ++++++-------------
>>>    .../coresight/coresight-etm4x-sysfs.c         |  7 ++-----
>>>    drivers/hwtracing/coresight/coresight-etm4x.h |  7 ++++++-
>>>    4 files changed, 14 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-cfg.c b/drivers/hwtracing/coresight/coresight-etm4x-cfg.c
>>> index c302072b293a..d14d7c8a23e5 100644
>>> --- a/drivers/hwtracing/coresight/coresight-etm4x-cfg.c
>>> +++ b/drivers/hwtracing/coresight/coresight-etm4x-cfg.c
>>> @@ -86,7 +86,6 @@ static int etm4_cfg_map_reg_offset(struct etmv4_drvdata *drvdata,
>>>    		off_mask =  (offset & GENMASK(11, 5));
>>>    		do {
>>>    			CHECKREGIDX(TRCSSCCRn(0), ss_ctrl, idx, off_mask);
>>> -			CHECKREGIDX(TRCSSCSRn(0), ss_status, idx, off_mask);
>>>    			CHECKREGIDX(TRCSSPCICRn(0), ss_pe_cmp, idx, off_mask);
>>>    		} while (0);
>>>    	} else if ((offset >= TRCCIDCVRn(0)) && (offset <= TRCVMIDCVRn(7))) {
>>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>>> index b2b092a76eb5..f55338a4989d 100644
>>> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
>>> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>>> @@ -91,7 +91,7 @@ static bool etm4x_sspcicrn_present(struct etmv4_drvdata *drvdata, int n)
>>>    	const struct etmv4_caps *caps = &drvdata->caps;
>>>    	return (n < caps->nr_ss_cmp) && caps->nr_pe_cmp &&
>>> -	       (drvdata->config.ss_status[n] & TRCSSCSRn_PC);
>>> +	       (caps->ss_cmp[n] & TRCSSCSRn_PC);
>>>    }
>>>    u64 etm4x_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>> @@ -573,11 +573,9 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
>>>    		etm4x_relaxed_write32(csa, config->res_ctrl[i], TRCRSCTLRn(i));
>>>    	for (i = 0; i < caps->nr_ss_cmp; i++) {
>>> -		/* always clear status bit on restart if using single-shot */
>>> -		if (config->ss_ctrl[i] || config->ss_pe_cmp[i])
>>> -			config->ss_status[i] &= ~TRCSSCSRn_STATUS;
>>>    		etm4x_relaxed_write32(csa, config->ss_ctrl[i], TRCSSCCRn(i));
>>> -		etm4x_relaxed_write32(csa, config->ss_status[i], TRCSSCSRn(i));
>>> +		/* always clear status and pending bits on restart if using single-shot */
>>> +		etm4x_relaxed_write32(csa, 0x0, TRCSSCSRn(i));
>>>    		if (etm4x_sspcicrn_present(drvdata, i))
>>>    			etm4x_relaxed_write32(csa, config->ss_pe_cmp[i], TRCSSPCICRn(i));
>>>    	}
>>> @@ -1055,12 +1053,6 @@ static void etm4_disable_hw(struct etmv4_drvdata *drvdata)
>>>    	etm4_disable_trace_unit(drvdata);
>>> -	/* read the status of the single shot comparators */
>>> -	for (i = 0; i < caps->nr_ss_cmp; i++) {
>>> -		config->ss_status[i] =
>>> -			etm4x_relaxed_read32(csa, TRCSSCSRn(i));
>>> -	}
>>> -
>>>    	/* read back the current counter values */
>>>    	for (i = 0; i < caps->nr_cntr; i++) {
>>>    		config->cntr_val[i] =
>>> @@ -1503,8 +1495,9 @@ static void etm4_init_arch_data(void *info)
>>>    	 */
>>>    	caps->nr_ss_cmp = FIELD_GET(TRCIDR4_NUMSSCC_MASK, etmidr4);
>>>    	for (i = 0; i < caps->nr_ss_cmp; i++) {
>>> -		drvdata->config.ss_status[i] =
>>> -			etm4x_relaxed_read32(csa, TRCSSCSRn(i));
>>> +		caps->ss_cmp[i] = etm4x_relaxed_read32(csa, TRCSSCSRn(i));
>>> +		caps->ss_cmp[i] &= (TRCSSCSRn_PC | TRCSSCSRn_DV |
>>> +				    TRCSSCSRn_DA | TRCSSCSRn_INST);
>>
>> Just re-go through this patch and had a question here:
>>
>> I’m not sure whether this new change should be documented in the ABI, given
>> that the TRCSSCSRn_STATUS bit is masked. In my opinion, this change breaks
>> the existing ABI description.
>>
>> Description from the ABI document:
>>
>> What:           /sys/bus/coresight/devices/etm<N>/sshot_status
>> Date:           December 2019
>> KernelVersion:  5.5
>> Contact:        Mathieu Poirier <mathieu.poirier@linaro.org>
>> Description:    (Read) Print the current value of the selected single
>>                  shot status register.
> 
> But, as I mentioned another thread:
>    - https://lore.kernel.org/all/ad5yV2FoNbGGLE6R@e129823.arm.com/
> 
> Till now, sysfs doesn't show the *current value* of the single shot
> state since the config->ss_status is updated enabled/disabled sysfs
> session. an I think once the session is disabled, other status bits
> (currently STATUS and PENDING bits) don't have any meaning.
> 
> I think it's enough to change the doc's Description for this.
> 
> Any thought?

Thanks for the info. I have missed this info, we are calling it 
'comparator' instead of 'status' by focusing on the capability bits.

Make sense to me.

Thanks,
Jie

> 
> --
> Sincerely,
> Yeoreum Yun



  reply	other threads:[~2026-04-16  7:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 16:55 [PATCH v5 00/12] fix several inconsistencies with sysfs configuration in etmX Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 01/12] coresight: etm4x: fix wrong check of etm4x_sspcicrn_present() Yeoreum Yun
2026-04-16 15:02   ` Leo Yan
2026-04-15 16:55 ` [PATCH v5 02/12] coresight: etm4x: fix underflow for nrseqstate Yeoreum Yun
2026-04-16 15:11   ` Leo Yan
2026-04-16 17:07     ` Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 03/12] coresight: etm4x: introduce struct etm4_caps Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 04/12] coresight: etm4x: exclude ss_status from drvdata->config Yeoreum Yun
2026-04-16  5:42   ` Jie Gan
2026-04-16  6:54     ` Yeoreum Yun
2026-04-16  7:20       ` Jie Gan [this message]
2026-04-16 15:51   ` Leo Yan
2026-04-15 16:55 ` [PATCH v5 05/12] coresight: etm4x: remove redundant fields in etmv4_save_state Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 06/12] coresight: etm4x: fix leaked trace id Yeoreum Yun
2026-04-16 16:55   ` Leo Yan
2026-04-16 17:06     ` Yeoreum Yun
2026-04-17  7:52       ` Leo Yan
2026-04-17  1:01     ` Jie Gan
2026-04-17  8:41       ` Leo Yan
2026-04-17  8:51         ` Jie Gan
2026-04-17  8:58           ` Jie Gan
2026-04-15 16:55 ` [PATCH v5 07/12] coresight: etm4x: fix inconsistencies with sysfs configuration Yeoreum Yun
2026-04-16  4:35   ` Jie Gan
2026-04-16  6:49     ` Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 08/12] coresight: etm4x: remove redundant call etm4_enable_hw() with hotplug Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 09/12] coresight: etm3x: change drvdata->spinlock type to raw_spin_lock_t Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 10/12] coresight: etm3x: introduce struct etm_caps Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 11/12] coresight: etm3x: fix inconsistencies with sysfs configuration Yeoreum Yun
2026-04-15 16:55 ` [PATCH v5 12/12] coresight: etm3x: remove redundant call etm_enable_hw() with hotplug Yeoreum Yun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=750c7a05-76a3-4992-a539-fb3c41b56ec7@oss.qualcomm.com \
    --to=jie.gan@oss.qualcomm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@linaro.org \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=yeoreum.yun@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox