Re: [PATCH 5/7] coresight: Clear self hosted claim tag on probe
From: Leo Yan
Date: Mon Mar 17 2025 - 14:10:01 EST
On Mon, Mar 17, 2025 at 03:05:41PM +0000, James Clark wrote:
[...]
> > > /*
> > > - * coresight_disclaim_device_unlocked : Clear the claim tag for the device.
> > > + * Clear the claim tag for the device.
> > > + * Returns an error if the device wasn't already claimed.
> > > + */
> > > +int coresight_reset_claim(struct csdev_access *csa)
> > > +{
> > > + int ret;
> > > +
> > > + CS_UNLOCK(csa->base);
> > > + ret = coresight_reset_claim_unlocked(csa);
> > > + CS_LOCK(csa->base);
> > > + return ret;
> > > +}
> > > +EXPORT_SYMBOL_GPL(coresight_reset_claim);
> >
> > Maybe my question is overlapping with Mike's comment.
> >
> > Callers never check the return values from coresight_reset_claim(). I am
>
> I can remove the return value if it's confusing. The thought process was
> probably that it could be useful somewhere in the future, and
> coresight_reset_claim_unlocked() returns something anyway so might as well
> pass it up.
>
> > wandering if coresight_reset_claim() can directly call
> > coresight_clear_self_claim_tag() for _trying_ to clear self-host tag in
> > probe phase. Any self claim tag issues will be deferred to detect until
> > enable the component.
> >
>
> Maybe, the spec does a read before setting which I assumed should be done
> for clearing as well.
If you mean PSCI doc, the flow for claiming tag is a handshake between
self-host software and external debugger, this is why a read is
required.
For a cleaning up, it is not about syncing with external debugger. And
writing bit 0 to TRCCLAIMCLR will not impact external debugger. So I
don't think a read prior to cleaning self claim tag is needed.
> As in to not touch anything if it's in use externally.
> It doesn't specifically describe any clearing sequence, but if we assume
> it's ok to blindly clear self hosted flag even when it's in use then yes we
> can directly call coresight_clear_self_claim_tag().
As a result, directly calling coresight_clear_self_claim_tag() works
for me.
Thanks,
Leo