From: Ralf Baechle <ralf@linux-mips.org>
To: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org, ddaney.cavm@gmail.com
Subject: Re: [PATCH 2/5] MIPS: Allow kernel to use coprocessor 2
Date: Mon, 10 Jun 2013 14:42:29 +0200 [thread overview]
Message-ID: <20130610124229.GH28380@linux-mips.org> (raw)
In-Reply-To: <1370849404-4918-3-git-send-email-jchandra@broadcom.com>
On Mon, Jun 10, 2013 at 01:00:01PM +0530, Jayachandran C wrote:
> 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>
> ---
> arch/mips/kernel/traps.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
> index beba1e6..142d2be 100644
> --- a/arch/mips/kernel/traps.c
> +++ b/arch/mips/kernel/traps.c
> @@ -1056,15 +1056,9 @@ static int default_cu2_call(struct notifier_block *nfb, unsigned long action,
> {
> struct pt_regs *regs = data;
>
> - switch (action) {
> - default:
> - die_if_kernel("Unhandled kernel unaligned access or invalid "
> + die_if_kernel("COP2: Unhandled kernel unaligned access or invalid "
> "instruction", regs);
> - /* Fall through */
> -
> - case CU2_EXCEPTION:
> - force_sig(SIGILL, current);
> - }
> + force_sig(SIGILL, current);
>
> return NOTIFY_OK;
> }
The idea for cu2_chain notifiers is that they should return a value with
NOTIFY_STOP_MASK set. That would prevent further calls to other notifiers.
The default_cu2_call() notifier is installed with the lowest possible
priority and is meant to only be called if there is no other notifier was
installed, that is on a bog standard MIPS core with no CP2.
> @@ -1080,10 +1074,11 @@ asmlinkage void do_cpu(struct pt_regs *regs)
> unsigned long __maybe_unused flags;
>
> prev_state = exception_enter();
> - die_if_kernel("do_cpu invoked from kernel context!", regs);
> -
> cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
>
> + if (cpid != 2)
> + die_if_kernel("do_cpu invoked from kernel context!", regs);
> +
> switch (cpid) {
> case 0:
> epc = (unsigned int __user *)exception_epc(regs);
I'm ok with this segment.
Ralf
next prev parent reply other threads:[~2013-06-10 12:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-10 7:29 [PATCH 0/5 v2] Cop2 save and restore for Netlogic XLP Jayachandran C
2013-06-10 7:30 ` [PATCH 1/5] MIPS: Move cop2 save/restore to switch_to() Jayachandran C
2013-06-10 7:30 ` [PATCH 2/5] MIPS: Allow kernel to use coprocessor 2 Jayachandran C
2013-06-10 11:31 ` Sergei Shtylyov
2013-06-10 12:42 ` Ralf Baechle [this message]
2013-06-11 4:12 ` Jayachandran C.
2013-06-10 7:30 ` [PATCH 3/5] MIPS: Netlogic: Fix nlm_read_c2_status() definition Jayachandran C
2013-06-10 7:30 ` [PATCH 4/5] MIPS: Netlogic: rename nlm_cop2_save/restore Jayachandran C
2013-06-10 7:30 ` [PATCH 5/5] MIPS: Netlogic: COP2 save/restore code Jayachandran C
-- strict thread matches above, loose matches on Subject: below --
2013-03-22 16:24 [RFC PATCH 0/5] Cop2 save/restore for XLR/XLP Jayachandran C
2013-03-22 16:24 ` [PATCH 2/5] MIPS: Allow kernel to use coprocessor 2 Jayachandran C
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130610124229.GH28380@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=ddaney.cavm@gmail.com \
--cc=jchandra@broadcom.com \
--cc=linux-mips@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox