[PATCH 3/5] arm64: refactor delay() to enable polling for value
Okanovic, Haris
harisokn at amazon.com
Wed Nov 6 09:42:38 PST 2024
On Tue, 2024-11-05 at 11:42 -0800, Christoph Lameter (Ampere) wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
>
>
>
> On Tue, 5 Nov 2024, Haris Okanovic wrote:
>
> > -#define USECS_TO_CYCLES(time_usecs) \
> > - xloops_to_cycles((time_usecs) * 0x10C7UL)
> > -
> > -static inline unsigned long xloops_to_cycles(unsigned long xloops)
> > +static inline u64 xloops_to_cycles(u64 xloops)
> > {
> > return (xloops * loops_per_jiffy * HZ) >> 32;
> > }
> >
> > -void __delay(unsigned long cycles)
> > +#define USECS_TO_XLOOPS(time_usecs) \
> > + ((time_usecs) * 0x10C7UL)
> > +
> > +#define USECS_TO_CYCLES(time_usecs) \
> > + xloops_to_cycles(USECS_TO_XLOOPS(time_usecs))
> > +
>
>
> > +#define NSECS_TO_XLOOPS(time_nsecs) \
> > + ((time_nsecs) * 0x10C7UL)
>
> The constant here is the same value as for microseconds. If I remember
> correctly its 5UL for nanoseconds.
>
You're right, good catch. Should be `nsecs * 0x5UL` per old code.
More information about the linux-arm-kernel
mailing list