Matt Brown | f718d42 | 2017-05-24 09:45:59 +1000 | [diff] [blame] | 1 | /* |
| 2 | * Altivec XOR operations |
| 3 | * |
| 4 | * Copyright 2017 IBM Corp. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/preempt.h> |
| 13 | #include <linux/export.h> |
| 14 | #include <linux/sched.h> |
| 15 | #include <asm/switch_to.h> |
Mathieu Malaterre | 7cf76a6 | 2018-03-28 20:55:25 +0200 | [diff] [blame] | 16 | #include <asm/xor_altivec.h> |
Matt Brown | f718d42 | 2017-05-24 09:45:59 +1000 | [diff] [blame] | 17 | #include "xor_vmx.h" |
| 18 | |
| 19 | void xor_altivec_2(unsigned long bytes, unsigned long *v1_in, |
| 20 | unsigned long *v2_in) |
| 21 | { |
| 22 | preempt_disable(); |
| 23 | enable_kernel_altivec(); |
| 24 | __xor_altivec_2(bytes, v1_in, v2_in); |
| 25 | disable_kernel_altivec(); |
| 26 | preempt_enable(); |
| 27 | } |
| 28 | EXPORT_SYMBOL(xor_altivec_2); |
| 29 | |
| 30 | void xor_altivec_3(unsigned long bytes, unsigned long *v1_in, |
| 31 | unsigned long *v2_in, unsigned long *v3_in) |
| 32 | { |
| 33 | preempt_disable(); |
| 34 | enable_kernel_altivec(); |
| 35 | __xor_altivec_3(bytes, v1_in, v2_in, v3_in); |
| 36 | disable_kernel_altivec(); |
| 37 | preempt_enable(); |
| 38 | } |
| 39 | EXPORT_SYMBOL(xor_altivec_3); |
| 40 | |
| 41 | void xor_altivec_4(unsigned long bytes, unsigned long *v1_in, |
| 42 | unsigned long *v2_in, unsigned long *v3_in, |
| 43 | unsigned long *v4_in) |
| 44 | { |
| 45 | preempt_disable(); |
| 46 | enable_kernel_altivec(); |
| 47 | __xor_altivec_4(bytes, v1_in, v2_in, v3_in, v4_in); |
| 48 | disable_kernel_altivec(); |
| 49 | preempt_enable(); |
| 50 | } |
| 51 | EXPORT_SYMBOL(xor_altivec_4); |
| 52 | |
| 53 | void xor_altivec_5(unsigned long bytes, unsigned long *v1_in, |
| 54 | unsigned long *v2_in, unsigned long *v3_in, |
| 55 | unsigned long *v4_in, unsigned long *v5_in) |
| 56 | { |
| 57 | preempt_disable(); |
| 58 | enable_kernel_altivec(); |
| 59 | __xor_altivec_5(bytes, v1_in, v2_in, v3_in, v4_in, v5_in); |
| 60 | disable_kernel_altivec(); |
| 61 | preempt_enable(); |
| 62 | } |
| 63 | EXPORT_SYMBOL(xor_altivec_5); |