HomeFreeBSD

ofw_cpu: check for "disabled" status during probe

Description

ofw_cpu: check for "disabled" status during probe

Some RISC-V CPUs contain a "monitor core" with limited functionality (no
MMU). These cores appear in some device trees, but we don't run the
kernel on them; in early CPU start-up code we skip them, and they have
no impact on mp_ncpu. It seems the new trend is to mark these monitor
cores with a 'status' property of 'disabled'.

However, we still instantiate an ofw_cpu pseudo device for the disabled
core. This is generally harmless, but there is an impact when attempting
to attach the cpufreq_dt driver. It counts more OFW CPU devices (unit
number) than logical CPUs (mp_ncpus), and therefore fails to attach for
the last logical CPU.

The solution is to check the status property in ofw_cpu_probe(), and
fail if the core is marked "disabled". This is subject to the same
exception already in ofw_cpu_early_foreach(); that is, if a disabled CPU
has an 'enable-method' property, it can be used by the kernel.

Reviewed by: andrew, jrtc27
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48123

Details

Provenance
mhorneAuthored on Fri, Jan 10, 6:46 PM
Reviewer
andrew
Differential Revision
D48123: ofw_cpu: check for "disabled" status
Parents
rG4ea0c3f04f42: ofw_cpu: collapse some #ifdef code
Branches
Unknown
Tags
Unknown