xor_vmx_glue.c 1.6 KB

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