diff options
author | Pekka Paalanen <pq@iki.fi> | 2008-09-16 15:00:34 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-14 04:37:11 -0400 |
commit | 9e57fb35d711331a9b1410c5c56ebeb3733428a0 (patch) | |
tree | 2e68b1b8bb233378cbcad0c8e9bc8f99abf7263a /arch | |
parent | 801fe40001dfc263848552fb28924b766ed44ea4 (diff) |
x86 mmiotrace: implement mmiotrace_printk()
Offer mmiotrace users a function to inject markers from inside the kernel.
This depends on the trace_vprintk() patch.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/mm/mmio-mod.c | 19 | ||||
-rw-r--r-- | arch/x86/mm/testmmiotrace.c | 4 |
2 files changed, 22 insertions, 1 deletions
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c index 754bd1eaf4f6..5e2e2e72ee80 100644 --- a/arch/x86/mm/mmio-mod.c +++ b/arch/x86/mm/mmio-mod.c | |||
@@ -75,7 +75,7 @@ static LIST_HEAD(trace_list); /* struct remap_trace */ | |||
75 | * and trace_lock. | 75 | * and trace_lock. |
76 | * - Routines depending on is_enabled() must take trace_lock. | 76 | * - Routines depending on is_enabled() must take trace_lock. |
77 | * - trace_list users must hold trace_lock. | 77 | * - trace_list users must hold trace_lock. |
78 | * - is_enabled() guarantees that mmio_trace_record is allowed. | 78 | * - is_enabled() guarantees that mmio_trace_{rw,mapping} are allowed. |
79 | * - pre/post callbacks assume the effect of is_enabled() being true. | 79 | * - pre/post callbacks assume the effect of is_enabled() being true. |
80 | */ | 80 | */ |
81 | 81 | ||
@@ -379,6 +379,23 @@ void mmiotrace_iounmap(volatile void __iomem *addr) | |||
379 | iounmap_trace_core(addr); | 379 | iounmap_trace_core(addr); |
380 | } | 380 | } |
381 | 381 | ||
382 | int mmiotrace_printk(const char *fmt, ...) | ||
383 | { | ||
384 | int ret = 0; | ||
385 | va_list args; | ||
386 | unsigned long flags; | ||
387 | va_start(args, fmt); | ||
388 | |||
389 | spin_lock_irqsave(&trace_lock, flags); | ||
390 | if (is_enabled()) | ||
391 | ret = mmio_trace_printk(fmt, args); | ||
392 | spin_unlock_irqrestore(&trace_lock, flags); | ||
393 | |||
394 | va_end(args); | ||
395 | return ret; | ||
396 | } | ||
397 | EXPORT_SYMBOL(mmiotrace_printk); | ||
398 | |||
382 | static void clear_trace_list(void) | 399 | static void clear_trace_list(void) |
383 | { | 400 | { |
384 | struct remap_trace *trace; | 401 | struct remap_trace *trace; |
diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c index d877c5b423ef..ab50a8d7402c 100644 --- a/arch/x86/mm/testmmiotrace.c +++ b/arch/x86/mm/testmmiotrace.c | |||
@@ -3,6 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/io.h> | 5 | #include <linux/io.h> |
6 | #include <linux/mmiotrace.h> | ||
6 | 7 | ||
7 | #define MODULE_NAME "testmmiotrace" | 8 | #define MODULE_NAME "testmmiotrace" |
8 | 9 | ||
@@ -13,6 +14,7 @@ MODULE_PARM_DESC(mmio_address, "Start address of the mapping of 16 kB."); | |||
13 | static void do_write_test(void __iomem *p) | 14 | static void do_write_test(void __iomem *p) |
14 | { | 15 | { |
15 | unsigned int i; | 16 | unsigned int i; |
17 | mmiotrace_printk("Write test.\n"); | ||
16 | for (i = 0; i < 256; i++) | 18 | for (i = 0; i < 256; i++) |
17 | iowrite8(i, p + i); | 19 | iowrite8(i, p + i); |
18 | for (i = 1024; i < (5 * 1024); i += 2) | 20 | for (i = 1024; i < (5 * 1024); i += 2) |
@@ -24,6 +26,7 @@ static void do_write_test(void __iomem *p) | |||
24 | static void do_read_test(void __iomem *p) | 26 | static void do_read_test(void __iomem *p) |
25 | { | 27 | { |
26 | unsigned int i; | 28 | unsigned int i; |
29 | mmiotrace_printk("Read test.\n"); | ||
27 | for (i = 0; i < 256; i++) | 30 | for (i = 0; i < 256; i++) |
28 | ioread8(p + i); | 31 | ioread8(p + i); |
29 | for (i = 1024; i < (5 * 1024); i += 2) | 32 | for (i = 1024; i < (5 * 1024); i += 2) |
@@ -39,6 +42,7 @@ static void do_test(void) | |||
39 | pr_err(MODULE_NAME ": could not ioremap, aborting.\n"); | 42 | pr_err(MODULE_NAME ": could not ioremap, aborting.\n"); |
40 | return; | 43 | return; |
41 | } | 44 | } |
45 | mmiotrace_printk("ioremap returned %p.\n", p); | ||
42 | do_write_test(p); | 46 | do_write_test(p); |
43 | do_read_test(p); | 47 | do_read_test(p); |
44 | iounmap(p); | 48 | iounmap(p); |