From patchwork Fri Apr 24 20:39:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 238440 List-Id: U-Boot discussion From: Eugeniy.Paltsev at synopsys.com (Eugeniy Paltsev) Date: Fri, 24 Apr 2020 23:39:22 +0300 Subject: [PATCH 01/14] ARC: ARCv2: handle DSP presence in HW In-Reply-To: <20200424203935.21333-1-Eugeniy.Paltsev@synopsys.com> References: <20200424203935.21333-1-Eugeniy.Paltsev@synopsys.com> Message-ID: <20200424203935.21333-2-Eugeniy.Paltsev@synopsys.com> 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. NOTE: we do the same adjustments in Linux kernel, see in kernel tree: commit 4827d0cf744e ("ARC: handle DSP presence in HW") Signed-off-by: Eugeniy Paltsev --- arch/arc/include/asm/arcregs.h | 1 + arch/arc/lib/start.S | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index fff6591c681..f3cd4a889ac 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h @@ -100,6 +100,7 @@ /* DSP-extensions related auxiliary registers */ #define ARC_AUX_DSP_BUILD 0x7A +#define ARC_AUX_DSP_CTRL 0x59F /* ARC Subsystems related auxiliary registers */ #define ARC_AUX_SUBSYS_BUILD 0xF0 diff --git a/arch/arc/lib/start.S b/arch/arc/lib/start.S index 8c744f5be7f..016ae85be23 100644 --- a/arch/arc/lib/start.S +++ b/arch/arc/lib/start.S @@ -61,6 +61,21 @@ ENTRY(_start) 1: #endif +#ifdef CONFIG_ISA_ARCV2 + ; 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. + lr r5, [ARC_AUX_DSP_BUILD] + bmsk r5, r5, 7 + breq r5, 0, 1f + mov r5, 0 + sr r5, [ARC_AUX_DSP_CTRL] +1: +#endif + #ifdef __ARC_UNALIGNED__ /* * Enable handling of unaligned access in the CPU as by default