Lines Matching +full:used +full:- +full:by +full:- +full:rtas
1 // SPDX-License-Identifier: GPL-2.0-or-later
22 #include <asm/cell-pmu.h>
31 #include <asm/rtas.h>
32 #include <asm/cell-regs.h>
66 * 2^32 - 1 - N.
68 #define NUM_INTERVAL_CYC 0xFFFFFFFF - 10
72 * This variable is used for SPU profiling and should ONLY be set
73 * at the beginning of cell_reg_setup; otherwise, it's read-only.
87 * ibm,cbe-perftools rtas parameters
100 * rtas call arguments
141 * The CELL profiling code makes rtas calls to setup the debug bus to
143 * a second rtas call to setup the hardware to capture the SPU PCs.
144 * The EIO error value is returned if the token lookups or the rtas
146 * error numbers. The probability of rtas related error is very low. But
147 * by returning EIO and printing additional information to dmsg the user
157 * 0 - even virtual cpus 0, 2, 4,...
158 * 1 - odd virtual cpus 1, 3, 5, ...
161 * of places. It works for now. -arnd
231 printk(KERN_WARNING "%s: rtas returned: %d\n", in pm_rtas_reset_signals()
243 * Note that only events in the same group can be used. in pm_rtas_activate_signals()
270 printk(KERN_WARNING "%s: rtas returned: %d\n", in pm_rtas_activate_signals()
272 return -EIO; in pm_rtas_activate_signals()
293 p->signal_group = PPU_CYCLES_GRP_NUM; in set_pm_event()
294 p->bus_word = 1; in set_pm_event()
295 p->sub_unit = 0; in set_pm_event()
296 p->bit = 0; in set_pm_event()
311 p->signal_group = event / 100; in set_pm_event()
312 p->bus_word = bus_word; in set_pm_event()
313 p->sub_unit = GET_SUB_UNIT(unit_mask); in set_pm_event()
331 signal_bit -= 32; in set_pm_event()
338 if ((bus_type == 0) && p->signal_group >= 60) in set_pm_event()
340 if ((bus_type == 1) && p->signal_group >= 50) in set_pm_event()
346 p->bit = signal_bit; in set_pm_event()
352 (bus_type << (30 - (2 * i))); in set_pm_event()
358 (i << (30 - (2 * j))); in set_pm_event()
436 * CPUs. The multiplexing of the performance counters is done by this
439 * The pmc_values used below is defined as 'per-cpu' but its use is
440 * more akin to 'per-node'. We need to store two sets of counter
441 * values per node -- one for the previous run and one for the next.
442 * The per-cpu[NR_PHYS_CTRS] gives us the storage we need. Each odd/even
443 * pair of per-cpu arrays is used for storing the previous and next
445 * NOTE: We use the per-cpu variable to improve cache performance.
565 * Each node will need to make the rtas call to start in cell_reg_setup_spu_cycles()
568 spu_rtas_token = rtas_token("ibm,cbe-spu-perftools"); in cell_reg_setup_spu_cycles()
572 "%s: rtas token ibm,cbe-spu-perftools unknown\n", in cell_reg_setup_spu_cycles()
574 return -EIO; in cell_reg_setup_spu_cycles()
691 * the rtas cbe-perftools call to setup and reset the debug bus. in cell_reg_setup_spu_events()
695 pm_rtas_token = rtas_token("ibm,cbe-perftools"); in cell_reg_setup_spu_events()
699 "%s: rtas token ibm,cbe-perftools unknown\n", in cell_reg_setup_spu_events()
701 return -EIO; in cell_reg_setup_spu_events()
705 * settings will be written per node by the in cell_reg_setup_spu_events()
712 * is not used. Bit 2 must be set to store SPU addresses. in cell_reg_setup_spu_events()
720 * Note, pm_signal[0] will be filled in by set_pm_event() call below. in cell_reg_setup_spu_events()
738 reset_value[0] = 0xFFFFFFFF - ctr[0].count; in cell_reg_setup_spu_events()
740 /* global, used by cell_cpu_setup */ in cell_reg_setup_spu_events()
763 return -EIO; in cell_reg_setup_ppu()
766 set_count_mode(sys->enable_kernel, sys->enable_user); in cell_reg_setup_ppu()
812 /* Using 32bit counters, reset max - count */ in cell_reg_setup_ppu()
813 reset_value[i] = 0xFFFFFFFF - ctr[i].count; in cell_reg_setup_ppu()
818 /* global, used by cell_cpu_setup */ in cell_reg_setup_ppu()
853 * the rtas cbe-perftools call to setup and reset the debug bus. in cell_reg_setup()
857 pm_rtas_token = rtas_token("ibm,cbe-perftools"); in cell_reg_setup()
861 "%s: rtas token ibm,cbe-perftools unknown\n", in cell_reg_setup()
863 return -EIO; in cell_reg_setup()
929 * The pm_rtas_activate_signals will return -EIO if the FW in cell_cpu_setup()
1001 * To avoid the time to compute the LFSR, a lookup table is used. The 24 bit
1006 * specifies N < 2^16, the LFSR value that is 2^16 from the end will be used.
1012 * 0 to 2^16-1 ---- 0
1013 * 2^16 to 2^16+2^19-1 2^12 1 to 128
1014 * 2^16+2^19 to 2^16+2^19+2^22-1 2^15 129 to 256
1015 * 2^16+2^19+2^22 to 2^24-1 2^18 257 to 302
1019 * 2^16+2^12, ... , 2^19-2^16, 2^19 and stored in the table at indicies
1034 * newlfsr0 = (((lfsr >> (size - 1 - 0)) & 1) ^
1035 * ((lfsr >> (size - 1 - 1)) & 1) ^
1036 * (((lfsr >> (size - 1 - 6)) & 1) ^
1037 * ((lfsr >> (size - 1 - 23)) & 1)));
1040 * lfsr = lfsr | (newlfsr0 << (size - 1));
1060 else if (((n - V2_16) >> 19) == 0) in calculate_lfsr()
1061 index = ((n - V2_16) >> 12) + 1; in calculate_lfsr()
1062 else if (((n - V2_16 - V2_19) >> 22) == 0) in calculate_lfsr()
1063 index = ((n - V2_16 - V2_19) >> 15 ) + 1 + 128; in calculate_lfsr()
1064 else if (((n - V2_16 - V2_19 - V2_22) >> 24) == 0) in calculate_lfsr()
1065 index = ((n - V2_16 - V2_19 - V2_22) >> 18 ) + 1 + 256; in calculate_lfsr()
1067 index = ENTRIES-1; in calculate_lfsr()
1071 index = ENTRIES-1; in calculate_lfsr()
1082 * Set up the rtas call to configure the debug bus to in pm_rtas_activate_spu_profiling()
1101 printk(KERN_WARNING "%s: rtas returned: %d\n", in pm_rtas_activate_spu_profiling()
1103 return -EIO; in pm_rtas_activate_spu_profiling()
1115 if ((val == CPUFREQ_PRECHANGE && frq->old < frq->new) || in oprof_cpufreq_notify()
1116 (val == CPUFREQ_POSTCHANGE && frq->old > frq->new)) in oprof_cpufreq_notify()
1117 set_spu_profiling_frequency(frq->new, spu_cycle_reset); in oprof_cpufreq_notify()
1153 * 2 - activate SPU tracing, in cell_global_stop_spu_cycles()
1154 * 3 - deactivate in cell_global_stop_spu_cycles()
1164 "%s: rtas call ibm,cbe-spu-perftools " \ in cell_global_stop_spu_cycles()
1250 /* The SPU profiling uses time-based profiling based on in cell_global_start_spu_cycles()
1274 * Setup SPU cycle-based profiling. in cell_global_start_spu_cycles()
1282 lfsr_value = calculate_lfsr(MAX_SPU_COUNT-1); in cell_global_start_spu_cycles()
1303 subfunc = 2; /* 2 - activate SPU tracing, 3 - deactivate */ in cell_global_start_spu_cycles()
1311 "%s: rtas call ibm,cbe-spu-perftools failed, " \ in cell_global_start_spu_cycles()
1313 rtas_error = -EIO; in cell_global_start_spu_cycles()
1341 * counter into the trace array. The occurrence mode is used to in cell_global_start_spu_events()
1345 * debug bus. The occurrence data in the trace buffer is not used. in cell_global_start_spu_events()
1358 * Setup SPU event-based profiling. in cell_global_start_spu_events()
1433 * the above for-loop. in cell_global_start_ppu()
1470 * is cleared, interrupts are cleared, the counter is reset to max - N.
1471 * A kernel timer is used to periodically call the routine spu_evnt_swap()
1511 /* only have one perf cntr being used, cntr 0 */ in cell_handle_interrupt_spu()
1533 * HW trace buffer is used for the SPU PC storage in cell_handle_interrupt_spu()
1541 * - unfortunately, the valid bits don't seem to work in cell_handle_interrupt_spu()
1552 * by 16 -2 bits */ in cell_handle_interrupt_spu()
1571 /* The counters were frozen by the interrupt. in cell_handle_interrupt_spu()
1578 /* clear the trace buffer, re-enable writes to trace buff */ in cell_handle_interrupt_spu()
1633 pc = regs->nip; in cell_handle_interrupt_ppu()
1645 * The counters were frozen by the interrupt. in cell_handle_interrupt_ppu()
1650 * use the virt_cntr_inter_mask to re-enable the interrupts. in cell_handle_interrupt_ppu()