mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: James Clark <james.clark@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH v2 6/8] coresight: Clear self hosted claim tag on probe
Date: Wed, 19 Mar 2025 09:13:33 +0000	[thread overview]
Message-ID: <20250319091333.GG2860028@e132581.arm.com> (raw)
In-Reply-To: <20250318-james-coresight-claim-tags-v2-6-e9c8a9cde84e@linaro.org>

On Tue, Mar 18, 2025 at 04:22:00PM +0000, James Clark wrote:
> This can be left behind from a crashed kernel after a kexec so clear it
> when probing each device. Clearing the self hosted bit even when claimed
> externally is harmless, so do it unconditionally.
> 
> Signed-off-by: James Clark <james.clark@linaro.org>

Just a note from me.

I'd expect it would be a rare case that users enable a Arm CoreSight
trace in a dump-capture kernel, as the second kernel is for dumping
CoreSight trace data but it is not necessarily to enable CoreSight
components.

This patch is not only helpful for crash kernel case, it can dismiss
quirks caused by insane hardware reset cases.

Reviewed-by: Leo Yan <leo.yan@arm.com>

> ---
>  drivers/hwtracing/coresight/coresight-catu.c       | 1 +
>  drivers/hwtracing/coresight/coresight-cti-core.c   | 2 ++
>  drivers/hwtracing/coresight/coresight-etb10.c      | 2 ++
>  drivers/hwtracing/coresight/coresight-etm3x-core.c | 1 +
>  drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 ++
>  drivers/hwtracing/coresight/coresight-funnel.c     | 1 +
>  drivers/hwtracing/coresight/coresight-replicator.c | 1 +
>  drivers/hwtracing/coresight/coresight-tmc-core.c   | 1 +
>  8 files changed, 11 insertions(+)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c
> index fa170c966bc3..deaacfd875af 100644
> --- a/drivers/hwtracing/coresight/coresight-catu.c
> +++ b/drivers/hwtracing/coresight/coresight-catu.c
> @@ -558,6 +558,7 @@ static int __catu_probe(struct device *dev, struct resource *res)
>  	catu_desc.subtype.helper_subtype = CORESIGHT_DEV_SUBTYPE_HELPER_CATU;
>  	catu_desc.ops = &catu_ops;
>  
> +	coresight_clear_self_claim_tag(&catu_desc.access);
>  	drvdata->csdev = coresight_register(&catu_desc);
>  	if (IS_ERR(drvdata->csdev))
>  		ret = PTR_ERR(drvdata->csdev);
> diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c b/drivers/hwtracing/coresight/coresight-cti-core.c
> index 80f6265e3740..8fb30dd73fd2 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-core.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-core.c
> @@ -931,6 +931,8 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
>  	cti_desc.ops = &cti_ops;
>  	cti_desc.groups = drvdata->ctidev.con_groups;
>  	cti_desc.dev = dev;
> +
> +	coresight_clear_self_claim_tag(&cti_desc.access);
>  	drvdata->csdev = coresight_register(&cti_desc);
>  	if (IS_ERR(drvdata->csdev)) {
>  		ret = PTR_ERR(drvdata->csdev);
> diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
> index 7948597d483d..2bfcb669aa84 100644
> --- a/drivers/hwtracing/coresight/coresight-etb10.c
> +++ b/drivers/hwtracing/coresight/coresight-etb10.c
> @@ -772,6 +772,8 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
>  	desc.pdata = pdata;
>  	desc.dev = dev;
>  	desc.groups = coresight_etb_groups;
> +
> +	coresight_clear_self_claim_tag(&desc.access);
>  	drvdata->csdev = coresight_register(&desc);
>  	if (IS_ERR(drvdata->csdev))
>  		return PTR_ERR(drvdata->csdev);
> diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c
> index cfd463ac715c..1c6204e14422 100644
> --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c
> @@ -764,6 +764,7 @@ static void etm_init_arch_data(void *info)
>  	drvdata->nr_ext_out = BMVAL(etmccr, 20, 22);
>  	drvdata->nr_ctxid_cmp = BMVAL(etmccr, 24, 25);
>  
> +	coresight_clear_self_claim_tag_unlocked(&drvdata->csa);
>  	etm_set_pwrdwn(drvdata);
>  	etm_clr_pwrup(drvdata);
>  	CS_LOCK(drvdata->csa.base);
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index e5972f16abff..52c9aa56e8b9 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -1372,6 +1372,8 @@ static void etm4_init_arch_data(void *info)
>  	drvdata->nrseqstate = FIELD_GET(TRCIDR5_NUMSEQSTATE_MASK, etmidr5);
>  	/* NUMCNTR, bits[30:28] number of counters available for tracing */
>  	drvdata->nr_cntr = FIELD_GET(TRCIDR5_NUMCNTR_MASK, etmidr5);
> +
> +	coresight_clear_self_claim_tag_unlocked(csa);
>  	etm4_cs_lock(drvdata, csa);
>  	cpu_detect_trace_filtering(drvdata);
>  }
> diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
> index 0541712b2bcb..7249cc356ccb 100644
> --- a/drivers/hwtracing/coresight/coresight-funnel.c
> +++ b/drivers/hwtracing/coresight/coresight-funnel.c
> @@ -255,6 +255,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
>  		drvdata->base = base;
>  		desc.groups = coresight_funnel_groups;
>  		desc.access = CSDEV_ACCESS_IOMEM(base);
> +		coresight_clear_self_claim_tag(&desc.access);
>  	}
>  
>  	dev_set_drvdata(dev, drvdata);
> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
> index ee7ee79f6cf7..b2acd4535c74 100644
> --- a/drivers/hwtracing/coresight/coresight-replicator.c
> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
> @@ -284,6 +284,7 @@ static int replicator_probe(struct device *dev, struct resource *res)
>  	desc.pdata = dev->platform_data;
>  	desc.dev = dev;
>  
> +	coresight_clear_self_claim_tag(&desc.access);
>  	drvdata->csdev = coresight_register(&desc);
>  	if (IS_ERR(drvdata->csdev)) {
>  		ret = PTR_ERR(drvdata->csdev);
> diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
> index a7814e8e657b..a09579eff3fd 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc-core.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
> @@ -869,6 +869,7 @@ static int __tmc_probe(struct device *dev, struct resource *res)
>  	dev->platform_data = pdata;
>  	desc.pdata = pdata;
>  
> +	coresight_clear_self_claim_tag(&desc.access);
>  	drvdata->csdev = coresight_register(&desc);
>  	if (IS_ERR(drvdata->csdev)) {
>  		ret = PTR_ERR(drvdata->csdev);
> 
> -- 
> 2.34.1
> 

  reply	other threads:[~2025-03-19  9:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 16:21 [PATCH v2 0/8] " James Clark
2025-03-18 16:21 ` [PATCH v2 1/8] coresight: Rename coresight_{set,clear}_claim_tags() James Clark
2025-03-18 16:21 ` [PATCH v2 2/8] coresight: Convert tag clear function to take a struct cs_access James Clark
2025-03-19  8:24   ` Leo Yan
2025-03-19 12:00   ` Suzuki K Poulose
2025-03-19 12:30     ` James Clark
2025-03-18 16:21 ` [PATCH v2 3/8] coresight: Only check bottom two claim bits James Clark
2025-03-18 16:21 ` [PATCH v2 4/8] coresight: Add claim tag warnings and debug messages James Clark
2025-03-19  8:27   ` Leo Yan
2025-03-18 16:21 ` [PATCH v2 5/8] coresight: etm3x: Convert raw base pointer to struct coresight access James Clark
2025-03-19  8:30   ` Leo Yan
2025-03-18 16:22 ` [PATCH v2 6/8] coresight: Clear self hosted claim tag on probe James Clark
2025-03-19  9:13   ` Leo Yan [this message]
2025-03-18 16:22 ` [PATCH v2 7/8] coresight: Remove inlines from static function definitions James Clark
2025-03-19  8:36   ` Leo Yan
2025-03-18 16:22 ` [PATCH v2 8/8] coresight: Remove extern from function declarations James Clark

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=20250319091333.GG2860028@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mike.leach@linaro.org \
    --cc=suzuki.poulose@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

all inboxes | Powered by JetHome®