aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-10-04 06:41:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-10-04 06:41:58 -0400
commit0d8770815f70cf41b69a82ede272b026dbb2df7d (patch)
tree3f088af1c614fd3b73e3aeae64223088797ef873 /arch
parent3e519dde1e8a73e59b0eab52575a14a2986283b6 (diff)
parentd218af78492a36a4ae607c08fedfb59258440314 (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle: "This week's round of MIPS fixes: - Fix JZ4740 build - Fix fallback to GFP_DMA - FP seccomp in case of ENOSYS - Fix bootmem panic - A number of FP and CPS fixes - Wire up new syscalls - Make sure BPF assembler objects can properly be disassembled - Fix BPF assembler code for MIPS I" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: MIPS: scall: Always run the seccomp syscall filters MIPS: Octeon: Fix kernel panic on startup from memory corruption MIPS: Fix R2300 FP context switch handling MIPS: Fix octeon FP context switch handling MIPS: BPF: Fix load delay slots. MIPS: BPF: Do all exports of symbols with FEXPORT(). MIPS: Fix the build on jz4740 after removing the custom gpio.h MIPS: CPS: #ifdef on CONFIG_MIPS_MT_SMP rather than CONFIG_MIPS_MT MIPS: CPS: Don't include MT code in non-MT kernels. MIPS: CPS: Stop dangling delay slot from has_mt. MIPS: dma-default: Fix 32-bit fall back to GFP_DMA MIPS: Wire up userfaultfd and membarrier syscalls.
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/cavium-octeon/setup.c2
-rw-r--r--arch/mips/include/uapi/asm/unistd.h18
-rw-r--r--arch/mips/jz4740/board-qi_lb60.c1
-rw-r--r--arch/mips/jz4740/gpio.c1
-rw-r--r--arch/mips/kernel/cps-vec.S12
-rw-r--r--arch/mips/kernel/octeon_switch.S26
-rw-r--r--arch/mips/kernel/r2300_switch.S28
-rw-r--r--arch/mips/kernel/scall32-o32.S41
-rw-r--r--arch/mips/kernel/scall64-64.S40
-rw-r--r--arch/mips/kernel/scall64-n32.S21
-rw-r--r--arch/mips/kernel/scall64-o32.S21
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mips/net/bpf_jit_asm.S13
13 files changed, 82 insertions, 144 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 89a628455bc2..bd634259eab9 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -933,7 +933,7 @@ void __init plat_mem_setup(void)
933 while ((boot_mem_map.nr_map < BOOT_MEM_MAP_MAX) 933 while ((boot_mem_map.nr_map < BOOT_MEM_MAP_MAX)
934 && (total < MAX_MEMORY)) { 934 && (total < MAX_MEMORY)) {
935 memory = cvmx_bootmem_phy_alloc(mem_alloc_size, 935 memory = cvmx_bootmem_phy_alloc(mem_alloc_size,
936 __pa_symbol(&__init_end), -1, 936 __pa_symbol(&_end), -1,
937 0x100000, 937 0x100000,
938 CVMX_BOOTMEM_FLAG_NO_LOCKING); 938 CVMX_BOOTMEM_FLAG_NO_LOCKING);
939 if (memory >= 0) { 939 if (memory >= 0) {
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index c03088f9f514..cfabadb135d9 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -377,16 +377,18 @@
377#define __NR_memfd_create (__NR_Linux + 354) 377#define __NR_memfd_create (__NR_Linux + 354)
378#define __NR_bpf (__NR_Linux + 355) 378#define __NR_bpf (__NR_Linux + 355)
379#define __NR_execveat (__NR_Linux + 356) 379#define __NR_execveat (__NR_Linux + 356)
380#define __NR_userfaultfd (__NR_Linux + 357)
381#define __NR_membarrier (__NR_Linux + 358)
380 382
381/* 383/*
382 * Offset of the last Linux o32 flavoured syscall 384 * Offset of the last Linux o32 flavoured syscall
383 */ 385 */
384#define __NR_Linux_syscalls 356 386#define __NR_Linux_syscalls 358
385 387
386#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 388#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
387 389
388#define __NR_O32_Linux 4000 390#define __NR_O32_Linux 4000
389#define __NR_O32_Linux_syscalls 356 391#define __NR_O32_Linux_syscalls 358
390 392
391#if _MIPS_SIM == _MIPS_SIM_ABI64 393#if _MIPS_SIM == _MIPS_SIM_ABI64
392 394
@@ -711,16 +713,18 @@
711#define __NR_memfd_create (__NR_Linux + 314) 713#define __NR_memfd_create (__NR_Linux + 314)
712#define __NR_bpf (__NR_Linux + 315) 714#define __NR_bpf (__NR_Linux + 315)
713#define __NR_execveat (__NR_Linux + 316) 715#define __NR_execveat (__NR_Linux + 316)
716#define __NR_userfaultfd (__NR_Linux + 317)
717#define __NR_membarrier (__NR_Linux + 318)
714 718
715/* 719/*
716 * Offset of the last Linux 64-bit flavoured syscall 720 * Offset of the last Linux 64-bit flavoured syscall
717 */ 721 */
718#define __NR_Linux_syscalls 316 722#define __NR_Linux_syscalls 318
719 723
720#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 724#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
721 725
722#define __NR_64_Linux 5000 726#define __NR_64_Linux 5000
723#define __NR_64_Linux_syscalls 316 727#define __NR_64_Linux_syscalls 318
724 728
725#if _MIPS_SIM == _MIPS_SIM_NABI32 729#if _MIPS_SIM == _MIPS_SIM_NABI32
726 730
@@ -1049,15 +1053,17 @@
1049#define __NR_memfd_create (__NR_Linux + 318) 1053#define __NR_memfd_create (__NR_Linux + 318)
1050#define __NR_bpf (__NR_Linux + 319) 1054#define __NR_bpf (__NR_Linux + 319)
1051#define __NR_execveat (__NR_Linux + 320) 1055#define __NR_execveat (__NR_Linux + 320)
1056#define __NR_userfaultfd (__NR_Linux + 321)
1057#define __NR_membarrier (__NR_Linux + 322)
1052 1058
1053/* 1059/*
1054 * Offset of the last N32 flavoured syscall 1060 * Offset of the last N32 flavoured syscall
1055 */ 1061 */
1056#define __NR_Linux_syscalls 320 1062#define __NR_Linux_syscalls 322
1057 1063
1058#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1064#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
1059 1065
1060#define __NR_N32_Linux 6000 1066#define __NR_N32_Linux 6000
1061#define __NR_N32_Linux_syscalls 320 1067#define __NR_N32_Linux_syscalls 322
1062 1068
1063#endif /* _UAPI_ASM_UNISTD_H */ 1069#endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c
index 4e62bf85d0b0..459cb017306c 100644
--- a/arch/mips/jz4740/board-qi_lb60.c
+++ b/arch/mips/jz4740/board-qi_lb60.c
@@ -26,6 +26,7 @@
26#include <linux/power/jz4740-battery.h> 26#include <linux/power/jz4740-battery.h>
27#include <linux/power/gpio-charger.h> 27#include <linux/power/gpio-charger.h>
28 28
29#include <asm/mach-jz4740/gpio.h>
29#include <asm/mach-jz4740/jz4740_fb.h> 30#include <asm/mach-jz4740/jz4740_fb.h>
30#include <asm/mach-jz4740/jz4740_mmc.h> 31#include <asm/mach-jz4740/jz4740_mmc.h>
31#include <asm/mach-jz4740/jz4740_nand.h> 32#include <asm/mach-jz4740/jz4740_nand.h>
diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
index a74e181058b0..8c6d76c9b2d6 100644
--- a/arch/mips/jz4740/gpio.c
+++ b/arch/mips/jz4740/gpio.c
@@ -28,6 +28,7 @@
28#include <linux/seq_file.h> 28#include <linux/seq_file.h>
29 29
30#include <asm/mach-jz4740/base.h> 30#include <asm/mach-jz4740/base.h>
31#include <asm/mach-jz4740/gpio.h>
31 32
32#define JZ4740_GPIO_BASE_A (32*0) 33#define JZ4740_GPIO_BASE_A (32*0)
33#define JZ4740_GPIO_BASE_B (32*1) 34#define JZ4740_GPIO_BASE_B (32*1)
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
index 9f71c06aebf6..209ded16806b 100644
--- a/arch/mips/kernel/cps-vec.S
+++ b/arch/mips/kernel/cps-vec.S
@@ -39,6 +39,7 @@
39 mfc0 \dest, CP0_CONFIG, 3 39 mfc0 \dest, CP0_CONFIG, 3
40 andi \dest, \dest, MIPS_CONF3_MT 40 andi \dest, \dest, MIPS_CONF3_MT
41 beqz \dest, \nomt 41 beqz \dest, \nomt
42 nop
42 .endm 43 .endm
43 44
44.section .text.cps-vec 45.section .text.cps-vec
@@ -223,10 +224,9 @@ LEAF(excep_ejtag)
223 END(excep_ejtag) 224 END(excep_ejtag)
224 225
225LEAF(mips_cps_core_init) 226LEAF(mips_cps_core_init)
226#ifdef CONFIG_MIPS_MT 227#ifdef CONFIG_MIPS_MT_SMP
227 /* Check that the core implements the MT ASE */ 228 /* Check that the core implements the MT ASE */
228 has_mt t0, 3f 229 has_mt t0, 3f
229 nop
230 230
231 .set push 231 .set push
232 .set mips64r2 232 .set mips64r2
@@ -310,8 +310,9 @@ LEAF(mips_cps_boot_vpes)
310 PTR_ADDU t0, t0, t1 310 PTR_ADDU t0, t0, t1
311 311
312 /* Calculate this VPEs ID. If the core doesn't support MT use 0 */ 312 /* Calculate this VPEs ID. If the core doesn't support MT use 0 */
313 li t9, 0
314#ifdef CONFIG_MIPS_MT_SMP
313 has_mt ta2, 1f 315 has_mt ta2, 1f
314 li t9, 0
315 316
316 /* Find the number of VPEs present in the core */ 317 /* Find the number of VPEs present in the core */
317 mfc0 t1, CP0_MVPCONF0 318 mfc0 t1, CP0_MVPCONF0
@@ -330,6 +331,7 @@ LEAF(mips_cps_boot_vpes)
330 /* Retrieve the VPE ID from EBase.CPUNum */ 331 /* Retrieve the VPE ID from EBase.CPUNum */
331 mfc0 t9, $15, 1 332 mfc0 t9, $15, 1
332 and t9, t9, t1 333 and t9, t9, t1
334#endif
333 335
3341: /* Calculate a pointer to this VPEs struct vpe_boot_config */ 3361: /* Calculate a pointer to this VPEs struct vpe_boot_config */
335 li t1, VPEBOOTCFG_SIZE 337 li t1, VPEBOOTCFG_SIZE
@@ -337,7 +339,7 @@ LEAF(mips_cps_boot_vpes)
337 PTR_L ta3, COREBOOTCFG_VPECONFIG(t0) 339 PTR_L ta3, COREBOOTCFG_VPECONFIG(t0)
338 PTR_ADDU v0, v0, ta3 340 PTR_ADDU v0, v0, ta3
339 341
340#ifdef CONFIG_MIPS_MT 342#ifdef CONFIG_MIPS_MT_SMP
341 343
342 /* If the core doesn't support MT then return */ 344 /* If the core doesn't support MT then return */
343 bnez ta2, 1f 345 bnez ta2, 1f
@@ -451,7 +453,7 @@ LEAF(mips_cps_boot_vpes)
451 453
4522: .set pop 4542: .set pop
453 455
454#endif /* CONFIG_MIPS_MT */ 456#endif /* CONFIG_MIPS_MT_SMP */
455 457
456 /* Return */ 458 /* Return */
457 jr ra 459 jr ra
diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S
index 423ae83af1fb..3375745b9198 100644
--- a/arch/mips/kernel/octeon_switch.S
+++ b/arch/mips/kernel/octeon_switch.S
@@ -18,7 +18,7 @@
18 .set pop 18 .set pop
19/* 19/*
20 * task_struct *resume(task_struct *prev, task_struct *next, 20 * task_struct *resume(task_struct *prev, task_struct *next,
21 * struct thread_info *next_ti, int usedfpu) 21 * struct thread_info *next_ti)
22 */ 22 */
23 .align 7 23 .align 7
24 LEAF(resume) 24 LEAF(resume)
@@ -28,30 +28,6 @@
28 cpu_save_nonscratch a0 28 cpu_save_nonscratch a0
29 LONG_S ra, THREAD_REG31(a0) 29 LONG_S ra, THREAD_REG31(a0)
30 30
31 /*
32 * check if we need to save FPU registers
33 */
34 .set push
35 .set noreorder
36 beqz a3, 1f
37 PTR_L t3, TASK_THREAD_INFO(a0)
38 .set pop
39
40 /*
41 * clear saved user stack CU1 bit
42 */
43 LONG_L t0, ST_OFF(t3)
44 li t1, ~ST0_CU1
45 and t0, t0, t1
46 LONG_S t0, ST_OFF(t3)
47
48 .set push
49 .set arch=mips64r2
50 fpu_save_double a0 t0 t1 # c0_status passed in t0
51 # clobbers t1
52 .set pop
531:
54
55#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 31#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0
56 /* Check if we need to store CVMSEG state */ 32 /* Check if we need to store CVMSEG state */
57 dmfc0 t0, $11,7 /* CvmMemCtl */ 33 dmfc0 t0, $11,7 /* CvmMemCtl */
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 5087a4b72e6b..ac27ef7d4d0e 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -31,18 +31,8 @@
31#define ST_OFF (_THREAD_SIZE - 32 - PT_SIZE + PT_STATUS) 31#define ST_OFF (_THREAD_SIZE - 32 - PT_SIZE + PT_STATUS)
32 32
33/* 33/*
34 * FPU context is saved iff the process has used it's FPU in the current
35 * time slice as indicated by TIF_USEDFPU. In any case, the CU1 bit for user
36 * space STATUS register should be 0, so that a process *always* starts its
37 * userland with FPU disabled after each context switch.
38 *
39 * FPU will be enabled as soon as the process accesses FPU again, through
40 * do_cpu() trap.
41 */
42
43/*
44 * task_struct *resume(task_struct *prev, task_struct *next, 34 * task_struct *resume(task_struct *prev, task_struct *next,
45 * struct thread_info *next_ti, int usedfpu) 35 * struct thread_info *next_ti)
46 */ 36 */
47LEAF(resume) 37LEAF(resume)
48 mfc0 t1, CP0_STATUS 38 mfc0 t1, CP0_STATUS
@@ -50,22 +40,6 @@ LEAF(resume)
50 cpu_save_nonscratch a0 40 cpu_save_nonscratch a0
51 sw ra, THREAD_REG31(a0) 41 sw ra, THREAD_REG31(a0)
52 42
53 beqz a3, 1f
54
55 PTR_L t3, TASK_THREAD_INFO(a0)
56
57 /*
58 * clear saved user stack CU1 bit
59 */
60 lw t0, ST_OFF(t3)
61 li t1, ~ST0_CU1
62 and t0, t0, t1
63 sw t0, ST_OFF(t3)
64
65 fpu_save_single a0, t0 # clobbers t0
66
671:
68
69#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 43#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
70 PTR_LA t8, __stack_chk_guard 44 PTR_LA t8, __stack_chk_guard
71 LONG_L t9, TASK_STACK_CANARY(a1) 45 LONG_L t9, TASK_STACK_CANARY(a1)
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 4cc13508d967..65a74e4f0f45 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -36,16 +36,8 @@ NESTED(handle_sys, PT_SIZE, sp)
36 lw t1, PT_EPC(sp) # skip syscall on return 36 lw t1, PT_EPC(sp) # skip syscall on return
37 37
38 subu v0, v0, __NR_O32_Linux # check syscall number 38 subu v0, v0, __NR_O32_Linux # check syscall number
39 sltiu t0, v0, __NR_O32_Linux_syscalls + 1
40 addiu t1, 4 # skip to next instruction 39 addiu t1, 4 # skip to next instruction
41 sw t1, PT_EPC(sp) 40 sw t1, PT_EPC(sp)
42 beqz t0, illegal_syscall
43
44 sll t0, v0, 2
45 la t1, sys_call_table
46 addu t1, t0
47 lw t2, (t1) # syscall routine
48 beqz t2, illegal_syscall
49 41
50 sw a3, PT_R26(sp) # save a3 for syscall restarting 42 sw a3, PT_R26(sp) # save a3 for syscall restarting
51 43
@@ -96,6 +88,16 @@ loads_done:
96 li t1, _TIF_WORK_SYSCALL_ENTRY 88 li t1, _TIF_WORK_SYSCALL_ENTRY
97 and t0, t1 89 and t0, t1
98 bnez t0, syscall_trace_entry # -> yes 90 bnez t0, syscall_trace_entry # -> yes
91syscall_common:
92 sltiu t0, v0, __NR_O32_Linux_syscalls + 1
93 beqz t0, illegal_syscall
94
95 sll t0, v0, 2
96 la t1, sys_call_table
97 addu t1, t0
98 lw t2, (t1) # syscall routine
99
100 beqz t2, illegal_syscall
99 101
100 jalr t2 # Do The Real Thing (TM) 102 jalr t2 # Do The Real Thing (TM)
101 103
@@ -116,7 +118,7 @@ o32_syscall_exit:
116 118
117syscall_trace_entry: 119syscall_trace_entry:
118 SAVE_STATIC 120 SAVE_STATIC
119 move s0, t2 121 move s0, v0
120 move a0, sp 122 move a0, sp
121 123
122 /* 124 /*
@@ -129,27 +131,18 @@ syscall_trace_entry:
129 131
1301: jal syscall_trace_enter 1321: jal syscall_trace_enter
131 133
132 bltz v0, 2f # seccomp failed? Skip syscall 134 bltz v0, 1f # seccomp failed? Skip syscall
135
136 move v0, s0 # restore syscall
133 137
134 move t0, s0
135 RESTORE_STATIC 138 RESTORE_STATIC
136 lw a0, PT_R4(sp) # Restore argument registers 139 lw a0, PT_R4(sp) # Restore argument registers
137 lw a1, PT_R5(sp) 140 lw a1, PT_R5(sp)
138 lw a2, PT_R6(sp) 141 lw a2, PT_R6(sp)
139 lw a3, PT_R7(sp) 142 lw a3, PT_R7(sp)
140 jalr t0 143 j syscall_common
141
142 li t0, -EMAXERRNO - 1 # error?
143 sltu t0, t0, v0
144 sw t0, PT_R7(sp) # set error flag
145 beqz t0, 1f
146
147 lw t1, PT_R2(sp) # syscall number
148 negu v0 # error
149 sw t1, PT_R0(sp) # save it for syscall restarting
1501: sw v0, PT_R2(sp) # result
151 144
1522: j syscall_exit 1451: j syscall_exit
153 146
154/* ------------------------------------------------------------------------ */ 147/* ------------------------------------------------------------------------ */
155 148
@@ -599,3 +592,5 @@ EXPORT(sys_call_table)
599 PTR sys_memfd_create 592 PTR sys_memfd_create
600 PTR sys_bpf /* 4355 */ 593 PTR sys_bpf /* 4355 */
601 PTR sys_execveat 594 PTR sys_execveat
595 PTR sys_userfaultfd
596 PTR sys_membarrier
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index a6f6b762c47a..e732981cf99f 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -39,18 +39,11 @@ NESTED(handle_sys64, PT_SIZE, sp)
39 .set at 39 .set at
40#endif 40#endif
41 41
42 dsubu t0, v0, __NR_64_Linux # check syscall number
43 sltiu t0, t0, __NR_64_Linux_syscalls + 1
44#if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32) 42#if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
45 ld t1, PT_EPC(sp) # skip syscall on return 43 ld t1, PT_EPC(sp) # skip syscall on return
46 daddiu t1, 4 # skip to next instruction 44 daddiu t1, 4 # skip to next instruction
47 sd t1, PT_EPC(sp) 45 sd t1, PT_EPC(sp)
48#endif 46#endif
49 beqz t0, illegal_syscall
50
51 dsll t0, v0, 3 # offset into table
52 ld t2, (sys_call_table - (__NR_64_Linux * 8))(t0)
53 # syscall routine
54 47
55 sd a3, PT_R26(sp) # save a3 for syscall restarting 48 sd a3, PT_R26(sp) # save a3 for syscall restarting
56 49
@@ -59,6 +52,17 @@ NESTED(handle_sys64, PT_SIZE, sp)
59 and t0, t1, t0 52 and t0, t1, t0
60 bnez t0, syscall_trace_entry 53 bnez t0, syscall_trace_entry
61 54
55syscall_common:
56 dsubu t2, v0, __NR_64_Linux
57 sltiu t0, t2, __NR_64_Linux_syscalls + 1
58 beqz t0, illegal_syscall
59
60 dsll t0, t2, 3 # offset into table
61 dla t2, sys_call_table
62 daddu t0, t2, t0
63 ld t2, (t0) # syscall routine
64 beqz t2, illegal_syscall
65
62 jalr t2 # Do The Real Thing (TM) 66 jalr t2 # Do The Real Thing (TM)
63 67
64 li t0, -EMAXERRNO - 1 # error? 68 li t0, -EMAXERRNO - 1 # error?
@@ -78,14 +82,14 @@ n64_syscall_exit:
78 82
79syscall_trace_entry: 83syscall_trace_entry:
80 SAVE_STATIC 84 SAVE_STATIC
81 move s0, t2 85 move s0, v0
82 move a0, sp 86 move a0, sp
83 move a1, v0 87 move a1, v0
84 jal syscall_trace_enter 88 jal syscall_trace_enter
85 89
86 bltz v0, 2f # seccomp failed? Skip syscall 90 bltz v0, 1f # seccomp failed? Skip syscall
87 91
88 move t0, s0 92 move v0, s0
89 RESTORE_STATIC 93 RESTORE_STATIC
90 ld a0, PT_R4(sp) # Restore argument registers 94 ld a0, PT_R4(sp) # Restore argument registers
91 ld a1, PT_R5(sp) 95 ld a1, PT_R5(sp)
@@ -93,19 +97,9 @@ syscall_trace_entry:
93 ld a3, PT_R7(sp) 97 ld a3, PT_R7(sp)
94 ld a4, PT_R8(sp) 98 ld a4, PT_R8(sp)
95 ld a5, PT_R9(sp) 99 ld a5, PT_R9(sp)
96 jalr t0 100 j syscall_common
97
98 li t0, -EMAXERRNO - 1 # error?
99 sltu t0, t0, v0
100 sd t0, PT_R7(sp) # set error flag
101 beqz t0, 1f
102
103 ld t1, PT_R2(sp) # syscall number
104 dnegu v0 # error
105 sd t1, PT_R0(sp) # save it for syscall restarting
1061: sd v0, PT_R2(sp) # result
107 101
1082: j syscall_exit 1021: j syscall_exit
109 103
110illegal_syscall: 104illegal_syscall:
111 /* This also isn't a 64-bit syscall, throw an error. */ 105 /* This also isn't a 64-bit syscall, throw an error. */
@@ -436,4 +430,6 @@ EXPORT(sys_call_table)
436 PTR sys_memfd_create 430 PTR sys_memfd_create
437 PTR sys_bpf /* 5315 */ 431 PTR sys_bpf /* 5315 */
438 PTR sys_execveat 432 PTR sys_execveat
433 PTR sys_userfaultfd
434 PTR sys_membarrier
439 .size sys_call_table,.-sys_call_table 435 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 4b2010654c46..c79484397584 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -52,6 +52,7 @@ NESTED(handle_sysn32, PT_SIZE, sp)
52 and t0, t1, t0 52 and t0, t1, t0
53 bnez t0, n32_syscall_trace_entry 53 bnez t0, n32_syscall_trace_entry
54 54
55syscall_common:
55 jalr t2 # Do The Real Thing (TM) 56 jalr t2 # Do The Real Thing (TM)
56 57
57 li t0, -EMAXERRNO - 1 # error? 58 li t0, -EMAXERRNO - 1 # error?
@@ -75,9 +76,9 @@ n32_syscall_trace_entry:
75 move a1, v0 76 move a1, v0
76 jal syscall_trace_enter 77 jal syscall_trace_enter
77 78
78 bltz v0, 2f # seccomp failed? Skip syscall 79 bltz v0, 1f # seccomp failed? Skip syscall
79 80
80 move t0, s0 81 move t2, s0
81 RESTORE_STATIC 82 RESTORE_STATIC
82 ld a0, PT_R4(sp) # Restore argument registers 83 ld a0, PT_R4(sp) # Restore argument registers
83 ld a1, PT_R5(sp) 84 ld a1, PT_R5(sp)
@@ -85,19 +86,9 @@ n32_syscall_trace_entry:
85 ld a3, PT_R7(sp) 86 ld a3, PT_R7(sp)
86 ld a4, PT_R8(sp) 87 ld a4, PT_R8(sp)
87 ld a5, PT_R9(sp) 88 ld a5, PT_R9(sp)
88 jalr t0 89 j syscall_common
89 90
90 li t0, -EMAXERRNO - 1 # error? 911: j syscall_exit
91 sltu t0, t0, v0
92 sd t0, PT_R7(sp) # set error flag
93 beqz t0, 1f
94
95 ld t1, PT_R2(sp) # syscall number
96 dnegu v0 # error
97 sd t1, PT_R0(sp) # save it for syscall restarting
981: sd v0, PT_R2(sp) # result
99
1002: j syscall_exit
101 92
102not_n32_scall: 93not_n32_scall:
103 /* This is not an n32 compatibility syscall, pass it on to 94 /* This is not an n32 compatibility syscall, pass it on to
@@ -429,4 +420,6 @@ EXPORT(sysn32_call_table)
429 PTR sys_memfd_create 420 PTR sys_memfd_create
430 PTR sys_bpf 421 PTR sys_bpf
431 PTR compat_sys_execveat /* 6320 */ 422 PTR compat_sys_execveat /* 6320 */
423 PTR sys_userfaultfd
424 PTR sys_membarrier
432 .size sysn32_call_table,.-sysn32_call_table 425 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index f543ff4feef9..6369cfd390c6 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -87,6 +87,7 @@ loads_done:
87 and t0, t1, t0 87 and t0, t1, t0
88 bnez t0, trace_a_syscall 88 bnez t0, trace_a_syscall
89 89
90syscall_common:
90 jalr t2 # Do The Real Thing (TM) 91 jalr t2 # Do The Real Thing (TM)
91 92
92 li t0, -EMAXERRNO - 1 # error? 93 li t0, -EMAXERRNO - 1 # error?
@@ -130,9 +131,9 @@ trace_a_syscall:
130 131
1311: jal syscall_trace_enter 1321: jal syscall_trace_enter
132 133
133 bltz v0, 2f # seccomp failed? Skip syscall 134 bltz v0, 1f # seccomp failed? Skip syscall
134 135
135 move t0, s0 136 move t2, s0
136 RESTORE_STATIC 137 RESTORE_STATIC
137 ld a0, PT_R4(sp) # Restore argument registers 138 ld a0, PT_R4(sp) # Restore argument registers
138 ld a1, PT_R5(sp) 139 ld a1, PT_R5(sp)
@@ -142,19 +143,9 @@ trace_a_syscall:
142 ld a5, PT_R9(sp) 143 ld a5, PT_R9(sp)
143 ld a6, PT_R10(sp) 144 ld a6, PT_R10(sp)
144 ld a7, PT_R11(sp) # For indirect syscalls 145 ld a7, PT_R11(sp) # For indirect syscalls
145 jalr t0 146 j syscall_common
146 147
147 li t0, -EMAXERRNO - 1 # error? 1481: j syscall_exit
148 sltu t0, t0, v0
149 sd t0, PT_R7(sp) # set error flag
150 beqz t0, 1f
151
152 ld t1, PT_R2(sp) # syscall number
153 dnegu v0 # error
154 sd t1, PT_R0(sp) # save it for syscall restarting
1551: sd v0, PT_R2(sp) # result
156
1572: j syscall_exit
158 149
159/* ------------------------------------------------------------------------ */ 150/* ------------------------------------------------------------------------ */
160 151
@@ -584,4 +575,6 @@ EXPORT(sys32_call_table)
584 PTR sys_memfd_create 575 PTR sys_memfd_create
585 PTR sys_bpf /* 4355 */ 576 PTR sys_bpf /* 4355 */
586 PTR compat_sys_execveat 577 PTR compat_sys_execveat
578 PTR sys_userfaultfd
579 PTR sys_membarrier
587 .size sys32_call_table,.-sys32_call_table 580 .size sys32_call_table,.-sys32_call_table
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index a914dc1cb6d1..d8117be729a2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -100,7 +100,7 @@ static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
100 else 100 else
101#endif 101#endif
102#if defined(CONFIG_ZONE_DMA) && !defined(CONFIG_ZONE_DMA32) 102#if defined(CONFIG_ZONE_DMA) && !defined(CONFIG_ZONE_DMA32)
103 if (dev->coherent_dma_mask < DMA_BIT_MASK(64)) 103 if (dev->coherent_dma_mask < DMA_BIT_MASK(sizeof(phys_addr_t) * 8))
104 dma_flag = __GFP_DMA; 104 dma_flag = __GFP_DMA;
105 else 105 else
106#endif 106#endif
diff --git a/arch/mips/net/bpf_jit_asm.S b/arch/mips/net/bpf_jit_asm.S
index dabf4179cd7e..5d2e0c8d29c0 100644
--- a/arch/mips/net/bpf_jit_asm.S
+++ b/arch/mips/net/bpf_jit_asm.S
@@ -57,12 +57,13 @@
57 57
58LEAF(sk_load_word) 58LEAF(sk_load_word)
59 is_offset_negative(word) 59 is_offset_negative(word)
60 .globl sk_load_word_positive 60FEXPORT(sk_load_word_positive)
61sk_load_word_positive:
62 is_offset_in_header(4, word) 61 is_offset_in_header(4, word)
63 /* Offset within header boundaries */ 62 /* Offset within header boundaries */
64 PTR_ADDU t1, $r_skb_data, offset 63 PTR_ADDU t1, $r_skb_data, offset
64 .set reorder
65 lw $r_A, 0(t1) 65 lw $r_A, 0(t1)
66 .set noreorder
66#ifdef CONFIG_CPU_LITTLE_ENDIAN 67#ifdef CONFIG_CPU_LITTLE_ENDIAN
67# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) 68# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
68 wsbh t0, $r_A 69 wsbh t0, $r_A
@@ -85,12 +86,13 @@ sk_load_word_positive:
85 86
86LEAF(sk_load_half) 87LEAF(sk_load_half)
87 is_offset_negative(half) 88 is_offset_negative(half)
88 .globl sk_load_half_positive 89FEXPORT(sk_load_half_positive)
89sk_load_half_positive:
90 is_offset_in_header(2, half) 90 is_offset_in_header(2, half)
91 /* Offset within header boundaries */ 91 /* Offset within header boundaries */
92 PTR_ADDU t1, $r_skb_data, offset 92 PTR_ADDU t1, $r_skb_data, offset
93 .set reorder
93 lh $r_A, 0(t1) 94 lh $r_A, 0(t1)
95 .set noreorder
94#ifdef CONFIG_CPU_LITTLE_ENDIAN 96#ifdef CONFIG_CPU_LITTLE_ENDIAN
95# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) 97# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
96 wsbh t0, $r_A 98 wsbh t0, $r_A
@@ -109,8 +111,7 @@ sk_load_half_positive:
109 111
110LEAF(sk_load_byte) 112LEAF(sk_load_byte)
111 is_offset_negative(byte) 113 is_offset_negative(byte)
112 .globl sk_load_byte_positive 114FEXPORT(sk_load_byte_positive)
113sk_load_byte_positive:
114 is_offset_in_header(1, byte) 115 is_offset_in_header(1, byte)
115 /* Offset within header boundaries */ 116 /* Offset within header boundaries */
116 PTR_ADDU t1, $r_skb_data, offset 117 PTR_ADDU t1, $r_skb_data, offset