From owner-svn-src-all@freebsd.org Mon Sep 16 22:17:18 2019 Return-Path: Delivered-To: svn-src-all@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 184C5EE18B; Mon, 16 Sep 2019 22:17:18 +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 46XLFn6qdGz4D9l; Mon, 16 Sep 2019 22:17:17 +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 C997F26C65; Mon, 16 Sep 2019 22:17:17 +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 x8GMHHdf030199; Mon, 16 Sep 2019 22:17:17 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GMHHat030196; Mon, 16 Sep 2019 22:17:17 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909162217.x8GMHHat030196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 16 Sep 2019 22:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352430 - in head/sys/riscv: conf riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys/riscv: conf riscv X-SVN-Commit-Revision: 352430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2019 22:17:18 -0000 Author: mhorne Date: Mon Sep 16 22:17:16 2019 New Revision: 352430 URL: https://svnweb.freebsd.org/changeset/base/352430 Log: RISC-V: Support EARLY_AP_STARTUP The EARLY_AP_STARTUP option initializes non-boot processors much sooner during startup. This adds support for this option on RISC-V and enables it by default for GENERIC. Reviewed by: jhb, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21661 Modified: head/sys/riscv/conf/GENERIC head/sys/riscv/riscv/clock.c head/sys/riscv/riscv/mp_machdep.c Modified: head/sys/riscv/conf/GENERIC ============================================================================== --- head/sys/riscv/conf/GENERIC Mon Sep 16 22:02:14 2019 (r352429) +++ head/sys/riscv/conf/GENERIC Mon Sep 16 22:17:16 2019 (r352430) @@ -71,6 +71,7 @@ options RACCT # Resource accounting framework options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default options RCTL # Resource limits options SMP +options EARLY_AP_STARTUP options INTRNG # RISC-V SBI console Modified: head/sys/riscv/riscv/clock.c ============================================================================== --- head/sys/riscv/riscv/clock.c Mon Sep 16 22:02:14 2019 (r352429) +++ head/sys/riscv/riscv/clock.c Mon Sep 16 22:17:16 2019 (r352430) @@ -37,10 +37,34 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include void cpu_initclocks(void) { +#ifdef EARLY_AP_STARTUP + struct thread *td; + int i; + td = curthread; cpu_initclocks_bsp(); + CPU_FOREACH(i) { + if (i == 0) + continue; + thread_lock(td); + sched_bind(td, i); + thread_unlock(td); + cpu_initclocks_ap(); + } + thread_lock(td); + if (sched_is_bound(td)) + sched_unbind(td); + thread_unlock(td); +#else + cpu_initclocks_bsp(); +#endif } Modified: head/sys/riscv/riscv/mp_machdep.c ============================================================================== --- head/sys/riscv/riscv/mp_machdep.c Mon Sep 16 22:02:14 2019 (r352429) +++ head/sys/riscv/riscv/mp_machdep.c Mon Sep 16 22:17:16 2019 (r352430) @@ -257,8 +257,10 @@ init_secondary(uint64_t hart) /* Enable software interrupts */ riscv_unmask_ipi(); +#ifndef EARLY_AP_STARTUP /* Start per-CPU event timers. */ cpu_initclocks_ap(); +#endif /* Enable external (PLIC) interrupts */ csr_set(sie, SIE_SEIE);