MIPS: Allow kernel to use coprocessor 2
Kernel threads should be able to use COP2 if the platform needs it. Do not call die_if_kernel() for a coprocessor unusable exception if the exception due to COP2 usage. Instead, the default notifier for COP2 exceptions is updated to call die_if_kernel. Signed-off-by: Jayachandran C <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Cc: ddaney.cavm@gmail.com Patchwork: https://patchwork.linux-mips.org/patch/5415/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
2c952e06e4
commit
83bee792d7
|
@ -1056,15 +1056,9 @@ static int default_cu2_call(struct notifier_block *nfb, unsigned long action,
|
||||||
{
|
{
|
||||||
struct pt_regs *regs = data;
|
struct pt_regs *regs = data;
|
||||||
|
|
||||||
switch (action) {
|
die_if_kernel("COP2: Unhandled kernel unaligned access or invalid "
|
||||||
default:
|
|
||||||
die_if_kernel("Unhandled kernel unaligned access or invalid "
|
|
||||||
"instruction", regs);
|
"instruction", regs);
|
||||||
/* Fall through */
|
force_sig(SIGILL, current);
|
||||||
|
|
||||||
case CU2_EXCEPTION:
|
|
||||||
force_sig(SIGILL, current);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NOTIFY_OK;
|
return NOTIFY_OK;
|
||||||
}
|
}
|
||||||
|
@ -1080,10 +1074,11 @@ asmlinkage void do_cpu(struct pt_regs *regs)
|
||||||
unsigned long __maybe_unused flags;
|
unsigned long __maybe_unused flags;
|
||||||
|
|
||||||
prev_state = exception_enter();
|
prev_state = exception_enter();
|
||||||
die_if_kernel("do_cpu invoked from kernel context!", regs);
|
|
||||||
|
|
||||||
cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
|
cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
|
||||||
|
|
||||||
|
if (cpid != 2)
|
||||||
|
die_if_kernel("do_cpu invoked from kernel context!", regs);
|
||||||
|
|
||||||
switch (cpid) {
|
switch (cpid) {
|
||||||
case 0:
|
case 0:
|
||||||
epc = (unsigned int __user *)exception_epc(regs);
|
epc = (unsigned int __user *)exception_epc(regs);
|
||||||
|
|
Loading…
Reference in New Issue