| 1 | --- a/arch/mips/Makefile |
| 2 | +++ b/arch/mips/Makefile |
| 3 | @@ -48,7 +48,9 @@ ifneq ($(SUBARCH),$(ARCH)) |
| 4 | endif |
| 5 | endif |
| 6 | |
| 7 | +ifndef CONFIG_PROFILING |
| 8 | cflags-y := -ffunction-sections |
| 9 | +endif |
| 10 | cflags-y += $(call cc-option, -mno-check-zero-division) |
| 11 | |
| 12 | ifdef CONFIG_32BIT |
| 13 | --- a/arch/mips/oprofile/op_model_mipsxx.c |
| 14 | +++ b/arch/mips/oprofile/op_model_mipsxx.c |
| 15 | @@ -298,6 +298,11 @@ static void reset_counters(void *arg) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | +static irqreturn_t mipsxx_perfcount_int(int irq, void *dev_id) |
| 20 | +{ |
| 21 | + return mipsxx_perfcount_handler(); |
| 22 | +} |
| 23 | + |
| 24 | static int __init mipsxx_init(void) |
| 25 | { |
| 26 | int counters; |
| 27 | @@ -374,6 +379,10 @@ static int __init mipsxx_init(void) |
| 28 | save_perf_irq = perf_irq; |
| 29 | perf_irq = mipsxx_perfcount_handler; |
| 30 | |
| 31 | + if (cp0_perfcount_irq >= 0) |
| 32 | + return request_irq(cp0_perfcount_irq, mipsxx_perfcount_int, |
| 33 | + IRQF_SHARED, "Perfcounter", save_perf_irq); |
| 34 | + |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | @@ -381,6 +390,9 @@ static void mipsxx_exit(void) |
| 39 | { |
| 40 | int counters = op_model_mipsxx_ops.num_counters; |
| 41 | |
| 42 | + if (cp0_perfcount_irq >= 0) |
| 43 | + free_irq(cp0_perfcount_irq, save_perf_irq); |
| 44 | + |
| 45 | counters = counters_per_cpu_to_total(counters); |
| 46 | on_each_cpu(reset_counters, (void *)(long)counters, 1); |
| 47 | |
| 48 | |