Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109469364
D39851.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D39851.diff
View Options
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -153,10 +153,9 @@
#
# 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
--- 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
--- a/sys/riscv/conf/GENERIC
+++ b/sys/riscv/conf/GENERIC
@@ -72,7 +72,6 @@
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
--- a/sys/riscv/conf/NOTES
+++ b/sys/riscv/conf/NOTES
@@ -16,7 +16,6 @@
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
--- a/sys/riscv/riscv/exec_machdep.c
+++ b/sys/riscv/riscv/exec_machdep.c
@@ -58,6 +58,7 @@
#include <sys/ucontext.h>
#include <machine/cpu.h>
+#include <machine/fpe.h>
#include <machine/kdb.h>
#include <machine/pcb.h>
#include <machine/pte.h>
@@ -70,10 +71,6 @@
#include <vm/pmap.h>
#include <vm/vm_map.h>
-#ifdef FPE
-#include <machine/fpe.h>
-#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 @@
int
fill_fpregs(struct thread *td, struct fpreg *regs)
{
-#ifdef FPE
struct pcb *pcb;
pcb = td->td_pcb;
@@ -139,7 +135,6 @@
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 @@
int
set_fpregs(struct thread *td, struct fpreg *regs)
{
-#ifdef FPE
struct trapframe *frame;
struct pcb *pcb;
@@ -160,7 +154,6 @@
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 @@
static void
get_fpcontext(struct thread *td, mcontext_t *mcp)
{
-#ifdef FPE
struct pcb *curpcb;
critical_enter();
@@ -300,20 +292,16 @@
}
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 @@
}
critical_exit();
-#endif
}
int
diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c
--- a/sys/riscv/riscv/identcpu.c
+++ b/sys/riscv/riscv/identcpu.c
@@ -203,10 +203,8 @@
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
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -81,6 +81,7 @@
#include <vm/vm_pager.h>
#include <machine/cpu.h>
+#include <machine/fpe.h>
#include <machine/intr.h>
#include <machine/kdb.h>
#include <machine/machdep.h>
@@ -92,10 +93,6 @@
#include <machine/trap.h>
#include <machine/vmparam.h>
-#ifdef FPE
-#include <machine/fpe.h>
-#endif
-
#ifdef FDT
#include <contrib/libfdt/libfdt.h>
#include <dev/fdt/fdt_common.h>
diff --git a/sys/riscv/riscv/swtch.S b/sys/riscv/riscv/swtch.S
--- 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 @@
ret
END(fpe_state_clear)
-#endif /* FPE */
-
+
/*
* void cpu_throw(struct thread *old __unused, struct thread *new)
*/
@@ -240,7 +238,6 @@
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 @@
/* Restore registers. */
__fpe_state_load x13
1:
-#endif
-
ret
END(cpu_throw)
@@ -292,7 +287,6 @@
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 @@
__fpe_state_save x13
1:
-#endif
/* Activate the new thread's pmap */
mv s0, a0
@@ -355,7 +348,6 @@
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 @@
/* Restore registers. */
__fpe_state_load x13
1:
-#endif
-
ret
END(cpu_switch)
@@ -466,8 +456,6 @@
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
--- a/sys/riscv/riscv/trap.c
+++ b/sys/riscv/riscv/trap.c
@@ -57,9 +57,7 @@
#include <vm/vm_param.h>
#include <vm/vm_extern.h>
-#ifdef FPE
#include <machine/fpe.h>
-#endif
#include <machine/frame.h>
#include <machine/pcb.h>
#include <machine/pcpu.h>
@@ -395,7 +393,6 @@
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 @@
pcb->pcb_fpflags |= PCB_FP_STARTED;
break;
}
-#endif
call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)frame->tf_sepc,
exception);
userret(td, frame);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 11:49 AM (20 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16492959
Default Alt Text
D39851.diff (6 KB)
Attached To
Mode
D39851: riscv: retire the FPE kernel option
Attached
Detach File
Event Timeline
Log In to Comment