]> Zhao Yanbai Git Server - minix.git/commitdiff
apic_timer_x
authorTomas Hruby <tom@minix3.org>
Thu, 16 Sep 2010 07:18:47 +0000 (07:18 +0000)
committerTomas Hruby <tom@minix3.org>
Thu, 16 Sep 2010 07:18:47 +0000 (07:18 +0000)
- set the apic_timer_x factor variable to slowdown apic timer in
  virtual machines

kernel/arch/i386/apic.c
kernel/glo.h
kernel/start.c

index 53bad419cf66a7afb07c8223145e12217a3b41cb..c6f2155fad5732567f5cbeff7dd3616beb411971 100644 (file)
@@ -506,7 +506,7 @@ PUBLIC void lapic_set_timer_one_shot(const u32_t usec)
        u32_t ticks_per_us;
        const u8_t cpu = cpuid;
 
-       ticks_per_us = lapic_bus_freq[cpu] / 1000000;
+       ticks_per_us = (lapic_bus_freq[cpu] / 1000000) * config_apic_timer_x;
 
        lvtt = APIC_TDCR_1;
        lapic_write(LAPIC_TIMER_DCR, lvtt);
@@ -525,7 +525,7 @@ PUBLIC void lapic_set_timer_periodic(const unsigned freq)
        u32_t lapic_ticks_per_clock_tick;
        const u8_t cpu = cpuid;
 
-       lapic_ticks_per_clock_tick = lapic_bus_freq[cpu] / freq;
+       lapic_ticks_per_clock_tick = (lapic_bus_freq[cpu] / freq) * config_apic_timer_x;
 
        lvtt = APIC_TDCR_1;
        lapic_write(LAPIC_TIMER_DCR, lvtt);
index fcbd73a94a86994146048ab12df68d23954bad3d..1c9eb5137e87222d7ea82f7eb7d81e38139048c9 100644 (file)
@@ -54,6 +54,7 @@ EXTERN int verboseflags;
 
 #ifdef CONFIG_APIC
 EXTERN int config_no_apic; /* optionaly turn off apic */
+EXTERN int config_apic_timer_x; /* apic timer slowdown factor */
 #endif
 
 EXTERN u64_t cpu_hz[CONFIG_MAX_CPUS];
index 7c6a5cf3cd2c575675bba59f9dd4867641fdcaf8..a39ddb8efd7db93e25d619e53a676aec6ff54892 100644 (file)
@@ -93,6 +93,11 @@ PUBLIC void cstart(
        config_no_apic = atoi(value);
   else
        config_no_apic = 1;
+  value = env_get("apic_timer_x");
+  if(value)
+       config_apic_timer_x = atoi(value);
+  else
+       config_apic_timer_x = 1;
 #endif
 
 #ifdef CONFIG_WATCHDOG