summaryrefslogtreecommitdiffstats
path: root/arch/nds32/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-03 13:23:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-03 13:23:41 -0400
commit30d1d92a888d03681b927c76a35181b4eed7071f (patch)
tree8a1d452bd9c13d9edaa8f86ff9355f663ea9ec55 /arch/nds32/include
parent01e7a841b4346836f19b40677e1fef4657cc0d0d (diff)
parent932296120543149e3397af252e7daee7af37eb05 (diff)
Merge tag 'nds32-for-linux-5.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux
Pull nds32 fixes from Greentime Hu: - fix warning for math-emu - fix nds32 fpu exception handling - fix nds32 fpu emulation implementation * tag 'nds32-for-linux-5.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux: nds32: add new emulations for floating point instruction nds32: Avoid IEX status being incorrectly modified math-emu: Use statement expressions to fix Wshift-count-overflow warning
Diffstat (limited to 'arch/nds32/include')
-rw-r--r--arch/nds32/include/asm/bitfield.h2
-rw-r--r--arch/nds32/include/asm/fpu.h2
-rw-r--r--arch/nds32/include/asm/fpuemu.h12
-rw-r--r--arch/nds32/include/asm/syscalls.h2
-rw-r--r--arch/nds32/include/uapi/asm/fp_udfiex_crtl.h16
-rw-r--r--arch/nds32/include/uapi/asm/sigcontext.h24
-rw-r--r--arch/nds32/include/uapi/asm/udftrap.h13
-rw-r--r--arch/nds32/include/uapi/asm/unistd.h4
8 files changed, 50 insertions, 25 deletions
diff --git a/arch/nds32/include/asm/bitfield.h b/arch/nds32/include/asm/bitfield.h
index e75212c76b20..b02a58e71f80 100644
--- a/arch/nds32/include/asm/bitfield.h
+++ b/arch/nds32/include/asm/bitfield.h
@@ -937,7 +937,7 @@
937#define FPCSR_mskDNIT ( 0x1 << FPCSR_offDNIT ) 937#define FPCSR_mskDNIT ( 0x1 << FPCSR_offDNIT )
938#define FPCSR_mskRIT ( 0x1 << FPCSR_offRIT ) 938#define FPCSR_mskRIT ( 0x1 << FPCSR_offRIT )
939#define FPCSR_mskALL (FPCSR_mskIVO | FPCSR_mskDBZ | FPCSR_mskOVF | FPCSR_mskUDF | FPCSR_mskIEX) 939#define FPCSR_mskALL (FPCSR_mskIVO | FPCSR_mskDBZ | FPCSR_mskOVF | FPCSR_mskUDF | FPCSR_mskIEX)
940#define FPCSR_mskALLE_NO_UDFE (FPCSR_mskIVOE | FPCSR_mskDBZE | FPCSR_mskOVFE | FPCSR_mskIEXE) 940#define FPCSR_mskALLE_NO_UDF_IEXE (FPCSR_mskIVOE | FPCSR_mskDBZE | FPCSR_mskOVFE)
941#define FPCSR_mskALLE (FPCSR_mskIVOE | FPCSR_mskDBZE | FPCSR_mskOVFE | FPCSR_mskUDFE | FPCSR_mskIEXE) 941#define FPCSR_mskALLE (FPCSR_mskIVOE | FPCSR_mskDBZE | FPCSR_mskOVFE | FPCSR_mskUDFE | FPCSR_mskIEXE)
942#define FPCSR_mskALLT (FPCSR_mskIVOT | FPCSR_mskDBZT | FPCSR_mskOVFT | FPCSR_mskUDFT | FPCSR_mskIEXT |FPCSR_mskDNIT | FPCSR_mskRIT) 942#define FPCSR_mskALLT (FPCSR_mskIVOT | FPCSR_mskDBZT | FPCSR_mskOVFT | FPCSR_mskUDFT | FPCSR_mskIEXT |FPCSR_mskDNIT | FPCSR_mskRIT)
943 943
diff --git a/arch/nds32/include/asm/fpu.h b/arch/nds32/include/asm/fpu.h
index 019f1bcfc5ee..8294ed4aaa2c 100644
--- a/arch/nds32/include/asm/fpu.h
+++ b/arch/nds32/include/asm/fpu.h
@@ -36,7 +36,7 @@ extern int do_fpuemu(struct pt_regs *regs, struct fpu_struct *fpu);
36 * enabled by default and kerenl will re-execute it by fpu emulator 36 * enabled by default and kerenl will re-execute it by fpu emulator
37 * when getting underflow exception. 37 * when getting underflow exception.
38 */ 38 */
39#define FPCSR_INIT FPCSR_mskUDFE 39#define FPCSR_INIT (FPCSR_mskUDFE | FPCSR_mskIEXE)
40#else 40#else
41#define FPCSR_INIT 0x0UL 41#define FPCSR_INIT 0x0UL
42#endif 42#endif
diff --git a/arch/nds32/include/asm/fpuemu.h b/arch/nds32/include/asm/fpuemu.h
index c4bd0c7faa75..63e7ef5f7969 100644
--- a/arch/nds32/include/asm/fpuemu.h
+++ b/arch/nds32/include/asm/fpuemu.h
@@ -13,6 +13,12 @@ void fsubs(void *ft, void *fa, void *fb);
13void fmuls(void *ft, void *fa, void *fb); 13void fmuls(void *ft, void *fa, void *fb);
14void fdivs(void *ft, void *fa, void *fb); 14void fdivs(void *ft, void *fa, void *fb);
15void fs2d(void *ft, void *fa); 15void fs2d(void *ft, void *fa);
16void fs2si(void *ft, void *fa);
17void fs2si_z(void *ft, void *fa);
18void fs2ui(void *ft, void *fa);
19void fs2ui_z(void *ft, void *fa);
20void fsi2s(void *ft, void *fa);
21void fui2s(void *ft, void *fa);
16void fsqrts(void *ft, void *fa); 22void fsqrts(void *ft, void *fa);
17void fnegs(void *ft, void *fa); 23void fnegs(void *ft, void *fa);
18int fcmps(void *ft, void *fa, void *fb, int cop); 24int fcmps(void *ft, void *fa, void *fb, int cop);
@@ -26,6 +32,12 @@ void fmuld(void *ft, void *fa, void *fb);
26void fdivd(void *ft, void *fa, void *fb); 32void fdivd(void *ft, void *fa, void *fb);
27void fsqrtd(void *ft, void *fa); 33void fsqrtd(void *ft, void *fa);
28void fd2s(void *ft, void *fa); 34void fd2s(void *ft, void *fa);
35void fd2si(void *ft, void *fa);
36void fd2si_z(void *ft, void *fa);
37void fd2ui(void *ft, void *fa);
38void fd2ui_z(void *ft, void *fa);
39void fsi2d(void *ft, void *fa);
40void fui2d(void *ft, void *fa);
29void fnegd(void *ft, void *fa); 41void fnegd(void *ft, void *fa);
30int fcmpd(void *ft, void *fa, void *fb, int cop); 42int fcmpd(void *ft, void *fa, void *fb, int cop);
31 43
diff --git a/arch/nds32/include/asm/syscalls.h b/arch/nds32/include/asm/syscalls.h
index f3b16f602cb5..4e7216082a67 100644
--- a/arch/nds32/include/asm/syscalls.h
+++ b/arch/nds32/include/asm/syscalls.h
@@ -7,7 +7,7 @@
7asmlinkage long sys_cacheflush(unsigned long addr, unsigned long len, unsigned int op); 7asmlinkage long sys_cacheflush(unsigned long addr, unsigned long len, unsigned int op);
8asmlinkage long sys_fadvise64_64_wrapper(int fd, int advice, loff_t offset, loff_t len); 8asmlinkage long sys_fadvise64_64_wrapper(int fd, int advice, loff_t offset, loff_t len);
9asmlinkage long sys_rt_sigreturn_wrapper(void); 9asmlinkage long sys_rt_sigreturn_wrapper(void);
10asmlinkage long sys_udftrap(int option); 10asmlinkage long sys_fp_udfiex_crtl(int cmd, int act);
11 11
12#include <asm-generic/syscalls.h> 12#include <asm-generic/syscalls.h>
13 13
diff --git a/arch/nds32/include/uapi/asm/fp_udfiex_crtl.h b/arch/nds32/include/uapi/asm/fp_udfiex_crtl.h
new file mode 100644
index 000000000000..d54a5d6c6538
--- /dev/null
+++ b/arch/nds32/include/uapi/asm/fp_udfiex_crtl.h
@@ -0,0 +1,16 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright (C) 2005-2019 Andes Technology Corporation */
3#ifndef _FP_UDF_IEX_CRTL_H
4#define _FP_UDF_IEX_CRTL_H
5
6/*
7 * The cmd list of sys_fp_udfiex_crtl()
8 */
9/* Disable UDF or IEX trap based on the content of parameter act */
10#define DISABLE_UDF_IEX_TRAP 0
11/* Enable UDF or IEX trap based on the content of parameter act */
12#define ENABLE_UDF_IEX_TRAP 1
13/* Get current status of UDF and IEX trap */
14#define GET_UDF_IEX_TRAP 2
15
16#endif /* _FP_UDF_IEX_CRTL_H */
diff --git a/arch/nds32/include/uapi/asm/sigcontext.h b/arch/nds32/include/uapi/asm/sigcontext.h
index 628ff6b75825..dc89af7ddcc3 100644
--- a/arch/nds32/include/uapi/asm/sigcontext.h
+++ b/arch/nds32/include/uapi/asm/sigcontext.h
@@ -13,14 +13,24 @@ struct fpu_struct {
13 unsigned long long fd_regs[32]; 13 unsigned long long fd_regs[32];
14 unsigned long fpcsr; 14 unsigned long fpcsr;
15 /* 15 /*
16 * UDF_trap is used to recognize whether underflow trap is enabled 16 * When CONFIG_SUPPORT_DENORMAL_ARITHMETIC is defined, kernel prevents
17 * or not. When UDF_trap == 1, this process will be traped and then 17 * hardware from treating the denormalized output as an underflow case
18 * get a SIGFPE signal when encountering an underflow exception. 18 * and rounding it to a normal number. Hence kernel enables the UDF and
19 * UDF_trap is only modified through setfputrap syscall. Therefore, 19 * IEX trap in the fpcsr register to step in the calculation.
20 * UDF_trap needn't be saved or loaded to context in each context 20 * However, the UDF and IEX trap enable bit in $fpcsr also lose
21 * switch. 21 * their use.
22 *
23 * UDF_IEX_trap replaces the feature of UDF and IEX trap enable bit in
24 * $fpcsr to control the trap of underflow and inexact. The bit filed
25 * of UDF_IEX_trap is the same as $fpcsr, 10th bit is used to enable UDF
26 * exception trapping and 11th bit is used to enable IEX exception
27 * trapping.
28 *
29 * UDF_IEX_trap is only modified through fp_udfiex_crtl syscall.
30 * Therefore, UDF_IEX_trap needn't be saved and restored in each
31 * context switch.
22 */ 32 */
23 unsigned long UDF_trap; 33 unsigned long UDF_IEX_trap;
24}; 34};
25 35
26struct zol_struct { 36struct zol_struct {
diff --git a/arch/nds32/include/uapi/asm/udftrap.h b/arch/nds32/include/uapi/asm/udftrap.h
deleted file mode 100644
index 433f79d679c0..000000000000
--- a/arch/nds32/include/uapi/asm/udftrap.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright (C) 2005-2018 Andes Technology Corporation */
3#ifndef _ASM_SETFPUTRAP
4#define _ASM_SETFPUTRAP
5
6/*
7 * Options for setfputrap system call
8 */
9#define DISABLE_UDFTRAP 0 /* disable underflow exception trap */
10#define ENABLE_UDFTRAP 1 /* enable undeflos exception trap */
11#define GET_UDFTRAP 2 /* only get undeflos exception trap status */
12
13#endif /* _ASM_CACHECTL */
diff --git a/arch/nds32/include/uapi/asm/unistd.h b/arch/nds32/include/uapi/asm/unistd.h
index c691735017ed..a0b2f7b9c0f2 100644
--- a/arch/nds32/include/uapi/asm/unistd.h
+++ b/arch/nds32/include/uapi/asm/unistd.h
@@ -11,6 +11,6 @@
11 11
12/* Additional NDS32 specific syscalls. */ 12/* Additional NDS32 specific syscalls. */
13#define __NR_cacheflush (__NR_arch_specific_syscall) 13#define __NR_cacheflush (__NR_arch_specific_syscall)
14#define __NR_udftrap (__NR_arch_specific_syscall + 1) 14#define __NR_fp_udfiex_crtl (__NR_arch_specific_syscall + 1)
15__SYSCALL(__NR_cacheflush, sys_cacheflush) 15__SYSCALL(__NR_cacheflush, sys_cacheflush)
16__SYSCALL(__NR_udftrap, sys_udftrap) 16__SYSCALL(__NR_fp_udfiex_crtl, sys_fp_udfiex_crtl)