[PATCH 2/2] prefetch: Add ARCH_HAS_PREFETCH definition when the architecture is not defined

From: Youling Tang
Date: Tue May 28 2024 - 23:22:21 EST


From: Youling Tang <tangyouling@xxxxxxxxxx>

After commit ab483570a13b ("x86 & generic: change to __builtin_prefetch()"), the
__builtin_prefetch implementation will be used by default, so add its definition
to return to a state similar to before commit[1].

Currently prefetch_range() will be empty implemented under the x86_64 architecture,
there was a concrete implementation before "x86 & generic: change to
__builtin_prefetch()", so fix it.

No similar changes have been made to ARCH_HAS_PREFETCHW at this time.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/include/linux/prefetch.h?id=8e4f2fd31bf737abb392e694898a1496157623b5

Fixes: ab483570a13b ("x86 & generic: change to __builtin_prefetch()")
Signed-off-by: Youling Tang <tangyouling@xxxxxxxxxx>
---
include/linux/prefetch.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h
index b068e2e60939..162b7105e37c 100644
--- a/include/linux/prefetch.h
+++ b/include/linux/prefetch.h
@@ -36,6 +36,7 @@ struct page;
*/

#ifndef ARCH_HAS_PREFETCH
+#define ARCH_HAS_PREFETCH
#define prefetch(x) __builtin_prefetch(x)
#endif

--
2.34.1