Commit 7cd63686 authored by James Clark's avatar James Clark Committed by Suzuki K Poulose
Browse files

coresight: Clear self hosted claim tag on probe



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.

Reviewed-by: default avatarLeo Yan <leo.yan@arm.com>
Reviewed-by: default avatarYeoreum Yun <yeoreum.yun@arm.com>
Signed-off-by: default avatarJames Clark <james.clark@linaro.org>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250325-james-coresight-claim-tags-v4-5-dfbd3822b2e5@linaro.org
parent a1b0e77c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -567,6 +567,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);
+2 −0
Original line number Diff line number Diff line
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -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);
}
Loading