Subject: Re: [PATCH v9 3/4] coresight: cti: add Qualcomm extended CTI identification and quirks

From: "Yingchao Deng (Consultant)" <[email-masked]>
Date: Fri, 29 May 2026 09:42:02 +0800

On 5/29/2026 1:11 AM, Leo Yan wrote:
> On Thu, May 21, 2026 at 08:16:29PM +0800, Yingchao Deng wrote:
>
> [...]
>
>> Qualcomm implements an extended variant of the ARM CoreSight CTI with a
>> different register layout and vendor-specific behavior. While the
>> programming model remains largely compatible, the register offsets differ
>> from the standard ARM CTI and require explicit handling.
> I cannot apply this patch successfuly. Please rebase on the latest
> coresight-next branch.
>
>> @@ -726,6 +734,22 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
>>   
>>   	raw_spin_lock_init(&drvdata->spinlock);
>>   
>> +	devarch = readl_relaxed(drvdata->base + CORESIGHT_DEVARCH);
>> +	if (CTI_DEVARCH_ARCHITECT(devarch) == ARCHITECT_QCOM) {
>> +		drvdata->is_qcom_cti = true;
>> +		/*
>> +		 * QCOM CTI does not implement Claimtag functionality as
>> +		 * per CoreSight specification, but its CLAIMSET register
>> +		 * is incorrectly initialized to 0xF. This can mislead
>> +		 * tools or drivers into thinking the component is claimed.
>> +		 *
>> +		 * Reset CLAIMSET to 0 to reflect that no claims are active.
>> +		 */
>> +		CS_UNLOCK(drvdata->base);
>> +		writel_relaxed(0, drvdata->base + CORESIGHT_CLAIMSET);
>> +		CS_LOCK(drvdata->base);
> Sorry I missed this piece before.
>
> Can you move this quirk into firmware? I don't think the CTI driver
> should clear the external claim bit as this totally break the protocol
> defined in PSCI. A clean way would clear the bits in firmware and then
> CTI driver can use the CLAIM registers.
>
> Or, another option is to create several helpers to bypass claim
> operations for Qcom CTI:
>
>    static void cti_clear_self_claim_tag(cti_drvdata *drvdata,
>                                        struct csdev_access *csa)
>    {
>        if (drvdata->is_qcom_cti)
>            return;
>
>        coresight_clear_self_claim_tag(csa);
>    }
>
>    static int cti_claim_device(cti_drvdata *drvdata)
>    {
>        if (drvdata->is_qcom_cti)
>            return 0;
>
>        return coresight_claim_device(drvdata->csdev);
>    }
>
>    static void cti_unclaim_device_unlocked(cti_drvdata *drvdata)
>    {
>        if (drvdata->is_qcom_cti)
>            return;
>
>        return coresight_disclaim_device_unlocked(drvdata->csdev);
>    }
>
> Otherwise, this patch is fine for me.
>
> Thanks,
> Leo
Thanks for the suggestion.

Moving this to firmware would be ideal, but in our case this behavior
comes from the hardware design and affects multiple platforms, so it is
not something we can easily address in firmware.
I will go with the helper bypass approach.

Thanks,
Yingchao