Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2019 21:39:29 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354104 - head/sys/riscv/riscv
Message-ID:  <201910252139.x9PLdTWZ045689@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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"));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910252139.x9PLdTWZ045689>