Hi Umesh,
...
> @@ -171,7 +173,12 @@ static u32 read_clock_frequency(struct intel_uncore
> *uncore)
>
> void intel_gt_init_clock_frequency(struct intel_gt *gt)
> {
> + unsigned long clock_period_scale;
> +
> gt->clock_frequency = read_clock_frequency(gt->uncore);
Shall we add a paranoid check here to raise a warning if
clock_frequency is '0'?
It should never happen, but for robustness I would suggest:
GEM_WARN_ON(!gt->clock_frequency);
(or even BUG_ON, though that might be overkill).
Andi
> + clock_period_scale = gcd(NSEC_PER_SEC, gt->clock_frequency);
> + gt->clock_nsec_scaled = NSEC_PER_SEC / clock_period_scale;
> + gt->clock_freq_scaled = gt->clock_frequency / clock_period_scale;
>
> /* Icelake appears to use another fixed frequency for CTX_TIMESTAMP */
> if (GRAPHICS_VER(gt->i915) == 11)