forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openrisc: Move FPU state out of pt_regs
My orignal naive FPU support patch had the FPCSR register stored to both the user pt_regs and the pt_regs stored for kernel state turing _switch. This had problems as: 1. it was wasteful to store and restore FPU state 2 times. 2. it is problematic when we consider: - Accessing FPU state from ptrace/getregs, accessing and writing FPU state to user pt_regs. - Accessing FPU state when raising exceptions, FPU state was not being saved on the syscall fast path. We fix this by moving the FPCSR state to `thread_struct` in `task_stuct`. We now only save FPCSR when: - in _switch - during syscalls if there is pending work for signals TODO need to restore! - during floating point exceptions TODO need to restore! Signed-off-by: Stafford Horne <shorne@gmail.com>
- Loading branch information
Showing
11 changed files
with
70 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef __ASM_OPENRISC_FPU_H | ||
#define __ASM_OPENRISC_FPU_H | ||
|
||
struct task_struct; | ||
|
||
#ifdef CONFIG_FPU | ||
extern void save_fpu(struct task_struct *__tsk); | ||
extern void restore_fpu(struct task_struct *__tsk); | ||
#else | ||
#define save_fpu(tsk) do { } while (0) | ||
#define restore_fpu(tsk) do { } while (0) | ||
#endif | ||
|
||
#endif /* __ASM_OPENRISC_FPU_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#include <linux/sched.h> | ||
|
||
#include <asm/fpu.h> | ||
#include <asm/spr.h> | ||
#include <asm/spr_defs.h> | ||
|
||
void save_fpu(struct task_struct *task) | ||
{ | ||
task->thread.fpcsr = mfspr(SPR_FPCSR); | ||
} | ||
|
||
void restore_fpu(struct task_struct *task) | ||
{ | ||
mtspr(SPR_FPCSR, task->thread.fpcsr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters