aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/perf
diff options
context:
space:
mode:
authorShaokun Zhang <zhangshaokun@hisilicon.com>2018-07-19 07:26:40 -0400
committerWill Deacon <will.deacon@arm.com>2018-07-24 10:40:43 -0400
commit06060ea7fb5b6b9b4c3251e0dcabbcca8ad91674 (patch)
tree7fa83608580ccdbd9602095a246d0a5b07c737e3 /drivers/perf
parentc13207905340d85eaddd85b6d2868218f324b180 (diff)
drivers/perf: hisi: update the sccl_id/ccl_id when MT is supported
MT bit in MPIDR_EL1 is now supported in certain HiSilicon platforms, so the mapping between sccl_id/ccl_id and affinity level needs to be updated from the generic encoding we originally used. Cc: John Garry <john.garry@huawei.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com> [will: fixed comment] Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/perf')
-rw-r--r--drivers/perf/hisilicon/hisi_uncore_pmu.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c
index 44df61397a38..9efd2413240c 100644
--- a/drivers/perf/hisilicon/hisi_uncore_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c
@@ -350,19 +350,21 @@ void hisi_uncore_pmu_disable(struct pmu *pmu)
350 350
351/* 351/*
352 * Read Super CPU cluster and CPU cluster ID from MPIDR_EL1. 352 * Read Super CPU cluster and CPU cluster ID from MPIDR_EL1.
353 * If multi-threading is supported, SCCL_ID is in MPIDR[aff3] and CCL_ID 353 * If multi-threading is supported, CCL_ID is the low 3-bits in MPIDR[Aff2]
354 * is in MPIDR[aff2]; if not, SCCL_ID is in MPIDR[aff2] and CCL_ID is 354 * and SCCL_ID is the upper 5-bits of Aff2 field; if not, SCCL_ID
355 * in MPIDR[aff1]. If this changes in future, this shall be updated. 355 * is in MPIDR[Aff2] and CCL_ID is in MPIDR[Aff1].
356 */ 356 */
357static void hisi_read_sccl_and_ccl_id(int *sccl_id, int *ccl_id) 357static void hisi_read_sccl_and_ccl_id(int *sccl_id, int *ccl_id)
358{ 358{
359 u64 mpidr = read_cpuid_mpidr(); 359 u64 mpidr = read_cpuid_mpidr();
360 360
361 if (mpidr & MPIDR_MT_BITMASK) { 361 if (mpidr & MPIDR_MT_BITMASK) {
362 int aff2 = MPIDR_AFFINITY_LEVEL(mpidr, 2);
363
362 if (sccl_id) 364 if (sccl_id)
363 *sccl_id = MPIDR_AFFINITY_LEVEL(mpidr, 3); 365 *sccl_id = aff2 >> 3;
364 if (ccl_id) 366 if (ccl_id)
365 *ccl_id = MPIDR_AFFINITY_LEVEL(mpidr, 2); 367 *ccl_id = aff2 & 0x7;
366 } else { 368 } else {
367 if (sccl_id) 369 if (sccl_id)
368 *sccl_id = MPIDR_AFFINITY_LEVEL(mpidr, 2); 370 *sccl_id = MPIDR_AFFINITY_LEVEL(mpidr, 2);