summaryrefslogtreecommitdiff
path: root/arch/s390/include/asm/fpu.h
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2024-02-03 13:45:05 +0300
committerHeiko Carstens <hca@linux.ibm.com>2024-02-16 16:30:14 +0300
commit88d8136a0896e32fc39f90788eaa5c7bdccc9fb0 (patch)
treef924af0bc42c320ea1e6734e5c58a44a38af20b6 /arch/s390/include/asm/fpu.h
parent13a8a519cacf04e970907687dcb1e85c03073ba8 (diff)
downloadlinux-88d8136a0896e32fc39f90788eaa5c7bdccc9fb0.tar.xz
s390/fpu: provide and use ld and std inline assemblies
Deduplicate the 64 ld and std inline assemblies. Provide an fpu inline assembly for both instructions, and use them in the new save_fp_regs() and load_fp_regs() helper functions. Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/fpu.h')
-rw-r--r--arch/s390/include/asm/fpu.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/s390/include/asm/fpu.h b/arch/s390/include/asm/fpu.h
index eed430c868df..626695de6085 100644
--- a/arch/s390/include/asm/fpu.h
+++ b/arch/s390/include/asm/fpu.h
@@ -84,6 +84,46 @@ void __load_fpu_regs(void);
void __kernel_fpu_begin(struct kernel_fpu *state, u32 flags);
void __kernel_fpu_end(struct kernel_fpu *state, u32 flags);
+static __always_inline void save_fp_regs(freg_t *fprs)
+{
+ fpu_std(0, &fprs[0]);
+ fpu_std(1, &fprs[1]);
+ fpu_std(2, &fprs[2]);
+ fpu_std(3, &fprs[3]);
+ fpu_std(4, &fprs[4]);
+ fpu_std(5, &fprs[5]);
+ fpu_std(6, &fprs[6]);
+ fpu_std(7, &fprs[7]);
+ fpu_std(8, &fprs[8]);
+ fpu_std(9, &fprs[9]);
+ fpu_std(10, &fprs[10]);
+ fpu_std(11, &fprs[11]);
+ fpu_std(12, &fprs[12]);
+ fpu_std(13, &fprs[13]);
+ fpu_std(14, &fprs[14]);
+ fpu_std(15, &fprs[15]);
+}
+
+static __always_inline void load_fp_regs(freg_t *fprs)
+{
+ fpu_ld(0, &fprs[0]);
+ fpu_ld(1, &fprs[1]);
+ fpu_ld(2, &fprs[2]);
+ fpu_ld(3, &fprs[3]);
+ fpu_ld(4, &fprs[4]);
+ fpu_ld(5, &fprs[5]);
+ fpu_ld(6, &fprs[6]);
+ fpu_ld(7, &fprs[7]);
+ fpu_ld(8, &fprs[8]);
+ fpu_ld(9, &fprs[9]);
+ fpu_ld(10, &fprs[10]);
+ fpu_ld(11, &fprs[11]);
+ fpu_ld(12, &fprs[12]);
+ fpu_ld(13, &fprs[13]);
+ fpu_ld(14, &fprs[14]);
+ fpu_ld(15, &fprs[15]);
+}
+
static inline void kernel_fpu_begin(struct kernel_fpu *state, u32 flags)
{
preempt_disable();