Re: [PATCH v3 1/1] coresight: fix issue where coresight component has no claimtags
From: Leo Yan
Date: Mon Jun 22 2026 - 06:30:49 EST
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