From owner-svn-src-head@freebsd.org Fri Oct 25 21:39:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0619615BFFE; Fri, 25 Oct 2019 21:39:30 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470HZ96DFMz45lw; Fri, 25 Oct 2019 21:39:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8D9A2C972; Fri, 25 Oct 2019 21:39:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLdTX1045690; Fri, 25 Oct 2019 21:39:29 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLdTWZ045689; Fri, 25 Oct 2019 21:39:29 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201910252139.x9PLdTWZ045689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 25 Oct 2019 21:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354104 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 354104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:39:30 -0000 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"));