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

Commit af62b7fa authored by Rohit Gupta's avatar Rohit Gupta
Browse files

perf: Allow multiple cycle count requests



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

Change-Id: Icc3a7a5859ef60ab56ffcb1339e3734c3885ede2
Signed-off-by: default avatarRohit Gupta <rohgup@codeaurora.org>
parent c5a15ee4
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -1224,11 +1224,9 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc,
	int idx;
	unsigned long evtype = event->config_base & ARMV8_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_CLOCK_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;
	}