U-boot 会在单核上 运行 吗?

U-boot will run on single core?

我正在开发基于 TI Jacinto6(ARM CortexA15) 的电路板。我正在了解 U-boot 源代码。 根据 start.S 文件,执行以下汇编指令以禁用 L1 I/D 缓存和 TLB。本说明来自start.s(http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/start.S;h=fedd7c8f7e00d0427405173849e6c0743d6b886f;hb=524123a70761110c5cf3ccc5f52f6d4da071b959)

 mov     r0, #0                  @ set up for MCR
 mcr     p15, 0, r0, c8, c7, 0   @ invalidate TLBs
 mcr     p15, 0, r0, c7, c5, 0   @ invalidate icache
 mcr     p15, 0, r0, c7, c5, 6   @ invalidate BP array
 mcr     p15, 0, r0, c7, c10, 4  @ DSB
 mcr     p15, 0, r0, c7, c5, 4   @ ISB

根据 ARM 文档,CortexA15 有 4 个内核。 上面的代码将禁用运行核心上的缓存和TLB,那么其他核心的缓存和TLB呢? U-boot 源代码只能在一个内核上运行吗?如果是这样,那么其他核心将如何被禁用?

Will the U-boot source runs on only one core?

U-Boot 二进制文件(不是源代码)仅在一个处理器内核上执行。
引导加载程序的功能不需要并行处理。
此外,Linux 内核在启动时只希望启用一个内核。

If so then how other cores will be disabled?

通常在 processor/system 重置后,只有一个核心被启用;其他一切都是静止的或禁用的。

So Kernel will enable the other cores while booting?

OS,假设它支持 SMP(对称多处理器),将启用其他核心作为其初始化的一部分。

can you please share the kernel source link(git) which enables the other cores.

对于 ARM Cortex-A9 四核(A15 类似),Linux 内核输出:

Booting Linux on physical CPU 0x0
Linux version 3.10.60+wandboard_1.0.2+1.0.0-wandboard (root@host) (gcc version 4.8.3 (crosstool-NG 1.19.0) ) #7 SMP Mon Dec 29 18:49:06 PST 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: Freescale i.MX6 Quad/DualLite (Device Tree), model: Wandboard Quad based on Freescale i.MX6 Quad
...  
L310 cache controller enabled
l2x0: 16 ways, CACHE_ID 0x410000c7, AUX_CTRL 0x32070000, Cache size: 1048576 B
...
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x804bdd30 - 0x804bdd88
CPU1: Booted secondary processor
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
CPU2: Booted secondary processor
CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
CPU3: Booted secondary processor
CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
Brought up 4 CPUs
SMP: Total of 4 processors activated (6324.22 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
...

Linux 内核在 start_kernel() 中开始执行其 C 代码 init/main.c
调用的第二个过程是 smp_setup_processor_id() 的 ARM 版本,它负责 Booting Linux on physical CPU ... 消息文本。

start_kernel() 结束时,check_bugs() 的 ARM 版本将调用check_writebuffer_bugs(),负责 CPU: Testing write buffer coherency: ... 消息文本。

start_kernel(),rest_init() eventually initializes the other processor cores through the ARM version of secondary_start_kernel() (CPUn: Booted secondary processor), invoked somehow through smp_init()(Brought up N CPUs).

结束