1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
2f984b51eSPekka Paalanen /*
3f984b51eSPekka Paalanen * Memory mapped I/O tracing
4f984b51eSPekka Paalanen *
5f984b51eSPekka Paalanen * Copyright (C) 2008 Pekka Paalanen <pq@iki.fi>
6f984b51eSPekka Paalanen */
7f984b51eSPekka Paalanen
8f984b51eSPekka Paalanen #include <linux/kernel.h>
9f984b51eSPekka Paalanen #include <linux/mmiotrace.h>
1013829537SPekka Paalanen #include <linux/pci.h>
115a0e3ad6STejun Heo #include <linux/slab.h>
12a5dec557SLi Zefan #include <linux/time.h>
13a5dec557SLi Zefan
1460063497SArun Sharma #include <linux/atomic.h>
15f984b51eSPekka Paalanen
16f984b51eSPekka Paalanen #include "trace.h"
17f0868d1eSSteven Rostedt #include "trace_output.h"
18f984b51eSPekka Paalanen
19d0a7e8caSPekka Paalanen struct header_iter {
20d0a7e8caSPekka Paalanen struct pci_dev *dev;
21d0a7e8caSPekka Paalanen };
22d0a7e8caSPekka Paalanen
23f984b51eSPekka Paalanen static struct trace_array *mmio_trace_array;
242039238bSPekka Paalanen static bool overrun_detected;
257ee1768dSPekka Paalanen static unsigned long prev_overruns;
26173ed24eSPekka Paalanen static atomic_t dropped_count;
27f984b51eSPekka Paalanen
mmio_reset_data(struct trace_array * tr)28bd8ac686SPekka Paalanen static void mmio_reset_data(struct trace_array *tr)
29bd8ac686SPekka Paalanen {
302039238bSPekka Paalanen overrun_detected = false;
317ee1768dSPekka Paalanen prev_overruns = 0;
32bd8ac686SPekka Paalanen
331c5eb448SSteven Rostedt (VMware) tracing_reset_online_cpus(&tr->array_buffer);
34bd8ac686SPekka Paalanen }
35f984b51eSPekka Paalanen
mmio_trace_init(struct trace_array * tr)361c80025aSFrederic Weisbecker static int mmio_trace_init(struct trace_array *tr)
37f984b51eSPekka Paalanen {
38f984b51eSPekka Paalanen pr_debug("in %s\n", __func__);
39f984b51eSPekka Paalanen mmio_trace_array = tr;
40c76f0694SSteven Rostedt
41bd8ac686SPekka Paalanen mmio_reset_data(tr);
42f984b51eSPekka Paalanen enable_mmiotrace();
431c80025aSFrederic Weisbecker return 0;
44f984b51eSPekka Paalanen }
45f984b51eSPekka Paalanen
mmio_trace_reset(struct trace_array * tr)46f984b51eSPekka Paalanen static void mmio_trace_reset(struct trace_array *tr)
47f984b51eSPekka Paalanen {
48f984b51eSPekka Paalanen pr_debug("in %s\n", __func__);
49c76f0694SSteven Rostedt
50f984b51eSPekka Paalanen disable_mmiotrace();
51bd8ac686SPekka Paalanen mmio_reset_data(tr);
52bd8ac686SPekka Paalanen mmio_trace_array = NULL;
53f984b51eSPekka Paalanen }
54f984b51eSPekka Paalanen
mmio_trace_start(struct trace_array * tr)55bbf5b1a0SSteven Rostedt static void mmio_trace_start(struct trace_array *tr)
56f984b51eSPekka Paalanen {
57f984b51eSPekka Paalanen pr_debug("in %s\n", __func__);
58bd8ac686SPekka Paalanen mmio_reset_data(tr);
59bd8ac686SPekka Paalanen }
60bd8ac686SPekka Paalanen
mmio_print_pcidev(struct trace_seq * s,const struct pci_dev * dev)61a72e10afSSteven Rostedt (Red Hat) static void mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev)
6213829537SPekka Paalanen {
6313829537SPekka Paalanen int i;
6413829537SPekka Paalanen resource_size_t start, end;
6513829537SPekka Paalanen const struct pci_driver *drv = pci_dev_driver(dev);
6613829537SPekka Paalanen
67a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s, "PCIDEV %02x%02x %04x%04x %x",
6813829537SPekka Paalanen dev->bus->number, dev->devfn,
6913829537SPekka Paalanen dev->vendor, dev->device, dev->irq);
7013829537SPekka Paalanen for (i = 0; i < 7; i++) {
719a51933eSBjorn Helgaas start = dev->resource[i].start;
72a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s, " %llx",
7313829537SPekka Paalanen (unsigned long long)(start |
7413829537SPekka Paalanen (dev->resource[i].flags & PCI_REGION_FLAG_MASK)));
7513829537SPekka Paalanen }
7613829537SPekka Paalanen for (i = 0; i < 7; i++) {
779a51933eSBjorn Helgaas start = dev->resource[i].start;
789a51933eSBjorn Helgaas end = dev->resource[i].end;
79a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s, " %llx",
8013829537SPekka Paalanen dev->resource[i].start < dev->resource[i].end ?
8113829537SPekka Paalanen (unsigned long long)(end - start) + 1 : 0);
8213829537SPekka Paalanen }
8313829537SPekka Paalanen if (drv)
84a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s, " %s\n", drv->name);
8513829537SPekka Paalanen else
86a72e10afSSteven Rostedt (Red Hat) trace_seq_puts(s, " \n");
8713829537SPekka Paalanen }
8813829537SPekka Paalanen
destroy_header_iter(struct header_iter * hiter)89d0a7e8caSPekka Paalanen static void destroy_header_iter(struct header_iter *hiter)
90bd8ac686SPekka Paalanen {
91d0a7e8caSPekka Paalanen if (!hiter)
92d0a7e8caSPekka Paalanen return;
93d0a7e8caSPekka Paalanen pci_dev_put(hiter->dev);
94d0a7e8caSPekka Paalanen kfree(hiter);
95d0a7e8caSPekka Paalanen }
96d0a7e8caSPekka Paalanen
mmio_pipe_open(struct trace_iterator * iter)97d0a7e8caSPekka Paalanen static void mmio_pipe_open(struct trace_iterator *iter)
98d0a7e8caSPekka Paalanen {
99d0a7e8caSPekka Paalanen struct header_iter *hiter;
100bd8ac686SPekka Paalanen struct trace_seq *s = &iter->seq;
10113829537SPekka Paalanen
102146c3442Szhangwei(Jovi) trace_seq_puts(s, "VERSION 20070824\n");
10313829537SPekka Paalanen
104d0a7e8caSPekka Paalanen hiter = kzalloc(sizeof(*hiter), GFP_KERNEL);
105d0a7e8caSPekka Paalanen if (!hiter)
106d0a7e8caSPekka Paalanen return;
107d0a7e8caSPekka Paalanen
108d0a7e8caSPekka Paalanen hiter->dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
109d0a7e8caSPekka Paalanen iter->private = hiter;
110d0a7e8caSPekka Paalanen }
111d0a7e8caSPekka Paalanen
112d0a7e8caSPekka Paalanen /* XXX: This is not called when the pipe is closed! */
mmio_close(struct trace_iterator * iter)113d0a7e8caSPekka Paalanen static void mmio_close(struct trace_iterator *iter)
114d0a7e8caSPekka Paalanen {
115d0a7e8caSPekka Paalanen struct header_iter *hiter = iter->private;
116d0a7e8caSPekka Paalanen destroy_header_iter(hiter);
117d0a7e8caSPekka Paalanen iter->private = NULL;
118d0a7e8caSPekka Paalanen }
119d0a7e8caSPekka Paalanen
count_overruns(struct trace_iterator * iter)1202039238bSPekka Paalanen static unsigned long count_overruns(struct trace_iterator *iter)
1212039238bSPekka Paalanen {
122173ed24eSPekka Paalanen unsigned long cnt = atomic_xchg(&dropped_count, 0);
1231c5eb448SSteven Rostedt (VMware) unsigned long over = ring_buffer_overruns(iter->array_buffer->buffer);
1247ee1768dSPekka Paalanen
1257ee1768dSPekka Paalanen if (over > prev_overruns)
126173ed24eSPekka Paalanen cnt += over - prev_overruns;
1277ee1768dSPekka Paalanen prev_overruns = over;
1282039238bSPekka Paalanen return cnt;
1292039238bSPekka Paalanen }
1302039238bSPekka Paalanen
mmio_read(struct trace_iterator * iter,struct file * filp,char __user * ubuf,size_t cnt,loff_t * ppos)131d0a7e8caSPekka Paalanen static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp,
132d0a7e8caSPekka Paalanen char __user *ubuf, size_t cnt, loff_t *ppos)
133d0a7e8caSPekka Paalanen {
134d0a7e8caSPekka Paalanen ssize_t ret;
135d0a7e8caSPekka Paalanen struct header_iter *hiter = iter->private;
136d0a7e8caSPekka Paalanen struct trace_seq *s = &iter->seq;
1372039238bSPekka Paalanen unsigned long n;
1382039238bSPekka Paalanen
1392039238bSPekka Paalanen n = count_overruns(iter);
1402039238bSPekka Paalanen if (n) {
1412039238bSPekka Paalanen /* XXX: This is later than where events were lost. */
1422039238bSPekka Paalanen trace_seq_printf(s, "MARK 0.000000 Lost %lu events.\n", n);
1432039238bSPekka Paalanen if (!overrun_detected)
144a395d6a7SJoe Perches pr_warn("mmiotrace has lost events\n");
1452039238bSPekka Paalanen overrun_detected = true;
1462039238bSPekka Paalanen goto print_out;
1472039238bSPekka Paalanen }
148d0a7e8caSPekka Paalanen
149d0a7e8caSPekka Paalanen if (!hiter)
150d0a7e8caSPekka Paalanen return 0;
151d0a7e8caSPekka Paalanen
152d0a7e8caSPekka Paalanen mmio_print_pcidev(s, hiter->dev);
153d0a7e8caSPekka Paalanen hiter->dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, hiter->dev);
154d0a7e8caSPekka Paalanen
155d0a7e8caSPekka Paalanen if (!hiter->dev) {
156d0a7e8caSPekka Paalanen destroy_header_iter(hiter);
157d0a7e8caSPekka Paalanen iter->private = NULL;
158d0a7e8caSPekka Paalanen }
159d0a7e8caSPekka Paalanen
1602039238bSPekka Paalanen print_out:
161d0a7e8caSPekka Paalanen ret = trace_seq_to_user(s, ubuf, cnt);
162d0a7e8caSPekka Paalanen return (ret == -EBUSY) ? 0 : ret;
163bd8ac686SPekka Paalanen }
164bd8ac686SPekka Paalanen
mmio_print_rw(struct trace_iterator * iter)16507f4e4f7SFrederic Weisbecker static enum print_line_t mmio_print_rw(struct trace_iterator *iter)
166bd8ac686SPekka Paalanen {
167bd8ac686SPekka Paalanen struct trace_entry *entry = iter->ent;
1687104f300SSteven Rostedt struct trace_mmiotrace_rw *field;
1697104f300SSteven Rostedt struct mmiotrace_rw *rw;
170bd8ac686SPekka Paalanen struct trace_seq *s = &iter->seq;
1713928a8a2SSteven Rostedt unsigned long long t = ns2usecs(iter->ts);
172a5dec557SLi Zefan unsigned long usec_rem = do_div(t, USEC_PER_SEC);
173bd8ac686SPekka Paalanen unsigned secs = (unsigned long)t;
174bd8ac686SPekka Paalanen
1757104f300SSteven Rostedt trace_assign_type(field, entry);
1767104f300SSteven Rostedt rw = &field->rw;
1777104f300SSteven Rostedt
178777e208dSSteven Rostedt switch (rw->opcode) {
179bd8ac686SPekka Paalanen case MMIO_READ:
180a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s,
1815e4abc98SSteven Rostedt "R %d %u.%06lu %d 0x%llx 0x%lx 0x%lx %d\n",
182dee310d0SPekka Paalanen rw->width, secs, usec_rem, rw->map_id,
183dee310d0SPekka Paalanen (unsigned long long)rw->phys,
184736ca61fSPekka Paalanen rw->value, rw->pc, 0);
185bd8ac686SPekka Paalanen break;
186bd8ac686SPekka Paalanen case MMIO_WRITE:
187a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s,
1885e4abc98SSteven Rostedt "W %d %u.%06lu %d 0x%llx 0x%lx 0x%lx %d\n",
189dee310d0SPekka Paalanen rw->width, secs, usec_rem, rw->map_id,
190dee310d0SPekka Paalanen (unsigned long long)rw->phys,
191736ca61fSPekka Paalanen rw->value, rw->pc, 0);
192bd8ac686SPekka Paalanen break;
193bd8ac686SPekka Paalanen case MMIO_UNKNOWN_OP:
194a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s,
1955e4abc98SSteven Rostedt "UNKNOWN %u.%06lu %d 0x%llx %02lx,%02lx,"
1965e4abc98SSteven Rostedt "%02lx 0x%lx %d\n",
197dee310d0SPekka Paalanen secs, usec_rem, rw->map_id,
198dee310d0SPekka Paalanen (unsigned long long)rw->phys,
199bd8ac686SPekka Paalanen (rw->value >> 16) & 0xff, (rw->value >> 8) & 0xff,
200736ca61fSPekka Paalanen (rw->value >> 0) & 0xff, rw->pc, 0);
201bd8ac686SPekka Paalanen break;
202bd8ac686SPekka Paalanen default:
203a72e10afSSteven Rostedt (Red Hat) trace_seq_puts(s, "rw what?\n");
204bd8ac686SPekka Paalanen break;
205bd8ac686SPekka Paalanen }
206a72e10afSSteven Rostedt (Red Hat)
207a72e10afSSteven Rostedt (Red Hat) return trace_handle_return(s);
208bd8ac686SPekka Paalanen }
209bd8ac686SPekka Paalanen
mmio_print_map(struct trace_iterator * iter)21007f4e4f7SFrederic Weisbecker static enum print_line_t mmio_print_map(struct trace_iterator *iter)
211bd8ac686SPekka Paalanen {
212bd8ac686SPekka Paalanen struct trace_entry *entry = iter->ent;
2137104f300SSteven Rostedt struct trace_mmiotrace_map *field;
2147104f300SSteven Rostedt struct mmiotrace_map *m;
215bd8ac686SPekka Paalanen struct trace_seq *s = &iter->seq;
2163928a8a2SSteven Rostedt unsigned long long t = ns2usecs(iter->ts);
217a5dec557SLi Zefan unsigned long usec_rem = do_div(t, USEC_PER_SEC);
218bd8ac686SPekka Paalanen unsigned secs = (unsigned long)t;
219bd8ac686SPekka Paalanen
2207104f300SSteven Rostedt trace_assign_type(field, entry);
2217104f300SSteven Rostedt m = &field->map;
2227104f300SSteven Rostedt
223777e208dSSteven Rostedt switch (m->opcode) {
224bd8ac686SPekka Paalanen case MMIO_PROBE:
225a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s,
2265e4abc98SSteven Rostedt "MAP %u.%06lu %d 0x%llx 0x%lx 0x%lx 0x%lx %d\n",
227dee310d0SPekka Paalanen secs, usec_rem, m->map_id,
228dee310d0SPekka Paalanen (unsigned long long)m->phys, m->virt, m->len,
229e0fd5c2fSPekka Paalanen 0UL, 0);
230bd8ac686SPekka Paalanen break;
231bd8ac686SPekka Paalanen case MMIO_UNPROBE:
232a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s,
2335e4abc98SSteven Rostedt "UNMAP %u.%06lu %d 0x%lx %d\n",
234e0fd5c2fSPekka Paalanen secs, usec_rem, m->map_id, 0UL, 0);
235bd8ac686SPekka Paalanen break;
236bd8ac686SPekka Paalanen default:
237a72e10afSSteven Rostedt (Red Hat) trace_seq_puts(s, "map what?\n");
238bd8ac686SPekka Paalanen break;
239bd8ac686SPekka Paalanen }
240a72e10afSSteven Rostedt (Red Hat)
241a72e10afSSteven Rostedt (Red Hat) return trace_handle_return(s);
242bd8ac686SPekka Paalanen }
243bd8ac686SPekka Paalanen
mmio_print_mark(struct trace_iterator * iter)24407f4e4f7SFrederic Weisbecker static enum print_line_t mmio_print_mark(struct trace_iterator *iter)
245fc5e27aeSPekka Paalanen {
246fc5e27aeSPekka Paalanen struct trace_entry *entry = iter->ent;
247777e208dSSteven Rostedt struct print_entry *print = (struct print_entry *)entry;
24848ead020SFrederic Weisbecker const char *msg = print->buf;
249fc5e27aeSPekka Paalanen struct trace_seq *s = &iter->seq;
2503928a8a2SSteven Rostedt unsigned long long t = ns2usecs(iter->ts);
251769b0441SFrederic Weisbecker unsigned long usec_rem = do_div(t, USEC_PER_SEC);
252fc5e27aeSPekka Paalanen unsigned secs = (unsigned long)t;
253fc5e27aeSPekka Paalanen
254fc5e27aeSPekka Paalanen /* The trailing newline must be in the message. */
255a72e10afSSteven Rostedt (Red Hat) trace_seq_printf(s, "MARK %u.%06lu %s", secs, usec_rem, msg);
256fc5e27aeSPekka Paalanen
257a72e10afSSteven Rostedt (Red Hat) return trace_handle_return(s);
258fc5e27aeSPekka Paalanen }
259fc5e27aeSPekka Paalanen
mmio_print_line(struct trace_iterator * iter)26007f4e4f7SFrederic Weisbecker static enum print_line_t mmio_print_line(struct trace_iterator *iter)
261bd8ac686SPekka Paalanen {
262bd8ac686SPekka Paalanen switch (iter->ent->type) {
263bd8ac686SPekka Paalanen case TRACE_MMIO_RW:
264bd8ac686SPekka Paalanen return mmio_print_rw(iter);
265bd8ac686SPekka Paalanen case TRACE_MMIO_MAP:
266bd8ac686SPekka Paalanen return mmio_print_map(iter);
267fc5e27aeSPekka Paalanen case TRACE_PRINT:
268fc5e27aeSPekka Paalanen return mmio_print_mark(iter);
269bd8ac686SPekka Paalanen default:
27007f4e4f7SFrederic Weisbecker return TRACE_TYPE_HANDLED; /* ignore unknown entries */
271bd8ac686SPekka Paalanen }
272bd8ac686SPekka Paalanen }
273f984b51eSPekka Paalanen
274f984b51eSPekka Paalanen static struct tracer mmio_tracer __read_mostly =
275f984b51eSPekka Paalanen {
276f984b51eSPekka Paalanen .name = "mmiotrace",
277f984b51eSPekka Paalanen .init = mmio_trace_init,
278f984b51eSPekka Paalanen .reset = mmio_trace_reset,
279bbf5b1a0SSteven Rostedt .start = mmio_trace_start,
280d0a7e8caSPekka Paalanen .pipe_open = mmio_pipe_open,
281d0a7e8caSPekka Paalanen .close = mmio_close,
282d0a7e8caSPekka Paalanen .read = mmio_read,
283bd8ac686SPekka Paalanen .print_line = mmio_print_line,
284c7b3ae0bSZiqian SUN (Zamir) .noboot = true,
285f984b51eSPekka Paalanen };
286f984b51eSPekka Paalanen
init_mmio_trace(void)287f984b51eSPekka Paalanen __init static int init_mmio_trace(void)
288f984b51eSPekka Paalanen {
289f984b51eSPekka Paalanen return register_tracer(&mmio_tracer);
290f984b51eSPekka Paalanen }
291f984b51eSPekka Paalanen device_initcall(init_mmio_trace);
292f984b51eSPekka Paalanen
__trace_mmiotrace_rw(struct trace_array * tr,struct trace_array_cpu * data,struct mmiotrace_rw * rw)29345dcd8b8SPekka Paalanen static void __trace_mmiotrace_rw(struct trace_array *tr,
29445dcd8b8SPekka Paalanen struct trace_array_cpu *data,
29545dcd8b8SPekka Paalanen struct mmiotrace_rw *rw)
29645dcd8b8SPekka Paalanen {
2972425bcb9SSteven Rostedt (Red Hat) struct trace_event_call *call = &event_mmiotrace_rw;
29813292494SSteven Rostedt (VMware) struct trace_buffer *buffer = tr->array_buffer.buffer;
2993928a8a2SSteven Rostedt struct ring_buffer_event *event;
300777e208dSSteven Rostedt struct trace_mmiotrace_rw *entry;
301*36590c50SSebastian Andrzej Siewior unsigned int trace_ctx;
30245dcd8b8SPekka Paalanen
303*36590c50SSebastian Andrzej Siewior trace_ctx = tracing_gen_ctx_flags(0);
304e77405adSSteven Rostedt event = trace_buffer_lock_reserve(buffer, TRACE_MMIO_RW,
305*36590c50SSebastian Andrzej Siewior sizeof(*entry), trace_ctx);
306173ed24eSPekka Paalanen if (!event) {
307173ed24eSPekka Paalanen atomic_inc(&dropped_count);
3083928a8a2SSteven Rostedt return;
309173ed24eSPekka Paalanen }
3103928a8a2SSteven Rostedt entry = ring_buffer_event_data(event);
311777e208dSSteven Rostedt entry->rw = *rw;
31260ba7702SSteven Rostedt
313f306cc82STom Zanussi if (!call_filter_check_discard(call, entry, buffer, event))
314*36590c50SSebastian Andrzej Siewior trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
31545dcd8b8SPekka Paalanen }
31645dcd8b8SPekka Paalanen
mmio_trace_rw(struct mmiotrace_rw * rw)317bd8ac686SPekka Paalanen void mmio_trace_rw(struct mmiotrace_rw *rw)
318f984b51eSPekka Paalanen {
319f984b51eSPekka Paalanen struct trace_array *tr = mmio_trace_array;
3201c5eb448SSteven Rostedt (VMware) struct trace_array_cpu *data = per_cpu_ptr(tr->array_buffer.data, smp_processor_id());
321bd8ac686SPekka Paalanen __trace_mmiotrace_rw(tr, data, rw);
322bd8ac686SPekka Paalanen }
323f984b51eSPekka Paalanen
__trace_mmiotrace_map(struct trace_array * tr,struct trace_array_cpu * data,struct mmiotrace_map * map)32445dcd8b8SPekka Paalanen static void __trace_mmiotrace_map(struct trace_array *tr,
32545dcd8b8SPekka Paalanen struct trace_array_cpu *data,
32645dcd8b8SPekka Paalanen struct mmiotrace_map *map)
32745dcd8b8SPekka Paalanen {
3282425bcb9SSteven Rostedt (Red Hat) struct trace_event_call *call = &event_mmiotrace_map;
32913292494SSteven Rostedt (VMware) struct trace_buffer *buffer = tr->array_buffer.buffer;
3303928a8a2SSteven Rostedt struct ring_buffer_event *event;
331777e208dSSteven Rostedt struct trace_mmiotrace_map *entry;
332*36590c50SSebastian Andrzej Siewior unsigned int trace_ctx;
33345dcd8b8SPekka Paalanen
334*36590c50SSebastian Andrzej Siewior trace_ctx = tracing_gen_ctx_flags(0);
335e77405adSSteven Rostedt event = trace_buffer_lock_reserve(buffer, TRACE_MMIO_MAP,
336*36590c50SSebastian Andrzej Siewior sizeof(*entry), trace_ctx);
337173ed24eSPekka Paalanen if (!event) {
338173ed24eSPekka Paalanen atomic_inc(&dropped_count);
3393928a8a2SSteven Rostedt return;
340173ed24eSPekka Paalanen }
3413928a8a2SSteven Rostedt entry = ring_buffer_event_data(event);
342777e208dSSteven Rostedt entry->map = *map;
34360ba7702SSteven Rostedt
344f306cc82STom Zanussi if (!call_filter_check_discard(call, entry, buffer, event))
345*36590c50SSebastian Andrzej Siewior trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
34645dcd8b8SPekka Paalanen }
34745dcd8b8SPekka Paalanen
mmio_trace_mapping(struct mmiotrace_map * map)348bd8ac686SPekka Paalanen void mmio_trace_mapping(struct mmiotrace_map *map)
349bd8ac686SPekka Paalanen {
350bd8ac686SPekka Paalanen struct trace_array *tr = mmio_trace_array;
351bd8ac686SPekka Paalanen struct trace_array_cpu *data;
352bd8ac686SPekka Paalanen
353bd8ac686SPekka Paalanen preempt_disable();
3541c5eb448SSteven Rostedt (VMware) data = per_cpu_ptr(tr->array_buffer.data, smp_processor_id());
355bd8ac686SPekka Paalanen __trace_mmiotrace_map(tr, data, map);
356bd8ac686SPekka Paalanen preempt_enable();
357f984b51eSPekka Paalanen }
3589e57fb35SPekka Paalanen
mmio_trace_printk(const char * fmt,va_list args)3599e57fb35SPekka Paalanen int mmio_trace_printk(const char *fmt, va_list args)
3609e57fb35SPekka Paalanen {
36140ce74f1SSteven Rostedt return trace_vprintk(0, fmt, args);
3629e57fb35SPekka Paalanen }
363