From nobody Tue May 02 18:04:18 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q9nyq14cWz49FZg; Tue, 2 May 2023 18:04:19 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q9nyq0GN0z3rRl; Tue, 2 May 2023 18:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683050659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eAIcZZ2rze2Ft59DOmrSsBMpEf0++WjTTRI0r39CfCg=; b=bHpVu8qZa2yYOTYE3nYvdNsS1wKAwxjSUCWhAoQA5ulnaVfCQLBDbSG+YXd5Ahla+KICPm Lba4FXvgdGOcRVm5HA6kwAqA7JPGzts9f/Ibo8Lw35dJb2nIAj1VXzqKP9VqI7/sfCLBod 1L9AqbBiZKcwaSWRMvkbOU4gaAKqQT6xLbUhjyizaPNi2zxZ/8zkdWc4RQ6lYMhAKpHTCn eFtLxZALDWT7xkPQl3TMTZ3nyLFztLJfpZSxAR7KATiWY5vC47Xjb3+6gLzFO/k8qhBK0g /0tfK9+nQNrXCieD7MhdQFAJrl0iRk9/C1r5EoM6TLx071DqWGYcottMY28qkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683050659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eAIcZZ2rze2Ft59DOmrSsBMpEf0++WjTTRI0r39CfCg=; b=cydBkOkAq20hFPG68SQ/Pg1XtgLG9fpGESq9zsV3VrZaqXdVvTglyIvJ+neg/4/itUbrWz ooIyxQ8dr/P9IWb5xcGDktUBxyjY+9OVLJKqMHx+01RtVPwmmtZFEvAtwLzaLoCTvq1N6A WPGjM7L0kamh3OECerjxud4pEGWKrPBxpxps+EXrZBSBzjKHA6am4NnuvXcPP5fyAtR1x+ 6WjtcBJPkPcTHc8vtoyoZRWSgz34bXYHGmlQKQdB5HtRb2zLbqtlLR+lSym1awZTrMYQnz 1SFtpRJXbJRawF/MJ1GfOqXcqq183BaIfKxObVO/domjfUsS1QAPPGhwlK6ocA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683050659; a=rsa-sha256; cv=none; b=oP83tQw0Etp/FQytdwgHPMkGgBdtfWvg1I1BS2fTbBae07JMvYETz3emxLreA2/G3nJIh1 LS/QahK8m+Npx1ejqU9b5YpjnGbgcaq72z79CWUdEmuthgGSERGZqJxpSVdnTSXvPt3tCu WJZ7U37CMyCvHNnCB76lmVahKpGafs846BScLod1W/TzrR3951XnCMCSGiBEOQoukHRA8x 1tO7dQ3JHaABKFjfRwmRc16YUA+B42TzmXppK8EYQcm4yS97Cv+9mjWQzAVTo97ZsIyLYf zVqzIyiRfgHagt1AUyCzQTeLhz8CTvHtdwMso6iQ75RhqBBPu4rZFdD76nu3RA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q9nyp6RnQzxvx; Tue, 2 May 2023 18:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 342I4I0r043898; Tue, 2 May 2023 18:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 342I4I4o043897; Tue, 2 May 2023 18:04:18 GMT (envelope-from git) Date: Tue, 2 May 2023 18:04:18 GMT Message-Id: <202305021804.342I4I4o043897@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: c32b6c742f36 - main - riscv: retire the FPE kernel option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c32b6c742f36225ca0a9d2e7a704f959875e37b3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c32b6c742f36225ca0a9d2e7a704f959875e37b3 commit c32b6c742f36225ca0a9d2e7a704f959875e37b3 Author: Mitchell Horne AuthorDate: 2023-04-25 17:51:35 +0000 Commit: Mitchell Horne CommitDate: 2023-05-02 18:01:31 +0000 riscv: retire the FPE kernel option We always build the kernel floating point support. Now that the riscv64sf userspace variant has been removed the option is required for correct operation. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39851 --- sys/conf/kern.mk | 7 +++---- sys/conf/options.riscv | 1 - sys/riscv/conf/GENERIC | 1 - sys/riscv/conf/NOTES | 1 - sys/riscv/riscv/exec_machdep.c | 15 +-------------- sys/riscv/riscv/identcpu.c | 2 -- sys/riscv/riscv/machdep.c | 5 +---- sys/riscv/riscv/swtch.S | 14 +------------- sys/riscv/riscv/trap.c | 4 ---- 9 files changed, 6 insertions(+), 44 deletions(-) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 1a1251f670e1..245f81e6ed71 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -153,10 +153,9 @@ INLINE_LIMIT?= 8000 # # For RISC-V we specify the soft-float ABI (lp64) to avoid the use of floating -# point registers within the kernel. However, for kernels supporting hardware -# float (FPE), we have to include that in the march so we can have limited -# floating point support in context switching needed for that. This is different -# than userland where we use a hard-float ABI (lp64d). +# point registers within the kernel. However, we include the F and D extensions +# in -march so we can have limited floating point support in context switching +# code. This is different than userland where we use a hard-float ABI (lp64d). # # We also specify the "medium" code model, which generates code suitable for a # 2GiB addressing range located at any offset, allowing modules to be located diff --git a/sys/conf/options.riscv b/sys/conf/options.riscv index 9e48f73fba33..964a2f07173c 100644 --- a/sys/conf/options.riscv +++ b/sys/conf/options.riscv @@ -1,5 +1,4 @@ # $FreeBSD$ RISCV opt_global.h # For cpu RISCV to work -FPE opt_global.h INTRNG opt_global.h diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index 49e3f07c0f96..04645ec9bf90 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -72,7 +72,6 @@ options MAC # TrustedBSD MAC Framework options KDTRACE_FRAME # Ensure frames are compiled in options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data -options FPE # Floating-point extension support options RACCT # Resource accounting framework options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default options RCTL # Resource limits diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES index f36e6283433d..d3ff441a95d6 100644 --- a/sys/riscv/conf/NOTES +++ b/sys/riscv/conf/NOTES @@ -16,7 +16,6 @@ options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KDTRACE_FRAME # Ensure frames are compiled in options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data -options FPE # Floating-point extension support options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default # RISC-V SBI console diff --git a/sys/riscv/riscv/exec_machdep.c b/sys/riscv/riscv/exec_machdep.c index ab79c0384eb3..e61bce628602 100644 --- a/sys/riscv/riscv/exec_machdep.c +++ b/sys/riscv/riscv/exec_machdep.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -70,10 +71,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef FPE -#include -#endif - static void get_fpcontext(struct thread *td, mcontext_t *mcp); static void set_fpcontext(struct thread *td, mcontext_t *mcp); @@ -123,7 +120,6 @@ set_regs(struct thread *td, struct reg *regs) int fill_fpregs(struct thread *td, struct fpreg *regs) { -#ifdef FPE struct pcb *pcb; pcb = td->td_pcb; @@ -139,7 +135,6 @@ fill_fpregs(struct thread *td, struct fpreg *regs) memcpy(regs->fp_x, pcb->pcb_x, sizeof(regs->fp_x)); regs->fp_fcsr = pcb->pcb_fcsr; } else -#endif memset(regs, 0, sizeof(*regs)); return (0); @@ -148,7 +143,6 @@ fill_fpregs(struct thread *td, struct fpreg *regs) int set_fpregs(struct thread *td, struct fpreg *regs) { -#ifdef FPE struct trapframe *frame; struct pcb *pcb; @@ -160,7 +154,6 @@ set_fpregs(struct thread *td, struct fpreg *regs) pcb->pcb_fpflags |= PCB_FP_STARTED; frame->tf_sstatus &= ~SSTATUS_FS_MASK; frame->tf_sstatus |= SSTATUS_FS_CLEAN; -#endif return (0); } @@ -274,7 +267,6 @@ set_mcontext(struct thread *td, mcontext_t *mcp) static void get_fpcontext(struct thread *td, mcontext_t *mcp) { -#ifdef FPE struct pcb *curpcb; critical_enter(); @@ -300,20 +292,16 @@ get_fpcontext(struct thread *td, mcontext_t *mcp) } critical_exit(); -#endif } static void set_fpcontext(struct thread *td, mcontext_t *mcp) { -#ifdef FPE struct pcb *curpcb; -#endif td->td_frame->tf_sstatus &= ~SSTATUS_FS_MASK; td->td_frame->tf_sstatus |= SSTATUS_FS_OFF; -#ifdef FPE critical_enter(); if ((mcp->mc_flags & _MC_FP_VALID) != 0) { @@ -327,7 +315,6 @@ set_fpcontext(struct thread *td, mcontext_t *mcp) } critical_exit(); -#endif } int diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index 5f10ec6358ae..c57a22c1b51a 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -203,10 +203,8 @@ parse_riscv_isa(char *isa, int len, u_long *hwcapp) switch(isa[i]) { case 'a': case 'c': -#ifdef FPE case 'd': case 'f': -#endif case 'i': case 'm': hwcap |= HWCAP_ISA_BIT(isa[i]); diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index 0821a29d11c1..6b8dcb647162 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -92,10 +93,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef FPE -#include -#endif - #ifdef FDT #include #include diff --git a/sys/riscv/riscv/swtch.S b/sys/riscv/riscv/swtch.S index d2e23784c994..5b878ae2fb30 100644 --- a/sys/riscv/riscv/swtch.S +++ b/sys/riscv/riscv/swtch.S @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); -#ifdef FPE .macro __fpe_state_save p /* * Enable FPE usage in supervisor mode, @@ -204,8 +203,7 @@ ENTRY(fpe_state_clear) ret END(fpe_state_clear) -#endif /* FPE */ - + /* * void cpu_throw(struct thread *old __unused, struct thread *new) */ @@ -240,7 +238,6 @@ ENTRY(cpu_throw) ld s10, (PCB_S + 10 * 8)(x13) ld s11, (PCB_S + 11 * 8)(x13) -#ifdef FPE /* Is FPE enabled for new thread? */ ld t0, TD_FRAME(a0) ld t1, (TF_SSTATUS)(t0) @@ -251,8 +248,6 @@ ENTRY(cpu_throw) /* Restore registers. */ __fpe_state_load x13 1: -#endif - ret END(cpu_throw) @@ -292,7 +287,6 @@ ENTRY(cpu_switch) sd s10, (PCB_S + 10 * 8)(x13) sd s11, (PCB_S + 11 * 8)(x13) -#ifdef FPE /* * Is FPE enabled and is it in dirty state * for the old thread? @@ -313,7 +307,6 @@ ENTRY(cpu_switch) __fpe_state_save x13 1: -#endif /* Activate the new thread's pmap */ mv s0, a0 @@ -355,7 +348,6 @@ ENTRY(cpu_switch) ld s10, (PCB_S + 10 * 8)(x13) ld s11, (PCB_S + 11 * 8)(x13) -#ifdef FPE /* Is FPE enabled for new thread? */ ld t0, TD_FRAME(a1) ld t1, (TF_SSTATUS)(t0) @@ -366,8 +358,6 @@ ENTRY(cpu_switch) /* Restore registers. */ __fpe_state_load x13 1: -#endif - ret END(cpu_switch) @@ -466,8 +456,6 @@ ENTRY(savectx) sd s10, (PCB_S + 10 * 8)(a0) sd s11, (PCB_S + 11 * 8)(a0) -#ifdef FPE __fpe_state_save a0 -#endif ret END(savectx) diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 39e0fbb1d5bd..11ecfa702054 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -57,9 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef FPE #include -#endif #include #include #include @@ -395,7 +393,6 @@ do_trap_user(struct trapframe *frame) ecall_handler(); break; case SCAUSE_ILLEGAL_INSTRUCTION: -#ifdef FPE if ((pcb->pcb_fpflags & PCB_FP_STARTED) == 0) { /* * May be a FPE trap. Enable FPE usage @@ -407,7 +404,6 @@ do_trap_user(struct trapframe *frame) pcb->pcb_fpflags |= PCB_FP_STARTED; break; } -#endif call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)frame->tf_sepc, exception); userret(td, frame);