From: Jerin Jacob Date: Fri, 12 Feb 2016 11:13:50 +0000 (+0530) Subject: eal: introduce non-temporal prefetch X-Git-Tag: spdx-start~7635 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ab3af0959d5e0dc2135ac0ae2847cc5d6006473a;p=dpdk.git eal: introduce non-temporal prefetch non-temporal/transient/stream version of rte_prefetch0() The non-temporal prefetch is intended as a prefetch hint that processor will use the prefetched data only once or short period, unlike the rte_prefetch0() function which imply that prefetched data to use repeatedly. Signed-off-by: Jerin Jacob Acked-by: Jan Viktorin --- diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h b/lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h index b716384ac5..5aeed22d05 100644 --- a/lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h +++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h @@ -54,6 +54,12 @@ static inline void rte_prefetch2(const volatile void *p) asm volatile ("pld [%0]" : : "r" (p)); } +static inline void rte_prefetch_non_temporal(const volatile void *p) +{ + /* non-temporal version not available, fallback to rte_prefetch0 */ + rte_prefetch0(p); +} + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h index f9cc62ee89..3ed46a46ff 100644 --- a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h +++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h @@ -54,6 +54,11 @@ static inline void rte_prefetch2(const volatile void *p) asm volatile ("PRFM PLDL3KEEP, [%0]" : : "r" (p)); } +static inline void rte_prefetch_non_temporal(const volatile void *p) +{ + asm volatile ("PRFM PLDL1STRM, [%0]" : : "r" (p)); +} + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h b/lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h index fea3be1a88..bcc7185c2b 100644 --- a/lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h @@ -54,6 +54,12 @@ static inline void rte_prefetch2(const volatile void *p) asm volatile ("dcbt 0,%[p],1" : : [p] "r" (p)); } +static inline void rte_prefetch_non_temporal(const volatile void *p) +{ + /* non-temporal version not available, fallback to rte_prefetch0 */ + rte_prefetch0(p); +} + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/include/arch/tile/rte_prefetch.h b/lib/librte_eal/common/include/arch/tile/rte_prefetch.h index c94075c60d..7a1bb93e5c 100644 --- a/lib/librte_eal/common/include/arch/tile/rte_prefetch.h +++ b/lib/librte_eal/common/include/arch/tile/rte_prefetch.h @@ -54,6 +54,12 @@ static inline void rte_prefetch2(const volatile void *p) __builtin_prefetch((const void *)(uintptr_t)p, 0, 1); } +static inline void rte_prefetch_non_temporal(const volatile void *p) +{ + /* non-temporal version not available, fallback to rte_prefetch0 */ + rte_prefetch0(p); +} + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/include/arch/x86/rte_prefetch.h b/lib/librte_eal/common/include/arch/x86/rte_prefetch.h index 8e6e02ccf5..5dac47ebd4 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_prefetch.h +++ b/lib/librte_eal/common/include/arch/x86/rte_prefetch.h @@ -55,6 +55,11 @@ static inline void rte_prefetch2(const volatile void *p) asm volatile ("prefetcht2 %[p]" : : [p] "m" (*(const volatile char *)p)); } +static inline void rte_prefetch_non_temporal(const volatile void *p) +{ + asm volatile ("prefetchnta %[p]" : : [p] "m" (*(const volatile char *)p)); +} + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/include/generic/rte_prefetch.h b/lib/librte_eal/common/include/generic/rte_prefetch.h index 725715ff6e..07e409ece7 100644 --- a/lib/librte_eal/common/include/generic/rte_prefetch.h +++ b/lib/librte_eal/common/include/generic/rte_prefetch.h @@ -68,4 +68,16 @@ static inline void rte_prefetch1(const volatile void *p); */ static inline void rte_prefetch2(const volatile void *p); +/** + * Prefetch a cache line into all cache levels (non-temporal/transient version) + * + * The non-temporal prefetch is intended as a prefetch hint that processor will + * use the prefetched data only once or short period, unlike the + * rte_prefetch0() function which imply that prefetched data to use repeatedly. + * + * @param p + * Address to prefetch + */ +static inline void rte_prefetch_non_temporal(const volatile void *p); + #endif /* _RTE_PREFETCH_H_ */