18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Altivec XOR operations 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright 2017 IBM Corp. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/preempt.h> 98c2ecf20Sopenharmony_ci#include <linux/export.h> 108c2ecf20Sopenharmony_ci#include <linux/sched.h> 118c2ecf20Sopenharmony_ci#include <asm/switch_to.h> 128c2ecf20Sopenharmony_ci#include <asm/xor_altivec.h> 138c2ecf20Sopenharmony_ci#include "xor_vmx.h" 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_civoid xor_altivec_2(unsigned long bytes, unsigned long *v1_in, 168c2ecf20Sopenharmony_ci unsigned long *v2_in) 178c2ecf20Sopenharmony_ci{ 188c2ecf20Sopenharmony_ci preempt_disable(); 198c2ecf20Sopenharmony_ci enable_kernel_altivec(); 208c2ecf20Sopenharmony_ci __xor_altivec_2(bytes, v1_in, v2_in); 218c2ecf20Sopenharmony_ci disable_kernel_altivec(); 228c2ecf20Sopenharmony_ci preempt_enable(); 238c2ecf20Sopenharmony_ci} 248c2ecf20Sopenharmony_ciEXPORT_SYMBOL(xor_altivec_2); 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_civoid xor_altivec_3(unsigned long bytes, unsigned long *v1_in, 278c2ecf20Sopenharmony_ci unsigned long *v2_in, unsigned long *v3_in) 288c2ecf20Sopenharmony_ci{ 298c2ecf20Sopenharmony_ci preempt_disable(); 308c2ecf20Sopenharmony_ci enable_kernel_altivec(); 318c2ecf20Sopenharmony_ci __xor_altivec_3(bytes, v1_in, v2_in, v3_in); 328c2ecf20Sopenharmony_ci disable_kernel_altivec(); 338c2ecf20Sopenharmony_ci preempt_enable(); 348c2ecf20Sopenharmony_ci} 358c2ecf20Sopenharmony_ciEXPORT_SYMBOL(xor_altivec_3); 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_civoid xor_altivec_4(unsigned long bytes, unsigned long *v1_in, 388c2ecf20Sopenharmony_ci unsigned long *v2_in, unsigned long *v3_in, 398c2ecf20Sopenharmony_ci unsigned long *v4_in) 408c2ecf20Sopenharmony_ci{ 418c2ecf20Sopenharmony_ci preempt_disable(); 428c2ecf20Sopenharmony_ci enable_kernel_altivec(); 438c2ecf20Sopenharmony_ci __xor_altivec_4(bytes, v1_in, v2_in, v3_in, v4_in); 448c2ecf20Sopenharmony_ci disable_kernel_altivec(); 458c2ecf20Sopenharmony_ci preempt_enable(); 468c2ecf20Sopenharmony_ci} 478c2ecf20Sopenharmony_ciEXPORT_SYMBOL(xor_altivec_4); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_civoid xor_altivec_5(unsigned long bytes, unsigned long *v1_in, 508c2ecf20Sopenharmony_ci unsigned long *v2_in, unsigned long *v3_in, 518c2ecf20Sopenharmony_ci unsigned long *v4_in, unsigned long *v5_in) 528c2ecf20Sopenharmony_ci{ 538c2ecf20Sopenharmony_ci preempt_disable(); 548c2ecf20Sopenharmony_ci enable_kernel_altivec(); 558c2ecf20Sopenharmony_ci __xor_altivec_5(bytes, v1_in, v2_in, v3_in, v4_in, v5_in); 568c2ecf20Sopenharmony_ci disable_kernel_altivec(); 578c2ecf20Sopenharmony_ci preempt_enable(); 588c2ecf20Sopenharmony_ci} 598c2ecf20Sopenharmony_ciEXPORT_SYMBOL(xor_altivec_5); 60