Skip to content

Commit

Permalink
ARC: boot: consolidate cross-checking of h/w and s/w
Browse files Browse the repository at this point in the history
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
  • Loading branch information
Vineet Gupta committed Oct 13, 2014
1 parent 52e9bae commit c4b9856
Showing 1 changed file with 15 additions and 29 deletions.
44 changes: 15 additions & 29 deletions arch/arc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
return buf;
}

static void arc_chk_ccms(void)
static void arc_chk_core_config(void)
{
#if defined(CONFIG_ARC_HAS_DCCM) || defined(CONFIG_ARC_HAS_ICCM)
struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
int fpu_enabled;

#ifdef CONFIG_ARC_HAS_DCCM
/*
Expand All @@ -257,33 +257,20 @@ static void arc_chk_ccms(void)
if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
panic("Linux built with incorrect ICCM Size\n");
#endif
#endif
}

/*
* Ensure that FP hardware and kernel config match
* -If hardware contains DPFP, kernel needs to save/restore FPU state
* across context switches
* -If hardware lacks DPFP, but kernel configured to save FPU state then
* kernel trying to access non-existant DPFP regs will crash
*
* We only check for Dbl precision Floating Point, because only DPFP
* hardware has dedicated regs which need to be saved/restored on ctx-sw
* (Single Precision uses core regs), thus kernel is kind of oblivious to it
*/
static void arc_chk_fpu(void)
{
struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
/*
* FP hardware/software config sanity
* -If hardware contains DPFP, kernel needs to save/restore FPU state
* -If not, it will crash trying to save/restore the non-existant regs
*
* (only DPDP checked since SP has no arch visible regs)
*/
fpu_enabled = IS_ENABLED(CONFIG_ARC_FPU_SAVE_RESTORE);

if (cpu->dpfp.ver) {
#ifndef CONFIG_ARC_FPU_SAVE_RESTORE
pr_warn("DPFP support broken in this kernel...\n");
#endif
} else {
#ifdef CONFIG_ARC_FPU_SAVE_RESTORE
panic("H/w lacks DPFP support, apps won't work\n");
#endif
}
if (cpu->dpfp.ver && !fpu_enabled)
pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n");
else if (!cpu->dpfp.ver && fpu_enabled)
panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n");
}

/*
Expand All @@ -304,12 +291,11 @@ void setup_processor(void)

arc_mmu_init();
arc_cache_init();
arc_chk_ccms();

printk(arc_extn_mumbojumbo(cpu_id, str, sizeof(str)));
printk(arc_platform_smp_cpuinfo());

arc_chk_fpu();
arc_chk_core_config();
}

static inline int is_kernel(unsigned long addr)
Expand Down

0 comments on commit c4b9856

Please sign in to comment.