12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2f718d426SMatt Brown /*
3f718d426SMatt Brown * Altivec XOR operations
4f718d426SMatt Brown *
5f718d426SMatt Brown * Copyright 2017 IBM Corp.
6f718d426SMatt Brown */
7f718d426SMatt Brown
8f718d426SMatt Brown #include <linux/preempt.h>
9f718d426SMatt Brown #include <linux/export.h>
10f718d426SMatt Brown #include <linux/sched.h>
11f718d426SMatt Brown #include <asm/switch_to.h>
127cf76a68SMathieu Malaterre #include <asm/xor_altivec.h>
13f718d426SMatt Brown #include "xor_vmx.h"
14f718d426SMatt Brown
xor_altivec_2(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2)15*297565aaSArd Biesheuvel void xor_altivec_2(unsigned long bytes, unsigned long * __restrict p1,
16*297565aaSArd Biesheuvel const unsigned long * __restrict p2)
17f718d426SMatt Brown {
18f718d426SMatt Brown preempt_disable();
19f718d426SMatt Brown enable_kernel_altivec();
20*297565aaSArd Biesheuvel __xor_altivec_2(bytes, p1, p2);
21f718d426SMatt Brown disable_kernel_altivec();
22f718d426SMatt Brown preempt_enable();
23f718d426SMatt Brown }
24f718d426SMatt Brown EXPORT_SYMBOL(xor_altivec_2);
25f718d426SMatt Brown
xor_altivec_3(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3)26*297565aaSArd Biesheuvel void xor_altivec_3(unsigned long bytes, unsigned long * __restrict p1,
27*297565aaSArd Biesheuvel const unsigned long * __restrict p2,
28*297565aaSArd Biesheuvel const unsigned long * __restrict p3)
29f718d426SMatt Brown {
30f718d426SMatt Brown preempt_disable();
31f718d426SMatt Brown enable_kernel_altivec();
32*297565aaSArd Biesheuvel __xor_altivec_3(bytes, p1, p2, p3);
33f718d426SMatt Brown disable_kernel_altivec();
34f718d426SMatt Brown preempt_enable();
35f718d426SMatt Brown }
36f718d426SMatt Brown EXPORT_SYMBOL(xor_altivec_3);
37f718d426SMatt Brown
xor_altivec_4(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4)38*297565aaSArd Biesheuvel void xor_altivec_4(unsigned long bytes, unsigned long * __restrict p1,
39*297565aaSArd Biesheuvel const unsigned long * __restrict p2,
40*297565aaSArd Biesheuvel const unsigned long * __restrict p3,
41*297565aaSArd Biesheuvel const unsigned long * __restrict p4)
42f718d426SMatt Brown {
43f718d426SMatt Brown preempt_disable();
44f718d426SMatt Brown enable_kernel_altivec();
45*297565aaSArd Biesheuvel __xor_altivec_4(bytes, p1, p2, p3, p4);
46f718d426SMatt Brown disable_kernel_altivec();
47f718d426SMatt Brown preempt_enable();
48f718d426SMatt Brown }
49f718d426SMatt Brown EXPORT_SYMBOL(xor_altivec_4);
50f718d426SMatt Brown
xor_altivec_5(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4,const unsigned long * __restrict p5)51*297565aaSArd Biesheuvel void xor_altivec_5(unsigned long bytes, unsigned long * __restrict p1,
52*297565aaSArd Biesheuvel const unsigned long * __restrict p2,
53*297565aaSArd Biesheuvel const unsigned long * __restrict p3,
54*297565aaSArd Biesheuvel const unsigned long * __restrict p4,
55*297565aaSArd Biesheuvel const unsigned long * __restrict p5)
56f718d426SMatt Brown {
57f718d426SMatt Brown preempt_disable();
58f718d426SMatt Brown enable_kernel_altivec();
59*297565aaSArd Biesheuvel __xor_altivec_5(bytes, p1, p2, p3, p4, p5);
60f718d426SMatt Brown disable_kernel_altivec();
61f718d426SMatt Brown preempt_enable();
62f718d426SMatt Brown }
63f718d426SMatt Brown EXPORT_SYMBOL(xor_altivec_5);
64