ARC: handle DSP presence in HW
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 where this reg is saved/restored upon kernel entry/exit. Reviewed-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
This commit is contained in:

committed by
Vineet Gupta

parent
240c84b1c2
commit
4827d0cf74
@@ -14,6 +14,7 @@
|
||||
#include <asm/entry.h>
|
||||
#include <asm/arcregs.h>
|
||||
#include <asm/cache.h>
|
||||
#include <asm/dsp-impl.h>
|
||||
#include <asm/irqflags.h>
|
||||
|
||||
.macro CPU_EARLY_SETUP
|
||||
@@ -59,6 +60,9 @@
|
||||
#endif
|
||||
kflag r5
|
||||
#endif
|
||||
; Config DSP_CTRL properly, so kernel may use integer multiply,
|
||||
; multiply-accumulate, and divide operations
|
||||
DSP_EARLY_INIT
|
||||
.endm
|
||||
|
||||
.section .init.text, "ax",@progbits
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <asm/unwind.h>
|
||||
#include <asm/mach_desc.h>
|
||||
#include <asm/smp.h>
|
||||
#include <asm/dsp-impl.h>
|
||||
|
||||
#define FIX_PTR(x) __asm__ __volatile__(";" : "+r"(x))
|
||||
|
||||
@@ -440,6 +441,8 @@ static void arc_chk_core_config(void)
|
||||
/* Accumulator Low:High pair (r58:59) present if DSP MPY or FPU */
|
||||
present = cpu->extn_mpy.dsp | cpu->extn.fpu_sp | cpu->extn.fpu_dp;
|
||||
CHK_OPT_STRICT(CONFIG_ARC_HAS_ACCL_REGS, present);
|
||||
|
||||
dsp_config_check();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user