diff options
| -rw-r--r-- | arch/sh/kernel/cpu/sh4/perf_event.c | 2 | ||||
| -rw-r--r-- | arch/sh/kernel/cpu/sh4a/perf_event.c | 2 | ||||
| -rw-r--r-- | arch/sh/oprofile/Makefile | 2 | ||||
| -rw-r--r-- | arch/sh/oprofile/common.c | 31 |
4 files changed, 21 insertions, 16 deletions
diff --git a/arch/sh/kernel/cpu/sh4/perf_event.c b/arch/sh/kernel/cpu/sh4/perf_event.c index 7f9ecc9c2d02..dbf3b4bb71fe 100644 --- a/arch/sh/kernel/cpu/sh4/perf_event.c +++ b/arch/sh/kernel/cpu/sh4/perf_event.c | |||
| @@ -225,7 +225,7 @@ static void sh7750_pmu_enable_all(void) | |||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static struct sh_pmu sh7750_pmu = { | 227 | static struct sh_pmu sh7750_pmu = { |
| 228 | .name = "SH7750", | 228 | .name = "sh7750", |
| 229 | .num_events = 2, | 229 | .num_events = 2, |
| 230 | .event_map = sh7750_event_map, | 230 | .event_map = sh7750_event_map, |
| 231 | .max_events = ARRAY_SIZE(sh7750_general_events), | 231 | .max_events = ARRAY_SIZE(sh7750_general_events), |
diff --git a/arch/sh/kernel/cpu/sh4a/perf_event.c b/arch/sh/kernel/cpu/sh4a/perf_event.c index b8b873d8d6b5..580276525731 100644 --- a/arch/sh/kernel/cpu/sh4a/perf_event.c +++ b/arch/sh/kernel/cpu/sh4a/perf_event.c | |||
| @@ -259,7 +259,7 @@ static void sh4a_pmu_enable_all(void) | |||
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | static struct sh_pmu sh4a_pmu = { | 261 | static struct sh_pmu sh4a_pmu = { |
| 262 | .name = "SH-4A", | 262 | .name = "sh4a", |
| 263 | .num_events = 2, | 263 | .num_events = 2, |
| 264 | .event_map = sh4a_event_map, | 264 | .event_map = sh4a_event_map, |
| 265 | .max_events = ARRAY_SIZE(sh4a_general_events), | 265 | .max_events = ARRAY_SIZE(sh4a_general_events), |
diff --git a/arch/sh/oprofile/Makefile b/arch/sh/oprofile/Makefile index e85aae73e3dc..ce3b119021e7 100644 --- a/arch/sh/oprofile/Makefile +++ b/arch/sh/oprofile/Makefile | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | obj-$(CONFIG_OPROFILE) += oprofile.o | 1 | obj-$(CONFIG_OPROFILE) += oprofile.o |
| 2 | 2 | ||
| 3 | CFLAGS_common.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' | ||
| 4 | |||
| 3 | DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \ | 5 | DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \ |
| 4 | oprof.o cpu_buffer.o buffer_sync.o \ | 6 | oprof.o cpu_buffer.o buffer_sync.o \ |
| 5 | event_buffer.o oprofile_files.o \ | 7 | event_buffer.o oprofile_files.o \ |
diff --git a/arch/sh/oprofile/common.c b/arch/sh/oprofile/common.c index e10d89376f9b..84533142da9b 100644 --- a/arch/sh/oprofile/common.c +++ b/arch/sh/oprofile/common.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/sh/oprofile/init.c | 2 | * arch/sh/oprofile/init.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2003 - 2008 Paul Mundt | 4 | * Copyright (C) 2003 - 2010 Paul Mundt |
| 5 | * | 5 | * |
| 6 | * Based on arch/mips/oprofile/common.c: | 6 | * Based on arch/mips/oprofile/common.c: |
| 7 | * | 7 | * |
| @@ -18,38 +18,41 @@ | |||
| 18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
| 19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
| 20 | #include <linux/perf_event.h> | 20 | #include <linux/perf_event.h> |
| 21 | #include <linux/slab.h> | ||
| 21 | #include <asm/processor.h> | 22 | #include <asm/processor.h> |
| 22 | 23 | ||
| 23 | #ifdef CONFIG_HW_PERF_EVENTS | 24 | #ifdef CONFIG_HW_PERF_EVENTS |
| 24 | extern void sh_backtrace(struct pt_regs * const regs, unsigned int depth); | 25 | extern void sh_backtrace(struct pt_regs * const regs, unsigned int depth); |
| 25 | 26 | ||
| 27 | /* | ||
| 28 | * This will need to be reworked when multiple PMUs are supported. | ||
| 29 | */ | ||
| 30 | static char *sh_pmu_op_name; | ||
| 31 | |||
| 26 | char *op_name_from_perf_id(void) | 32 | char *op_name_from_perf_id(void) |
| 27 | { | 33 | { |
| 28 | const char *pmu; | 34 | return sh_pmu_op_name; |
| 29 | char buf[20]; | ||
| 30 | int size; | ||
| 31 | |||
| 32 | pmu = perf_pmu_name(); | ||
| 33 | if (!pmu) | ||
| 34 | return NULL; | ||
| 35 | |||
| 36 | size = snprintf(buf, sizeof(buf), "sh/%s", pmu); | ||
| 37 | if (size > -1 && size < sizeof(buf)) | ||
| 38 | return buf; | ||
| 39 | |||
| 40 | return NULL; | ||
| 41 | } | 35 | } |
| 42 | 36 | ||
| 43 | int __init oprofile_arch_init(struct oprofile_operations *ops) | 37 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
| 44 | { | 38 | { |
| 45 | ops->backtrace = sh_backtrace; | 39 | ops->backtrace = sh_backtrace; |
| 46 | 40 | ||
| 41 | if (perf_num_counters() == 0) | ||
| 42 | return -ENODEV; | ||
| 43 | |||
| 44 | sh_pmu_op_name = kasprintf(GFP_KERNEL, "%s/%s", | ||
| 45 | UTS_MACHINE, perf_pmu_name()); | ||
| 46 | if (unlikely(!sh_pmu_op_name)) | ||
| 47 | return -ENOMEM; | ||
| 48 | |||
| 47 | return oprofile_perf_init(ops); | 49 | return oprofile_perf_init(ops); |
| 48 | } | 50 | } |
| 49 | 51 | ||
| 50 | void __exit oprofile_arch_exit(void) | 52 | void __exit oprofile_arch_exit(void) |
| 51 | { | 53 | { |
| 52 | oprofile_perf_exit(); | 54 | oprofile_perf_exit(); |
| 55 | kfree(sh_pmu_op_name); | ||
| 53 | } | 56 | } |
| 54 | #else | 57 | #else |
| 55 | int __init oprofile_arch_init(struct oprofile_operations *ops) | 58 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
