Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xenomai
ipipe-ppc32
Commits
4b37b573
Commit
4b37b573
authored
Apr 27, 2018
by
Steven Seeger
Browse files
address msr bits lost during hard local irq save/restore on non-bookE processors
parent
af1396b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
arch/powerpc/kernel/process.c
View file @
4b37b573
...
...
@@ -175,6 +175,7 @@ void giveup_fpu(struct task_struct *tsk)
msr_check_and_set
(
MSR_FP
);
__giveup_fpu
(
tsk
);
msr_check_and_clear
(
MSR_FP
);
flags
&=
~
MSR_FP
;
hard_cond_local_irq_restore
(
flags
);
}
EXPORT_SYMBOL
(
giveup_fpu
);
...
...
@@ -207,6 +208,11 @@ void flush_fp_to_thread(struct task_struct *tsk)
*/
BUG_ON
(
tsk
!=
current
);
giveup_fpu
(
tsk
);
/* giveup_fpu clears the MSR_FP bit from MSR
* unconditionally
*/
flags
&=
~
MSR_FP
;
}
hard_preempt_enable
(
flags
);
}
...
...
@@ -221,6 +227,7 @@ void enable_kernel_fp(void)
flags
=
hard_cond_local_irq_save
();
cpumsr
=
msr_check_and_set
(
MSR_FP
);
flags
|=
MSR_FP
;
/* must exit this routine with MSR_FP bit set */
if
(
current
->
thread
.
regs
&&
(
current
->
thread
.
regs
->
msr
&
MSR_FP
))
{
check_if_tm_restore_required
(
current
);
...
...
@@ -289,6 +296,7 @@ void enable_kernel_altivec(void)
flags
=
hard_cond_local_irq_save
();
cpumsr
=
msr_check_and_set
(
MSR_VEC
);
flags
|=
MSR_VEC
;
/* must exit this routine with MSR_VEC set in MSR */
if
(
current
->
thread
.
regs
&&
(
current
->
thread
.
regs
->
msr
&
MSR_VEC
))
{
check_if_tm_restore_required
(
current
);
...
...
@@ -321,6 +329,10 @@ void flush_altivec_to_thread(struct task_struct *tsk)
if
(
tsk
->
thread
.
regs
->
msr
&
MSR_VEC
)
{
BUG_ON
(
tsk
!=
current
);
giveup_altivec
(
tsk
);
/* giveup_altivec() clears MSR_VEC
* unconditionally from MSR
*/
flags
&=
~
MSR_VEC
;
}
hard_preempt_enable
(
flags
);
}
...
...
@@ -405,6 +417,10 @@ void flush_vsx_to_thread(struct task_struct *tsk)
if
(
tsk
->
thread
.
regs
->
msr
&
(
MSR_VSX
|
MSR_VEC
|
MSR_FP
))
{
BUG_ON
(
tsk
!=
current
);
giveup_vsx
(
tsk
);
/* giveup_vsx() clears MSR_FP,VEC,VSX unconditionally
* so clear them in flags
*/
flags
&=
~
(
MSR_FP
|
MSR_VEC
|
MSR_VSX
);
}
hard_preempt_enable
(
flags
);
}
...
...
@@ -435,6 +451,8 @@ void giveup_spe(struct task_struct *tsk)
msr_check_and_set
(
MSR_SPE
);
__giveup_spe
(
tsk
);
msr_check_and_clear
(
MSR_SPE
);
/* must exit this routine with NSR_SPE cleared in MSR */
flags
&=
~
MSR_SPE
;
hard_cond_local_irq_restore
(
flags
);
}
EXPORT_SYMBOL
(
giveup_spe
);
...
...
@@ -447,7 +465,8 @@ void enable_kernel_spe(void)
flags
=
hard_cond_local_irq_save
();
msr_check_and_set
(
MSR_SPE
);
/* must exit this routine with MSR_SPE set in MSR */
flags
|=
MSR_SPE
;
if
(
current
->
thread
.
regs
&&
(
current
->
thread
.
regs
->
msr
&
MSR_SPE
))
{
check_if_tm_restore_required
(
current
);
__giveup_spe
(
current
);
...
...
@@ -465,6 +484,10 @@ void flush_spe_to_thread(struct task_struct *tsk)
BUG_ON
(
tsk
!=
current
);
tsk
->
thread
.
spefscr
=
mfspr
(
SPRN_SPEFSCR
);
giveup_spe
(
tsk
);
/* giveup_spe clears MSR_SPE from MSR, so must clear
* it here to exit rouitine properly
*/
flags
&=
MSR_SPE
;
}
hard_preempt_enable
(
flags
);
}
...
...
@@ -527,6 +550,7 @@ void giveup_all(struct task_struct *tsk)
#endif
msr_check_and_clear
(
msr_all_available
);
flags
&=
~
msr_all_available
;
/* clear all available just in case */
hard_cond_local_irq_restore
(
flags
);
}
EXPORT_SYMBOL
(
giveup_all
);
...
...
@@ -559,6 +583,7 @@ void restore_math(struct pt_regs *regs)
}
msr_check_and_clear
(
msr_all_available
);
flags
&=
~
msr_all_available
;
/* clear all available just in case */
hard_cond_local_irq_restore
(
flags
);
regs
->
msr
=
msr
;
...
...
@@ -1224,6 +1249,8 @@ struct task_struct *__switch_to(struct task_struct *prev,
/* Save FPU, Altivec, VSX and SPE state */
giveup_all
(
prev
);
/* giveup_all clears msr_all_available bits unconditionally */
flags
&=
~
msr_all_available
;
__switch_to_tm
(
prev
,
new
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment