From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Cc: <catalin.marinas@arm.com>, <will@kernel.org>,
<guohanjun@huawei.com>, <yangyingliang@huawei.com>
Subject: [PATCH 1/3] arm64: lib: introduce ldp2/stp2 macro
Date: Tue, 23 Mar 2021 15:34:30 +0800 [thread overview]
Message-ID: <20210323073432.3422227-2-yangyingliang@huawei.com> (raw)
In-Reply-To: <20210323073432.3422227-1-yangyingliang@huawei.com>
Introduce ldp2/stp2 to load/store without add src/dst.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
arch/arm64/include/asm/asm-uaccess.h | 16 ++++++++++++++++
arch/arm64/lib/copy_from_user.S | 8 ++++++++
arch/arm64/lib/copy_in_user.S | 8 ++++++++
arch/arm64/lib/copy_to_user.S | 8 ++++++++
arch/arm64/lib/memcpy.S | 8 ++++++++
5 files changed, 48 insertions(+)
diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h
index ccedf548dac9..129c08621df1 100644
--- a/arch/arm64/include/asm/asm-uaccess.h
+++ b/arch/arm64/include/asm/asm-uaccess.h
@@ -72,6 +72,14 @@ alternative_else_nop_endif
_asm_extable 8889b,\l;
.endm
+ .macro user_ldp2 l, reg1, reg2, addr, post_inc1, post_inc2
+8888: ldtr \reg1, [\addr, \post_inc1];
+8889: ldtr \reg2, [\addr, \post_inc2];
+
+ _asm_extable 8888b,\l;
+ _asm_extable 8889b,\l;
+ .endm
+
.macro user_stp l, reg1, reg2, addr, post_inc
8888: sttr \reg1, [\addr];
8889: sttr \reg2, [\addr, #8];
@@ -81,6 +89,14 @@ alternative_else_nop_endif
_asm_extable 8889b,\l;
.endm
+ .macro user_stp2 l, reg1, reg2, addr, post_inc1, post_inc2
+8888: sttr \reg1, [\addr, \post_inc1];
+8889: sttr \reg2, [\addr, \post_inc2];
+
+ _asm_extable 8888b,\l;
+ _asm_extable 8889b,\l;
+ .endm
+
.macro user_ldst l, inst, reg, addr, post_inc
8888: \inst \reg, [\addr];
add \addr, \addr, \post_inc;
diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S
index 95cd62d67371..37308bcb338e 100644
--- a/arch/arm64/lib/copy_from_user.S
+++ b/arch/arm64/lib/copy_from_user.S
@@ -48,10 +48,18 @@
user_ldp 9998f, \reg1, \reg2, \ptr, \val
.endm
+ .macro ldp2 reg1, reg2, ptr, val1, val2
+ user_ldp2 9998f, \reg1, \reg2, \ptr, \val1, \val2
+ .endm
+
.macro stp1 reg1, reg2, ptr, val
stp \reg1, \reg2, [\ptr], \val
.endm
+ .macro stp2 reg1, reg2, ptr, val1, val2
+ stp \reg1, \reg2, [\ptr, \val1]
+ .endm
+
end .req x5
SYM_FUNC_START(__arch_copy_from_user)
add end, x0, x2
diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S
index 1f61cd0df062..5654f7098102 100644
--- a/arch/arm64/lib/copy_in_user.S
+++ b/arch/arm64/lib/copy_in_user.S
@@ -49,10 +49,18 @@
user_ldp 9998f, \reg1, \reg2, \ptr, \val
.endm
+ .macro ldp2 reg1, reg2, ptr, val1, val2
+ user_ldp2 9998f, \reg1, \reg2, \ptr, \val1, \val2
+ .endm
+
.macro stp1 reg1, reg2, ptr, val
user_stp 9998f, \reg1, \reg2, \ptr, \val
.endm
+ .macro stp2 reg1, reg2, ptr, val1, val2
+ user_stp2 9998f, \reg1, \reg2, \ptr, \val1, \val2
+ .endm
+
end .req x5
SYM_FUNC_START(__arch_copy_in_user)
diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S
index 043da90f5dd7..a1f95169ce04 100644
--- a/arch/arm64/lib/copy_to_user.S
+++ b/arch/arm64/lib/copy_to_user.S
@@ -47,10 +47,18 @@
ldp \reg1, \reg2, [\ptr], \val
.endm
+ .macro ldp2 reg1, reg2, ptr, val1, val2
+ ldp \reg1, \reg2, [\ptr, \val1]
+ .endm
+
.macro stp1 reg1, reg2, ptr, val
user_stp 9998f, \reg1, \reg2, \ptr, \val
.endm
+ .macro stp2 reg1, reg2, ptr, val1, val2
+ user_stp2 9998f, \reg1, \reg2, \ptr, \val1, \val2
+ .endm
+
end .req x5
SYM_FUNC_START(__arch_copy_to_user)
add end, x0, x2
diff --git a/arch/arm64/lib/memcpy.S b/arch/arm64/lib/memcpy.S
index dc8d2a216a6e..9e0bfefd2673 100644
--- a/arch/arm64/lib/memcpy.S
+++ b/arch/arm64/lib/memcpy.S
@@ -52,10 +52,18 @@
ldp \reg1, \reg2, [\ptr], \val
.endm
+ .macro ldp2 reg1, reg2, ptr, val1, val2
+ ldp \reg1, \reg2, [\ptr, \val1]
+ .endm
+
.macro stp1 reg1, reg2, ptr, val
stp \reg1, \reg2, [\ptr], \val
.endm
+ .macro stp2 reg1, reg2, ptr, val1, val2
+ stp \reg1, \reg2, [\ptr, \val1]
+ .endm
+
SYM_FUNC_START_ALIAS(__memcpy)
SYM_FUNC_START_WEAK_PI(memcpy)
#include "copy_template.S"
--
2.25.1
next prev parent reply other threads:[~2021-03-23 7:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-23 7:34 [PATCH 0/3] arm64: lib: improve copy performance Yang Yingliang
2021-03-23 7:34 ` Yang Yingliang [this message]
2021-03-23 7:34 ` [PATCH 2/3] arm64: lib: improve copy performance when size is ge 128 bytes Yang Yingliang
2021-03-23 12:08 ` Robin Murphy
2021-03-23 13:32 ` Will Deacon
2021-03-23 14:28 ` Robin Murphy
2021-03-23 15:03 ` Catalin Marinas
2021-03-24 16:38 ` David Laight
2021-03-24 19:36 ` Robin Murphy
2021-03-23 7:34 ` [PATCH 3/3] arm64: lib: improve copy performance when size is less than 128 and ge 64 bytes Yang Yingliang
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=20210323073432.3422227-2-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=guohanjun@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@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®