diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-02-22 19:31:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-02-22 19:31:26 -0500 |
commit | 2cc63b39003913fdf564cde5c646ac8f174e3ac7 (patch) | |
tree | 13ce5f5d7e409c095987c9ccb56473b679dd8697 | |
parent | 8456e98e18f35f4d4376e8ff3110a3342f81ce9b (diff) | |
parent | 7b2e932f633bcb7b190fc7031ce6dac75f8c3472 (diff) |
Merge tag 'arc-5.0-final' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC fixes from Vineet Gupta:
"Fixes for ARC for 5.0, bunch of those are stable fodder anyways so
sooner the better.
- Fix memcpy to prevent prefetchw beyond end of buffer [Eugeniy]
- Enable unaligned access early to prevent exceptions given newer gcc
code gen [Eugeniy]
- Tighten up uboot arg checking to prevent false negatives and also
allow both jtag and bootloading to coexist w/o config option as
needed by kernelCi folks [Eugeniy]
- Set slab alignment to 8 for ARC to avoid the atomic64_t unalign
[Alexey]
- Disable regfile auto save on interrupts on HSDK platform due to a
silicon issue [Vineet]
- Avoid HS38x boot printing crash by not reading HS48x only reg
[Vineet]"
* tag 'arc-5.0-final' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
ARCv2: don't assume core 0x54 has dual issue
ARC: define ARCH_SLAB_MINALIGN = 8
ARC: enable uboot support unconditionally
ARC: U-boot: check arguments paranoidly
ARCv2: support manual regfile save on interrupts
ARC: uacces: remove lp_start, lp_end from clobber list
ARC: fix actionpoints configuration detection
ARCv2: lib: memcpy: fix doing prefetchw outside of buffer
ARCv2: Enable unaligned access in early ASM code
-rw-r--r-- | arch/arc/Kconfig | 20 | ||||
-rw-r--r-- | arch/arc/configs/nps_defconfig | 1 | ||||
-rw-r--r-- | arch/arc/configs/vdk_hs38_defconfig | 1 | ||||
-rw-r--r-- | arch/arc/configs/vdk_hs38_smp_defconfig | 2 | ||||
-rw-r--r-- | arch/arc/include/asm/arcregs.h | 8 | ||||
-rw-r--r-- | arch/arc/include/asm/cache.h | 11 | ||||
-rw-r--r-- | arch/arc/include/asm/entry-arcv2.h | 54 | ||||
-rw-r--r-- | arch/arc/include/asm/uaccess.h | 8 | ||||
-rw-r--r-- | arch/arc/kernel/entry-arcv2.S | 4 | ||||
-rw-r--r-- | arch/arc/kernel/head.S | 16 | ||||
-rw-r--r-- | arch/arc/kernel/intc-arcv2.c | 2 | ||||
-rw-r--r-- | arch/arc/kernel/setup.c | 119 | ||||
-rw-r--r-- | arch/arc/lib/memcpy-archs.S | 14 | ||||
-rw-r--r-- | arch/arc/plat-hsdk/Kconfig | 1 |
14 files changed, 188 insertions, 73 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 376366a7db81..d750b302d5ab 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
@@ -191,7 +191,6 @@ config NR_CPUS | |||
191 | 191 | ||
192 | config ARC_SMP_HALT_ON_RESET | 192 | config ARC_SMP_HALT_ON_RESET |
193 | bool "Enable Halt-on-reset boot mode" | 193 | bool "Enable Halt-on-reset boot mode" |
194 | default y if ARC_UBOOT_SUPPORT | ||
195 | help | 194 | help |
196 | In SMP configuration cores can be configured as Halt-on-reset | 195 | In SMP configuration cores can be configured as Halt-on-reset |
197 | or they could all start at same time. For Halt-on-reset, non | 196 | or they could all start at same time. For Halt-on-reset, non |
@@ -407,6 +406,14 @@ config ARC_HAS_ACCL_REGS | |||
407 | (also referred to as r58:r59). These can also be used by gcc as GPR so | 406 | (also referred to as r58:r59). These can also be used by gcc as GPR so |
408 | kernel needs to save/restore per process | 407 | kernel needs to save/restore per process |
409 | 408 | ||
409 | config ARC_IRQ_NO_AUTOSAVE | ||
410 | bool "Disable hardware autosave regfile on interrupts" | ||
411 | default n | ||
412 | help | ||
413 | On HS cores, taken interrupt auto saves the regfile on stack. | ||
414 | This is programmable and can be optionally disabled in which case | ||
415 | software INTERRUPT_PROLOGUE/EPILGUE do the needed work | ||
416 | |||
410 | endif # ISA_ARCV2 | 417 | endif # ISA_ARCV2 |
411 | 418 | ||
412 | endmenu # "ARC CPU Configuration" | 419 | endmenu # "ARC CPU Configuration" |
@@ -515,17 +522,6 @@ config ARC_DBG_TLB_PARANOIA | |||
515 | 522 | ||
516 | endif | 523 | endif |
517 | 524 | ||
518 | config ARC_UBOOT_SUPPORT | ||
519 | bool "Support uboot arg Handling" | ||
520 | help | ||
521 | ARC Linux by default checks for uboot provided args as pointers to | ||
522 | external cmdline or DTB. This however breaks in absence of uboot, | ||
523 | when booting from Metaware debugger directly, as the registers are | ||
524 | not zeroed out on reset by mdb and/or ARCv2 based cores. The bogus | ||
525 | registers look like uboot args to kernel which then chokes. | ||
526 | So only enable the uboot arg checking/processing if users are sure | ||
527 | of uboot being in play. | ||
528 | |||
529 | config ARC_BUILTIN_DTB_NAME | 525 | config ARC_BUILTIN_DTB_NAME |
530 | string "Built in DTB" | 526 | string "Built in DTB" |
531 | help | 527 | help |
diff --git a/arch/arc/configs/nps_defconfig b/arch/arc/configs/nps_defconfig index 6e84060e7c90..621f59407d76 100644 --- a/arch/arc/configs/nps_defconfig +++ b/arch/arc/configs/nps_defconfig | |||
@@ -31,7 +31,6 @@ CONFIG_ARC_CACHE_LINE_SHIFT=5 | |||
31 | # CONFIG_ARC_HAS_LLSC is not set | 31 | # CONFIG_ARC_HAS_LLSC is not set |
32 | CONFIG_ARC_KVADDR_SIZE=402 | 32 | CONFIG_ARC_KVADDR_SIZE=402 |
33 | CONFIG_ARC_EMUL_UNALIGNED=y | 33 | CONFIG_ARC_EMUL_UNALIGNED=y |
34 | CONFIG_ARC_UBOOT_SUPPORT=y | ||
35 | CONFIG_PREEMPT=y | 34 | CONFIG_PREEMPT=y |
36 | CONFIG_NET=y | 35 | CONFIG_NET=y |
37 | CONFIG_UNIX=y | 36 | CONFIG_UNIX=y |
diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig index 1e59a2e9c602..e447ace6fa1c 100644 --- a/arch/arc/configs/vdk_hs38_defconfig +++ b/arch/arc/configs/vdk_hs38_defconfig | |||
@@ -13,7 +13,6 @@ CONFIG_PARTITION_ADVANCED=y | |||
13 | CONFIG_ARC_PLAT_AXS10X=y | 13 | CONFIG_ARC_PLAT_AXS10X=y |
14 | CONFIG_AXS103=y | 14 | CONFIG_AXS103=y |
15 | CONFIG_ISA_ARCV2=y | 15 | CONFIG_ISA_ARCV2=y |
16 | CONFIG_ARC_UBOOT_SUPPORT=y | ||
17 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38" | 16 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38" |
18 | CONFIG_PREEMPT=y | 17 | CONFIG_PREEMPT=y |
19 | CONFIG_NET=y | 18 | CONFIG_NET=y |
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig index b5c3f6c54b03..c82cdb10aaf4 100644 --- a/arch/arc/configs/vdk_hs38_smp_defconfig +++ b/arch/arc/configs/vdk_hs38_smp_defconfig | |||
@@ -15,8 +15,6 @@ CONFIG_AXS103=y | |||
15 | CONFIG_ISA_ARCV2=y | 15 | CONFIG_ISA_ARCV2=y |
16 | CONFIG_SMP=y | 16 | CONFIG_SMP=y |
17 | # CONFIG_ARC_TIMERS_64BIT is not set | 17 | # CONFIG_ARC_TIMERS_64BIT is not set |
18 | # CONFIG_ARC_SMP_HALT_ON_RESET is not set | ||
19 | CONFIG_ARC_UBOOT_SUPPORT=y | ||
20 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" | 18 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" |
21 | CONFIG_PREEMPT=y | 19 | CONFIG_PREEMPT=y |
22 | CONFIG_NET=y | 20 | CONFIG_NET=y |
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index f1b86cef0905..a27eafdc8260 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h | |||
@@ -151,6 +151,14 @@ struct bcr_isa_arcv2 { | |||
151 | #endif | 151 | #endif |
152 | }; | 152 | }; |
153 | 153 | ||
154 | struct bcr_uarch_build_arcv2 { | ||
155 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
156 | unsigned int pad:8, prod:8, maj:8, min:8; | ||
157 | #else | ||
158 | unsigned int min:8, maj:8, prod:8, pad:8; | ||
159 | #endif | ||
160 | }; | ||
161 | |||
154 | struct bcr_mpy { | 162 | struct bcr_mpy { |
155 | #ifdef CONFIG_CPU_BIG_ENDIAN | 163 | #ifdef CONFIG_CPU_BIG_ENDIAN |
156 | unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8; | 164 | unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8; |
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h index f393b663413e..2ad77fb43639 100644 --- a/arch/arc/include/asm/cache.h +++ b/arch/arc/include/asm/cache.h | |||
@@ -52,6 +52,17 @@ | |||
52 | #define cache_line_size() SMP_CACHE_BYTES | 52 | #define cache_line_size() SMP_CACHE_BYTES |
53 | #define ARCH_DMA_MINALIGN SMP_CACHE_BYTES | 53 | #define ARCH_DMA_MINALIGN SMP_CACHE_BYTES |
54 | 54 | ||
55 | /* | ||
56 | * Make sure slab-allocated buffers are 64-bit aligned when atomic64_t uses | ||
57 | * ARCv2 64-bit atomics (LLOCKD/SCONDD). This guarantess runtime 64-bit | ||
58 | * alignment for any atomic64_t embedded in buffer. | ||
59 | * Default ARCH_SLAB_MINALIGN is __alignof__(long long) which has a relaxed | ||
60 | * value of 4 (and not 8) in ARC ABI. | ||
61 | */ | ||
62 | #if defined(CONFIG_ARC_HAS_LL64) && defined(CONFIG_ARC_HAS_LLSC) | ||
63 | #define ARCH_SLAB_MINALIGN 8 | ||
64 | #endif | ||
65 | |||
55 | extern void arc_cache_init(void); | 66 | extern void arc_cache_init(void); |
56 | extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); | 67 | extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); |
57 | extern void read_decode_cache_bcr(void); | 68 | extern void read_decode_cache_bcr(void); |
diff --git a/arch/arc/include/asm/entry-arcv2.h b/arch/arc/include/asm/entry-arcv2.h index 309f4e6721b3..225e7df2d8ed 100644 --- a/arch/arc/include/asm/entry-arcv2.h +++ b/arch/arc/include/asm/entry-arcv2.h | |||
@@ -17,6 +17,33 @@ | |||
17 | ; | 17 | ; |
18 | ; Now manually save: r12, sp, fp, gp, r25 | 18 | ; Now manually save: r12, sp, fp, gp, r25 |
19 | 19 | ||
20 | #ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE | ||
21 | .ifnc \called_from, exception | ||
22 | st.as r9, [sp, -10] ; save r9 in it's final stack slot | ||
23 | sub sp, sp, 12 ; skip JLI, LDI, EI | ||
24 | |||
25 | PUSH lp_count | ||
26 | PUSHAX lp_start | ||
27 | PUSHAX lp_end | ||
28 | PUSH blink | ||
29 | |||
30 | PUSH r11 | ||
31 | PUSH r10 | ||
32 | |||
33 | sub sp, sp, 4 ; skip r9 | ||
34 | |||
35 | PUSH r8 | ||
36 | PUSH r7 | ||
37 | PUSH r6 | ||
38 | PUSH r5 | ||
39 | PUSH r4 | ||
40 | PUSH r3 | ||
41 | PUSH r2 | ||
42 | PUSH r1 | ||
43 | PUSH r0 | ||
44 | .endif | ||
45 | #endif | ||
46 | |||
20 | #ifdef CONFIG_ARC_HAS_ACCL_REGS | 47 | #ifdef CONFIG_ARC_HAS_ACCL_REGS |
21 | PUSH r59 | 48 | PUSH r59 |
22 | PUSH r58 | 49 | PUSH r58 |
@@ -86,6 +113,33 @@ | |||
86 | POP r59 | 113 | POP r59 |
87 | #endif | 114 | #endif |
88 | 115 | ||
116 | #ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE | ||
117 | .ifnc \called_from, exception | ||
118 | POP r0 | ||
119 | POP r1 | ||
120 | POP r2 | ||
121 | POP r3 | ||
122 | POP r4 | ||
123 | POP r5 | ||
124 | POP r6 | ||
125 | POP r7 | ||
126 | POP r8 | ||
127 | POP r9 | ||
128 | POP r10 | ||
129 | POP r11 | ||
130 | |||
131 | POP blink | ||
132 | POPAX lp_end | ||
133 | POPAX lp_start | ||
134 | |||
135 | POP r9 | ||
136 | mov lp_count, r9 | ||
137 | |||
138 | add sp, sp, 12 ; skip JLI, LDI, EI | ||
139 | ld.as r9, [sp, -10] ; reload r9 which got clobbered | ||
140 | .endif | ||
141 | #endif | ||
142 | |||
89 | .endm | 143 | .endm |
90 | 144 | ||
91 | /*------------------------------------------------------------------------*/ | 145 | /*------------------------------------------------------------------------*/ |
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index c9173c02081c..eabc3efa6c6d 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h | |||
@@ -207,7 +207,7 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n) | |||
207 | */ | 207 | */ |
208 | "=&r" (tmp), "+r" (to), "+r" (from) | 208 | "=&r" (tmp), "+r" (to), "+r" (from) |
209 | : | 209 | : |
210 | : "lp_count", "lp_start", "lp_end", "memory"); | 210 | : "lp_count", "memory"); |
211 | 211 | ||
212 | return n; | 212 | return n; |
213 | } | 213 | } |
@@ -433,7 +433,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n) | |||
433 | */ | 433 | */ |
434 | "=&r" (tmp), "+r" (to), "+r" (from) | 434 | "=&r" (tmp), "+r" (to), "+r" (from) |
435 | : | 435 | : |
436 | : "lp_count", "lp_start", "lp_end", "memory"); | 436 | : "lp_count", "memory"); |
437 | 437 | ||
438 | return n; | 438 | return n; |
439 | } | 439 | } |
@@ -653,7 +653,7 @@ static inline unsigned long __arc_clear_user(void __user *to, unsigned long n) | |||
653 | " .previous \n" | 653 | " .previous \n" |
654 | : "+r"(d_char), "+r"(res) | 654 | : "+r"(d_char), "+r"(res) |
655 | : "i"(0) | 655 | : "i"(0) |
656 | : "lp_count", "lp_start", "lp_end", "memory"); | 656 | : "lp_count", "memory"); |
657 | 657 | ||
658 | return res; | 658 | return res; |
659 | } | 659 | } |
@@ -686,7 +686,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) | |||
686 | " .previous \n" | 686 | " .previous \n" |
687 | : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) | 687 | : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) |
688 | : "g"(-EFAULT), "r"(count) | 688 | : "g"(-EFAULT), "r"(count) |
689 | : "lp_count", "lp_start", "lp_end", "memory"); | 689 | : "lp_count", "memory"); |
690 | 690 | ||
691 | return res; | 691 | return res; |
692 | } | 692 | } |
diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S index cc558a25b8fa..562089d62d9d 100644 --- a/arch/arc/kernel/entry-arcv2.S +++ b/arch/arc/kernel/entry-arcv2.S | |||
@@ -209,7 +209,9 @@ restore_regs: | |||
209 | ;####### Return from Intr ####### | 209 | ;####### Return from Intr ####### |
210 | 210 | ||
211 | debug_marker_l1: | 211 | debug_marker_l1: |
212 | bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot | 212 | ; bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot |
213 | btst r0, STATUS_DE_BIT ; Z flag set if bit clear | ||
214 | bnz .Lintr_ret_to_delay_slot ; branch if STATUS_DE_BIT set | ||
213 | 215 | ||
214 | .Lisr_ret_fast_path: | 216 | .Lisr_ret_fast_path: |
215 | ; Handle special case #1: (Entry via Exception, Return via IRQ) | 217 | ; Handle special case #1: (Entry via Exception, Return via IRQ) |
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S index 8b90d25a15cc..30e090625916 100644 --- a/arch/arc/kernel/head.S +++ b/arch/arc/kernel/head.S | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/entry.h> | 17 | #include <asm/entry.h> |
18 | #include <asm/arcregs.h> | 18 | #include <asm/arcregs.h> |
19 | #include <asm/cache.h> | 19 | #include <asm/cache.h> |
20 | #include <asm/irqflags.h> | ||
20 | 21 | ||
21 | .macro CPU_EARLY_SETUP | 22 | .macro CPU_EARLY_SETUP |
22 | 23 | ||
@@ -47,6 +48,15 @@ | |||
47 | sr r5, [ARC_REG_DC_CTRL] | 48 | sr r5, [ARC_REG_DC_CTRL] |
48 | 49 | ||
49 | 1: | 50 | 1: |
51 | |||
52 | #ifdef CONFIG_ISA_ARCV2 | ||
53 | ; Unaligned access is disabled at reset, so re-enable early as | ||
54 | ; gcc 7.3.1 (ARC GNU 2018.03) onwards generates unaligned access | ||
55 | ; by default | ||
56 | lr r5, [status32] | ||
57 | bset r5, r5, STATUS_AD_BIT | ||
58 | kflag r5 | ||
59 | #endif | ||
50 | .endm | 60 | .endm |
51 | 61 | ||
52 | .section .init.text, "ax",@progbits | 62 | .section .init.text, "ax",@progbits |
@@ -90,15 +100,13 @@ ENTRY(stext) | |||
90 | st.ab 0, [r5, 4] | 100 | st.ab 0, [r5, 4] |
91 | 1: | 101 | 1: |
92 | 102 | ||
93 | #ifdef CONFIG_ARC_UBOOT_SUPPORT | ||
94 | ; Uboot - kernel ABI | 103 | ; Uboot - kernel ABI |
95 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 | 104 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 |
96 | ; r1 = magic number (board identity, unused as of now | 105 | ; r1 = magic number (always zero as of now) |
97 | ; r2 = pointer to uboot provided cmdline or external DTB in mem | 106 | ; r2 = pointer to uboot provided cmdline or external DTB in mem |
98 | ; These are handled later in setup_arch() | 107 | ; These are handled later in handle_uboot_args() |
99 | st r0, [@uboot_tag] | 108 | st r0, [@uboot_tag] |
100 | st r2, [@uboot_arg] | 109 | st r2, [@uboot_arg] |
101 | #endif | ||
102 | 110 | ||
103 | ; setup "current" tsk and optionally cache it in dedicated r25 | 111 | ; setup "current" tsk and optionally cache it in dedicated r25 |
104 | mov r9, @init_task | 112 | mov r9, @init_task |
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c index 067ea362fb3e..cf18b3e5a934 100644 --- a/arch/arc/kernel/intc-arcv2.c +++ b/arch/arc/kernel/intc-arcv2.c | |||
@@ -49,11 +49,13 @@ void arc_init_IRQ(void) | |||
49 | 49 | ||
50 | *(unsigned int *)&ictrl = 0; | 50 | *(unsigned int *)&ictrl = 0; |
51 | 51 | ||
52 | #ifndef CONFIG_ARC_IRQ_NO_AUTOSAVE | ||
52 | ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */ | 53 | ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */ |
53 | ictrl.save_blink = 1; | 54 | ictrl.save_blink = 1; |
54 | ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */ | 55 | ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */ |
55 | ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */ | 56 | ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */ |
56 | ictrl.save_idx_regs = 1; /* JLI, LDI, EI */ | 57 | ictrl.save_idx_regs = 1; /* JLI, LDI, EI */ |
58 | #endif | ||
57 | 59 | ||
58 | WRITE_AUX(AUX_IRQ_CTRL, ictrl); | 60 | WRITE_AUX(AUX_IRQ_CTRL, ictrl); |
59 | 61 | ||
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index feb90093e6b1..7b2340996cf8 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c | |||
@@ -199,20 +199,36 @@ static void read_arc_build_cfg_regs(void) | |||
199 | cpu->bpu.ret_stk = 4 << bpu.rse; | 199 | cpu->bpu.ret_stk = 4 << bpu.rse; |
200 | 200 | ||
201 | if (cpu->core.family >= 0x54) { | 201 | if (cpu->core.family >= 0x54) { |
202 | unsigned int exec_ctrl; | ||
203 | 202 | ||
204 | READ_BCR(AUX_EXEC_CTRL, exec_ctrl); | 203 | struct bcr_uarch_build_arcv2 uarch; |
205 | cpu->extn.dual_enb = !(exec_ctrl & 1); | ||
206 | 204 | ||
207 | /* dual issue always present for this core */ | 205 | /* |
208 | cpu->extn.dual = 1; | 206 | * The first 0x54 core (uarch maj:min 0:1 or 0:2) was |
207 | * dual issue only (HS4x). But next uarch rev (1:0) | ||
208 | * allows it be configured for single issue (HS3x) | ||
209 | * Ensure we fiddle with dual issue only on HS4x | ||
210 | */ | ||
211 | READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch); | ||
212 | |||
213 | if (uarch.prod == 4) { | ||
214 | unsigned int exec_ctrl; | ||
215 | |||
216 | /* dual issue hardware always present */ | ||
217 | cpu->extn.dual = 1; | ||
218 | |||
219 | READ_BCR(AUX_EXEC_CTRL, exec_ctrl); | ||
220 | |||
221 | /* dual issue hardware enabled ? */ | ||
222 | cpu->extn.dual_enb = !(exec_ctrl & 1); | ||
223 | |||
224 | } | ||
209 | } | 225 | } |
210 | } | 226 | } |
211 | 227 | ||
212 | READ_BCR(ARC_REG_AP_BCR, ap); | 228 | READ_BCR(ARC_REG_AP_BCR, ap); |
213 | if (ap.ver) { | 229 | if (ap.ver) { |
214 | cpu->extn.ap_num = 2 << ap.num; | 230 | cpu->extn.ap_num = 2 << ap.num; |
215 | cpu->extn.ap_full = !!ap.min; | 231 | cpu->extn.ap_full = !ap.min; |
216 | } | 232 | } |
217 | 233 | ||
218 | READ_BCR(ARC_REG_SMART_BCR, bcr); | 234 | READ_BCR(ARC_REG_SMART_BCR, bcr); |
@@ -462,43 +478,78 @@ void setup_processor(void) | |||
462 | arc_chk_core_config(); | 478 | arc_chk_core_config(); |
463 | } | 479 | } |
464 | 480 | ||
465 | static inline int is_kernel(unsigned long addr) | 481 | static inline bool uboot_arg_invalid(unsigned long addr) |
466 | { | 482 | { |
467 | if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) | 483 | /* |
468 | return 1; | 484 | * Check that it is a untranslated address (although MMU is not enabled |
469 | return 0; | 485 | * yet, it being a high address ensures this is not by fluke) |
486 | */ | ||
487 | if (addr < PAGE_OFFSET) | ||
488 | return true; | ||
489 | |||
490 | /* Check that address doesn't clobber resident kernel image */ | ||
491 | return addr >= (unsigned long)_stext && addr <= (unsigned long)_end; | ||
470 | } | 492 | } |
471 | 493 | ||
472 | void __init setup_arch(char **cmdline_p) | 494 | #define IGNORE_ARGS "Ignore U-boot args: " |
495 | |||
496 | /* uboot_tag values for U-boot - kernel ABI revision 0; see head.S */ | ||
497 | #define UBOOT_TAG_NONE 0 | ||
498 | #define UBOOT_TAG_CMDLINE 1 | ||
499 | #define UBOOT_TAG_DTB 2 | ||
500 | |||
501 | void __init handle_uboot_args(void) | ||
473 | { | 502 | { |
474 | #ifdef CONFIG_ARC_UBOOT_SUPPORT | 503 | bool use_embedded_dtb = true; |
475 | /* make sure that uboot passed pointer to cmdline/dtb is valid */ | 504 | bool append_cmdline = false; |
476 | if (uboot_tag && is_kernel((unsigned long)uboot_arg)) | 505 | |
477 | panic("Invalid uboot arg\n"); | 506 | /* check that we know this tag */ |
478 | 507 | if (uboot_tag != UBOOT_TAG_NONE && | |
479 | /* See if u-boot passed an external Device Tree blob */ | 508 | uboot_tag != UBOOT_TAG_CMDLINE && |
480 | machine_desc = setup_machine_fdt(uboot_arg); /* uboot_tag == 2 */ | 509 | uboot_tag != UBOOT_TAG_DTB) { |
481 | if (!machine_desc) | 510 | pr_warn(IGNORE_ARGS "invalid uboot tag: '%08x'\n", uboot_tag); |
482 | #endif | 511 | goto ignore_uboot_args; |
483 | { | 512 | } |
484 | /* No, so try the embedded one */ | 513 | |
514 | if (uboot_tag != UBOOT_TAG_NONE && | ||
515 | uboot_arg_invalid((unsigned long)uboot_arg)) { | ||
516 | pr_warn(IGNORE_ARGS "invalid uboot arg: '%px'\n", uboot_arg); | ||
517 | goto ignore_uboot_args; | ||
518 | } | ||
519 | |||
520 | /* see if U-boot passed an external Device Tree blob */ | ||
521 | if (uboot_tag == UBOOT_TAG_DTB) { | ||
522 | machine_desc = setup_machine_fdt((void *)uboot_arg); | ||
523 | |||
524 | /* external Device Tree blob is invalid - use embedded one */ | ||
525 | use_embedded_dtb = !machine_desc; | ||
526 | } | ||
527 | |||
528 | if (uboot_tag == UBOOT_TAG_CMDLINE) | ||
529 | append_cmdline = true; | ||
530 | |||
531 | ignore_uboot_args: | ||
532 | |||
533 | if (use_embedded_dtb) { | ||
485 | machine_desc = setup_machine_fdt(__dtb_start); | 534 | machine_desc = setup_machine_fdt(__dtb_start); |
486 | if (!machine_desc) | 535 | if (!machine_desc) |
487 | panic("Embedded DT invalid\n"); | 536 | panic("Embedded DT invalid\n"); |
537 | } | ||
488 | 538 | ||
489 | /* | 539 | /* |
490 | * If we are here, it is established that @uboot_arg didn't | 540 | * NOTE: @boot_command_line is populated by setup_machine_fdt() so this |
491 | * point to DT blob. Instead if u-boot says it is cmdline, | 541 | * append processing can only happen after. |
492 | * append to embedded DT cmdline. | 542 | */ |
493 | * setup_machine_fdt() would have populated @boot_command_line | 543 | if (append_cmdline) { |
494 | */ | 544 | /* Ensure a whitespace between the 2 cmdlines */ |
495 | if (uboot_tag == 1) { | 545 | strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); |
496 | /* Ensure a whitespace between the 2 cmdlines */ | 546 | strlcat(boot_command_line, uboot_arg, COMMAND_LINE_SIZE); |
497 | strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); | ||
498 | strlcat(boot_command_line, uboot_arg, | ||
499 | COMMAND_LINE_SIZE); | ||
500 | } | ||
501 | } | 547 | } |
548 | } | ||
549 | |||
550 | void __init setup_arch(char **cmdline_p) | ||
551 | { | ||
552 | handle_uboot_args(); | ||
502 | 553 | ||
503 | /* Save unparsed command line copy for /proc/cmdline */ | 554 | /* Save unparsed command line copy for /proc/cmdline */ |
504 | *cmdline_p = boot_command_line; | 555 | *cmdline_p = boot_command_line; |
diff --git a/arch/arc/lib/memcpy-archs.S b/arch/arc/lib/memcpy-archs.S index d61044dd8b58..ea14b0bf3116 100644 --- a/arch/arc/lib/memcpy-archs.S +++ b/arch/arc/lib/memcpy-archs.S | |||
@@ -25,15 +25,11 @@ | |||
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #ifdef CONFIG_ARC_HAS_LL64 | 27 | #ifdef CONFIG_ARC_HAS_LL64 |
28 | # define PREFETCH_READ(RX) prefetch [RX, 56] | ||
29 | # define PREFETCH_WRITE(RX) prefetchw [RX, 64] | ||
30 | # define LOADX(DST,RX) ldd.ab DST, [RX, 8] | 28 | # define LOADX(DST,RX) ldd.ab DST, [RX, 8] |
31 | # define STOREX(SRC,RX) std.ab SRC, [RX, 8] | 29 | # define STOREX(SRC,RX) std.ab SRC, [RX, 8] |
32 | # define ZOLSHFT 5 | 30 | # define ZOLSHFT 5 |
33 | # define ZOLAND 0x1F | 31 | # define ZOLAND 0x1F |
34 | #else | 32 | #else |
35 | # define PREFETCH_READ(RX) prefetch [RX, 28] | ||
36 | # define PREFETCH_WRITE(RX) prefetchw [RX, 32] | ||
37 | # define LOADX(DST,RX) ld.ab DST, [RX, 4] | 33 | # define LOADX(DST,RX) ld.ab DST, [RX, 4] |
38 | # define STOREX(SRC,RX) st.ab SRC, [RX, 4] | 34 | # define STOREX(SRC,RX) st.ab SRC, [RX, 4] |
39 | # define ZOLSHFT 4 | 35 | # define ZOLSHFT 4 |
@@ -41,8 +37,6 @@ | |||
41 | #endif | 37 | #endif |
42 | 38 | ||
43 | ENTRY_CFI(memcpy) | 39 | ENTRY_CFI(memcpy) |
44 | prefetch [r1] ; Prefetch the read location | ||
45 | prefetchw [r0] ; Prefetch the write location | ||
46 | mov.f 0, r2 | 40 | mov.f 0, r2 |
47 | ;;; if size is zero | 41 | ;;; if size is zero |
48 | jz.d [blink] | 42 | jz.d [blink] |
@@ -72,8 +66,6 @@ ENTRY_CFI(memcpy) | |||
72 | lpnz @.Lcopy32_64bytes | 66 | lpnz @.Lcopy32_64bytes |
73 | ;; LOOP START | 67 | ;; LOOP START |
74 | LOADX (r6, r1) | 68 | LOADX (r6, r1) |
75 | PREFETCH_READ (r1) | ||
76 | PREFETCH_WRITE (r3) | ||
77 | LOADX (r8, r1) | 69 | LOADX (r8, r1) |
78 | LOADX (r10, r1) | 70 | LOADX (r10, r1) |
79 | LOADX (r4, r1) | 71 | LOADX (r4, r1) |
@@ -117,9 +109,7 @@ ENTRY_CFI(memcpy) | |||
117 | lpnz @.Lcopy8bytes_1 | 109 | lpnz @.Lcopy8bytes_1 |
118 | ;; LOOP START | 110 | ;; LOOP START |
119 | ld.ab r6, [r1, 4] | 111 | ld.ab r6, [r1, 4] |
120 | prefetch [r1, 28] ;Prefetch the next read location | ||
121 | ld.ab r8, [r1,4] | 112 | ld.ab r8, [r1,4] |
122 | prefetchw [r3, 32] ;Prefetch the next write location | ||
123 | 113 | ||
124 | SHIFT_1 (r7, r6, 24) | 114 | SHIFT_1 (r7, r6, 24) |
125 | or r7, r7, r5 | 115 | or r7, r7, r5 |
@@ -162,9 +152,7 @@ ENTRY_CFI(memcpy) | |||
162 | lpnz @.Lcopy8bytes_2 | 152 | lpnz @.Lcopy8bytes_2 |
163 | ;; LOOP START | 153 | ;; LOOP START |
164 | ld.ab r6, [r1, 4] | 154 | ld.ab r6, [r1, 4] |
165 | prefetch [r1, 28] ;Prefetch the next read location | ||
166 | ld.ab r8, [r1,4] | 155 | ld.ab r8, [r1,4] |
167 | prefetchw [r3, 32] ;Prefetch the next write location | ||
168 | 156 | ||
169 | SHIFT_1 (r7, r6, 16) | 157 | SHIFT_1 (r7, r6, 16) |
170 | or r7, r7, r5 | 158 | or r7, r7, r5 |
@@ -204,9 +192,7 @@ ENTRY_CFI(memcpy) | |||
204 | lpnz @.Lcopy8bytes_3 | 192 | lpnz @.Lcopy8bytes_3 |
205 | ;; LOOP START | 193 | ;; LOOP START |
206 | ld.ab r6, [r1, 4] | 194 | ld.ab r6, [r1, 4] |
207 | prefetch [r1, 28] ;Prefetch the next read location | ||
208 | ld.ab r8, [r1,4] | 195 | ld.ab r8, [r1,4] |
209 | prefetchw [r3, 32] ;Prefetch the next write location | ||
210 | 196 | ||
211 | SHIFT_1 (r7, r6, 8) | 197 | SHIFT_1 (r7, r6, 8) |
212 | or r7, r7, r5 | 198 | or r7, r7, r5 |
diff --git a/arch/arc/plat-hsdk/Kconfig b/arch/arc/plat-hsdk/Kconfig index f25c085b9874..23e00216e5a5 100644 --- a/arch/arc/plat-hsdk/Kconfig +++ b/arch/arc/plat-hsdk/Kconfig | |||
@@ -9,6 +9,7 @@ menuconfig ARC_SOC_HSDK | |||
9 | bool "ARC HS Development Kit SOC" | 9 | bool "ARC HS Development Kit SOC" |
10 | depends on ISA_ARCV2 | 10 | depends on ISA_ARCV2 |
11 | select ARC_HAS_ACCL_REGS | 11 | select ARC_HAS_ACCL_REGS |
12 | select ARC_IRQ_NO_AUTOSAVE | ||
12 | select CLK_HSDK | 13 | select CLK_HSDK |
13 | select RESET_HSDK | 14 | select RESET_HSDK |
14 | select HAVE_PCI | 15 | select HAVE_PCI |