Hi Huacai, On Wed, Jul 25, 2018 at 10:08:33AM +0800, Huacai Chen wrote: > >> > I think it'd be neater if we did this from C in cpu_probe_loongson() > >> > though. If we add __BUILD_SET_C0(config6) to asm/mipsregs.h and define a > >> > macro naming the SFB enable bit then both boot CPU & secondary cases > >> > could be handled by a single line in cpu_probe_loongson(). Something > >> > like this: > >> > > >> > set_c0_config6(LOONGSON_CONFIG6_SFB_ENABLE); > >> > > >> > Unless there's a technical reason this doesn't work I'd prefer it to the > >> > assembly version (and maybe we could move the LPA & ELPA configuration > >> > into cpu-probe.c too then remove asm/mach-loongson64/kernel-entry-init.h > >> > entirely). > >> > >> We should enable SFB/ELPA as early as possible, because it is > >> dangerous if one core is SFB-enabled why another core isn't. ELPA is > >> similar. > > > > Why is it dangerous, and in what circumstances? > > > > Based on commit messages & our other discussions about the SFB my > > understanding is that it sits within a core, between the CPU pipeline & > > the core's L1 data cache. Why would another core care about it being > > enabled or disabled? How could the other core even tell? > > In practice, SFB cannot be enabled/disabled dynamically. But I don't > know why because I'm not the CPU designer. That's not what I'm suggesting though - I'm just suggesting that we move enabling it from assembly to C. If you're already enabling it with assembly then it obviously can be enabled at runtime, I'm just suggesting we move the code that's doing that somewhere that it can be smaller & more readable. Thanks, Paul