Skip to content

FreeBSD Arm64 MIDR_EL1 detection info #344

@toor1245

Description

@toor1245

This issue was created to make it easier for people experiencing the problem of MIDR_EL1 not receiving information on FreeBSD Arm64 to more easily determine the root cause.

We use elf_aux_info(3) to detect MIDR_EL1 info (implementer, variant, part, revision) for FreeBSD Arm64. To retrieve this information we check if HWCAP_CPUID is enabled to retrieve data from system registers EL1 in user mode. However, FreeBSD export the cpuid registers since 2018 but never set the
HWCAP_CPUID flag to tell userspace, so it was fixed recently.

ref: https://cgit.freebsd.org/src/commit/?id=d61f9bfb0e5c119c97a559f187b1e9c73077307b

Below you can see results with build on current main FreeBSD branch before and after the fix:

mhohsadze@generic:~/cpu_features_toor1245_2 $ bazel run list_cpu_features
INFO: Analyzed target //:list_cpu_features (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:list_cpu_features up-to-date:
  bazel-bin/list_cpu_features
INFO: Elapsed time: 0.991s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/list_cpu_features
arch            : aarch64
implementer     :   0 (0x00)
variant         :   0 (0x00)
part            :   0 (0x00)
revision        :   0 (0x00)
flags           : asimd,crc32,fp
mhohsadze@generic:~/cpu_features_toor1245_2 $ bazel run list_cpu_features
Starting local Bazel server and connecting to it...
... still trying to connect to local Bazel server (1532) after 10 seconds ...
INFO: Analyzed target //:list_cpu_features (37 packages loaded, 192 targets configured).
INFO: Found 1 target...
Target //:list_cpu_features up-to-date:
  bazel-bin/list_cpu_features
INFO: Elapsed time: 61.431s, Critical Path: 4.52s
INFO: 8 processes: 1 internal, 7 processwrapper-sandbox.
INFO: Build completed successfully, 8 total actions
INFO: Running command line: bazel-bin/list_cpu_features
arch            : aarch64
implementer     :  65 (0x41)
variant         :   0 (0x00)
part            : 3336 (0xD08)
revision        :   3 (0x03)
flags           : asimd,cpuid,crc32,fp
mhohsadze@generic:~/cpu_features_toor1245_2 $ 

As you can see, a user of the stable version of FreeBSD will currently see empty MIDR information. The fix will probably work starting from versions 14.x+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions