• Home
  • Raw
  • Download

Lines Matching refs:dtl

35 struct dtl {  struct
43 static DEFINE_PER_CPU(struct dtl, cpu_dtl); argument
103 static int dtl_start(struct dtl *dtl) in dtl_start() argument
105 struct dtl_ring *dtlr = &per_cpu(dtl_rings, dtl->cpu); in dtl_start()
107 dtlr->buf = dtl->buf; in dtl_start()
108 dtlr->buf_end = dtl->buf + dtl->buf_entries; in dtl_start()
113 dtlr->write_ptr = dtl->buf; in dtl_start()
116 dtlr->saved_dtl_mask = lppaca_of(dtl->cpu).dtl_enable_mask; in dtl_start()
117 lppaca_of(dtl->cpu).dtl_enable_mask |= dtl_event_mask; in dtl_start()
124 static void dtl_stop(struct dtl *dtl) in dtl_stop() argument
126 struct dtl_ring *dtlr = &per_cpu(dtl_rings, dtl->cpu); in dtl_stop()
134 lppaca_of(dtl->cpu).dtl_enable_mask = dtlr->saved_dtl_mask; in dtl_stop()
140 static u64 dtl_current_index(struct dtl *dtl) in dtl_current_index() argument
142 return per_cpu(dtl_rings, dtl->cpu).write_index; in dtl_current_index()
147 static int dtl_start(struct dtl *dtl) in dtl_start() argument
154 ((u32 *)dtl->buf)[1] = DISPATCH_LOG_BYTES; in dtl_start()
156 hwcpu = get_hard_smp_processor_id(dtl->cpu); in dtl_start()
157 addr = __pa(dtl->buf); in dtl_start()
161 "failed with %d\n", __func__, dtl->cpu, hwcpu, ret); in dtl_start()
166 lppaca_of(dtl->cpu).dtl_idx = 0; in dtl_start()
173 lppaca_of(dtl->cpu).dtl_enable_mask = dtl_event_mask; in dtl_start()
178 static void dtl_stop(struct dtl *dtl) in dtl_stop() argument
180 int hwcpu = get_hard_smp_processor_id(dtl->cpu); in dtl_stop()
182 lppaca_of(dtl->cpu).dtl_enable_mask = 0x0; in dtl_stop()
187 static u64 dtl_current_index(struct dtl *dtl) in dtl_current_index() argument
189 return lppaca_of(dtl->cpu).dtl_idx; in dtl_current_index()
193 static int dtl_enable(struct dtl *dtl) in dtl_enable() argument
203 if (dtl->buf) in dtl_enable()
207 buf = kmem_cache_alloc_node(dtl_cache, GFP_KERNEL, cpu_to_node(dtl->cpu)); in dtl_enable()
210 __func__, dtl->cpu); in dtl_enable()
214 spin_lock(&dtl->lock); in dtl_enable()
216 if (!dtl->buf) { in dtl_enable()
218 dtl->buf_entries = n_entries; in dtl_enable()
219 dtl->buf = buf; in dtl_enable()
220 dtl->last_idx = 0; in dtl_enable()
221 rc = dtl_start(dtl); in dtl_enable()
223 dtl->buf = NULL; in dtl_enable()
225 spin_unlock(&dtl->lock); in dtl_enable()
232 static void dtl_disable(struct dtl *dtl) in dtl_disable() argument
234 spin_lock(&dtl->lock); in dtl_disable()
235 dtl_stop(dtl); in dtl_disable()
236 kmem_cache_free(dtl_cache, dtl->buf); in dtl_disable()
237 dtl->buf = NULL; in dtl_disable()
238 dtl->buf_entries = 0; in dtl_disable()
239 spin_unlock(&dtl->lock); in dtl_disable()
246 struct dtl *dtl = inode->i_private; in dtl_file_open() local
249 rc = dtl_enable(dtl); in dtl_file_open()
253 filp->private_data = dtl; in dtl_file_open()
259 struct dtl *dtl = inode->i_private; in dtl_file_release() local
260 dtl_disable(dtl); in dtl_file_release()
268 struct dtl *dtl; in dtl_file_read() local
274 dtl = filp->private_data; in dtl_file_read()
282 spin_lock(&dtl->lock); in dtl_file_read()
284 cur_idx = dtl_current_index(dtl); in dtl_file_read()
285 last_idx = dtl->last_idx; in dtl_file_read()
287 if (last_idx + dtl->buf_entries <= cur_idx) in dtl_file_read()
288 last_idx = cur_idx - dtl->buf_entries + 1; in dtl_file_read()
294 dtl->last_idx = last_idx + n_req; in dtl_file_read()
296 spin_unlock(&dtl->lock); in dtl_file_read()
301 i = last_idx % dtl->buf_entries; in dtl_file_read()
304 if (i + n_req > dtl->buf_entries) { in dtl_file_read()
305 read_size = dtl->buf_entries - i; in dtl_file_read()
307 rc = copy_to_user(buf, &dtl->buf[i], in dtl_file_read()
319 rc = copy_to_user(buf, &dtl->buf[i], n_req * sizeof(struct dtl_entry)); in dtl_file_read()
337 static int dtl_setup_file(struct dtl *dtl) in dtl_setup_file() argument
341 sprintf(name, "cpu-%d", dtl->cpu); in dtl_setup_file()
343 dtl->file = debugfs_create_file(name, 0400, dtl_dir, dtl, &dtl_fops); in dtl_setup_file()
344 if (!dtl->file) in dtl_setup_file()
380 struct dtl *dtl = &per_cpu(cpu_dtl, i); in dtl_init() local
381 spin_lock_init(&dtl->lock); in dtl_init()
382 dtl->cpu = i; in dtl_init()
384 rc = dtl_setup_file(dtl); in dtl_init()