aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2019-02-21 16:44:49 -0500
committerVineet Gupta <vgupta@synopsys.com>2019-02-21 17:53:36 -0500
commit7b2e932f633bcb7b190fc7031ce6dac75f8c3472 (patch)
tree4102321338daed2d80932fe7951bba20b78858b7
parentb6835ea77729e7faf4656ca637ba53f42b8ee3fd (diff)
ARCv2: don't assume core 0x54 has dual issue
The first release of core4 (0x54) was dual issue only (HS4x). Newer releases allow hardware to be configured as single issue (HS3x) or dual issue. Prevent accessing a HS4x only aux register in HS3x, which otherwise leads to illegal instruction exceptions Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/include/asm/arcregs.h8
-rw-r--r--arch/arc/kernel/setup.c26
2 files changed, 29 insertions, 5 deletions
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index f1b86cef0905..a27eafdc8260 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -151,6 +151,14 @@ struct bcr_isa_arcv2 {
151#endif 151#endif
152}; 152};
153 153
154struct bcr_uarch_build_arcv2 {
155#ifdef CONFIG_CPU_BIG_ENDIAN
156 unsigned int pad:8, prod:8, maj:8, min:8;
157#else
158 unsigned int min:8, maj:8, prod:8, pad:8;
159#endif
160};
161
154struct bcr_mpy { 162struct bcr_mpy {
155#ifdef CONFIG_CPU_BIG_ENDIAN 163#ifdef CONFIG_CPU_BIG_ENDIAN
156 unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8; 164 unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8;
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 93d4d6639873..7b2340996cf8 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -199,13 +199,29 @@ static void read_arc_build_cfg_regs(void)
199 cpu->bpu.ret_stk = 4 << bpu.rse; 199 cpu->bpu.ret_stk = 4 << bpu.rse;
200 200
201 if (cpu->core.family >= 0x54) { 201 if (cpu->core.family >= 0x54) {
202 unsigned int exec_ctrl;
203 202
204 READ_BCR(AUX_EXEC_CTRL, exec_ctrl); 203 struct bcr_uarch_build_arcv2 uarch;
205 cpu->extn.dual_enb = !(exec_ctrl & 1);
206 204
207 /* dual issue always present for this core */ 205 /*
208 cpu->extn.dual = 1; 206 * The first 0x54 core (uarch maj:min 0:1 or 0:2) was
207 * dual issue only (HS4x). But next uarch rev (1:0)
208 * allows it be configured for single issue (HS3x)
209 * Ensure we fiddle with dual issue only on HS4x
210 */
211 READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch);
212
213 if (uarch.prod == 4) {
214 unsigned int exec_ctrl;
215
216 /* dual issue hardware always present */
217 cpu->extn.dual = 1;
218
219 READ_BCR(AUX_EXEC_CTRL, exec_ctrl);
220
221 /* dual issue hardware enabled ? */
222 cpu->extn.dual_enb = !(exec_ctrl & 1);
223
224 }
209 } 225 }
210 } 226 }
211 227