Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.0 159 lines 4.8 kB view raw
1/* 2 * Copyright (C) 2012 ARM Ltd. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16#ifndef __ASM_FP_H 17#define __ASM_FP_H 18 19#include <asm/errno.h> 20#include <asm/ptrace.h> 21#include <asm/processor.h> 22#include <asm/sigcontext.h> 23#include <asm/sysreg.h> 24 25#ifndef __ASSEMBLY__ 26 27#include <linux/build_bug.h> 28#include <linux/cache.h> 29#include <linux/init.h> 30#include <linux/stddef.h> 31 32#if defined(__KERNEL__) && defined(CONFIG_COMPAT) 33/* Masks for extracting the FPSR and FPCR from the FPSCR */ 34#define VFP_FPSCR_STAT_MASK 0xf800009f 35#define VFP_FPSCR_CTRL_MASK 0x07f79f00 36/* 37 * The VFP state has 32x64-bit registers and a single 32-bit 38 * control/status register. 39 */ 40#define VFP_STATE_SIZE ((32 * 8) + 4) 41#endif 42 43struct task_struct; 44 45extern void fpsimd_save_state(struct user_fpsimd_state *state); 46extern void fpsimd_load_state(struct user_fpsimd_state *state); 47 48extern void fpsimd_save(void); 49 50extern void fpsimd_thread_switch(struct task_struct *next); 51extern void fpsimd_flush_thread(void); 52 53extern void fpsimd_signal_preserve_current_state(void); 54extern void fpsimd_preserve_current_state(void); 55extern void fpsimd_restore_current_state(void); 56extern void fpsimd_update_current_state(struct user_fpsimd_state const *state); 57 58extern void fpsimd_bind_task_to_cpu(void); 59extern void fpsimd_bind_state_to_cpu(struct user_fpsimd_state *state); 60 61extern void fpsimd_flush_task_state(struct task_struct *target); 62extern void fpsimd_flush_cpu_state(void); 63extern void sve_flush_cpu_state(void); 64 65/* Maximum VL that SVE VL-agnostic software can transparently support */ 66#define SVE_VL_ARCH_MAX 0x100 67 68/* Offset of FFR in the SVE register dump */ 69static inline size_t sve_ffr_offset(int vl) 70{ 71 return SVE_SIG_FFR_OFFSET(sve_vq_from_vl(vl)) - SVE_SIG_REGS_OFFSET; 72} 73 74static inline void *sve_pffr(struct thread_struct *thread) 75{ 76 return (char *)thread->sve_state + sve_ffr_offset(thread->sve_vl); 77} 78 79extern void sve_save_state(void *state, u32 *pfpsr); 80extern void sve_load_state(void const *state, u32 const *pfpsr, 81 unsigned long vq_minus_1); 82extern unsigned int sve_get_vl(void); 83 84struct arm64_cpu_capabilities; 85extern void sve_kernel_enable(const struct arm64_cpu_capabilities *__unused); 86 87extern u64 read_zcr_features(void); 88 89extern int __ro_after_init sve_max_vl; 90 91#ifdef CONFIG_ARM64_SVE 92 93extern size_t sve_state_size(struct task_struct const *task); 94 95extern void sve_alloc(struct task_struct *task); 96extern void fpsimd_release_task(struct task_struct *task); 97extern void fpsimd_sync_to_sve(struct task_struct *task); 98extern void sve_sync_to_fpsimd(struct task_struct *task); 99extern void sve_sync_from_fpsimd_zeropad(struct task_struct *task); 100 101extern int sve_set_vector_length(struct task_struct *task, 102 unsigned long vl, unsigned long flags); 103 104extern int sve_set_current_vl(unsigned long arg); 105extern int sve_get_current_vl(void); 106 107static inline void sve_user_disable(void) 108{ 109 sysreg_clear_set(cpacr_el1, CPACR_EL1_ZEN_EL0EN, 0); 110} 111 112static inline void sve_user_enable(void) 113{ 114 sysreg_clear_set(cpacr_el1, 0, CPACR_EL1_ZEN_EL0EN); 115} 116 117/* 118 * Probing and setup functions. 119 * Calls to these functions must be serialised with one another. 120 */ 121extern void __init sve_init_vq_map(void); 122extern void sve_update_vq_map(void); 123extern int sve_verify_vq_map(void); 124extern void __init sve_setup(void); 125 126#else /* ! CONFIG_ARM64_SVE */ 127 128static inline void sve_alloc(struct task_struct *task) { } 129static inline void fpsimd_release_task(struct task_struct *task) { } 130static inline void sve_sync_to_fpsimd(struct task_struct *task) { } 131static inline void sve_sync_from_fpsimd_zeropad(struct task_struct *task) { } 132 133static inline int sve_set_current_vl(unsigned long arg) 134{ 135 return -EINVAL; 136} 137 138static inline int sve_get_current_vl(void) 139{ 140 return -EINVAL; 141} 142 143static inline void sve_user_disable(void) { BUILD_BUG(); } 144static inline void sve_user_enable(void) { BUILD_BUG(); } 145 146static inline void sve_init_vq_map(void) { } 147static inline void sve_update_vq_map(void) { } 148static inline int sve_verify_vq_map(void) { return 0; } 149static inline void sve_setup(void) { } 150 151#endif /* ! CONFIG_ARM64_SVE */ 152 153/* For use by EFI runtime services calls only */ 154extern void __efi_fpsimd_begin(void); 155extern void __efi_fpsimd_end(void); 156 157#endif 158 159#endif