]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sparc64: Fix bit twiddling in sparc_pmu_enable_event().
authorDavid S. Miller <davem@davemloft.net>
Tue, 16 Oct 2012 20:05:25 +0000 (13:05 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 30 Oct 2012 23:26:31 +0000 (23:26 +0000)
[ Upstream commit e793d8c6740f8fe704fa216e95685f4d92c4c4b9 ]

There was a serious disconnect in the logic happening in
sparc_pmu_disable_event() vs. sparc_pmu_enable_event().

Event disable is implemented by programming a NOP event into the PCR.

However, event enable was not reversing this operation.  Instead, it
was setting the User/Priv/Hypervisor trace enable bits.

That's not sparc_pmu_enable_event()'s job, that's what
sparc_pmu_enable() and sparc_pmu_disable() do .

The intent of sparc_pmu_enable_event() is clear, since it first clear
out the event type encoding field.  So fix this by OR'ing in the event
encoding rather than the trace enable bits.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/sparc/kernel/perf_event.c

index 5331ae1774727bc0eb851e766a2698ec0c71407f..3c8f2202affecf20f9440f0a573fe48a52d5944d 100644 (file)
@@ -555,11 +555,13 @@ static u64 nop_for_index(int idx)
 
 static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx)
 {
-       u64 val, mask = mask_for_index(idx);
+       u64 enc, val, mask = mask_for_index(idx);
+
+       enc = perf_event_get_enc(cpuc->events[idx]);
 
        val = cpuc->pcr;
        val &= ~mask;
-       val |= hwc->config;
+       val |= event_encoding(enc, idx);
        cpuc->pcr = val;
 
        pcr_ops->write(cpuc->pcr);