mm: make wait_on_page_writeback() wait for multiple pending writebacks
[linux/fpc-iii.git] / arch / s390 / include / asm / fpu / internal.h
blob4a71dbbf76fbb5d42de432f18a853e97d94114e2
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * FPU state and register content conversion primitives
5 * Copyright IBM Corp. 2015
6 * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
7 */
9 #ifndef _ASM_S390_FPU_INTERNAL_H
10 #define _ASM_S390_FPU_INTERNAL_H
12 #include <linux/string.h>
13 #include <asm/ctl_reg.h>
14 #include <asm/fpu/types.h>
16 static inline void save_vx_regs(__vector128 *vxrs)
18 asm volatile(
19 " la 1,%0\n"
20 " .word 0xe70f,0x1000,0x003e\n" /* vstm 0,15,0(1) */
21 " .word 0xe70f,0x1100,0x0c3e\n" /* vstm 16,31,256(1) */
22 : "=Q" (*(struct vx_array *) vxrs) : : "1");
25 static inline void convert_vx_to_fp(freg_t *fprs, __vector128 *vxrs)
27 int i;
29 for (i = 0; i < __NUM_FPRS; i++)
30 fprs[i] = *(freg_t *)(vxrs + i);
33 static inline void convert_fp_to_vx(__vector128 *vxrs, freg_t *fprs)
35 int i;
37 for (i = 0; i < __NUM_FPRS; i++)
38 *(freg_t *)(vxrs + i) = fprs[i];
41 static inline void fpregs_store(_s390_fp_regs *fpregs, struct fpu *fpu)
43 fpregs->pad = 0;
44 fpregs->fpc = fpu->fpc;
45 if (MACHINE_HAS_VX)
46 convert_vx_to_fp((freg_t *)&fpregs->fprs, fpu->vxrs);
47 else
48 memcpy((freg_t *)&fpregs->fprs, fpu->fprs,
49 sizeof(fpregs->fprs));
52 static inline void fpregs_load(_s390_fp_regs *fpregs, struct fpu *fpu)
54 fpu->fpc = fpregs->fpc;
55 if (MACHINE_HAS_VX)
56 convert_fp_to_vx(fpu->vxrs, (freg_t *)&fpregs->fprs);
57 else
58 memcpy(fpu->fprs, (freg_t *)&fpregs->fprs,
59 sizeof(fpregs->fprs));
62 #endif /* _ASM_S390_FPU_INTERNAL_H */