diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-08-06 22:28:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-08-06 22:28:24 -0400 |
commit | 49d7c6559bf2ab4f1d56be131ab9571a51fc71bd (patch) | |
tree | f8c4fd10754c70192d5f7f0cc0eace4213fe1839 | |
parent | 8664b90baedb0f9aa6bea5bfbdfeae0d5883d28e (diff) | |
parent | 44922150d87cef616fd183220d43d8fde4d41390 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull sparc fix from David Miller:
"FPU register corruption bug fix"
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
sparc64: Fix userspace FPU register corruptions.
-rw-r--r-- | arch/sparc/include/asm/visasm.h | 16 | ||||
-rw-r--r-- | arch/sparc/lib/NG4memcpy.S | 5 | ||||
-rw-r--r-- | arch/sparc/lib/VISsave.S | 67 | ||||
-rw-r--r-- | arch/sparc/lib/ksyms.c | 4 |
4 files changed, 11 insertions, 81 deletions
diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h index 1f0aa2024e94..6424249d5f78 100644 --- a/arch/sparc/include/asm/visasm.h +++ b/arch/sparc/include/asm/visasm.h | |||
@@ -28,16 +28,10 @@ | |||
28 | * Must preserve %o5 between VISEntryHalf and VISExitHalf */ | 28 | * Must preserve %o5 between VISEntryHalf and VISExitHalf */ |
29 | 29 | ||
30 | #define VISEntryHalf \ | 30 | #define VISEntryHalf \ |
31 | rd %fprs, %o5; \ | 31 | VISEntry |
32 | andcc %o5, FPRS_FEF, %g0; \ | 32 | |
33 | be,pt %icc, 297f; \ | 33 | #define VISExitHalf \ |
34 | sethi %hi(298f), %g7; \ | 34 | VISExit |
35 | sethi %hi(VISenterhalf), %g1; \ | ||
36 | jmpl %g1 + %lo(VISenterhalf), %g0; \ | ||
37 | or %g7, %lo(298f), %g7; \ | ||
38 | clr %o5; \ | ||
39 | 297: wr %o5, FPRS_FEF, %fprs; \ | ||
40 | 298: | ||
41 | 35 | ||
42 | #define VISEntryHalfFast(fail_label) \ | 36 | #define VISEntryHalfFast(fail_label) \ |
43 | rd %fprs, %o5; \ | 37 | rd %fprs, %o5; \ |
@@ -47,7 +41,7 @@ | |||
47 | ba,a,pt %xcc, fail_label; \ | 41 | ba,a,pt %xcc, fail_label; \ |
48 | 297: wr %o5, FPRS_FEF, %fprs; | 42 | 297: wr %o5, FPRS_FEF, %fprs; |
49 | 43 | ||
50 | #define VISExitHalf \ | 44 | #define VISExitHalfFast \ |
51 | wr %o5, 0, %fprs; | 45 | wr %o5, 0, %fprs; |
52 | 46 | ||
53 | #ifndef __ASSEMBLY__ | 47 | #ifndef __ASSEMBLY__ |
diff --git a/arch/sparc/lib/NG4memcpy.S b/arch/sparc/lib/NG4memcpy.S index 140527a20e7d..83aeeb1dffdb 100644 --- a/arch/sparc/lib/NG4memcpy.S +++ b/arch/sparc/lib/NG4memcpy.S | |||
@@ -240,8 +240,11 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ | |||
240 | add %o0, 0x40, %o0 | 240 | add %o0, 0x40, %o0 |
241 | bne,pt %icc, 1b | 241 | bne,pt %icc, 1b |
242 | LOAD(prefetch, %g1 + 0x200, #n_reads_strong) | 242 | LOAD(prefetch, %g1 + 0x200, #n_reads_strong) |
243 | #ifdef NON_USER_COPY | ||
244 | VISExitHalfFast | ||
245 | #else | ||
243 | VISExitHalf | 246 | VISExitHalf |
244 | 247 | #endif | |
245 | brz,pn %o2, .Lexit | 248 | brz,pn %o2, .Lexit |
246 | cmp %o2, 19 | 249 | cmp %o2, 19 |
247 | ble,pn %icc, .Lsmall_unaligned | 250 | ble,pn %icc, .Lsmall_unaligned |
diff --git a/arch/sparc/lib/VISsave.S b/arch/sparc/lib/VISsave.S index b320ae9e2e2e..a063d84336d6 100644 --- a/arch/sparc/lib/VISsave.S +++ b/arch/sparc/lib/VISsave.S | |||
@@ -44,9 +44,8 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 | |||
44 | 44 | ||
45 | stx %g3, [%g6 + TI_GSR] | 45 | stx %g3, [%g6 + TI_GSR] |
46 | 2: add %g6, %g1, %g3 | 46 | 2: add %g6, %g1, %g3 |
47 | cmp %o5, FPRS_DU | 47 | mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5 |
48 | be,pn %icc, 6f | 48 | sll %g1, 3, %g1 |
49 | sll %g1, 3, %g1 | ||
50 | stb %o5, [%g3 + TI_FPSAVED] | 49 | stb %o5, [%g3 + TI_FPSAVED] |
51 | rd %gsr, %g2 | 50 | rd %gsr, %g2 |
52 | add %g6, %g1, %g3 | 51 | add %g6, %g1, %g3 |
@@ -80,65 +79,3 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 | |||
80 | .align 32 | 79 | .align 32 |
81 | 80: jmpl %g7 + %g0, %g0 | 80 | 80: jmpl %g7 + %g0, %g0 |
82 | nop | 81 | nop |
83 | |||
84 | 6: ldub [%g3 + TI_FPSAVED], %o5 | ||
85 | or %o5, FPRS_DU, %o5 | ||
86 | add %g6, TI_FPREGS+0x80, %g2 | ||
87 | stb %o5, [%g3 + TI_FPSAVED] | ||
88 | |||
89 | sll %g1, 5, %g1 | ||
90 | add %g6, TI_FPREGS+0xc0, %g3 | ||
91 | wr %g0, FPRS_FEF, %fprs | ||
92 | membar #Sync | ||
93 | stda %f32, [%g2 + %g1] ASI_BLK_P | ||
94 | stda %f48, [%g3 + %g1] ASI_BLK_P | ||
95 | membar #Sync | ||
96 | ba,pt %xcc, 80f | ||
97 | nop | ||
98 | |||
99 | .align 32 | ||
100 | 80: jmpl %g7 + %g0, %g0 | ||
101 | nop | ||
102 | |||
103 | .align 32 | ||
104 | VISenterhalf: | ||
105 | ldub [%g6 + TI_FPDEPTH], %g1 | ||
106 | brnz,a,pn %g1, 1f | ||
107 | cmp %g1, 1 | ||
108 | stb %g0, [%g6 + TI_FPSAVED] | ||
109 | stx %fsr, [%g6 + TI_XFSR] | ||
110 | clr %o5 | ||
111 | jmpl %g7 + %g0, %g0 | ||
112 | wr %g0, FPRS_FEF, %fprs | ||
113 | |||
114 | 1: bne,pn %icc, 2f | ||
115 | srl %g1, 1, %g1 | ||
116 | ba,pt %xcc, vis1 | ||
117 | sub %g7, 8, %g7 | ||
118 | 2: addcc %g6, %g1, %g3 | ||
119 | sll %g1, 3, %g1 | ||
120 | andn %o5, FPRS_DU, %g2 | ||
121 | stb %g2, [%g3 + TI_FPSAVED] | ||
122 | |||
123 | rd %gsr, %g2 | ||
124 | add %g6, %g1, %g3 | ||
125 | stx %g2, [%g3 + TI_GSR] | ||
126 | add %g6, %g1, %g2 | ||
127 | stx %fsr, [%g2 + TI_XFSR] | ||
128 | sll %g1, 5, %g1 | ||
129 | 3: andcc %o5, FPRS_DL, %g0 | ||
130 | be,pn %icc, 4f | ||
131 | add %g6, TI_FPREGS, %g2 | ||
132 | |||
133 | add %g6, TI_FPREGS+0x40, %g3 | ||
134 | membar #Sync | ||
135 | stda %f0, [%g2 + %g1] ASI_BLK_P | ||
136 | stda %f16, [%g3 + %g1] ASI_BLK_P | ||
137 | membar #Sync | ||
138 | ba,pt %xcc, 4f | ||
139 | nop | ||
140 | |||
141 | .align 32 | ||
142 | 4: and %o5, FPRS_DU, %o5 | ||
143 | jmpl %g7 + %g0, %g0 | ||
144 | wr %o5, FPRS_FEF, %fprs | ||
diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c index 1d649a95660c..8069ce12f20b 100644 --- a/arch/sparc/lib/ksyms.c +++ b/arch/sparc/lib/ksyms.c | |||
@@ -135,10 +135,6 @@ EXPORT_SYMBOL(copy_user_page); | |||
135 | void VISenter(void); | 135 | void VISenter(void); |
136 | EXPORT_SYMBOL(VISenter); | 136 | EXPORT_SYMBOL(VISenter); |
137 | 137 | ||
138 | /* CRYPTO code needs this */ | ||
139 | void VISenterhalf(void); | ||
140 | EXPORT_SYMBOL(VISenterhalf); | ||
141 | |||
142 | extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); | 138 | extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); |
143 | extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, | 139 | extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, |
144 | unsigned long *); | 140 | unsigned long *); |