diff options
Diffstat (limited to 'arch/powerpc/oprofile')
-rw-r--r-- | arch/powerpc/oprofile/op_model_cell.c | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c index 8d4a9586464d..e08e1d7b3dc5 100644 --- a/arch/powerpc/oprofile/op_model_cell.c +++ b/arch/powerpc/oprofile/op_model_cell.c | |||
@@ -39,6 +39,9 @@ | |||
39 | #include "../platforms/cell/interrupt.h" | 39 | #include "../platforms/cell/interrupt.h" |
40 | 40 | ||
41 | #define PPU_CYCLES_EVENT_NUM 1 /* event number for CYCLES */ | 41 | #define PPU_CYCLES_EVENT_NUM 1 /* event number for CYCLES */ |
42 | #define PPU_CYCLES_GRP_NUM 1 /* special group number for identifying | ||
43 | * PPU_CYCLES event | ||
44 | */ | ||
42 | #define CBE_COUNT_ALL_CYCLES 0x42800000 /* PPU cycle event specifier */ | 45 | #define CBE_COUNT_ALL_CYCLES 0x42800000 /* PPU cycle event specifier */ |
43 | 46 | ||
44 | #define NUM_THREADS 2 /* number of physical threads in | 47 | #define NUM_THREADS 2 /* number of physical threads in |
@@ -62,7 +65,7 @@ struct pmc_cntrl_data { | |||
62 | struct pm_signal { | 65 | struct pm_signal { |
63 | u16 cpu; /* Processor to modify */ | 66 | u16 cpu; /* Processor to modify */ |
64 | u16 sub_unit; /* hw subunit this applies to (if applicable) */ | 67 | u16 sub_unit; /* hw subunit this applies to (if applicable) */ |
65 | u16 signal_group; /* Signal Group to Enable/Disable */ | 68 | short int signal_group; /* Signal Group to Enable/Disable */ |
66 | u8 bus_word; /* Enable/Disable on this Trace/Trigger/Event | 69 | u8 bus_word; /* Enable/Disable on this Trace/Trigger/Event |
67 | * Bus Word(s) (bitmask) | 70 | * Bus Word(s) (bitmask) |
68 | */ | 71 | */ |
@@ -179,26 +182,40 @@ static void pm_rtas_reset_signals(u32 node) | |||
179 | static void pm_rtas_activate_signals(u32 node, u32 count) | 182 | static void pm_rtas_activate_signals(u32 node, u32 count) |
180 | { | 183 | { |
181 | int ret; | 184 | int ret; |
182 | int j; | 185 | int i, j; |
183 | struct pm_signal pm_signal_local[NR_PHYS_CTRS]; | 186 | struct pm_signal pm_signal_local[NR_PHYS_CTRS]; |
184 | 187 | ||
188 | /* There is no debug setup required for the cycles event. | ||
189 | * Note that only events in the same group can be used. | ||
190 | * Otherwise, there will be conflicts in correctly routing | ||
191 | * the signals on the debug bus. It is the responsiblity | ||
192 | * of the OProfile user tool to check the events are in | ||
193 | * the same group. | ||
194 | */ | ||
195 | i = 0; | ||
185 | for (j = 0; j < count; j++) { | 196 | for (j = 0; j < count; j++) { |
186 | /* fw expects physical cpu # */ | 197 | if (pm_signal[j].signal_group != PPU_CYCLES_GRP_NUM) { |
187 | pm_signal_local[j].cpu = node; | 198 | |
188 | pm_signal_local[j].signal_group | 199 | /* fw expects physical cpu # */ |
189 | = pm_signal[j].signal_group; | 200 | pm_signal_local[i].cpu = node; |
190 | pm_signal_local[j].bus_word = pm_signal[j].bus_word; | 201 | pm_signal_local[i].signal_group |
191 | pm_signal_local[j].sub_unit = pm_signal[j].sub_unit; | 202 | = pm_signal[j].signal_group; |
192 | pm_signal_local[j].bit = pm_signal[j].bit; | 203 | pm_signal_local[i].bus_word = pm_signal[j].bus_word; |
204 | pm_signal_local[i].sub_unit = pm_signal[j].sub_unit; | ||
205 | pm_signal_local[i].bit = pm_signal[j].bit; | ||
206 | i++; | ||
207 | } | ||
193 | } | 208 | } |
194 | 209 | ||
195 | ret = rtas_ibm_cbe_perftools(SUBFUNC_ACTIVATE, PASSTHRU_ENABLE, | 210 | if (i != 0) { |
196 | pm_signal_local, | 211 | ret = rtas_ibm_cbe_perftools(SUBFUNC_ACTIVATE, PASSTHRU_ENABLE, |
197 | count * sizeof(struct pm_signal)); | 212 | pm_signal_local, |
213 | i * sizeof(struct pm_signal)); | ||
198 | 214 | ||
199 | if (ret) | 215 | if (ret) |
200 | printk(KERN_WARNING "%s: rtas returned: %d\n", | 216 | printk(KERN_WARNING "%s: rtas returned: %d\n", |
201 | __FUNCTION__, ret); | 217 | __FUNCTION__, ret); |
218 | } | ||
202 | } | 219 | } |
203 | 220 | ||
204 | /* | 221 | /* |
@@ -215,7 +232,7 @@ static void set_pm_event(u32 ctr, int event, u32 unit_mask) | |||
215 | /* Special Event: Count all cpu cycles */ | 232 | /* Special Event: Count all cpu cycles */ |
216 | pm_regs.pm07_cntrl[ctr] = CBE_COUNT_ALL_CYCLES; | 233 | pm_regs.pm07_cntrl[ctr] = CBE_COUNT_ALL_CYCLES; |
217 | p = &(pm_signal[ctr]); | 234 | p = &(pm_signal[ctr]); |
218 | p->signal_group = 21; | 235 | p->signal_group = PPU_CYCLES_GRP_NUM; |
219 | p->bus_word = 1; | 236 | p->bus_word = 1; |
220 | p->sub_unit = 0; | 237 | p->sub_unit = 0; |
221 | p->bit = 0; | 238 | p->bit = 0; |