aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2014-09-25 06:37:44 -0400
committerVineet Gupta <vgupta@synopsys.com>2014-10-13 05:16:22 -0400
commitc4b9856b5e1eb6d4f0d226f3c48be208475fc3d7 (patch)
treee24897d17b202dd90324ea1df568f6421d05bcef
parent52e9bae93802bd29c33be11e9e758ad7daac805f (diff)
ARC: boot: consolidate cross-checking of h/w and s/w
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/kernel/setup.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 8fccf0328ad0..5a10b63e2283 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -236,10 +236,10 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
236 return buf; 236 return buf;
237} 237}
238 238
239static void arc_chk_ccms(void) 239static void arc_chk_core_config(void)
240{ 240{
241#if defined(CONFIG_ARC_HAS_DCCM) || defined(CONFIG_ARC_HAS_ICCM)
242 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 241 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
242 int fpu_enabled;
243 243
244#ifdef CONFIG_ARC_HAS_DCCM 244#ifdef CONFIG_ARC_HAS_DCCM
245 /* 245 /*
@@ -257,33 +257,20 @@ static void arc_chk_ccms(void)
257 if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz) 257 if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
258 panic("Linux built with incorrect ICCM Size\n"); 258 panic("Linux built with incorrect ICCM Size\n");
259#endif 259#endif
260#endif
261}
262 260
263/* 261 /*
264 * Ensure that FP hardware and kernel config match 262 * FP hardware/software config sanity
265 * -If hardware contains DPFP, kernel needs to save/restore FPU state 263 * -If hardware contains DPFP, kernel needs to save/restore FPU state
266 * across context switches 264 * -If not, it will crash trying to save/restore the non-existant regs
267 * -If hardware lacks DPFP, but kernel configured to save FPU state then 265 *
268 * kernel trying to access non-existant DPFP regs will crash 266 * (only DPDP checked since SP has no arch visible regs)
269 * 267 */
270 * We only check for Dbl precision Floating Point, because only DPFP 268 fpu_enabled = IS_ENABLED(CONFIG_ARC_FPU_SAVE_RESTORE);
271 * hardware has dedicated regs which need to be saved/restored on ctx-sw
272 * (Single Precision uses core regs), thus kernel is kind of oblivious to it
273 */
274static void arc_chk_fpu(void)
275{
276 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
277 269
278 if (cpu->dpfp.ver) { 270 if (cpu->dpfp.ver && !fpu_enabled)
279#ifndef CONFIG_ARC_FPU_SAVE_RESTORE 271 pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n");
280 pr_warn("DPFP support broken in this kernel...\n"); 272 else if (!cpu->dpfp.ver && fpu_enabled)
281#endif 273 panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n");
282 } else {
283#ifdef CONFIG_ARC_FPU_SAVE_RESTORE
284 panic("H/w lacks DPFP support, apps won't work\n");
285#endif
286 }
287} 274}
288 275
289/* 276/*
@@ -304,12 +291,11 @@ void setup_processor(void)
304 291
305 arc_mmu_init(); 292 arc_mmu_init();
306 arc_cache_init(); 293 arc_cache_init();
307 arc_chk_ccms();
308 294
309 printk(arc_extn_mumbojumbo(cpu_id, str, sizeof(str))); 295 printk(arc_extn_mumbojumbo(cpu_id, str, sizeof(str)));
310 printk(arc_platform_smp_cpuinfo()); 296 printk(arc_platform_smp_cpuinfo());
311 297
312 arc_chk_fpu(); 298 arc_chk_core_config();
313} 299}
314 300
315static inline int is_kernel(unsigned long addr) 301static inline int is_kernel(unsigned long addr)