gitlab.arm.com will be in the maintainance mode on Wednesday June 29th 01:00 - 10:00 (UTC+1). Repositories is read only during the maintainance.

Commit 709af12d authored by Robin Murphy's avatar Robin Murphy
Browse files

perf/arm-cmn: DTC domain hacks



Try to discover the DTC domain assignment with a "see where the
rollover goes" contrivance. It sort of works...
Signed-off-by: Robin Murphy's avatarRobin Murphy <robin.murphy@arm.com>
parent 5b99ee01
......@@ -1859,6 +1859,52 @@ static int arm_cmn_init_irqs(struct arm_cmn *cmn)
return 0;
}
static void arm_cmn_do_something(void *data)
{
struct arm_cmn *cmn = data;
int i;
for (i = 0; i < cmn->num_xps; i++)
readq(cmn->xps[i].pmu_base + CMN_DTM_PMU_CONFIG);
}
/*
* On CMN-600, the DTM->DTC relationship is not discoverable. However, that's
* not to say it isn't _visible_, if only there was a way to reliably trigger
* overflow from a given DTM.
*/
static void arm_cmn_scan_dtms(struct arm_cmn *cmn)
{
struct arm_cmn_node *xp = cmn->xps;
int i, j;
for (i = 0; i < cmn->num_xps; i++, xp++) {
if (!(xp->dtc & (xp->dtc - 1)))
continue;
writel_relaxed(0, cmn->dtc[0].base + CMN_DT_PMCR);
for (j = 0; j < cmn->num_dtcs; j++)
writel_relaxed(0, cmn->dtc[j].base + CMN_DT_PMEVCNT(0));
/* All 4 XP events paired with DTC counter 0 */
writeq_relaxed(0x07060504000000f1ULL, xp->pmu_base + CMN_DTM_PMU_CONFIG);
/* All DTM counters primed to roll over */
writeq_relaxed(~0ULL, xp->pmu_base + CMN_DTM_PMEVCNT);
/* REQ TX flit valid event for each grid direction */
writel_relaxed(0x0d090501, xp->pmu_base + CMN_PMU_EVENT_SEL);
writel_relaxed(CMN_DT_PMCR_PMU_EN, cmn->dtc[0].base + CMN_DT_PMCR);
/* Throw some traffic around and hope... */
on_each_cpu(arm_cmn_do_something, cmn, 1);
writeq_relaxed(0, xp->pmu_base + CMN_DTM_PMU_CONFIG);
for (j = 0; j < cmn->num_dtcs; j++)
if (readl_relaxed(cmn->dtc[j].base + CMN_DT_PMEVCNT(0)))
xp->dtc = 1 << j;
}
}
static void arm_cmn_init_dtm(struct arm_cmn_dtm *dtm, struct arm_cmn_node *xp, int idx)
{
int i;
......@@ -1945,6 +1991,8 @@ static int arm_cmn_init_dtcs(struct arm_cmn *cmn)
writel_relaxed(CMN_DT_DTC_CTL_DT_EN, cmn->dtc[0].base + CMN_DT_DTC_CTL);
arm_cmn_scan_dtms(cmn);
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment