xor_vmx_glue.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include <linux/preempt.h>
  12. #include <linux/export.h>
  13. #include <linux/sched.h>
  14. #include <asm/switch_to.h>
  15. #include "xor_vmx.h"
  16. void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
  17. unsigned long *v2_in)
  18. {
  19. preempt_disable();
  20. enable_kernel_altivec();
  21. __xor_altivec_2(bytes, v1_in, v2_in);
  22. disable_kernel_altivec();
  23. preempt_enable();
  24. }
  25. EXPORT_SYMBOL(xor_altivec_2);
  26. void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
  27. unsigned long *v2_in, unsigned long *v3_in)
  28. {
  29. preempt_disable();
  30. enable_kernel_altivec();
  31. __xor_altivec_3(bytes, v1_in, v2_in, v3_in);
  32. disable_kernel_altivec();
  33. preempt_enable();
  34. }
  35. EXPORT_SYMBOL(xor_altivec_3);
  36. void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
  37. unsigned long *v2_in, unsigned long *v3_in,
  38. unsigned long *v4_in)
  39. {
  40. preempt_disable();
  41. enable_kernel_altivec();
  42. __xor_altivec_4(bytes, v1_in, v2_in, v3_in, v4_in);
  43. disable_kernel_altivec();
  44. preempt_enable();
  45. }
  46. EXPORT_SYMBOL(xor_altivec_4);
  47. void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
  48. unsigned long *v2_in, unsigned long *v3_in,
  49. unsigned long *v4_in, unsigned long *v5_in)
  50. {
  51. preempt_disable();
  52. enable_kernel_altivec();
  53. __xor_altivec_5(bytes, v1_in, v2_in, v3_in, v4_in, v5_in);
  54. disable_kernel_altivec();
  55. preempt_enable();
  56. }
  57. EXPORT_SYMBOL(xor_altivec_5);