linux/arch/powerpc/lib
Matt Brown f718d426d7 powerpc/lib/xor_vmx: Ensure no altivec code executes before enable_kernel_altivec()
The xor_vmx.c file is used for the RAID5 xor operations. In these functions
altivec is enabled to run the operation and then disabled.

The code uses enable_kernel_altivec() around the core of the algorithm, however
the whole file is built with -maltivec, so the compiler is within its rights to
generate altivec code anywhere. This has been seen at least once in the wild:

  0:mon> di $xor_altivec_2
  c0000000000b97d0  3c4c01d9	addis   r2,r12,473
  c0000000000b97d4  3842db30	addi    r2,r2,-9424
  c0000000000b97d8  7c0802a6	mflr    r0
  c0000000000b97dc  f8010010	std     r0,16(r1)
  c0000000000b97e0  60000000	nop
  c0000000000b97e4  7c0802a6	mflr    r0
  c0000000000b97e8  faa1ffa8	std     r21,-88(r1)
  ...
  c0000000000b981c  f821ff41	stdu    r1,-192(r1)
  c0000000000b9820  7f8101ce	stvx    v28,r1,r0		<-- POP
  c0000000000b9824  38000030	li      r0,48
  c0000000000b9828  7fa101ce	stvx    v29,r1,r0
  ...
  c0000000000b984c  4bf6a06d	bl      c0000000000238b8 # enable_kernel_altivec

This patch splits the non-altivec code into xor_vmx_glue.c which calls the
altivec functions in xor_vmx.c. By compiling xor_vmx_glue.c without
-maltivec we can guarantee that altivec instruction will not be executed
outside of the enable/disable block.

Signed-off-by: Matt Brown <matthew.brown.dev@gmail.com>
[mpe: Rework change log and include disassembly]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-06-02 20:17:52 +10:00
..
alloc.c treewide: replace obsolete _refok by __ref 2016-08-02 17:31:41 -04:00
checksum_32.S powerpc: EX_TABLE macro for exception tables 2016-11-14 11:11:51 +11:00
checksum_64.S powerpc/64: Use optimized checksum routines on little-endian 2017-01-25 13:34:18 +11:00
checksum_wrappers.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
code-patching.c powerpc/kprobes: Convert __kprobes to NOKPROBE_SYMBOL() 2017-04-23 20:32:25 +10:00
copy_32.S powerpc: get rid of zeroing, switch to RAW_COPY_USER 2017-04-06 15:08:42 -04:00
copypage_64.S powerpc/64: Fix naming of cache block vs. cache line 2017-02-06 19:46:04 +11:00
copypage_power7.S powerpc: Change vrX register defines to vX to match gcc and glibc 2015-03-16 18:32:11 +11:00
copyuser_64.S powerpc: get rid of zeroing, switch to RAW_COPY_USER 2017-04-06 15:08:42 -04:00
copyuser_power7.S powerpc: Tweak copy selection parameter in __copy_tofrom_user_power7() 2017-05-30 14:59:51 +10:00
crtsavres.S powerpc/64: Do not create new section for save/restore functions 2017-05-30 14:59:51 +10:00
div64.S
feature-fixups-test.S powerpc: Ensure the else case of feature sections will fit 2011-01-21 14:08:33 +11:00
feature-fixups.c sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
hweight_64.S ppc: move exports to definitions 2016-08-07 23:50:09 -04:00
ldstfp.S powerpc: EX_TABLE macro for exception tables 2016-11-14 11:11:51 +11:00
locks.c powerpc/spinlock: Fix spin_unlock_wait() 2016-06-14 16:05:44 +10:00
Makefile powerpc/lib/xor_vmx: Ensure no altivec code executes before enable_kernel_altivec() 2017-06-02 20:17:52 +10:00
mem_64.S Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2016-10-14 14:26:58 -07:00
memcmp_64.S ppc: move exports to definitions 2016-08-07 23:50:09 -04:00
memcpy_64.S ppc: move exports to definitions 2016-08-07 23:50:09 -04:00
memcpy_power7.S powerpc: Change vrX register defines to vX to match gcc and glibc 2015-03-16 18:32:11 +11:00
rheap.c powerpc: Various typo fixes 2016-06-14 13:58:26 +10:00
sstep.c powerpc/kprobes: Convert __kprobes to NOKPROBE_SYMBOL() 2017-04-23 20:32:25 +10:00
string_64.S powerpc/64: Fix naming of cache block vs. cache line 2017-02-06 19:46:04 +11:00
string.S powerpc: EX_TABLE macro for exception tables 2016-11-14 11:11:51 +11:00
test_emulate_step.c powerpc: emulate_step() tests for load/store instructions 2017-03-03 11:24:50 +11:00
vmx-helper.c powerpc: Introduce asm-prototypes.h 2016-06-16 22:39:54 +10:00
xor_vmx_glue.c powerpc/lib/xor_vmx: Ensure no altivec code executes before enable_kernel_altivec() 2017-06-02 20:17:52 +10:00
xor_vmx.c powerpc/lib/xor_vmx: Ensure no altivec code executes before enable_kernel_altivec() 2017-06-02 20:17:52 +10:00
xor_vmx.h powerpc/lib/xor_vmx: Ensure no altivec code executes before enable_kernel_altivec() 2017-06-02 20:17:52 +10:00