~ubuntu-branches/ubuntu/precise/linux-linaro-u8500/precise

« back to all changes in this revision

Viewing changes to arch/arm/kernel/perf_event.c

  • Committer: Bazaar Package Importer
  • Author(s): John Rigby, Upstream Fixes, Andy Green, John Rigby
  • Date: 2011-04-14 12:16:06 UTC
  • Revision ID: james.westby@ubuntu.com-20110414121606-b77podkyqgr2oix7
Tags: 2.6.38-1002.3
[ Upstream Fixes ]

* MUSB: shutdown: Make sure block is awake before doing shutdown
  - LP: #745737
* Fixed gpio polarity of gpio USB-phy reset.
  - LP: #747639

[ Andy Green ]

* LINARO: SAUCE: disable CONFIG_OMAP_RESET_CLOCKS
  - LP: #752900

[ John Rigby ]

* Rebase to new upstreams:
  Linux v2.6.38.1
  linaro-linux-2.6.38-upstream-29Mar2011
  Ubuntu-2.6.38-7.35
* SAUCE: OMAP4: clock: wait for module to become accessible on
  a clk enable
  - LP: #745737
* Rebase to new upstreams:
  Linux v2.6.38.2
  linaro-linux-2.6.38-upstream-5Apr2011
  Ubuntu-2.6.38-8.41
  - LP: #732842
* Update configs for device tree, dvfs and lttng
* LINARO: add building of dtb's
* LINARO: SAUCE: Disable lowest operating freqs on omap34xx
  - LP: #732912

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        void            (*write_counter)(int idx, u32 val);
80
80
        void            (*start)(void);
81
81
        void            (*stop)(void);
 
82
        void            (*reset)(void *);
82
83
        const unsigned  (*cache_map)[PERF_COUNT_HW_CACHE_MAX]
83
84
                                    [PERF_COUNT_HW_CACHE_OP_MAX]
84
85
                                    [PERF_COUNT_HW_CACHE_RESULT_MAX];
204
205
static u64
205
206
armpmu_event_update(struct perf_event *event,
206
207
                    struct hw_perf_event *hwc,
207
 
                    int idx)
 
208
                    int idx, int overflow)
208
209
{
209
 
        int shift = 64 - 32;
210
 
        s64 prev_raw_count, new_raw_count;
211
 
        u64 delta;
 
210
        u64 delta, prev_raw_count, new_raw_count;
212
211
 
213
212
again:
214
213
        prev_raw_count = local64_read(&hwc->prev_count);
218
217
                             new_raw_count) != prev_raw_count)
219
218
                goto again;
220
219
 
221
 
        delta = (new_raw_count << shift) - (prev_raw_count << shift);
222
 
        delta >>= shift;
 
220
        new_raw_count &= armpmu->max_period;
 
221
        prev_raw_count &= armpmu->max_period;
 
222
 
 
223
        if (overflow)
 
224
                delta = armpmu->max_period - prev_raw_count + new_raw_count + 1;
 
225
        else
 
226
                delta = new_raw_count - prev_raw_count;
223
227
 
224
228
        local64_add(delta, &event->count);
225
229
        local64_sub(delta, &hwc->period_left);
236
240
        if (hwc->idx < 0)
237
241
                return;
238
242
 
239
 
        armpmu_event_update(event, hwc, hwc->idx);
 
243
        armpmu_event_update(event, hwc, hwc->idx, 0);
240
244
}
241
245
 
242
246
static void
254
258
        if (!(hwc->state & PERF_HES_STOPPED)) {
255
259
                armpmu->disable(hwc, hwc->idx);
256
260
                barrier(); /* why? */
257
 
                armpmu_event_update(event, hwc, hwc->idx);
 
261
                armpmu_event_update(event, hwc, hwc->idx, 0);
258
262
                hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;
259
263
        }
260
264
}
624
628
#include "perf_event_v6.c"
625
629
#include "perf_event_v7.c"
626
630
 
 
631
/*
 
632
 * Ensure the PMU has sane values out of reset.
 
633
 * This requires SMP to be available, so exists as a separate initcall.
 
634
 */
 
635
static int __init
 
636
armpmu_reset(void)
 
637
{
 
638
        if (armpmu && armpmu->reset)
 
639
                return on_each_cpu(armpmu->reset, NULL, 1);
 
640
        return 0;
 
641
}
 
642
arch_initcall(armpmu_reset);
 
643
 
627
644
static int __init
628
645
init_hw_perf_events(void)
629
646
{