From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
"linux-snps-arc@lists.infradead.org"
<linux-snps-arc@lists.infradead.org>
Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/4] ARC: handle DSP presence in HW
Date: Sat, 7 Mar 2020 00:12:35 +0000 [thread overview]
Message-ID: <2d11b6d9-a37a-8cc3-1feb-a9dbc345de12@synopsys.com> (raw)
In-Reply-To: <20200305200252.14278-3-Eugeniy.Paltsev@synopsys.com>
On 3/5/20 12:02 PM, Eugeniy Paltsev wrote:
> In case of DSP extension presence in HW some instructions
> (related to integer multiply, multiply-accumulate, and divide
> operation) executes on this DSP execution unit. So their
> execution will depend on dsp configuration register (DSP_CTRL)
>
> As we want these instructions to execute the same way regardless
> of DSP presence we need to set DSP_CTRL properly. However this
> register can be modified bu any usersace app therefore any
> usersace may break kernel execution.
>
> Fix that by configure DSP_CTRL in CPU early code and in IRQs
> entries.
How about below ....
"When DSP extensions are present, some of the regular integer instructions such as
DIV, MACD etc are executed in the DSP unit with semantics alterable by flags in
DSP_CTRL aux register. This register is writable by userspace and thus can
potentially affect corresponding instructions in kernel code, intentionally or
otherwise. So safegaurd kernel by effectively disabling DSP_CTRL upon bootup and
every entry to kernel.
Do note that for this config we simply zero out the DSP_CTRL reg assuming
userspace doesn't really care about DSP. The next patch caters to the DSP aware
userspace which this actually saved/restored upon kernel entry."
>
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> ---
> arch/arc/Kconfig | 29 +++++++++++++++-
> arch/arc/include/asm/arcregs.h | 12 +++++++
> arch/arc/include/asm/dsp-impl.h | 54 ++++++++++++++++++++++++++++++
> arch/arc/include/asm/entry-arcv2.h | 3 ++
> arch/arc/kernel/head.S | 4 +++
> arch/arc/kernel/setup.c | 3 ++
> 6 files changed, 104 insertions(+), 1 deletion(-)
> create mode 100644 arch/arc/include/asm/dsp-impl.h
>
> diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
> index 7124ab82dfa3..55432a8fc20d 100644
> --- a/arch/arc/Kconfig
> +++ b/arch/arc/Kconfig
> @@ -401,13 +401,40 @@ config ARC_HAS_DIV_REM
> default y
>
> config ARC_HAS_ACCL_REGS
> - bool "Reg Pair ACCL:ACCH (FPU and/or MPY > 6)"
> + bool "Reg Pair ACCL:ACCH (FPU and/or MPY > 6 and/or DSP)"
> default y
> help
> Depending on the configuration, CPU can contain accumulator reg-pair
> (also referred to as r58:r59). These can also be used by gcc as GPR so
> kernel needs to save/restore per process
>
> +config ARC_DSP_HANDLED
> + def_bool n
> +
> +choice
> + prompt "DSP support"
> + default ARC_DSP_NONE
> + help
> + Depending on the configuration, CPU can contain DSP registers
> + (ACC0_GLO, ACC0_GHI, DSP_BFLY0, DSP_CTRL, DSP_FFT_CTRL).
> + Bellow is options describing how to handle these registers in
typo: Below
Looks good otherwise. No need to respin just for this.
Reviewed-by: Vineet Gupta <vgupta@synopsys.com>
next prev parent reply other threads:[~2020-03-07 0:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 20:02 [PATCH v2 0/4] " Eugeniy Paltsev
2020-03-05 20:02 ` [PATCH v2 1/4] ARC: add helpers to sanitize config options Eugeniy Paltsev
2020-03-06 22:55 ` Vineet Gupta
2020-03-05 20:02 ` [PATCH v2 2/4] ARC: handle DSP presence in HW Eugeniy Paltsev
2020-03-07 0:12 ` Vineet Gupta [this message]
2020-03-10 12:18 ` Eugeniy Paltsev
2020-03-10 12:19 ` Eugeniy Paltsev
2020-03-05 20:02 ` [PATCH v2 3/4] ARC: add support for DSP-enabled userspace applications Eugeniy Paltsev
2020-03-11 19:13 ` Vineet Gupta
2020-03-05 20:02 ` [PATCH v2 4/4] ARC: allow userspace DSP applications to use AGU extensions Eugeniy Paltsev
2020-03-11 19:15 ` Vineet Gupta
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=2d11b6d9-a37a-8cc3-1feb-a9dbc345de12@synopsys.com \
--to=vineet.gupta1@synopsys.com \
--cc=Alexey.Brodkin@synopsys.com \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.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
all inboxes | Powered by JetHome®