arm-cci: Group writes to counter
authorSuzuki K Poulose <[email protected]>
Tue, 23 Feb 2016 10:49:45 +0000 (10:49 +0000)
committerWill Deacon <[email protected]>
Mon, 29 Feb 2016 23:23:16 +0000 (23:23 +0000)
Add a helper to group the writes to PMU counter, this will be
used to delay setting the event period to pmu::pmu_enable()

Cc: Punit Agrawal <[email protected]>
Acked-by: Olof Johansson <[email protected]>
Acked-by: Mark Rutland <[email protected]>
Signed-off-by: Suzuki K. Poulose <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
drivers/bus/arm-cci.c

index 5fb1c06e0020d8d20c03126c52ddfec63aa0cae1..6a76ac76fb8bb01484084a7e1df507ff765e66c7 100644 (file)
@@ -771,6 +771,21 @@ static void pmu_write_counter(struct perf_event *event, u32 value)
                pmu_write_register(cci_pmu, value, idx, CCI_PMU_CNTR);
 }
 
+static void __maybe_unused
+pmu_write_counters(struct cci_pmu *cci_pmu, unsigned long *mask)
+{
+       int i;
+       struct cci_pmu_hw_events *cci_hw = &cci_pmu->hw_events;
+
+       for_each_set_bit(i, mask, cci_pmu->num_cntrs) {
+               struct perf_event *event = cci_hw->events[i];
+
+               if (WARN_ON(!event))
+                       continue;
+               pmu_write_counter(event, local64_read(&event->hw.prev_count));
+       }
+}
+
 static u64 pmu_event_update(struct perf_event *event)
 {
        struct hw_perf_event *hwc = &event->hw;