ARC: Allow disabling of prefetch operations for debugging purposes
PATCH 1/1 ARC: Allow disabling of prefetch operations for debugging purposes
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>
--- arch/arc/Kconfig | 5 +++++ arch/arc/include/asm/processor.h | 11 +++++++++++ arch/arc/lib/memcpy-archs.S | 16 ++++++++++++++++ arch/arc/lib/memset-archs.S | 6 ++++++ 4 files changed, 38 insertions(+)
arch/arc/Kconfig +5 -0
@@ -532,6 +532,11 @@ config ARC_DBG_TLB_PARANOIA bool "Paranoia Checks in Low Level TLB Handlers" default n +config ARC_DISABLE_PREFETCH + bool "Disable use of prefetch instructions" + default n + help + Suppresses usage of prefetchw and prealloc instructions. endif config ARC_UBOOT_SUPPORT
arch/arc/include/asm/processor.h +11 -0
@@ -106,6 +106,17 @@ extern unsigned int get_wchan(struct task_struct *p);*/ #define current_text_addr () ({ __label__ _l; _l: &&_l; }) +#ifdef CONFIG_ARC_DISABLE_PREFETCH +#define ARCH_HAS_PREFETCH +#define prefetch (x) + +#define ARCH_HAS_PREFETCHW +#define prefetchw (x) + +#define ARCH_HAS_SPINLOCK_PREFETCH +#define spin_lock_prefetch (x) +#endif /* CONFIG_ARC_DISABLE_PREFETCH */ +#endif /* !__ASSEMBLY__ */ /*
arch/arc/lib/memcpy-archs.S +16 -0
@@ -41,8 +41,10 @@ #endif ENTRY_CFI(memcpy) +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetch [r1] ; Prefetch the read location prefetchw [r0] ; Prefetch the write location +#endif mov.f 0, r2 ;;; if size is zero jz.d [blink]
@@ -72,8 +74,10 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy32_64bytes ;; LOOP START LOADX (r6, r1) +#ifndef CONFIG_ARC_DISABLE_PREFETCH PREFETCH_READ (r1) PREFETCH_WRITE (r3) +#endif LOADX (r8, r1) LOADX (r10, r1) LOADX (r4, r1)
@@ -117,9 +121,13 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_1 ;; LOOP START ld.ab r6, [r1, 4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetch [r1, 28] ;Prefetch the next read location +#endif ld.ab r8, [r1,4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r3, 32] ;Prefetch the next write location +#endif SHIFT_1 (r7, r6, 24) or r7, r7, r5
@@ -162,9 +170,13 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_2 ;; LOOP START ld.ab r6, [r1, 4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetch [r1, 28] ;Prefetch the next read location +#endif ld.ab r8, [r1,4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r3, 32] ;Prefetch the next write location +#endif SHIFT_1 (r7, r6, 16) or r7, r7, r5
@@ -204,9 +216,13 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_3 ;; LOOP START ld.ab r6, [r1, 4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetch [r1, 28] ;Prefetch the next read location +#endif ld.ab r8, [r1,4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r3, 32] ;Prefetch the next write location +#endif SHIFT_1 (r7, r6, 8) or r7, r7, r5
arch/arc/lib/memset-archs.S +6 -0
@@ -11,7 +11,9 @@ #undef PREALLOC_NOT_AVAIL ENTRY_CFI(memset) +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r0] ; Prefetch the write location +#endif mov.f 0, r2 ;;; if size is zero jz.d [blink]
@@ -48,11 +50,13 @@ ENTRY_CFI(memset) lpnz @.Lset64bytes ;; LOOP START +#ifndef CONFIG_ARC_DISABLE_PREFETCH #ifdef PREALLOC_NOT_AVAIL prefetchw [r3, 64] ;Prefetch the next write location #else prealloc [r3, 64] #endif +#endif /* CONFIG_ARC_DISABLE_PREFETCH */ #ifdef CONFIG_ARC_HAS_LL64 std.ab r4, [r3, 8] std.ab r4, [r3, 8]
@@ -85,7 +89,9 @@ ENTRY_CFI(memset) lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes lpnz .Lset32bytes ;; LOOP START +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r3, 32] ;Prefetch the next write location +#endif #ifdef CONFIG_ARC_HAS_LL64 std.ab r4, [r3, 8] std.ab r4, [r3, 8]
Signature · 1 line
2.11.0
Quoted 51 lines · Alexey Brodkin
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>--- arch/arc/Kconfig | 5 +++++ arch/arc/include/asm/processor.h | 11 +++++++++++ arch/arc/lib/memcpy-archs.S | 16 ++++++++++++++++ arch/arc/lib/memset-archs.S | 6 ++++++ 4 files changed, 38 insertions(+)arch/arc/Kconfig +5
-0@@ -532,6 +532,11 @@ config ARC_DBG_TLB_PARANOIA bool "Paranoia Checks in Low Level TLB Handlers" default n +config ARC_DISABLE_PREFETCH + bool "Disable use of prefetch instructions" + default n + help + Suppresses usage of prefetchw and prealloc instructions. endif config ARC_UBOOT_SUPPORTarch/arc/include/asm/processor.h +11
-0@@ -106,6 +106,17 @@ extern unsigned int get_wchan(struct task_struct *p);*/ #define current_text_addr () ({ __label__ _l; _l: &&_l; }) +#ifdef CONFIG_ARC_DISABLE_PREFETCH +#define ARCH_HAS_PREFETCH +#define prefetch (x) + +#define ARCH_HAS_PREFETCHW +#define prefetchw (x) + +#define ARCH_HAS_SPINLOCK_PREFETCH +#define spin_lock_prefetch (x) +#endif /* CONFIG_ARC_DISABLE_PREFETCH */ +#endif /* !__ASSEMBLY__ */ /* arch/arc/lib/memcpy-archs.S +0
-0
arch/arc/lib/memcpy-archs.S line 47
Quoted 7 lines
arch/arc/lib/memcpy-archs.S +2
-0@@ -41,8 +41,10 @@ #endif ENTRY_CFI(memcpy) +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetch [r1] ; Prefetch the read location prefetchw [r0] ; Prefetch the write location +#endif
This code is already unreadable and this change is not helping. Can we make some macros "C" / gas style and have the switch inside the macro rather than littering this all over the place please !
Quoted 94 lines
arch/arc/lib/memcpy-archs.S +14
-0mov.f 0, r2 ;;; if size is zero jz.d [blink]@@ -72,8 +74,10 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy32_64bytes ;; LOOP START LOADX (r6, r1) +#ifndef CONFIG_ARC_DISABLE_PREFETCH PREFETCH_READ (r1) PREFETCH_WRITE (r3) +#endif LOADX (r8, r1) LOADX (r10, r1) LOADX (r4, r1)@@ -117,9 +121,13 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_1 ;; LOOP START ld.ab r6, [r1, 4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetch [r1, 28] ;Prefetch the next read location +#endif ld.ab r8, [r1,4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r3, 32] ;Prefetch the next write location +#endif SHIFT_1 (r7, r6, 24) or r7, r7, r5@@ -162,9 +170,13 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_2 ;; LOOP START ld.ab r6, [r1, 4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetch [r1, 28] ;Prefetch the next read location +#endif ld.ab r8, [r1,4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r3, 32] ;Prefetch the next write location +#endif SHIFT_1 (r7, r6, 16) or r7, r7, r5@@ -204,9 +216,13 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_3 ;; LOOP START ld.ab r6, [r1, 4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetch [r1, 28] ;Prefetch the next read location +#endif ld.ab r8, [r1,4] +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r3, 32] ;Prefetch the next write location +#endif SHIFT_1 (r7, r6, 8) or r7, r7, r5arch/arc/lib/memset-archs.S +6
-0@@ -11,7 +11,9 @@ #undef PREALLOC_NOT_AVAIL ENTRY_CFI(memset) +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r0] ; Prefetch the write location +#endif mov.f 0, r2 ;;; if size is zero jz.d [blink]@@ -48,11 +50,13 @@ ENTRY_CFI(memset) lpnz @.Lset64bytes ;; LOOP START +#ifndef CONFIG_ARC_DISABLE_PREFETCH #ifdef PREALLOC_NOT_AVAIL prefetchw [r3, 64] ;Prefetch the next write location #else prealloc [r3, 64] #endif +#endif /* CONFIG_ARC_DISABLE_PREFETCH */ #ifdef CONFIG_ARC_HAS_LL64 std.ab r4, [r3, 8] std.ab r4, [r3, 8]@@ -85,7 +89,9 @@ ENTRY_CFI(memset) lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes lpnz .Lset32bytes ;; LOOP START +#ifndef CONFIG_ARC_DISABLE_PREFETCH prefetchw [r3, 32] ;Prefetch the next write location +#endif #ifdef CONFIG_ARC_HAS_LL64 std.ab r4, [r3, 8] std.ab r4, [r3, 8]