diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2024-02-03 11:45:17 +0100 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2024-02-16 14:30:16 +0100 |
commit | 066c40918bb495de8f2e45bd7eec06737a142712 (patch) | |
tree | 4b510a53f7616d9095336cc60e78fcc54f2275a7 /arch/s390/kernel/fpu.c | |
parent | cad8c3abaac3848f46ba9d1b21f79fab87098da2 (diff) |
s390/fpu: decrease stack usage for some cases
The kernel_fpu structure has a quite large size of 520 bytes. In order to
reduce stack footprint introduce several kernel fpu structures with
different and also smaller sizes. This way every kernel fpu user must use
the correct variant. A compile time check verifies that the correct variant
is used.
There are several users which use only 16 instead of all 32 vector
registers. For those users the new kernel_fpu_16 structure with a size of
only 266 bytes can be used.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/fpu.c')
-rw-r--r-- | arch/s390/kernel/fpu.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/arch/s390/kernel/fpu.c b/arch/s390/kernel/fpu.c index 733e188951b7..62e9befe7890 100644 --- a/arch/s390/kernel/fpu.c +++ b/arch/s390/kernel/fpu.c @@ -19,41 +19,41 @@ void __kernel_fpu_begin(struct kernel_fpu *state, int flags) * Limit the save to the FPU/vector registers already * in use by the previous context. */ - flags &= state->mask; + flags &= state->hdr.mask; if (flags & KERNEL_FPC) - fpu_stfpc(&state->fpc); + fpu_stfpc(&state->hdr.fpc); if (!cpu_has_vx()) { if (flags & KERNEL_VXR_LOW) - save_fp_regs_vx(state->vxrs); + save_fp_regs_vx(vxrs); return; } mask = flags & KERNEL_VXR; if (mask == KERNEL_VXR) { - fpu_vstm(0, 15, &vxrs[0]); - fpu_vstm(16, 31, &vxrs[16]); + vxrs += fpu_vstm(0, 15, vxrs); + vxrs += fpu_vstm(16, 31, vxrs); return; } if (mask == KERNEL_VXR_MID) { - fpu_vstm(8, 23, &vxrs[8]); + vxrs += fpu_vstm(8, 23, vxrs); return; } mask = flags & KERNEL_VXR_LOW; if (mask) { if (mask == KERNEL_VXR_LOW) - fpu_vstm(0, 15, &vxrs[0]); + vxrs += fpu_vstm(0, 15, vxrs); else if (mask == KERNEL_VXR_V0V7) - fpu_vstm(0, 7, &vxrs[0]); + vxrs += fpu_vstm(0, 7, vxrs); else - fpu_vstm(8, 15, &vxrs[8]); + vxrs += fpu_vstm(8, 15, vxrs); } mask = flags & KERNEL_VXR_HIGH; if (mask) { if (mask == KERNEL_VXR_HIGH) - fpu_vstm(16, 31, &vxrs[16]); + vxrs += fpu_vstm(16, 31, vxrs); else if (mask == KERNEL_VXR_V16V23) - fpu_vstm(16, 23, &vxrs[16]); + vxrs += fpu_vstm(16, 23, vxrs); else - fpu_vstm(24, 31, &vxrs[24]); + vxrs += fpu_vstm(24, 31, vxrs); } } EXPORT_SYMBOL(__kernel_fpu_begin); @@ -68,41 +68,41 @@ void __kernel_fpu_end(struct kernel_fpu *state, int flags) * previous context that have been overwritten by the * current context. */ - flags &= state->mask; + flags &= state->hdr.mask; if (flags & KERNEL_FPC) - fpu_lfpc(&state->fpc); + fpu_lfpc(&state->hdr.fpc); if (!cpu_has_vx()) { if (flags & KERNEL_VXR_LOW) - load_fp_regs_vx(state->vxrs); + load_fp_regs_vx(vxrs); return; } mask = flags & KERNEL_VXR; if (mask == KERNEL_VXR) { - fpu_vlm(0, 15, &vxrs[0]); - fpu_vlm(16, 31, &vxrs[16]); + vxrs += fpu_vlm(0, 15, vxrs); + vxrs += fpu_vlm(16, 31, vxrs); return; } if (mask == KERNEL_VXR_MID) { - fpu_vlm(8, 23, &vxrs[8]); + vxrs += fpu_vlm(8, 23, vxrs); return; } mask = flags & KERNEL_VXR_LOW; if (mask) { if (mask == KERNEL_VXR_LOW) - fpu_vlm(0, 15, &vxrs[0]); + vxrs += fpu_vlm(0, 15, vxrs); else if (mask == KERNEL_VXR_V0V7) - fpu_vlm(0, 7, &vxrs[0]); + vxrs += fpu_vlm(0, 7, vxrs); else - fpu_vlm(8, 15, &vxrs[8]); + vxrs += fpu_vlm(8, 15, vxrs); } mask = flags & KERNEL_VXR_HIGH; if (mask) { if (mask == KERNEL_VXR_HIGH) - fpu_vlm(16, 31, &vxrs[16]); + vxrs += fpu_vlm(16, 31, vxrs); else if (mask == KERNEL_VXR_V16V23) - fpu_vlm(16, 23, &vxrs[16]); + vxrs += fpu_vlm(16, 23, vxrs); else - fpu_vlm(24, 31, &vxrs[24]); + vxrs += fpu_vlm(24, 31, vxrs); } } EXPORT_SYMBOL(__kernel_fpu_end); |