powerpc/process: Remove useless #ifdef CONFIG_SPE
cpu_has_feature(CPU_FTR_SPE) returns false when CONFIG_SPE is not set. There is no need to enclose the test in an #ifdef CONFIG_SPE. Remove it. CPU_FTR_SPE only exists on 32 bits. Define it as 0 on 64 bits. We have a couple of places like: #ifdef CONFIG_SPE if (cpu_has_feature(CPU_FTR_SPE)) { do_something_that_requires_CONFIG_SPE } else { return -EINVAL; } #else return -EINVAL; #endif Replace them by a cleaner version: if (cpu_has_feature(CPU_FTR_SPE)) { #ifdef CONFIG_SPE do_something_that_requires_CONFIG_SPE #endif } else { return -EINVAL; } When CONFIG_SPE is not set, this resolves to an unconditional return of -EINVAL Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/698df8387555765b70ea42e4a7fa48141c309c1f.1597643221.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
e3667ee427
commit
532ed1900d
2 changed files with 8 additions and 14 deletions
|
@ -170,6 +170,7 @@ static inline void cpu_feature_keys_init(void) { }
|
||||||
#else /* CONFIG_PPC32 */
|
#else /* CONFIG_PPC32 */
|
||||||
/* Define these to 0 for the sake of tests in common code */
|
/* Define these to 0 for the sake of tests in common code */
|
||||||
#define CPU_FTR_PPC_LE (0)
|
#define CPU_FTR_PPC_LE (0)
|
||||||
|
#define CPU_FTR_SPE (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -413,10 +413,8 @@ static int __init init_msr_all_available(void)
|
||||||
msr_all_available |= MSR_VEC;
|
msr_all_available |= MSR_VEC;
|
||||||
if (cpu_has_feature(CPU_FTR_VSX))
|
if (cpu_has_feature(CPU_FTR_VSX))
|
||||||
msr_all_available |= MSR_VSX;
|
msr_all_available |= MSR_VSX;
|
||||||
#ifdef CONFIG_SPE
|
|
||||||
if (cpu_has_feature(CPU_FTR_SPE))
|
if (cpu_has_feature(CPU_FTR_SPE))
|
||||||
msr_all_available |= MSR_SPE;
|
msr_all_available |= MSR_SPE;
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -446,10 +444,8 @@ void giveup_all(struct task_struct *tsk)
|
||||||
#endif
|
#endif
|
||||||
if (usermsr & MSR_VEC)
|
if (usermsr & MSR_VEC)
|
||||||
__giveup_altivec(tsk);
|
__giveup_altivec(tsk);
|
||||||
#ifdef CONFIG_SPE
|
|
||||||
if (usermsr & MSR_SPE)
|
if (usermsr & MSR_SPE)
|
||||||
__giveup_spe(tsk);
|
__giveup_spe(tsk);
|
||||||
#endif
|
|
||||||
|
|
||||||
msr_check_and_clear(msr_all_available);
|
msr_check_and_clear(msr_all_available);
|
||||||
}
|
}
|
||||||
|
@ -1899,7 +1895,6 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
|
||||||
* fpexc_mode. fpexc_mode is also used for setting FP exception
|
* fpexc_mode. fpexc_mode is also used for setting FP exception
|
||||||
* mode (asyn, precise, disabled) for 'Classic' FP. */
|
* mode (asyn, precise, disabled) for 'Classic' FP. */
|
||||||
if (val & PR_FP_EXC_SW_ENABLE) {
|
if (val & PR_FP_EXC_SW_ENABLE) {
|
||||||
#ifdef CONFIG_SPE
|
|
||||||
if (cpu_has_feature(CPU_FTR_SPE)) {
|
if (cpu_has_feature(CPU_FTR_SPE)) {
|
||||||
/*
|
/*
|
||||||
* When the sticky exception bits are set
|
* When the sticky exception bits are set
|
||||||
|
@ -1913,16 +1908,15 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
|
||||||
* anyway to restore the prctl settings from
|
* anyway to restore the prctl settings from
|
||||||
* the saved environment.
|
* the saved environment.
|
||||||
*/
|
*/
|
||||||
|
#ifdef CONFIG_SPE
|
||||||
tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR);
|
tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR);
|
||||||
tsk->thread.fpexc_mode = val &
|
tsk->thread.fpexc_mode = val &
|
||||||
(PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT);
|
(PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
return -EINVAL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* on a CONFIG_SPE this does not hurt us. The bits that
|
/* on a CONFIG_SPE this does not hurt us. The bits that
|
||||||
|
@ -1943,8 +1937,7 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE)
|
if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) {
|
||||||
#ifdef CONFIG_SPE
|
|
||||||
if (cpu_has_feature(CPU_FTR_SPE)) {
|
if (cpu_has_feature(CPU_FTR_SPE)) {
|
||||||
/*
|
/*
|
||||||
* When the sticky exception bits are set
|
* When the sticky exception bits are set
|
||||||
|
@ -1958,15 +1951,15 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
|
||||||
* anyway to restore the prctl settings from
|
* anyway to restore the prctl settings from
|
||||||
* the saved environment.
|
* the saved environment.
|
||||||
*/
|
*/
|
||||||
|
#ifdef CONFIG_SPE
|
||||||
tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR);
|
tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR);
|
||||||
val = tsk->thread.fpexc_mode;
|
val = tsk->thread.fpexc_mode;
|
||||||
|
#endif
|
||||||
} else
|
} else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
#else
|
} else {
|
||||||
return -EINVAL;
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
val = __unpack_fe01(tsk->thread.fpexc_mode);
|
val = __unpack_fe01(tsk->thread.fpexc_mode);
|
||||||
|
}
|
||||||
return put_user(val, (unsigned int __user *) adr);
|
return put_user(val, (unsigned int __user *) adr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue