Skip to content

Commit

Permalink
s390/fpu: remove regs member from struct fpu
Browse files Browse the repository at this point in the history
KVM was the only user which modified the regs pointer in struct fpu. Remove
the pointer and convert the rest of the core fpu code to directly access
the save area embedded within struct fpu.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
  • Loading branch information
Heiko Carstens committed Feb 16, 2024
1 parent ed3a0a0 commit 9cbff7f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion arch/s390/include/asm/fpu-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

struct fpu {
__u32 fpc; /* Floating-point control */
void *regs; /* Pointer to the current save area */
union {
/* Floating-point register save area */
freg_t fprs[__NUM_FPRS];
Expand Down
1 change: 0 additions & 1 deletion arch/s390/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ typedef struct thread_struct thread_struct;

#define INIT_THREAD { \
.ksp = sizeof(init_stack) + (unsigned long) &init_stack, \
.ufpu.regs = (void *)init_task.thread.ufpu.fprs, \
.last_break = 1, \
}

Expand Down
11 changes: 4 additions & 7 deletions arch/s390/kernel/fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,12 @@ EXPORT_SYMBOL(__kernel_fpu_end);
void __load_user_fpu_regs(void)
{
struct fpu *state = &current->thread.ufpu;
void *regs = current->thread.ufpu.regs;

fpu_lfpc_safe(&state->fpc);
if (likely(cpu_has_vx()))
load_vx_regs(regs);
load_vx_regs(state->vxrs);
else
load_fp_regs(regs);
load_fp_regs(state->fprs);
clear_thread_flag(TIF_FPU);
}

Expand All @@ -132,21 +131,19 @@ void save_user_fpu_regs(void)
{
unsigned long flags;
struct fpu *state;
void *regs;

local_irq_save(flags);

if (test_thread_flag(TIF_FPU))
goto out;

state = &current->thread.ufpu;
regs = current->thread.ufpu.regs;

fpu_stfpc(&state->fpc);
if (likely(cpu_has_vx()))
save_vx_regs(regs);
save_vx_regs(state->vxrs);
else
save_fp_regs(regs);
save_fp_regs(state->fprs);
set_thread_flag(TIF_FPU);
out:
local_irq_restore(flags);
Expand Down
1 change: 0 additions & 1 deletion arch/s390/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
save_user_fpu_regs();

*dst = *src;
dst->thread.ufpu.regs = dst->thread.ufpu.fprs;
dst->thread.kfpu_flags = 0;

/*
Expand Down

0 comments on commit 9cbff7f

Please sign in to comment.