/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2004-2012 Cavium Networks */ #include <asm/cop2.h> #include <linux/export.h> #include <linux/interrupt.h> #include <linux/sched/task_stack.h> #include "octeon-crypto.h" /** * Enable access to Octeon's COP2 crypto hardware for kernel use. Wrap any * crypto operations in calls to octeon_crypto_enable/disable in order to make * sure the state of COP2 isn't corrupted if userspace is also performing * hardware crypto operations. Allocate the state parameter on the stack. * Returns with preemption disabled. * * @state: Pointer to state structure to store current COP2 state in. * * Returns: Flags to be passed to octeon_crypto_disable() */
unsigned long octeon_crypto_enable(struct octeon_cop2_state *state) { int status; unsigned long flags; preempt_disable(); local_irq_save(flags); status = read_c0_status(); write_c0_status(status | ST0_CU2); if (KSTK_STATUS(current) & ST0_CU2) { octeon_cop2_save(&(current->thread.cp2)); KSTK_STATUS(current) &= ~ST0_CU2; status &= ~ST0_CU2; } else if (status & ST0_CU2) { octeon_cop2_save(state); } local_irq_restore(flags); return status & ST0_CU2; }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Aaro Koskinen | 98 | 100.00% | 2 | 100.00% |
Total | 98 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Aaro Koskinen | 52 | 100.00% | 2 | 100.00% |
Total | 52 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Aaro Koskinen | 174 | 97.75% | 2 | 50.00% |
Arnd Bergmann | 3 | 1.69% | 1 | 25.00% |
Paul Gortmaker | 1 | 0.56% | 1 | 25.00% |
Total | 178 | 100.00% | 4 | 100.00% |