Lines Matching refs:telemetry

63 	struct adf_telemetry *telemetry;  in adf_tl_alloc_mem()  local
68 telemetry = kzalloc_node(sizeof(*telemetry), GFP_KERNEL, node); in adf_tl_alloc_mem()
69 if (!telemetry) in adf_tl_alloc_mem()
72 telemetry->rp_num_indexes = kmalloc_array(tl_data->max_rp, in adf_tl_alloc_mem()
73 sizeof(*telemetry->rp_num_indexes), in adf_tl_alloc_mem()
75 if (!telemetry->rp_num_indexes) in adf_tl_alloc_mem()
78 telemetry->regs_hist_buff = kmalloc_array(tl_data->num_hbuff, in adf_tl_alloc_mem()
79 sizeof(*telemetry->regs_hist_buff), in adf_tl_alloc_mem()
81 if (!telemetry->regs_hist_buff) in adf_tl_alloc_mem()
84 telemetry->regs_data = dma_alloc_coherent(dev, regs_sz, in adf_tl_alloc_mem()
85 &telemetry->regs_data_p, in adf_tl_alloc_mem()
87 if (!telemetry->regs_data) in adf_tl_alloc_mem()
95 telemetry->regs_hist_buff[i] = tl_data_regs; in adf_tl_alloc_mem()
98 accel_dev->telemetry = telemetry; in adf_tl_alloc_mem()
103 dma_free_coherent(dev, regs_sz, telemetry->regs_data, in adf_tl_alloc_mem()
104 telemetry->regs_data_p); in adf_tl_alloc_mem()
107 kfree(telemetry->regs_hist_buff[i]); in adf_tl_alloc_mem()
110 kfree(telemetry->regs_hist_buff); in adf_tl_alloc_mem()
112 kfree(telemetry->rp_num_indexes); in adf_tl_alloc_mem()
114 kfree(telemetry); in adf_tl_alloc_mem()
122 struct adf_telemetry *telemetry = accel_dev->telemetry; in adf_tl_free_mem() local
128 kfree(telemetry->regs_hist_buff[i]); in adf_tl_free_mem()
130 dma_free_coherent(dev, regs_sz, telemetry->regs_data, in adf_tl_free_mem()
131 telemetry->regs_data_p); in adf_tl_free_mem()
133 kfree(telemetry->regs_hist_buff); in adf_tl_free_mem()
134 kfree(telemetry->rp_num_indexes); in adf_tl_free_mem()
135 kfree(telemetry); in adf_tl_free_mem()
136 accel_dev->telemetry = NULL; in adf_tl_free_mem()
144 static void snapshot_regs(struct adf_telemetry *telemetry, size_t size) in snapshot_regs() argument
146 void *dst = telemetry->regs_hist_buff[telemetry->hb_num]; in snapshot_regs()
147 void *src = telemetry->regs_data; in snapshot_regs()
155 struct adf_telemetry *telemetry; in tl_work_handler() local
163 telemetry = container_of(delayed_work, struct adf_telemetry, work_ctx); in tl_work_handler()
164 tl_data = &GET_TL_DATA(telemetry->accel_dev); in tl_work_handler()
165 regs_data = telemetry->regs_data; in tl_work_handler()
170 if (!atomic_read(&telemetry->state)) { in tl_work_handler()
171 cancel_delayed_work_sync(&telemetry->work_ctx); in tl_work_handler()
177 if (msg_cnt == telemetry->msg_cnt) in tl_work_handler()
180 mutex_lock(&telemetry->regs_hist_lock); in tl_work_handler()
182 snapshot_regs(telemetry, layout_sz); in tl_work_handler()
187 snapshot_regs(telemetry, layout_sz); in tl_work_handler()
189 telemetry->msg_cnt = msg_cnt; in tl_work_handler()
190 telemetry->hb_num++; in tl_work_handler()
191 telemetry->hb_num %= telemetry->hbuffs; in tl_work_handler()
193 mutex_unlock(&telemetry->regs_hist_lock); in tl_work_handler()
196 adf_misc_wq_queue_delayed_work(&telemetry->work_ctx, get_next_timeout()); in tl_work_handler()
201 struct adf_telemetry *telemetry = accel_dev->telemetry; in adf_tl_halt() local
205 cancel_delayed_work_sync(&telemetry->work_ctx); in adf_tl_halt()
206 atomic_set(&telemetry->state, 0); in adf_tl_halt()
218 struct adf_telemetry *telemetry = accel_dev->telemetry; in adf_tl_run() local
223 ret = adf_send_admin_tl_start(accel_dev, telemetry->regs_data_p, in adf_tl_run()
224 layout_sz, telemetry->rp_num_indexes, in adf_tl_run()
225 &telemetry->slice_cnt); in adf_tl_run()
231 ret = validate_tl_slice_counters(&telemetry->slice_cnt, tl_data->max_sl_cnt); in adf_tl_run()
238 telemetry->hbuffs = state; in adf_tl_run()
239 atomic_set(&telemetry->state, state); in adf_tl_run()
241 adf_misc_wq_queue_delayed_work(&telemetry->work_ctx, get_next_timeout()); in adf_tl_run()
251 struct adf_telemetry *telemetry; in adf_tl_init() local
265 telemetry = accel_dev->telemetry; in adf_tl_init()
266 telemetry->accel_dev = accel_dev; in adf_tl_init()
268 mutex_init(&telemetry->wr_lock); in adf_tl_init()
269 mutex_init(&telemetry->regs_hist_lock); in adf_tl_init()
270 INIT_DELAYED_WORK(&telemetry->work_ctx, tl_work_handler); in adf_tl_init()
273 telemetry->rp_num_indexes[i] = ADF_TL_RP_REGS_DISABLED; in adf_tl_init()
282 if (!accel_dev->telemetry) in adf_tl_start()
296 if (!accel_dev->telemetry) in adf_tl_stop()
299 if (atomic_read(&accel_dev->telemetry->state)) in adf_tl_stop()
305 if (!accel_dev->telemetry) in adf_tl_shutdown()