Commit 340750c1 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

s390/switch_to: use generic header file



Move the switch_to() implementation to process.c and use the generic
switch_to.h header file instead, like some other architectures.

This addresses also the oddity that the old switch_to() implementation
assigns the return value of __switch_to() to 'prev' instead of 'last',
like it should.

Remove also all includes of switch_to.h from C files, except process.c.

Acked-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 30410373
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -203,6 +203,10 @@ static inline int test_and_clear_pt_regs_flag(struct pt_regs *regs, int flag)
	return ret;
}

struct task_struct;

void update_cr_regs(struct task_struct *task);

/*
 * These are defined as per linux/ptrace.h, which see.
 */
+0 −1
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@

#include <linux/uaccess.h>
#include <linux/ptrace.h>
#include <asm/switch_to.h>

struct stack_frame_user {
	unsigned long back_chain;

arch/s390/include/asm/switch_to.h

deleted100644 → 0
+0 −36
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright IBM Corp. 1999, 2009
 *
 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
 */

#ifndef __ASM_SWITCH_TO_H
#define __ASM_SWITCH_TO_H

#include <linux/thread_info.h>
#include <asm/fpu/api.h>
#include <asm/access-regs.h>
#include <asm/ptrace.h>
#include <asm/guarded_storage.h>

extern struct task_struct *__switch_to(void *, void *);
extern void update_cr_regs(struct task_struct *task);

#define switch_to(prev, next, last) do {				\
	/* save_fpu_regs() sets the CIF_FPU flag, which enforces	\
	 * a restore of the floating point / vector registers as	\
	 * soon as the next task returns to user space			\
	 */								\
	save_fpu_regs();						\
	save_access_regs(&prev->thread.acrs[0]);			\
	save_ri_cb(prev->thread.ri_cb);					\
	save_gs_cb(prev->thread.gs_cb);					\
	update_cr_regs(next);						\
	restore_access_regs(&next->thread.acrs[0]);			\
	restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb);		\
	restore_gs_cb(next->thread.gs_cb);				\
	prev = __switch_to(prev, next);					\
} while (0)

#endif /* __ASM_SWITCH_TO_H */
+5 −5
Original line number Diff line number Diff line
@@ -171,13 +171,13 @@ _LPP_OFFSET = __LC_LPP
	nop	0

/*
 * Scheduler resume function, called by switch_to
 * Scheduler resume function, called by __switch_to
 *  gpr2 = (task_struct *)prev
 *  gpr3 = (task_struct *)next
 * Returns:
 *  gpr2 = prev
 */
SYM_FUNC_START(__switch_to)
SYM_FUNC_START(__switch_to_asm)
	stmg	%r6,%r15,__SF_GPRS(%r15)	# store gprs of prev task
	lghi	%r4,__TASK_stack
	lghi	%r1,__TASK_thread
@@ -193,7 +193,7 @@ SYM_FUNC_START(__switch_to)
	lmg	%r6,%r15,__SF_GPRS(%r15)	# load gprs of next task
	ALTERNATIVE "nop", "lpp _LPP_OFFSET", 40
	BR_EX	%r14
SYM_FUNC_END(__switch_to)
SYM_FUNC_END(__switch_to_asm)

#if IS_ENABLED(CONFIG_KVM)
/*
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ void mcck_int_handler(void);
void restart_int_handler(void);
void early_pgm_check_handler(void);

struct task_struct *__switch_to_asm(struct task_struct *prev, struct task_struct *next);
void __ret_from_fork(struct task_struct *prev, struct pt_regs *regs);
void __do_pgm_check(struct pt_regs *regs);
void __do_syscall(struct pt_regs *regs, int per_trap);
Loading