Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Mike Leach <mike.leach@arm.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, suzuki.poulose@arm.com,
	james.clark@linaro.org
Subject: Re: [PATCH v3 1/1] coresight: fix issue where coresight component has no claimtags
Date: Mon, 22 Jun 2026 11:26:25 +0100	[thread overview]
Message-ID: <20260622102625.GF31870@e132581.arm.com> (raw)
In-Reply-To: <20260619160148.499223-2-mike.leach@arm.com>

Hi Mike,

On Fri, Jun 19, 2026 at 05:01:48PM +0100, Mike Leach wrote:

[...]

> Any device which is not verified to support claim tags, will now get a
> success return from the claim/disclaim calls.

Do we really want to relax this?

AFAIK, all Arm standard modules should follow the claim tag protocol.
SoC specific modules that do not support claim tags should not enable
claim tag handling in the first place. In that case, they would not
need any claim tag-related operations.

The tricky part is that if a module provides CORESIGHT_CLAIMSET, it
likely supports claim tags. Conversely, if a module does not provide
CORESIGHT_CLAIMSET, validating claim tags using that offset seems
pointless.

As a result, can we constraint to only two cases as below?

  enum coresight_claim_tag_info {
       CS_CLAIM_TAG_STD_PROTOCOL,
       CS_CLAIM_TAG_IGNORE,
  };

For CS_CLAIM_TAG_STD_PROTOCOL type, it must pass the validation.
Otherwise, the claim tag operations will be totally ignored.

[...]

> diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c
> index 43abe13995cf..d8a0ecc502af 100644
> --- a/drivers/hwtracing/coresight/coresight-catu.c
> +++ b/drivers/hwtracing/coresight/coresight-catu.c
> @@ -574,10 +574,14 @@ 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);
> +
> +	ret = coresight_init_claim_tags(drvdata->csdev);
> +	if (ret)
> +		coresight_unregister(drvdata->csdev);
> +

coresight_init_claim_tags() is much simpler than coresight_register(),
this is why we can put coresight_init_claim_tags() before
coresight_register() to avoid complex rollback operations for claim init
failure.

I have no strong opinion for this, as the sequence in this patch should
can work as well.

> +/* helper for checking if claim tag protocol in use */
> +static bool coresight_using_claim_tag_protocol(struct coresight_device *csdev)
> +{
> +	return (bool)(csdev->claim_tag_info == CS_CLAIM_TAG_STD_PROTOCOL);
> +}

Redundant for bool cast?

> +
> +/* helper to check initialised */
> +static bool coresight_claim_tag_noinit(struct coresight_device *csdev)
> +{
> +	return (bool)(csdev->claim_tag_info == CS_CLAIM_TAG_UNKNOWN);

Ditto.

> +/* cpu bound devices (etms) may need to run on bound cpu */
> +int coresight_init_claim_tags_cpu_smp(struct coresight_device *csdev, int cpu)
> +{
> +	int ret = 0;
> +	struct cs_claim_tag_init_arg arg = { };
> +
> +	arg.csdev = csdev;
> +	ret = smp_call_function_single(cpu,
> +				       coresight_init_claim_tags_smp_call,
> +				       &arg, 1);
> +
> +	if (!ret)
> +		ret = arg.rc;
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(coresight_init_claim_tags_cpu_smp);

Do we really need a specific SMP call for this? I understand this will
be used by ETMv3/v4 drivers, can we simply init claim tags in the local
functions (e.g., etm4_init_arch_data() for ETMv4), same as the current
implemenation?

Thanks,
Leo


      reply	other threads:[~2026-06-22 10:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19 16:01 [PATCH v3 0/1] coresight: fix issue with insufficient claim tags Mike Leach
2026-06-19 16:01 ` [PATCH v3 1/1] coresight: fix issue where coresight component has no claimtags Mike Leach
2026-06-22 10:26   ` Leo Yan [this message]

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=20260622102625.GF31870@e132581.arm.com \
    --to=leo.yan@arm.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=mike.leach@arm.com \
    --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