fpsimd.h (6f84981772535e670e4e2df051a672af229b6694) fpsimd.h (ce514000da4f4b5f850f3339f805471e5c5c1caf)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 ARM Ltd.
4 */
5#ifndef __ASM_FP_H
6#define __ASM_FP_H
7
8#include <asm/errno.h>

--- 47 unchanged lines hidden (view full) ---

56extern void fpsimd_preserve_current_state(void);
57extern void fpsimd_restore_current_state(void);
58extern void fpsimd_update_current_state(struct user_fpsimd_state const *state);
59extern void fpsimd_kvm_prepare(void);
60
61struct cpu_fp_state {
62 struct user_fpsimd_state *st;
63 void *sve_state;
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 ARM Ltd.
4 */
5#ifndef __ASM_FP_H
6#define __ASM_FP_H
7
8#include <asm/errno.h>

--- 47 unchanged lines hidden (view full) ---

56extern void fpsimd_preserve_current_state(void);
57extern void fpsimd_restore_current_state(void);
58extern void fpsimd_update_current_state(struct user_fpsimd_state const *state);
59extern void fpsimd_kvm_prepare(void);
60
61struct cpu_fp_state {
62 struct user_fpsimd_state *st;
63 void *sve_state;
64 void *za_state;
64 void *sme_state;
65 u64 *svcr;
66 unsigned int sve_vl;
67 unsigned int sme_vl;
68 enum fp_type *fp_type;
69 enum fp_type to_save;
70};
71
72extern void fpsimd_bind_state_to_cpu(struct cpu_fp_state *fp_state);

--- 277 unchanged lines hidden (view full) ---

350
351extern void sme_alloc(struct task_struct *task);
352extern unsigned int sme_get_vl(void);
353extern int sme_set_current_vl(unsigned long arg);
354extern int sme_get_current_vl(void);
355
356/*
357 * Return how many bytes of memory are required to store the full SME
65 u64 *svcr;
66 unsigned int sve_vl;
67 unsigned int sme_vl;
68 enum fp_type *fp_type;
69 enum fp_type to_save;
70};
71
72extern void fpsimd_bind_state_to_cpu(struct cpu_fp_state *fp_state);

--- 277 unchanged lines hidden (view full) ---

350
351extern void sme_alloc(struct task_struct *task);
352extern unsigned int sme_get_vl(void);
353extern int sme_set_current_vl(unsigned long arg);
354extern int sme_get_current_vl(void);
355
356/*
357 * Return how many bytes of memory are required to store the full SME
358 * specific state (currently just ZA) for task, given task's currently
359 * configured vector length.
358 * specific state for task, given task's currently configured vector
359 * length.
360 */
360 */
361static inline size_t za_state_size(struct task_struct const *task)
361static inline size_t sme_state_size(struct task_struct const *task)
362{
363 unsigned int vl = task_get_sme_vl(task);
362{
363 unsigned int vl = task_get_sme_vl(task);
364 size_t size;
364
365
365 return ZA_SIG_REGS_SIZE(sve_vq_from_vl(vl));
366 size = ZA_SIG_REGS_SIZE(sve_vq_from_vl(vl));
367
368 return size;
366}
367
368#else
369
370static inline void sme_user_disable(void) { BUILD_BUG(); }
371static inline void sme_user_enable(void) { BUILD_BUG(); }
372
373static inline void sme_smstart_sm(void) { }
374static inline void sme_smstop_sm(void) { }
375static inline void sme_smstop(void) { }
376
377static inline void sme_alloc(struct task_struct *task) { }
378static inline void sme_setup(void) { }
379static inline unsigned int sme_get_vl(void) { return 0; }
380static inline int sme_max_vl(void) { return 0; }
381static inline int sme_max_virtualisable_vl(void) { return 0; }
382static inline int sme_set_current_vl(unsigned long arg) { return -EINVAL; }
383static inline int sme_get_current_vl(void) { return -EINVAL; }
384
369}
370
371#else
372
373static inline void sme_user_disable(void) { BUILD_BUG(); }
374static inline void sme_user_enable(void) { BUILD_BUG(); }
375
376static inline void sme_smstart_sm(void) { }
377static inline void sme_smstop_sm(void) { }
378static inline void sme_smstop(void) { }
379
380static inline void sme_alloc(struct task_struct *task) { }
381static inline void sme_setup(void) { }
382static inline unsigned int sme_get_vl(void) { return 0; }
383static inline int sme_max_vl(void) { return 0; }
384static inline int sme_max_virtualisable_vl(void) { return 0; }
385static inline int sme_set_current_vl(unsigned long arg) { return -EINVAL; }
386static inline int sme_get_current_vl(void) { return -EINVAL; }
387
385static inline size_t za_state_size(struct task_struct const *task)
388static inline size_t sme_state_size(struct task_struct const *task)
386{
387 return 0;
388}
389
390#endif /* ! CONFIG_ARM64_SME */
391
392/* For use by EFI runtime services calls only */
393extern void __efi_fpsimd_begin(void);
394extern void __efi_fpsimd_end(void);
395
396#endif
397
398#endif
389{
390 return 0;
391}
392
393#endif /* ! CONFIG_ARM64_SME */
394
395/* For use by EFI runtime services calls only */
396extern void __efi_fpsimd_begin(void);
397extern void __efi_fpsimd_end(void);
398
399#endif
400
401#endif