Commit 630f0a33 authored by Philippe Gerum's avatar Philippe Gerum

cobalt/arm: calibrate: prevent excessive delay of next host tick

The calibration procedure overwrites the current value of the timer
counter for a pending oneshot tick event, which is admittedly ok in
the context of initializing Cobalt. However, the previous
implementation maxed the counter value, potentially causing excessive
delay to the host waiting for the overwritten timer event.

Use a shorter delay value when calibrating so that the next shot does
not occur later than one jiffy after we left the calibration
routine. One jiffy is also long enough for preventing the timer to
ever fire while running the calibration loop.
parent 5e46fa9a
......@@ -45,10 +45,9 @@ static void mach_arm_prefault(struct vm_area_struct *vma)
static unsigned long mach_arm_calibrate(void)
{
unsigned long delay = (cobalt_pipeline.timer_freq + HZ / 2) / HZ;
unsigned long long start, end, sum = 0, sum_sq = 0;
volatile unsigned const_delay = 0xffffffff;
unsigned long result, flags, tsc_lat;
unsigned int delay = const_delay;
long long diff;
int i, j;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment