DPDK patches and discussions
 help / color / mirror / Atom feed
From: Daniel Gregory <daniel.gregory@bytedance.com>
To: Stanislaw Kardach <stanislaw.kardach@gmail.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>,
	dev@dpdk.org, Liang Ma <liangma@liangbit.com>,
	Punit Agrawal <punit.agrawal@bytedance.com>,
	Daniel Gregory <daniel.gregory@bytedance.com>
Subject: [PATCH 1/2] eal: add flag to hide generic prefetch_write
Date: Thu, 30 May 2024 18:19:47 +0100	[thread overview]
Message-ID: <20240530171948.19763-2-daniel.gregory@bytedance.com> (raw)
In-Reply-To: <20240530171948.19763-1-daniel.gregory@bytedance.com>

This allows for the definition of architecture-specific implementations
of the rte_prefetch*_write collection of functions by defining
RTE_PREFETCH_WRITE_ARCH_DEFINED.

Signed-off-by: Daniel Gregory <daniel.gregory@bytedance.com>
---
 lib/eal/include/generic/rte_prefetch.h | 47 +++++++++++++++++---------
 1 file changed, 31 insertions(+), 16 deletions(-)

diff --git a/lib/eal/include/generic/rte_prefetch.h b/lib/eal/include/generic/rte_prefetch.h
index f9fab5e359..5558376cba 100644
--- a/lib/eal/include/generic/rte_prefetch.h
+++ b/lib/eal/include/generic/rte_prefetch.h
@@ -65,14 +65,7 @@ static inline void rte_prefetch_non_temporal(const volatile void *p);
  */
 __rte_experimental
 static inline void
-rte_prefetch0_write(const void *p)
-{
-	/* 1 indicates intention to write, 3 sets target cache level to L1. See
-	 * GCC docs where these integer constants are described in more detail:
-	 *  https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
-	 */
-	__builtin_prefetch(p, 1, 3);
-}
+rte_prefetch0_write(const void *p);
 
 /**
  * @warning
@@ -86,14 +79,7 @@ rte_prefetch0_write(const void *p)
  */
 __rte_experimental
 static inline void
-rte_prefetch1_write(const void *p)
-{
-	/* 1 indicates intention to write, 2 sets target cache level to L2. See
-	 * GCC docs where these integer constants are described in more detail:
-	 *  https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
-	 */
-	__builtin_prefetch(p, 1, 2);
-}
+rte_prefetch1_write(const void *p);
 
 /**
  * @warning
@@ -105,6 +91,33 @@ rte_prefetch1_write(const void *p)
  *
  * @param p Address to prefetch
  */
+__rte_experimental
+static inline void
+rte_prefetch2_write(const void *p);
+
+#ifndef RTE_PREFETCH_WRITE_ARCH_DEFINED
+__rte_experimental
+static inline void
+rte_prefetch0_write(const void *p)
+{
+	/* 1 indicates intention to write, 3 sets target cache level to L1. See
+	 * GCC docs where these integer constants are described in more detail:
+	 *  https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
+	 */
+	__builtin_prefetch(p, 1, 3);
+}
+
+__rte_experimental
+static inline void
+rte_prefetch1_write(const void *p)
+{
+	/* 1 indicates intention to write, 2 sets target cache level to L2. See
+	 * GCC docs where these integer constants are described in more detail:
+	 *  https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
+	 */
+	__builtin_prefetch(p, 1, 2);
+}
+
 __rte_experimental
 static inline void
 rte_prefetch2_write(const void *p)
@@ -116,6 +129,8 @@ rte_prefetch2_write(const void *p)
 	__builtin_prefetch(p, 1, 1);
 }
 
+#endif /* RTE_PREFETCH_WRITE_ARCH_DEFINED */
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
-- 
2.39.2


  reply	other threads:[~2024-05-30 17:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30 17:19 [PATCH 0/2] eal/riscv: implement prefetch using zicbop Daniel Gregory
2024-05-30 17:19 ` Daniel Gregory [this message]
2024-05-30 17:19 ` [PATCH 2/2] eal/riscv: add support for zicbop extension Daniel Gregory
2024-05-31  8:49   ` Daniel Gregory

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240530171948.19763-2-daniel.gregory@bytedance.com \
    --to=daniel.gregory@bytedance.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=liangma@liangbit.com \
    --cc=punit.agrawal@bytedance.com \
    --cc=roretzla@linux.microsoft.com \
    --cc=stanislaw.kardach@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).