[PATCH v7 01/24] KVM: arm64: Add a generic clock

Vincent Donnefort vdonnefort at google.com
Wed Jul 15 07:34:09 PDT 2026


[...]

> > #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
> 



More information about the linux-arm-kernel mailing list