diff options
Diffstat (limited to 'arch/arm/oprofile/common.c')
-rw-r--r-- | arch/arm/oprofile/common.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c index 3fcd752d6146..2680f4d4b2f3 100644 --- a/arch/arm/oprofile/common.c +++ b/arch/arm/oprofile/common.c @@ -14,6 +14,10 @@ #include <linux/sysdev.h> #include <linux/mutex.h> +#include <asm/system.h> +#include <asm/cputype.h> +#include <asm/io.h> + #include "op_counter.h" #include "op_arm_model.h" @@ -130,24 +134,37 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) { struct op_arm_model_spec *spec = NULL; int ret = -ENODEV; + int cpu_arch = cpu_architecture(); ops->backtrace = arm_backtrace; -#ifdef CONFIG_CPU_XSCALE + if (cpu_is_xscale()) spec = &op_xscale_spec; -#endif - -#ifdef CONFIG_OPROFILE_ARMV6 + else if (cpu_is_11mpcore() || cpu_arch == CPU_ARCH_ARMv6) { + /* cpu_architecture returns V7 for MPCore! */ spec = &op_armv6_spec; -#endif - -#ifdef CONFIG_OPROFILE_MPCORE - spec = &op_mpcore_spec; -#endif - -#ifdef CONFIG_OPROFILE_ARMV7 + if (cpu_is_11mpcore()) + spec->name = "arm/11mpcore"; + } + else if (cpu_arch == CPU_ARCH_ARMv7) { spec = &op_armv7_spec; -#endif + /* + * V7 CPUs all have the same kind of PMUs, but have a variable + * number of them. So the kernel side of Oprofile only needs + * to know whether we have the L2x0, and whether we're SMP. + * The user side needs more information, to decide which + * events file to use because, for example, some A8 event + * numbers differ from A9 event numbers). + */ + if (cpu_is_a9()) { + if (is_smp()) + spec->name = "arm/a9mpcore"; + else + spec->name = "arm/a9"; + } + else + spec->name = "arm/a8"; + } if (spec) { ret = spec->init(); @@ -167,7 +184,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) ops->start = op_arm_start; ops->stop = op_arm_stop; ops->cpu_type = op_arm_model->name; - printk(KERN_INFO "oprofile: using %s\n", spec->name); + printk(KERN_INFO "oprofile: cpu_architecture() returns 0x%x, using %s model\n", cpu_arch, spec->name); } return ret; |