Re: [PATCH v7 01/24] KVM: arm64: Add a generic clock
From: Vincent Donnefort
Date: Wed Jul 15 2026 - 10:52:27 EST
[...]
> > #define smmu_wait() {
> > static u32 window = arch_timer_get_cntfrq() / ARM_SMMU_EL2_POLL_TIMEOUT_US
> > u64 timeout = __arch_counter_get_cntvct() + window;
> > u64 cur;
> >
> > ...
> >
> > while (!(__cond)) {
> > ...
> >
> > cur = __arch_counter_get_cntvct();
> > if (cur >= timeout)
> > __ret = -ETIMEOUT;
> >
> >
> > No risk of overflowing u64
> > No init necessary
>
> It believe init will be needed as caching arch_timer_get_cntfrq()
> is much better that re-reading everytime. But I can make all of this
> contained in the SMMUv3 driver and remove this patch.
That's why I have made window static :) (well of course it is per callsite...)
>
> Thanks,
> Mostafa
>