Re: [PATCH] x86, apic: Add apic calibration hook.

From: Alok Kataria
Date: Tue Aug 24 2010 - 13:06:12 EST


Hi Thomas,

Thanks for taking a look.

On Tue, 2010-08-24 at 06:37 -0700, Thomas Gleixner wrote:
> On Wed, 18 Aug 2010, Alok Kataria wrote:
> >
> > +static void __init initialize_lapic_clkevt(long delta)
> > +{
> > + /* Calculate the scaled math multiplication factor */
> > + lapic_clockevent.mult = div_sc(delta, TICK_NSEC * LAPIC_CAL_LOOPS,
> > + lapic_clockevent.shift);
> > + lapic_clockevent.max_delta_ns =
> > + clockevent_delta2ns(0x7FFFFF, &lapic_clockevent);
> > + lapic_clockevent.min_delta_ns =
> > + clockevent_delta2ns(0xF, &lapic_clockevent);
> > +}
> > +
> > static int __init calibrate_APIC_clock(void)
> > {
> > + apic_calibration_res = x86_init.timers.calibrate_apic();
> > + if (apic_calibration_res) {
> > + struct clock_event_device *levt = &__get_cpu_var(lapic_events);
> > + long delta;
> > +
> > + if (lapic_clockevent.mult)
> > + return 0;
>
> Why is this necessary ? calibrate_APIC_clock() is only called once.
>

Yes, though timer.calibrate_apci() could behave differently on different
platforms. For eg. the vmware_calibrate_apic doesn't initialize any of
the lapic_clockevent state and we need this to set it up in that case.

Thanks,
Alok

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/