Re: [PATCH] riscv: add ntl_hints.h for non-temporal locality hints
From: Vivian Wang
Date: Mon Aug 03 2026 - 19:32:02 EST
On 8/4/26 06:55, Omer El Idrissi wrote:
> Provides asm volatile wrappers for all NTL hint variants
> (P1, PALL, S1, ALL) defined by the Zihintntl extension.
Doesn't seem to be used anywhere? That's a NAK from me.
> 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 <omer.e.idrissi@xxxxxxxxx>
> ---
> 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" ::: ); })
And there's no way these would correctly do anything anyway. The
non-temporal hints must come exactly before a load instruction, which
your asm blocks don't provide.
> +
> +#endif /* _ASM_RISCV_NTL_HINTS_H */
If you need this anywhere, roll this into the same patch series where
you use these hints. And you want to be sure to use them *correctly*.
Vivian "dramforever" Wang