]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/s390/kernel/vtime.c
Merge branch 'reset-seq' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libat...
[linux-2.6-omap-h63xx.git] / arch / s390 / kernel / vtime.c
index 2306cd83fca125f2f995a482f51ac54297bd6e81..1e1a6ee2cac174b163aa8684eb70a92b5e64ff37 100644 (file)
 
 #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);
+static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
 /*
@@ -127,7 +128,7 @@ static inline void set_vtimer(__u64 expires)
        S390_lowcore.last_update_timer = expires;
 
        /* store expire time for this CPU timer */
-       per_cpu(virt_cpu_timer, smp_processor_id()).to_expire = expires;
+       __get_cpu_var(virt_cpu_timer).to_expire = expires;
 }
 #else
 static inline void set_vtimer(__u64 expires)
@@ -136,7 +137,7 @@ static inline void set_vtimer(__u64 expires)
        asm volatile ("SPT %0" : : "m" (S390_lowcore.last_update_timer));
 
        /* store expire time for this CPU timer */
-       per_cpu(virt_cpu_timer, smp_processor_id()).to_expire = expires;
+       __get_cpu_var(virt_cpu_timer).to_expire = expires;
 }
 #endif
 
@@ -144,7 +145,7 @@ static void start_cpu_timer(void)
 {
        struct vtimer_queue *vt_list;
 
-       vt_list = &per_cpu(virt_cpu_timer, smp_processor_id());
+       vt_list = &__get_cpu_var(virt_cpu_timer);
 
        /* CPU timer interrupt is pending, don't reprogramm it */
        if (vt_list->idle & 1LL<<63)
@@ -158,7 +159,7 @@ static void stop_cpu_timer(void)
 {
        struct vtimer_queue *vt_list;
 
-       vt_list = &per_cpu(virt_cpu_timer, smp_processor_id());
+       vt_list = &__get_cpu_var(virt_cpu_timer);
 
        /* nothing to do */
        if (list_empty(&vt_list->list)) {
@@ -208,22 +209,22 @@ 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))
                return;
 
-       vt_list = &per_cpu(virt_cpu_timer, smp_processor_id());
+       vt_list = &__get_cpu_var(virt_cpu_timer);
 
        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 */
@@ -241,9 +242,8 @@ 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;
        struct vtimer_queue *vt_list;
        struct vtimer_list *event, *tmp;
@@ -252,8 +252,7 @@ static void do_cpu_timer_interrupt(struct pt_regs *regs, __u16 error_code)
        struct list_head cb_list;
 
        INIT_LIST_HEAD(&cb_list);
-       cpu = smp_processor_id();
-       vt_list = &per_cpu(virt_cpu_timer, cpu);
+       vt_list = &__get_cpu_var(virt_cpu_timer);
 
        /* walk timer list, fire all expired events */
        spin_lock(&vt_list->lock);
@@ -274,7 +273,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);
@@ -523,18 +522,17 @@ EXPORT_SYMBOL(del_virt_timer);
 void init_cpu_vtimer(void)
 {
        struct vtimer_queue *vt_list;
-       unsigned long cr0;
 
        /* kick the virtual timer */
        S390_lowcore.exit_timer = VTIMER_MAX_SLICE;
        S390_lowcore.last_update_timer = VTIMER_MAX_SLICE;
        asm volatile ("SPT %0" : : "m" (S390_lowcore.last_update_timer));
        asm volatile ("STCK %0" : "=m" (S390_lowcore.last_update_clock));
-       __ctl_store(cr0, 0, 0);
-       cr0 |= 0x400;
-       __ctl_load(cr0, 0, 0);
 
-       vt_list = &per_cpu(virt_cpu_timer, smp_processor_id());
+       /* enable cpu timer interrupts */
+       __ctl_set_bit(0,10);
+
+       vt_list = &__get_cpu_var(virt_cpu_timer);
        INIT_LIST_HEAD(&vt_list->list);
        spin_lock_init(&vt_list->lock);
        vt_list->to_expire = 0;
@@ -571,6 +569,7 @@ void __init vtime_init(void)
        if (register_idle_notifier(&vtimer_idle_nb))
                panic("Couldn't register idle notifier");
 
+       /* Enable cpu timer interrupts on the boot cpu. */
        init_cpu_vtimer();
 }