Subject: oprofile support for Cell From: David Erb This provides oprofile functions for Cell (linux-2.6.16) TODO: fix code to allow Cell and other PowerPC to be built together Signed-off-by: Arnd Bergmann Index: linus-2.6/arch/powerpc/oprofile/common.c =================================================================== --- linus-2.6.orig/arch/powerpc/oprofile/common.c +++ linus-2.6/arch/powerpc/oprofile/common.c @@ -82,6 +82,7 @@ static int op_powerpc_create_files(struc int i; #ifdef CONFIG_PPC64 +#ifndef CONFIG_PPC_CELL /* * There is one mmcr0, mmcr1 and mmcra for setting the events for * all of the counters. @@ -90,6 +91,7 @@ static int op_powerpc_create_files(struc oprofilefs_create_ulong(sb, root, "mmcr1", &sys.mmcr1); oprofilefs_create_ulong(sb, root, "mmcra", &sys.mmcra); #endif +#endif for (i = 0; i < model->num_counters; ++i) { struct dentry *dir; @@ -139,6 +141,11 @@ int __init oprofile_arch_init(struct opr return -ENODEV; switch (cur_cpu_spec->oprofile_type) { +#ifdef CONFIG_PPC_CELL + case PPC_OPROFILE_CELL: + model = &op_model_cell; + break; +#else #ifdef CONFIG_PPC64 case PPC_OPROFILE_RS64: model = &op_model_rs64; @@ -151,6 +158,7 @@ int __init oprofile_arch_init(struct opr model = &op_model_7450; break; #endif +#endif #ifdef CONFIG_FSL_BOOKE case PPC_OPROFILE_BOOKE: model = &op_model_fsl_booke; Index: linus-2.6/arch/powerpc/oprofile/Makefile =================================================================== --- linus-2.6.orig/arch/powerpc/oprofile/Makefile +++ linus-2.6/arch/powerpc/oprofile/Makefile @@ -7,6 +7,7 @@ DRIVER_OBJS := $(addprefix ../../../driv timer_int.o ) oprofile-y := $(DRIVER_OBJS) common.o +oprofile-$(CONFIG_PPC_CELL) += op_model_cell.o oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o oprofile-$(CONFIG_FSL_BOOKE) += op_model_fsl_booke.o oprofile-$(CONFIG_PPC32) += op_model_7450.o Index: linus-2.6/include/asm-powerpc/oprofile_impl.h =================================================================== --- linus-2.6.orig/include/asm-powerpc/oprofile_impl.h +++ linus-2.6/include/asm-powerpc/oprofile_impl.h @@ -63,6 +63,7 @@ extern struct op_powerpc_model op_model_ #ifdef CONFIG_PPC64 extern struct op_powerpc_model op_model_rs64; extern struct op_powerpc_model op_model_power4; +extern struct op_powerpc_model op_model_cell; #else /* Otherwise, CONFIG_PPC32 */ extern struct op_powerpc_model op_model_7450; Index: linus-2.6/arch/powerpc/kernel/pmc.c =================================================================== --- linus-2.6.orig/arch/powerpc/kernel/pmc.c +++ linus-2.6/arch/powerpc/kernel/pmc.c @@ -28,6 +28,20 @@ static void dummy_perf(struct pt_regs *r pmgc0 &= ~PMGC0_PMIE; mtpmr(PMRN_PMGC0, pmgc0); } +#elif defined(CONFIG_PPC_CELL) + +#ifdef CONFIG_BE_PERF +#include "../platforms/cell/perfmon.h" +#endif + +/* Ensure exceptions are disabled */ +static void dummy_perf(struct pt_regs *regs) +{ +#ifdef CONFIG_BE_PERF + cbe_disable_pm_interrupts(smp_processor_id()); +#endif +} + #elif defined(CONFIG_PPC64) || defined(CONFIG_6xx) #ifndef MMCR0_PMAO