HomeFreeBSD

Rework CPU identification on ARM64

Description

Rework CPU identification on ARM64

This commit reworks the code responsible for identification of
the CPUs during runtime.
It is necessary to provide a way for workarounds and erratums
to be applied only for certain HW versions.

The copy of MIDR is now stored in pcpu to provide a fast and
convenient way for assambly code to read it (pcpu is used quite often
so there is a chance it's inside the cache).
The MIDR is also better way of identification than using user-friendly
cpu_desc structure, because it can be compiled into comparision of
single u32 with only one access to the memory - this is crucial
for some erratums which are called from performance-critical
places.

Changes in cpu_identify makes this function safe to be called
on non-boot CPUs.

New function CPU_MATCH was implemented which returns boolean
value based on mathing masked MIDR with chip identification.
Example of usage:

printf("is thunder: %d\n", CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK,

CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 0, 0));

printf("is generic: %d\n", CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK,

CPU_IMPL_ARM, CPU_PART_FOUNDATION, 0, 0));

Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3030

Details

Provenance
zbbAuthored on
Reviewer
andrew
Differential Revision
D3030: Rework armv8 CPU identification
Parents
rS285310: Cover a race between doselwakeup() and selfdfree(). If doselwakeup()
Branches
Unknown
Tags
Unknown