[PATCH] eal/riscv: implement prefetch using __builtin_prefetch

Stephen Hemminger stephen at networkplumber.org
Tue Sep 15 15:22:33 CEST 2026


On Tue, 10 Mar 2026 21:35:24 +0800
dangshiwei <1138222970gg at gmail.com> wrote:

> RISC-V currently has no-op implementations of the rte_prefetch*
> functions. Use __builtin_prefetch() to allow the compiler to emit
> Zicbop prefetch instructions when the target supports them (GCC
> 13.1+, Clang 17.0.1+ with -march=rv*_zicbop).
> 
> The Zicbop extension has no cache-level hints, so rte_prefetch1()
> and rte_prefetch2() fall back to rte_prefetch0(). The volatile
> qualifier is stripped via uintptr_t cast to satisfy
> __builtin_prefetch()'s const void * parameter without triggering
> -Wdiscarded-qualifiers.
> 
> This replaces the abandoned v1 series by Daniel Gregory
> (Message-ID: 20240530171948.19763-1-daniel.gregory at bytedance.com)
> addressing reviewer feedback from Kardach and Hemminger.
> 
> Signed-off-by: dangshiwei <1138222970gg at gmail.com>
> ---

There is another patch for x86 that does same thing.
https://patchwork.dpdk.org/project/dpdk/patch/20250223125215.358925-2-mattias.ronnblom@ericsson.com/

Would be good to have single common file for all arch.


More information about the dev mailing list