apic_timer_x

- set the apic_timer_x factor variable to slowdown apic timer in
  virtual machines
This commit is contained in:
Tomas Hruby 2010-09-16 07:18:47 +00:00
parent 159ca9c8c7
commit 72cc01ff48
3 changed files with 8 additions and 2 deletions

View file

@ -506,7 +506,7 @@ PUBLIC void lapic_set_timer_one_shot(const u32_t usec)
u32_t ticks_per_us; u32_t ticks_per_us;
const u8_t cpu = cpuid; 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; lvtt = APIC_TDCR_1;
lapic_write(LAPIC_TIMER_DCR, lvtt); 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; u32_t lapic_ticks_per_clock_tick;
const u8_t cpu = cpuid; 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; lvtt = APIC_TDCR_1;
lapic_write(LAPIC_TIMER_DCR, lvtt); lapic_write(LAPIC_TIMER_DCR, lvtt);

View file

@ -54,6 +54,7 @@ EXTERN int verboseflags;
#ifdef CONFIG_APIC #ifdef CONFIG_APIC
EXTERN int config_no_apic; /* optionaly turn off apic */ EXTERN int config_no_apic; /* optionaly turn off apic */
EXTERN int config_apic_timer_x; /* apic timer slowdown factor */
#endif #endif
EXTERN u64_t cpu_hz[CONFIG_MAX_CPUS]; EXTERN u64_t cpu_hz[CONFIG_MAX_CPUS];

View file

@ -93,6 +93,11 @@ PUBLIC void cstart(
config_no_apic = atoi(value); config_no_apic = atoi(value);
else else
config_no_apic = 1; 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 #endif
#ifdef CONFIG_WATCHDOG #ifdef CONFIG_WATCHDOG