MPIDR_EL1寄存器

AFF0 :表示一个 core 中的第几个 thread,大多数 core 都是 single-threaded core,所以大多数 core 中的该值是 0.
AFF1:表示一个 cluster 中的第几个 cpu
AFF2/AFF3:表示系统中的第几个 cluster,这个值由 SOC 厂商给 core 的输入信号决定
汇编
mrs x2, mpidr_el1
and x2, x2, #0xFF00 // x2 == CLUSTER number

参考: