mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 01:07:57 +00:00
hv: timer: add periodic timer setup support
and add MIN_TIMER_PERIOD_US for limit periodic timer frequency. Now it's set to 500 us. Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -1576,7 +1576,7 @@ vlapic_reset(struct vlapic *vlapic)
|
||||
|
||||
vlapic->svr_last = lapic->svr;
|
||||
|
||||
initialize_timer(&vlapic->timer, NULL, NULL, 0);
|
||||
initialize_timer(&vlapic->timer, NULL, NULL, 0, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1974,7 +1974,7 @@ vlapic_wrmsr(struct vcpu *vcpu, uint32_t msr, uint64_t val)
|
||||
|
||||
initialize_timer(&vlapic->timer,
|
||||
tsc_periodic_time, (void *)vcpu,
|
||||
val);
|
||||
val, TICK_MODE_ONESHOT, 0);
|
||||
|
||||
if (add_timer(&vlapic->timer) != 0) {
|
||||
pr_err("failed to add timer on VM %d",
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#define MAX_TIMER_ACTIONS 32
|
||||
#define TIMER_IRQ (NR_MAX_IRQS - 1)
|
||||
#define CAL_MS 10
|
||||
#define MIN_TIMER_PERIOD_US 500
|
||||
|
||||
uint64_t tsc_hz = 1000000000;
|
||||
|
||||
@@ -228,6 +229,12 @@ int timer_softirq(int pcpu_id)
|
||||
|
||||
run_timer(timer);
|
||||
|
||||
if (timer->mode == TICK_MODE_PERIODIC) {
|
||||
timer->fire_tsc += max(timer->period_in_cycle,
|
||||
US_TO_TICKS(MIN_TIMER_PERIOD_US));
|
||||
add_timer(timer);
|
||||
}
|
||||
|
||||
/* search next one */
|
||||
timer = find_expired_timer(cpu_timer, rdtsc());
|
||||
}
|
||||
|
Reference in New Issue
Block a user