git: e1c77d783206 - main - arm64: add inline functions for FEAT_WFxT instructions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Jan 2025 17:27:27 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=e1c77d783206bceee1f8d5fcbb0b3df214b4b282
commit e1c77d783206bceee1f8d5fcbb0b3df214b4b282
Author: Harry Moulton <harry.moulton@arm.com>
AuthorDate: 2025-01-23 12:27:28 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-01-23 17:26:25 +0000
arm64: add inline functions for FEAT_WFxT instructions
This adds inline functions for WFET/WFIT instructions introduced with
ARMv8.7 FEAT_WFxT. These instructions allow for regular WFE/WFI
instructions to be bound by a timeout. Once the value of CNTVCT_EL0
reaches, or exceeds, that of the timeout value, the WFE/WFI state will
be exited and the PE will continue.
These instructions are implemented as inline functions, with a write to
the corresponding system register acting as an alias for the two
instructions. Writing to these registers is only valid on ARMv8.7 and
above, therefore the use of these functions must be guarded by a feature
check.
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48579
Signed-off-by: Harry Moulton <harry.moulton@arm.com>
---
sys/arm64/include/cpufunc.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h
index ba712f48b262..c948799eb7b9 100644
--- a/sys/arm64/include/cpufunc.h
+++ b/sys/arm64/include/cpufunc.h
@@ -160,6 +160,26 @@ invalidate_local_icache(void)
"isb \n");
}
+static __inline void
+wfet(uint64_t val)
+{
+ __asm __volatile(
+ "msr s0_3_c1_c0_0, %0\n"
+ :
+ : "r" ((val))
+ : "memory");
+}
+
+static __inline void
+wfit(uint64_t val)
+{
+ __asm __volatile(
+ "msr s0_3_c1_c0_1, %0\n"
+ :
+ : "r" ((val))
+ : "memory");
+}
+
extern bool icache_aliasing;
extern bool icache_vmid;