xref: /openbmc/linux/arch/powerpc/lib/xor_vmx_glue.c (revision 4da722ca)
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>
16 #include "xor_vmx.h"
17 
18 void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
19 		   unsigned long *v2_in)
20 {
21 	preempt_disable();
22 	enable_kernel_altivec();
23 	__xor_altivec_2(bytes, v1_in, v2_in);
24 	disable_kernel_altivec();
25 	preempt_enable();
26 }
27 EXPORT_SYMBOL(xor_altivec_2);
28 
29 void xor_altivec_3(unsigned long bytes,  unsigned long *v1_in,
30 		   unsigned long *v2_in, unsigned long *v3_in)
31 {
32 	preempt_disable();
33 	enable_kernel_altivec();
34 	__xor_altivec_3(bytes, v1_in, v2_in, v3_in);
35 	disable_kernel_altivec();
36 	preempt_enable();
37 }
38 EXPORT_SYMBOL(xor_altivec_3);
39 
40 void xor_altivec_4(unsigned long bytes,  unsigned long *v1_in,
41 		   unsigned long *v2_in, unsigned long *v3_in,
42 		   unsigned long *v4_in)
43 {
44 	preempt_disable();
45 	enable_kernel_altivec();
46 	__xor_altivec_4(bytes, v1_in, v2_in, v3_in, v4_in);
47 	disable_kernel_altivec();
48 	preempt_enable();
49 }
50 EXPORT_SYMBOL(xor_altivec_4);
51 
52 void xor_altivec_5(unsigned long bytes,  unsigned long *v1_in,
53 		   unsigned long *v2_in, unsigned long *v3_in,
54 		   unsigned long *v4_in, unsigned long *v5_in)
55 {
56 	preempt_disable();
57 	enable_kernel_altivec();
58 	__xor_altivec_5(bytes, v1_in, v2_in, v3_in, v4_in, v5_in);
59 	disable_kernel_altivec();
60 	preempt_enable();
61 }
62 EXPORT_SYMBOL(xor_altivec_5);
63