(same with the last mail)

Add the function pointers to the reset_signals() and activate_signals() in
pfm_arch_pmu_info structure. These function pointers are set according to 
the platform and the appropriate functions are executed. 

Add pfm_cell_platform_probe() to register the functions to those pointers
according to the platform identification. It is called immediately before 
pfm_pmu_register() is called.

Moreover, the pfm_cell_platform_probe() registers the function to check
pmX_event and to find impossible PM signal combination.

Signed-off-by: Takaki Azuma <[EMAIL PROTECTED]>
Signed-off-by: Takayuki Uchikawa <[EMAIL PROTECTED]>

Index: linux-2.6.22/include/asm-powerpc/perfmon.h
===================================================================
--- linux-2.6.22-base/include/asm-powerpc/perfmon.h
+++ linux-2.6.22/include/asm-powerpc/perfmon.h
@@ -42,6 +42,8 @@ enum powerpc_pmu_type {
        PFM_POWERPC_PMU_CELL,
 };
 
+typedef struct cell_rtas_arg * struct_cell_rtas_arg;
+
 struct pfm_arch_pmu_info {
        enum powerpc_pmu_type pmu_style;
 
@@ -74,6 +76,9 @@ struct pfm_arch_pmu_info {
                             struct task_struct *task);
        int  (*unload_context)(struct pfm_context *ctx,
                               struct task_struct *task);
+
+       int (*reset_signals)(u32 cpu);
+       int (*activate_signals)(struct_cell_rtas_arg signals, int num_signals);
 };
 
 #ifdef CONFIG_PPC32
@@ -218,7 +223,7 @@ static inline void pfm_arch_intr_unfreez
 
        arch_info = pfm_pmu_conf->arch_info;
        BUG_ON(!arch_info->enable_counters);
-       arch_info->enable_counters(ctx->active_set);
+       arch_info->enable_counters(ctx, ctx->active_set);
 }
 
 /*
@@ -350,5 +355,19 @@ struct pfm_arch_context {
 
 #define PFM_ARCH_CTX_SIZE sizeof(struct pfm_arch_context)
 
+static inline int pfm_arch_reset_signals(int cpu)
+{
+       struct pfm_arch_pmu_info *arch_info = pfm_pmu_conf->arch_info;
+
+       return arch_info->reset_signals(cpu);
+}
+
+static inline int pfm_arch_activate_signals(struct_cell_rtas_arg signals, int 
num_signals)
+{
+       struct pfm_arch_pmu_info *arch_info = pfm_pmu_conf->arch_info;
+
+       return arch_info->activate_signals(signals, num_signals);
+}
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_PERFMON_H_ */
Index: linux-2.6.22/arch/powerpc/perfmon/Makefile
===================================================================
--- linux-2.6.22-base/arch/powerpc/perfmon/Makefile
+++ linux-2.6.22/arch/powerpc/perfmon/Makefile
@@ -1,4 +1,4 @@
 obj-$(CONFIG_PERFMON)          += perfmon.o
 obj-$(CONFIG_PERFMON_POWER5)   += perfmon_power5.o
 obj-$(CONFIG_PERFMON_PPC32)    += perfmon_ppc32.o
-obj-$(CONFIG_PERFMON_CELL)     += perfmon_cell.o
+obj-$(CONFIG_PERFMON_CELL)     += perfmon_cell.o perfmon_cell_signals.o
Index: linux-2.6.22/arch/powerpc/perfmon/perfmon_cell.c
===================================================================
--- linux-2.6.22-base/arch/powerpc/perfmon/perfmon_cell.c
+++ linux-2.6.22/arch/powerpc/perfmon/perfmon_cell.c
@@ -28,7 +28,10 @@
 #include <asm/cell-pmu.h>
 #include <asm/io.h>
 #include <asm/rtas.h>
+#include <asm/machdep.h>
+#include <asm/firmware.h>
 #include "../platforms/cell/cbe_regs.h"
+#include "./perfmon_cell_signals.h"
 
 MODULE_AUTHOR("Kevin Corry <kevcorry at us.ibm.com>, "
              "Carl Love <carll at us.ibm.com>");
@@ -198,7 +201,7 @@ static void write_pm07_event(int cpu, un
        signal.signal_group = RTAS_SIGNAL_NUMBER(value) / 100;
        signal.bit = RTAS_SIGNAL_NUMBER(value) % 100;
 
-       rc = rtas_activate_signals(&signal, 1);
+       rc = pfm_arch_activate_signals(&signal, 1);
        if (rc) {
                PFM_WARN("%s(%d, %u, %lu): Error calling "
                         "rtas_activate_signal(): %d\n", __FUNCTION__,
@@ -338,7 +341,7 @@ void pfm_cell_restore_pmcs(struct pfm_ev
                }
        }
 
-       rc = rtas_activate_signals(signals, num_used);
+       rc = pfm_arch_activate_signals(signals, num_used);
        if (rc) {
                PFM_WARN("Error calling rtas_activate_signal(): %d\n", rc);
                /* FIX: We will also need this routine to be able to return
@@ -368,7 +371,7 @@ static int pfm_cell_unload_context(struc
                                   struct task_struct *task)
 {
        if (task == current || ctx->flags.system) {
-               rtas_reset_signals(smp_processor_id());
+               pfm_arch_reset_signals(smp_processor_id());
        }
        return 0;
 }
@@ -383,7 +386,7 @@ static int pfm_cell_unload_context(struc
 int pfm_cell_ctxswout_thread(struct task_struct *task,
                             struct pfm_context *ctx, struct pfm_event_set *set)
 {
-       rtas_reset_signals(smp_processor_id());
+       pfm_arch_reset_signals(smp_processor_id());
        return 0;
 }
 
@@ -539,6 +542,8 @@ static struct pfm_arch_pmu_info pfm_cell
        .restore_pmcs     = pfm_cell_restore_pmcs,
        .ctxswout_thread  = pfm_cell_ctxswout_thread,
        .unload_context   = pfm_cell_unload_context,
+       .reset_signals    = rtas_reset_signals,
+       .activate_signals = rtas_activate_signals,
 };
 
 static struct pfm_pmu_config pfm_cell_pmu_conf = {
@@ -555,8 +560,23 @@ static struct pfm_pmu_config pfm_cell_pm
        .owner = THIS_MODULE,
 };
 
+static inline void pfm_cell_platform_probe(void)
+{
+       if (machine_is(celleb)) {
+               int cnum;
+               pfm_cell_pmu_info.reset_signals = pfm_cell_reset_signals;
+               pfm_cell_pmu_info.activate_signals = pfm_cell_activate_signals;
+               pfm_cell_pmu_conf.pmc_write_check = pfm_cell_pmc_check;
+               for (cnum = NR_CTRS; cnum < (NR_CTRS * 2); cnum++) {
+                       pfm_cell_pmc_desc[cnum].type |= PFM_REG_WC;
+               }
+       }
+}
+
 static int __init pfm_cell_pmu_init_module(void)
 {
+       pfm_cell_platform_probe();
+
        return pfm_pmu_register(&pfm_cell_pmu_conf);
 }
 

_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to