Hi,
I'm using a Juno r1 board and I'm trying to get processor's related CPU ID without using any header file like function sched_getcpu from sched.h.
The reason is I want to get the CPU number for TrustZone application and there is no way to using those header files.
I know there is an instruction CPUID which could be used in x86 for this purpose, so I'm wondering is there any instruction I could use for ARMv8-A?
Thanks.
Simon
Hi Matt mwsealey,
I'm writing an applicantion running in the Secure World and I want to know on what CPU my application is running on.
However, since I'm using the OPTEE and their Trusted Applications can't include the header file 'sched.h' so I can't use the function "sched_getcpu()" to get the information.
So in this case, is there any way for me to get the CPU ID for a Trusted Application in Secure World?
shengyewan,
If OP-TEE don't provide an API to do so, then the answer is pretty simply that you don't - the MPIDR_EL1 register that contains the multi-processor CPU identifier (i.e. it's thread, core, cluster and system topology) is only accessible in privileged modes, which a Secure EL0 application won't be able to access. The only way to get that value (or a value that means something to the OS, at least) is to use an SVC call into the Trusted OS, and have it give you the response (which is what sched_getgpu() does - on Linux, it is wired into sys_getcpuid syscall or something similarly named).
If there's no API to do so then the question you may want to ask yourself is whether your application truly requires knowledge of the current CPU, or whether it can simply let the OS fill in the information when required (the OS should already know full-well which CPU the application runs on..)?
Ta,
Matt