From: rmk+kernel@armlinux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] ARM: kuser: simplify kuser_cmpxchg* preprocessor conditionals
Date: Thu, 09 Feb 2017 12:18:45 +0000 [thread overview]
Message-ID: <E1cbngT-000269-4q@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20170209121756.GC27312@n2100.armlinux.org.uk>
Simplify the kuser_cmpxchg* preprocessor conditionals by arranging the
ARMv6+ code first. This gives us one level of preprocessor conditional
nesting, rather than two levels.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
arch/arm/kernel/kuser.S | 42 ++++++++++++++++++------------------------
1 file changed, 18 insertions(+), 24 deletions(-)
diff --git a/arch/arm/kernel/kuser.S b/arch/arm/kernel/kuser.S
index 5d2a2784ed09..d7081a4761fe 100644
--- a/arch/arm/kernel/kuser.S
+++ b/arch/arm/kernel/kuser.S
@@ -2,6 +2,10 @@
#include <asm/assembler.h>
+#if defined(CONFIG_SMP) && !defined(CONFIG_CPU_32v6K)
+#error "incoherent kernel configuration"
+#endif
+
__INIT
/*
@@ -63,9 +67,7 @@ __kuser_cmpxchg64: @ 0xffff0f60
ldmfd sp!, {r4, r5, r6, r7}
usr_ret lr
-#elif !defined(CONFIG_SMP)
-
-#ifdef CONFIG_MMU
+#elif defined(CONFIG_MMU)
/*
* The only thing that can break atomicity in this cmpxchg64
@@ -109,10 +111,6 @@ __kuser_cmpxchg64: @ 0xffff0f60
usr_ret lr
#endif
-#else
-#error "incoherent kernel configuration"
-#endif
-
kuser_pad __kuser_cmpxchg64, 64
__kuser_memory_barrier: @ 0xffff0fa0
@@ -123,9 +121,20 @@ __kuser_memory_barrier: @ 0xffff0fa0
__kuser_cmpxchg: @ 0xffff0fc0
-#if __LINUX_ARM_ARCH__ < 6
+#if __LINUX_ARM_ARCH__ >= 6
-#ifdef CONFIG_MMU
+ smp_dmb arm
+1: ldrex r3, [r2]
+ subs r3, r3, r0
+ strexeq r3, r1, [r2]
+ teqeq r3, #1
+ beq 1b
+ rsbs r0, r3, #0
+ /* beware -- each __kuser slot must be 8 instructions max */
+ ALT_SMP(b __kuser_memory_barrier)
+ ALT_UP(usr_ret lr)
+
+#elif defined(CONFIG_MMU)
/*
* The only thing that can break atomicity in this cmpxchg
@@ -164,21 +173,6 @@ __kuser_cmpxchg: @ 0xffff0fc0
usr_ret lr
#endif
-#else
-
- smp_dmb arm
-1: ldrex r3, [r2]
- subs r3, r3, r0
- strexeq r3, r1, [r2]
- teqeq r3, #1
- beq 1b
- rsbs r0, r3, #0
- /* beware -- each __kuser slot must be 8 instructions max */
- ALT_SMP(b __kuser_memory_barrier)
- ALT_UP(usr_ret lr)
-
-#endif
-
kuser_pad __kuser_cmpxchg, 32
__kuser_get_tls: @ 0xffff0fe0
--
2.7.4
next prev parent reply other threads:[~2017-02-09 12:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 12:17 [PATCH 0/4] kuser updates for ARM-only vs Thumb Russell King - ARM Linux
2017-02-09 12:18 ` [PATCH 1/4] ARM: add CPU_THUMB_CAPABLE to indicate possible Thumb support Russell King
2017-02-10 17:29 ` Stephen Boyd
2017-02-09 12:18 ` [PATCH 2/4] ARM: kuser: split out kuser code Russell King
2017-02-09 12:18 ` Russell King [this message]
2017-02-09 12:18 ` [PATCH 4/4] ARM: kuser: split the kuser support for Thumb-capable and ARM-only Russell King
2017-02-09 19:25 ` Nicolas Pitre
2017-02-20 17:06 ` [PATCH 0/4] kuser updates for ARM-only vs Thumb Martin Kaiser
2017-02-20 17:24 ` Russell King - ARM Linux
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=E1cbngT-000269-4q@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.