Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 18 Oct 2014 16:30:41 +0000 (09:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 18 Oct 2014 16:30:41 +0000 (09:30 -0700)
Pull Sparc bugfix from David Miller:
 "Sparc64 AES ctr mode bug fix"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
  sparc64: Fix FPU register corruption with AES crypto offload.

arch/sparc/include/asm/visasm.h
arch/sparc/lib/NG4memcpy.S

index b2667375928306d1442c475604fb0d919fd4bf09..1f0aa2024e94be341efc079f58145a2e70909052 100644 (file)
 297:   wr              %o5, FPRS_FEF, %fprs;           \
 298:
 
+#define VISEntryHalfFast(fail_label)                   \
+       rd              %fprs, %o5;                     \
+       andcc           %o5, FPRS_FEF, %g0;             \
+       be,pt           %icc, 297f;                     \
+        nop;                                           \
+       ba,a,pt         %xcc, fail_label;               \
+297:   wr              %o5, FPRS_FEF, %fprs;
+
 #define VISExitHalf                                    \
        wr              %o5, 0, %fprs;
 
index 9cf2ee01cee371e77749469831a5f9fab9f9fa09..140527a20e7df03cc0a0dd9e6a3438f44b432177 100644 (file)
 #endif
 #endif
 
+#if !defined(EX_LD) && !defined(EX_ST)
+#define NON_USER_COPY
+#endif
+
 #ifndef EX_LD
 #define EX_LD(x)       x
 #endif
@@ -197,9 +201,13 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
         mov            EX_RETVAL(%o3), %o0
 
 .Llarge_src_unaligned:
+#ifdef NON_USER_COPY
+       VISEntryHalfFast(.Lmedium_vis_entry_fail)
+#else
+       VISEntryHalf
+#endif
        andn            %o2, 0x3f, %o4
        sub             %o2, %o4, %o2
-       VISEntryHalf
        alignaddr       %o1, %g0, %g1
        add             %o1, %o4, %o1
        EX_LD(LOAD(ldd, %g1 + 0x00, %f0))
@@ -240,6 +248,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
         nop
        ba,a,pt         %icc, .Lmedium_unaligned
 
+#ifdef NON_USER_COPY
+.Lmedium_vis_entry_fail:
+        or             %o0, %o1, %g2
+#endif
 .Lmedium:
        LOAD(prefetch, %o1 + 0x40, #n_reads_strong)
        andcc           %g2, 0x7, %g0