From: Cong Wang <xiyou.wangcong@gmail.com>
To: linux-kernel@vger.kernel.org, Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>
Cc: Andy Chiu <tchiu@tenstorrent.com>,
daichengrong <daichengrong@iscas.ac.cn>,
Troy Mitchell <troy@kernel.org>,
linux-riscv@lists.infradead.org, Cong Wang <cwang@multikernel.io>
Subject: [RFC PATCH 1/2] riscv: lib: Give the scalar memcpy() body a symbol of its own
Date: Tue, 1 Dec 2026 20:03:43 -0800 [thread overview]
Message-ID: <20261202040344.1259264-2-xiyou.wangcong@gmail.com> (raw)
In-Reply-To: <20261202040344.1259264-1-xiyou.wangcong@gmail.com>
From: Cong Wang <cwang@multikernel.io>
memcpy() and __memcpy() are about to become an entry point that may hand
large copies to a vector routine. Three users must keep reaching the
scalar code directly: the purgatory, which builds memcpy.S into an image
with no kernel symbols and no alternatives patching, the __pi_ aliases
used by position independent early boot code, and the fallback of the
vector routine itself.
Name the scalar body __memcpy_scalar and make the existing names aliases
of it. No functional change.
Signed-off-by: Cong Wang <cwang@multikernel.io>
Reviewed-by: Troy Mitchell <troy@kernel.org>
---
arch/riscv/lib/memcpy.S | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/riscv/lib/memcpy.S b/arch/riscv/lib/memcpy.S
index 44e009ec5fef..6f1d3681fecf 100644
--- a/arch/riscv/lib/memcpy.S
+++ b/arch/riscv/lib/memcpy.S
@@ -7,7 +7,7 @@
#include <asm/asm.h>
/* void *memcpy(void *, const void *, size_t) */
-SYM_FUNC_START(__memcpy)
+SYM_FUNC_START(__memcpy_scalar)
move t6, a0 /* Preserve return value */
/* Defer to byte-oriented copy for small sizes */
@@ -104,7 +104,8 @@ SYM_FUNC_START(__memcpy)
bltu a1, a3, 5b
6:
ret
-SYM_FUNC_END(__memcpy)
+SYM_FUNC_END(__memcpy_scalar)
+SYM_FUNC_ALIAS(__memcpy, __memcpy_scalar)
SYM_FUNC_ALIAS_WEAK(memcpy, __memcpy)
-SYM_FUNC_ALIAS(__pi_memcpy, __memcpy)
-SYM_FUNC_ALIAS(__pi___memcpy, __memcpy)
+SYM_FUNC_ALIAS(__pi_memcpy, __memcpy_scalar)
+SYM_FUNC_ALIAS(__pi___memcpy, __memcpy_scalar)
--
2.43.0
next prev parent reply other threads:[~2026-12-02 4:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 4:03 [RFC PATCH 0/2] riscv: Use the vector registers for large memcpy() Cong Wang
2026-12-02 4:03 ` Cong Wang [this message]
2026-12-02 4:03 ` [RFC PATCH 2/2] riscv: lib: " Cong Wang
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=20261202040344.1259264-2-xiyou.wangcong@gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=cwang@multikernel.io \
--cc=daichengrong@iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=tchiu@tenstorrent.com \
--cc=troy@kernel.org \
/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
all inboxes | Powered by JetHome®