On Thu, Oct 09, 2025 at 02:24:52PM +0200, Andi Shyti wrote:
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:
I did post that change, but BAT fails for PNV since clock_frequency is 0
on PNV (gen3). I will use this version without the check.
Thanks,
Umesh
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)