]> Pileus Git - ~andy/linux/blobdiff - arch/powerpc/kernel/process.c
Merge branch 'linus'
[~andy/linux] / arch / powerpc / kernel / process.c
index 1f816f0d7740eb4e7a9601a34faabcb9f4995a69..1770a066c2176f71afa3e736904d8744bf0e0b84 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  arch/ppc/kernel/process.c
- *
  *  Derived from "arch/i386/kernel/process.c"
  *    Copyright (C) 1995  Linus Torvalds
  *
@@ -47,9 +45,9 @@
 #include <asm/mmu.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
+#include <asm/time.h>
 #ifdef CONFIG_PPC64
 #include <asm/firmware.h>
-#include <asm/time.h>
 #endif
 
 extern unsigned long _get_SP(void);
@@ -201,13 +199,13 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
 }
 #endif /* CONFIG_SPE */
 
+#ifndef CONFIG_SMP
 /*
  * If we are doing lazy switching of CPU state (FP, altivec or SPE),
  * and the current task has some state, discard it.
  */
-static inline void discard_lazy_cpu_state(void)
+void discard_lazy_cpu_state(void)
 {
-#ifndef CONFIG_SMP
        preempt_disable();
        if (last_task_used_math == current)
                last_task_used_math = NULL;
@@ -220,9 +218,10 @@ static inline void discard_lazy_cpu_state(void)
                last_task_used_spe = NULL;
 #endif
        preempt_enable();
-#endif /* CONFIG_SMP */
 }
+#endif /* CONFIG_SMP */
 
+#ifdef CONFIG_PPC_MERGE                /* XXX for now */
 int set_dabr(unsigned long dabr)
 {
        if (ppc_md.set_dabr)
@@ -231,6 +230,7 @@ int set_dabr(unsigned long dabr)
        mtspr(SPRN_DABR, dabr);
        return 0;
 }
+#endif
 
 #ifdef CONFIG_PPC64
 DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
@@ -328,6 +328,11 @@ struct task_struct *__switch_to(struct task_struct *prev,
 #endif
 
        local_irq_save(flags);
+
+       account_system_vtime(current);
+       account_process_vtime(current);
+       calculate_steal_time();
+
        last = _switch(old_thread, new_thread);
 
        local_irq_restore(flags);
@@ -886,3 +891,35 @@ void dump_stack(void)
        show_stack(current, NULL);
 }
 EXPORT_SYMBOL(dump_stack);
+
+#ifdef CONFIG_PPC64
+void ppc64_runlatch_on(void)
+{
+       unsigned long ctrl;
+
+       if (cpu_has_feature(CPU_FTR_CTRL) && !test_thread_flag(TIF_RUNLATCH)) {
+               HMT_medium();
+
+               ctrl = mfspr(SPRN_CTRLF);
+               ctrl |= CTRL_RUNLATCH;
+               mtspr(SPRN_CTRLT, ctrl);
+
+               set_thread_flag(TIF_RUNLATCH);
+       }
+}
+
+void ppc64_runlatch_off(void)
+{
+       unsigned long ctrl;
+
+       if (cpu_has_feature(CPU_FTR_CTRL) && test_thread_flag(TIF_RUNLATCH)) {
+               HMT_medium();
+
+               clear_thread_flag(TIF_RUNLATCH);
+
+               ctrl = mfspr(SPRN_CTRLF);
+               ctrl &= ~CTRL_RUNLATCH;
+               mtspr(SPRN_CTRLT, ctrl);
+       }
+}
+#endif