diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/oprofile/op_model_cell.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c index 35141a8bc3d9..25a4ec2514a3 100644 --- a/arch/powerpc/oprofile/op_model_cell.c +++ b/arch/powerpc/oprofile/op_model_cell.c | |||
@@ -582,6 +582,13 @@ static int cell_reg_setup(struct op_counter_config *ctr, | |||
582 | 582 | ||
583 | num_counters = num_ctrs; | 583 | num_counters = num_ctrs; |
584 | 584 | ||
585 | if (unlikely(num_ctrs > NR_PHYS_CTRS)) { | ||
586 | printk(KERN_ERR | ||
587 | "%s: Oprofile, number of specified events " \ | ||
588 | "exceeds number of physical counters\n", | ||
589 | __func__); | ||
590 | return -EIO; | ||
591 | } | ||
585 | pm_regs.group_control = 0; | 592 | pm_regs.group_control = 0; |
586 | pm_regs.debug_bus_control = 0; | 593 | pm_regs.debug_bus_control = 0; |
587 | 594 | ||
@@ -830,13 +837,13 @@ static int calculate_lfsr(int n) | |||
830 | static int pm_rtas_activate_spu_profiling(u32 node) | 837 | static int pm_rtas_activate_spu_profiling(u32 node) |
831 | { | 838 | { |
832 | int ret, i; | 839 | int ret, i; |
833 | struct pm_signal pm_signal_local[NR_PHYS_CTRS]; | 840 | struct pm_signal pm_signal_local[NUM_SPUS_PER_NODE]; |
834 | 841 | ||
835 | /* | 842 | /* |
836 | * Set up the rtas call to configure the debug bus to | 843 | * Set up the rtas call to configure the debug bus to |
837 | * route the SPU PCs. Setup the pm_signal for each SPU | 844 | * route the SPU PCs. Setup the pm_signal for each SPU |
838 | */ | 845 | */ |
839 | for (i = 0; i < NUM_SPUS_PER_NODE; i++) { | 846 | for (i = 0; i < ARRAY_SIZE(pm_signal_local); i++) { |
840 | pm_signal_local[i].cpu = node; | 847 | pm_signal_local[i].cpu = node; |
841 | pm_signal_local[i].signal_group = 41; | 848 | pm_signal_local[i].signal_group = 41; |
842 | /* spu i on word (i/2) */ | 849 | /* spu i on word (i/2) */ |
@@ -848,7 +855,7 @@ static int pm_rtas_activate_spu_profiling(u32 node) | |||
848 | 855 | ||
849 | ret = rtas_ibm_cbe_perftools(SUBFUNC_ACTIVATE, | 856 | ret = rtas_ibm_cbe_perftools(SUBFUNC_ACTIVATE, |
850 | PASSTHRU_ENABLE, pm_signal_local, | 857 | PASSTHRU_ENABLE, pm_signal_local, |
851 | (NUM_SPUS_PER_NODE | 858 | (ARRAY_SIZE(pm_signal_local) |
852 | * sizeof(struct pm_signal))); | 859 | * sizeof(struct pm_signal))); |
853 | 860 | ||
854 | if (unlikely(ret)) { | 861 | if (unlikely(ret)) { |