[S390] Add ipl/reipl loadparm attribute.
[powerpc.git] / arch / s390 / kernel / vtime.c
index 22a895e..21baaf5 100644 (file)
@@ -7,7 +7,6 @@
  *    Author(s): Jan Glauber <jan.glauber@de.ibm.com>
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/time.h>
@@ -23,6 +22,7 @@
 
 #include <asm/s390_ext.h>
 #include <asm/timer.h>
+#include <asm/irq_regs.h>
 
 static ext_int_info_t ext_int_info_timer;
 DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
@@ -32,7 +32,7 @@ DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
  * Update process times based on virtual cpu times stored by entry.S
  * to the lowcore fields user_timer, system_timer & steal_clock.
  */
-void account_user_vtime(struct task_struct *tsk)
+void account_tick_vtime(struct task_struct *tsk)
 {
        cputime_t cputime;
        __u64 timer, clock;
@@ -72,6 +72,31 @@ void account_user_vtime(struct task_struct *tsk)
        run_posix_cpu_timers(tsk);
 }
 
+/*
+ * Update process times based on virtual cpu times stored by entry.S
+ * to the lowcore fields user_timer, system_timer & steal_clock.
+ */
+void account_vtime(struct task_struct *tsk)
+{
+       cputime_t cputime;
+       __u64 timer;
+
+       timer = S390_lowcore.last_update_timer;
+       asm volatile ("  STPT %0"    /* Store current cpu timer value */
+                     : "=m" (S390_lowcore.last_update_timer) );
+       S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
+
+       cputime = S390_lowcore.user_timer >> 12;
+       S390_lowcore.user_timer -= cputime << 12;
+       S390_lowcore.steal_clock -= cputime << 12;
+       account_user_time(tsk, cputime);
+
+       cputime =  S390_lowcore.system_timer >> 12;
+       S390_lowcore.system_timer -= cputime << 12;
+       S390_lowcore.steal_clock -= cputime << 12;
+       account_system_time(tsk, 0, cputime);
+}
+
 /*
  * Update process times based on virtual cpu times stored by entry.S
  * to the lowcore fields user_timer, system_timer & steal_clock.
@@ -184,11 +209,11 @@ static void list_add_sorted(struct vtimer_list *timer, struct list_head *head)
  * Do the callback functions of expired vtimer events.
  * Called from within the interrupt handler.
  */
-static void do_callbacks(struct list_head *cb_list, struct pt_regs *regs)
+static void do_callbacks(struct list_head *cb_list)
 {
        struct vtimer_queue *vt_list;
        struct vtimer_list *event, *tmp;
-       void (*fn)(unsigned long, struct pt_regs*);
+       void (*fn)(unsigned long);
        unsigned long data;
 
        if (list_empty(cb_list))
@@ -199,7 +224,7 @@ static void do_callbacks(struct list_head *cb_list, struct pt_regs *regs)
        list_for_each_entry_safe(event, tmp, cb_list, entry) {
                fn = event->function;
                data = event->data;
-               fn(data, regs);
+               fn(data);
 
                if (!event->interval)
                        /* delete one shot timer */
@@ -217,7 +242,7 @@ static void do_callbacks(struct list_head *cb_list, struct pt_regs *regs)
 /*
  * Handler for the virtual CPU timer.
  */
-static void do_cpu_timer_interrupt(struct pt_regs *regs, __u16 error_code)
+static void do_cpu_timer_interrupt(__u16 error_code)
 {
        int cpu;
        __u64 next, delta;
@@ -250,7 +275,7 @@ static void do_cpu_timer_interrupt(struct pt_regs *regs, __u16 error_code)
                list_move_tail(&event->entry, &cb_list);
        }
        spin_unlock(&vt_list->lock);
-       do_callbacks(&cb_list, regs);
+       do_callbacks(&cb_list);
 
        /* next event is first in list */
        spin_lock(&vt_list->lock);
@@ -331,7 +356,7 @@ static void internal_add_vtimer(struct vtimer_list *timer)
 
        set_vtimer(event->expires);
        spin_unlock_irqrestore(&vt_list->lock, flags);
-       /* release CPU aquired in prepare_vtimer or mod_virt_timer() */
+       /* release CPU acquired in prepare_vtimer or mod_virt_timer() */
        put_cpu();
 }