k1om: fixing initialization of apic timer interrupts
authorReto Achermann <reto.achermann@inf.ethz.ch>
Sun, 23 Jul 2017 20:25:25 +0000 (22:25 +0200)
committerReto Achermann <reto.achermann@inf.ethz.ch>
Sun, 23 Jul 2017 20:25:25 +0000 (22:25 +0200)
Signed-off-by: Reto Achermann <reto.achermann@inf.ethz.ch>

kernel/arch/k1om/init.c

index 688bb01..a0579bc 100644 (file)
@@ -43,7 +43,7 @@
 #include <barrelfish_kpi/asm_inlines_arch.h>
 #include <coreboot.h>
 #include <kcb.h>
-
+#include <systime.h>
 #include <xeon_phi.h>
 #include <xeon_phi/xeon_phi.h>
 
@@ -509,17 +509,15 @@ static void  __attribute__ ((noreturn, noinline)) text_init(void)
     // do not remove/change this printf: needed by regression harness
     printf("Barrelfish CPU driver starting on k1om apic_id %u\n", apic_id);
 
-
     // Initialize local APIC timer
     if (kernel_ticks_enabled) {
         timing_calibrate();
-        bool periodic = true;
-        #ifdef CONFIG_ONESHOT_TIMER
-        // we probably need a global variable like kernel_ticks_enabled
-        periodic = false;
-        #endif
-        apic_timer_init(false, periodic);
-        timing_apic_timer_set_ms(kernel_timeslice);
+        apic_timer_init(false, false);
+        apic_timer_set_divide(xapic_by1);
+        kernel_timeslice = ns_to_systime(config_timeslice * 1000000);
+#ifndef CONFIG_ONESHOT_TIMER
+        systime_set_timeout(systime_now() + kernel_timeslice);
+#endif
     } else {
         printk(LOG_WARN, "APIC timer disabled: NO timeslicing\n");
         apic_mask_timer();