Commit 87c5c700 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

s390/fpu: rename save_fpu_regs() to save_user_fpu_regs(), etc



Rename save_fpu_regs(), load_fpu_regs(), and struct thread_struct's fpu
member to save_user_fpu_regs(), load_user_fpu_regs(), and ufpu. This way
the function and variable names reflect for which context they are supposed
to be used.

This large and trivial conversion is a prerequisite for making the kernel
fpu usage preemptible.

Reviewed-by: default avatarClaudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 419abc4d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
static __always_inline void arch_exit_to_user_mode(void)
{
	if (test_thread_flag(TIF_FPU))
		__load_fpu_regs();
		__load_user_fpu_regs();

	if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
		debug_user_asce(1);
+4 −4
Original line number Diff line number Diff line
@@ -57,9 +57,9 @@ static inline bool cpu_has_vx(void)
	return likely(test_facility(129));
}

void save_fpu_regs(void);
void load_fpu_regs(void);
void __load_fpu_regs(void);
void save_user_fpu_regs(void);
void load_user_fpu_regs(void);
void __load_user_fpu_regs(void);

enum {
	KERNEL_FPC_BIT = 0,
@@ -150,7 +150,7 @@ static inline void kernel_fpu_begin(struct kernel_fpu *state, u32 flags)
	state->mask = S390_lowcore.fpu_flags;
	if (!test_thread_flag(TIF_FPU)) {
		/* Save user space FPU state and register contents */
		save_fpu_regs();
		save_user_fpu_regs();
	} else if (state->mask & flags) {
		/* Save FPU/vector register in-use by the kernel */
		__kernel_fpu_begin(state, flags);
+2 −2
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ struct thread_struct {
	struct gs_cb *gs_cb;			/* Current guarded storage cb */
	struct gs_cb *gs_bc_cb;			/* Broadcast guarded storage cb */
	struct pgm_tdb trap_tdb;		/* Transaction abort diagnose block */
	struct fpu fpu;				/* FP and VX register save area */
	struct fpu ufpu;			/* User FP and VX register save area */
};

/* Flag to disable transactions. */
@@ -200,7 +200,7 @@ typedef struct thread_struct thread_struct;

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

+9 −9
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ typedef struct
static void store_sigregs(void)
{
	save_access_regs(current->thread.acrs);
	save_fpu_regs();
	save_user_fpu_regs();
}

/* Load registers after signal return */
@@ -79,7 +79,7 @@ static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
		user_sregs.regs.gprs[i] = (__u32) regs->gprs[i];
	memcpy(&user_sregs.regs.acrs, current->thread.acrs,
	       sizeof(user_sregs.regs.acrs));
	fpregs_store((_s390_fp_regs *) &user_sregs.fpregs, &current->thread.fpu);
	fpregs_store((_s390_fp_regs *) &user_sregs.fpregs, &current->thread.ufpu);
	if (__copy_to_user(sregs, &user_sregs, sizeof(_sigregs32)))
		return -EFAULT;
	return 0;
@@ -113,7 +113,7 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
		regs->gprs[i] = (__u64) user_sregs.regs.gprs[i];
	memcpy(&current->thread.acrs, &user_sregs.regs.acrs,
	       sizeof(current->thread.acrs));
	fpregs_load((_s390_fp_regs *) &user_sregs.fpregs, &current->thread.fpu);
	fpregs_load((_s390_fp_regs *)&user_sregs.fpregs, &current->thread.ufpu);

	clear_pt_regs_flag(regs, PIF_SYSCALL); /* No longer in a system call */
	return 0;
@@ -136,11 +136,11 @@ static int save_sigregs_ext32(struct pt_regs *regs,
	/* Save vector registers to signal stack */
	if (cpu_has_vx()) {
		for (i = 0; i < __NUM_VXRS_LOW; i++)
			vxrs[i] = current->thread.fpu.vxrs[i].low;
			vxrs[i] = current->thread.ufpu.vxrs[i].low;
		if (__copy_to_user(&sregs_ext->vxrs_low, vxrs,
				   sizeof(sregs_ext->vxrs_low)) ||
		    __copy_to_user(&sregs_ext->vxrs_high,
				   current->thread.fpu.vxrs + __NUM_VXRS_LOW,
				   current->thread.ufpu.vxrs + __NUM_VXRS_LOW,
				   sizeof(sregs_ext->vxrs_high)))
			return -EFAULT;
	}
@@ -165,12 +165,12 @@ static int restore_sigregs_ext32(struct pt_regs *regs,
	if (cpu_has_vx()) {
		if (__copy_from_user(vxrs, &sregs_ext->vxrs_low,
				     sizeof(sregs_ext->vxrs_low)) ||
		    __copy_from_user(current->thread.fpu.vxrs + __NUM_VXRS_LOW,
		    __copy_from_user(current->thread.ufpu.vxrs + __NUM_VXRS_LOW,
				     &sregs_ext->vxrs_high,
				     sizeof(sregs_ext->vxrs_high)))
			return -EFAULT;
		for (i = 0; i < __NUM_VXRS_LOW; i++)
			current->thread.fpu.vxrs[i].low = vxrs[i];
			current->thread.ufpu.vxrs[i].low = vxrs[i];
	}
	return 0;
}
@@ -184,7 +184,7 @@ COMPAT_SYSCALL_DEFINE0(sigreturn)
	if (get_compat_sigset(&set, (compat_sigset_t __user *)frame->sc.oldmask))
		goto badframe;
	set_current_blocked(&set);
	save_fpu_regs();
	save_user_fpu_regs();
	if (restore_sigregs32(regs, &frame->sregs))
		goto badframe;
	if (restore_sigregs_ext32(regs, &frame->sregs_ext))
@@ -207,7 +207,7 @@ COMPAT_SYSCALL_DEFINE0(rt_sigreturn)
	set_current_blocked(&set);
	if (compat_restore_altstack(&frame->uc.uc_stack))
		goto badframe;
	save_fpu_regs();
	save_user_fpu_regs();
	if (restore_sigregs32(regs, &frame->uc.uc_mcontext))
		goto badframe;
	if (restore_sigregs_ext32(regs, &frame->uc.uc_mcontext_ext))
+10 −10
Original line number Diff line number Diff line
@@ -107,10 +107,10 @@ void __kernel_fpu_end(struct kernel_fpu *state, u32 flags)
}
EXPORT_SYMBOL(__kernel_fpu_end);

void __load_fpu_regs(void)
void __load_user_fpu_regs(void)
{
	struct fpu *state = &current->thread.fpu;
	void *regs = current->thread.fpu.regs;
	struct fpu *state = &current->thread.ufpu;
	void *regs = current->thread.ufpu.regs;

	fpu_lfpc_safe(&state->fpc);
	if (likely(cpu_has_vx()))
@@ -120,15 +120,15 @@ void __load_fpu_regs(void)
	clear_thread_flag(TIF_FPU);
}

void load_fpu_regs(void)
void load_user_fpu_regs(void)
{
	raw_local_irq_disable();
	__load_fpu_regs();
	__load_user_fpu_regs();
	raw_local_irq_enable();
}
EXPORT_SYMBOL(load_fpu_regs);
EXPORT_SYMBOL(load_user_fpu_regs);

void save_fpu_regs(void)
void save_user_fpu_regs(void)
{
	unsigned long flags;
	struct fpu *state;
@@ -139,8 +139,8 @@ void save_fpu_regs(void)
	if (test_thread_flag(TIF_FPU))
		goto out;

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

	fpu_stfpc(&state->fpc);
	if (likely(cpu_has_vx()))
@@ -151,4 +151,4 @@ void save_fpu_regs(void)
out:
	local_irq_restore(flags);
}
EXPORT_SYMBOL(save_fpu_regs);
EXPORT_SYMBOL(save_user_fpu_regs);
Loading