[PATCH v2 0/2] Optimize udelay for aarch64 boards

Peter Hoyes peter.hoyes at arm.com
Wed May 1 10:16:31 CEST 2024


Arm boards currently use the default implementation of __udelay which
consists of a spin-loop. AArch64 however provides an architectural
timer with an event stream which can be enabled and waited upon with
a few lines of assembly. This is more efficient and also avoids
an issue on Arm FVPs where polling the counter frequently takes much
longer than real-time.

Therefore, overrride __udelay for all armv8 boards to use the event
stream.

Macros for the relevant instructions already existed for mach-exynos,
so pull these up to a common header file.

I have tested this patch chain on qemu-system-aarch64
(virt,secure=on), FVP_Base_RevC and a Raspberry Pi 4.

Peter Hoyes (2):
  arm: Move sev() and wfe() definitions to common Arm header file
  armv8: generic_timer: Use event stream for udelay

 arch/arm/cpu/armv8/Kconfig                 |  8 +++++++
 arch/arm/cpu/armv8/generic_timer.c         | 27 ++++++++++++++++++++++
 arch/arm/include/asm/system.h              | 15 ++++++++++--
 arch/arm/mach-exynos/include/mach/system.h | 19 ---------------
 4 files changed, 48 insertions(+), 21 deletions(-)

-- 
2.34.1



More information about the U-Boot mailing list