[PATCH] arm64: cpuinfo: add AArch64 & elf platform for app compatibility

Robin Murphy robin.murphy at arm.com
Thu May 19 04:04:45 PDT 2016


On 19/05/16 03:44, x00195127 wrote:
> we find that some apps will read cpuinfo when start up,
> they need the string  as follows:
> "Processor       : AArch64 Processor rev 0 (aarch64)"
>
> Then thay could load the corresponding libs. But now
> arm64 platform's cpuinfo don't has this now, so
> we need add this.
>
> Signed-off-by: Qing Xia <saberlily.xia at hisilicon.com>
> ---
>   arch/arm64/kernel/cpuinfo.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index 3808470..c3527ad 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c
> @@ -114,6 +114,9 @@ static int c_show(struct seq_file *m, void *v)
>   		 * online processors, looking for lines beginning with
>   		 * "processor".  Give glibc what it expects.
>   		 */
> +		seq_printf(m, "Processor\t: AArch64 Processor rev %d (%s)\n",
> +				read_cpuid_id() & 15, ELF_PLATFORM);

The pre-3.19 behaviour printed this once - now you're printing it for 
every CPU in the system, but all with the same revision of whichever 
core this happens to be running on, which is unjustifiably incorrect.

Furthermore, this string provides virtually no useful information anyway 
- the majority of code running on AArch64 already knows that by virtue 
of the fact that *it's running at all*, and for scripts/interpreted 
code/etc. there are already appropriate mechanisms for discovering the 
platform (e.g. uname).

Robin.

> +
>   		seq_printf(m, "processor\t: %d\n", i);
>
>   		seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
>




More information about the linux-arm-kernel mailing list