[PATCH] riscv: add ntl_hints.h for non-temporal locality hints

Omer El Idrissi <[email protected]> Tue, 4 Aug 2026 00:55:47 +0200
Newsgroups org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Provides asm volatile wrappers for all NTL hint variants
(P1, PALL, S1, ALL) defined by the Zihintntl extension.

These hints request non-temporal caching behaviour for subsequent
loads and stores.

The new header falls under the existing riscv arch maintainers
in MAINTAINERS, so no separate entry needed.

Signed-off-by: Omer El Idrissi <[email protected]>
---
 arch/riscv/include/asm/ntl_hints.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 arch/riscv/include/asm/ntl_hints.h

diff --git a/arch/riscv/include/asm/ntl_hints.h b/arch/riscv/include/asm/ntl_hints.h
new file mode 100644
index 000000000000..0c51cb8b49c2
--- /dev/null
+++ b/arch/riscv/include/asm/ntl_hints.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_RISCV_NTL_HINTS_H
+#define _ASM_RISCV_NTL_HINTS_H
+
+#define ntl_all()	({ __asm__ __volatile__("add x0, x0, x5" ::: ); })
+#define ntl_p1()	({ __asm__ __volatile__("add x0, x0, x2" ::: ); })
+#define ntl_pall()	({ __asm__ __volatile__("add x0, x0, x3" ::: ); })
+#define ntl_s1()	({ __asm__ __volatile__("add x0, x0, x4" ::: ); })
+
+#endif /* _ASM_RISCV_NTL_HINTS_H */
-- 
2.53.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv