Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5970610d authored by Patrick Fay's avatar Patrick Fay
Browse files

perf: Allow multiple cycle count requests



Use existing avaialble PMU counters if there are multiple requests
for counting CPU cycles.

Change-Id: I26daeb0b2909ab68580eba29f2b8c7935938cf3e
Signed-off-by: default avatarPatrick Fay <pfay@codeaurora.org>
parent 436b4a5f
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -840,11 +840,9 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc,
	struct hw_perf_event *hwc = &event->hw;
	unsigned long evtype = hwc->config_base & ARMV8_PMU_EVTYPE_EVENT;

	/* Always place a cycle counter into the cycle counter. */
	/* Place the first cycle counter request into the cycle counter. */
	if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) {
		if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))
			return -EAGAIN;

		if (!test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))
			return ARMV8_IDX_CYCLE_COUNTER;
	}