svn commit: r354104 - head/sys/riscv/riscv
Mitchell Horne
mhorne at FreeBSD.org
Fri Oct 25 21:39:30 UTC 2019
Author: mhorne
Date: Fri Oct 25 21:39:29 2019
New Revision: 354104
URL: https://svnweb.freebsd.org/changeset/base/354104
Log:
RISC-V: skip cpu-map when parsing elf_hwcap
The fill_elf_hwcap() function expects to find only cpu nodes under the
/cpus entry of the device tree. Newer versions of QEMU insert a cpu-map
node which describes the CPU topology, breaking this function. To fix
this, simply skip any non-cpu entries.
Reviewed by: markj, kp, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22151
Modified:
head/sys/riscv/riscv/identcpu.c
Modified: head/sys/riscv/riscv/identcpu.c
==============================================================================
--- head/sys/riscv/riscv/identcpu.c Fri Oct 25 21:38:38 2019 (r354103)
+++ head/sys/riscv/riscv/identcpu.c Fri Oct 25 21:39:29 2019 (r354104)
@@ -142,11 +142,9 @@ fill_elf_hwcap(void *dummy __unused)
* ISAs, keep only the extension bits that are common to all harts.
*/
for (node = OF_child(node); node > 0; node = OF_peer(node)) {
- if (!ofw_bus_node_is_compatible(node, "riscv")) {
- if (bootverbose)
- printf("fill_elf_hwcap: Can't find cpu\n");
- return;
- }
+ /* Skip any non-CPU nodes, such as cpu-map. */
+ if (!ofw_bus_node_is_compatible(node, "riscv"))
+ continue;
len = OF_getprop(node, "riscv,isa", isa, sizeof(isa));
KASSERT(len <= ISA_NAME_MAXLEN, ("ISA string truncated"));
More information about the svn-src-all
mailing list