ARC: uaccess: elide unaliged handling if hardware supports
authorVineet Gupta <vgupta@kernel.org>
Mon, 3 Feb 2020 19:43:22 +0000 (11:43 -0800)
committerVineet Gupta <vgupta@kernel.org>
Thu, 17 Aug 2023 19:40:26 +0000 (12:40 -0700)
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
arch/arc/include/asm/uaccess.h

index d2da159..1e8809e 100644 (file)
@@ -146,8 +146,9 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n)
        if (n == 0)
                return 0;
 
-       /* unaligned */
-       if (((unsigned long)to & 0x3) || ((unsigned long)from & 0x3)) {
+       /* fallback for unaligned access when hardware doesn't support */
+       if (!IS_ENABLED(CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS) &&
+            (((unsigned long)to & 0x3) || ((unsigned long)from & 0x3))) {
 
                unsigned char tmp;
 
@@ -373,8 +374,9 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
        if (n == 0)
                return 0;
 
-       /* unaligned */
-       if (((unsigned long)to & 0x3) || ((unsigned long)from & 0x3)) {
+       /* fallback for unaligned access when hardware doesn't support */
+       if (!IS_ENABLED(CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS) &&
+            (((unsigned long)to & 0x3) || ((unsigned long)from & 0x3))) {
 
                unsigned char tmp;