Skip to content

Commit 16f77de

Browse files
paulburtonralfbaechle
authored andcommitted
Revert "MIPS: Save/restore MSA context around signals"
This reverts commit eec43a2 "MIPS: Save/restore MSA context around signals" and the MSA parts of ca75064 "MIPS: kernel: signal: Prevent save/restore FPU context in user memory" (the restore path of which appears incorrect anyway...). The reverted patch took care not to break compatibility with userland users of struct sigcontext, but inadvertantly changed the offset of the uc_sigmask field of struct ucontext. Thus Linux v3.15 breaks the userland ABI. The MSA context will need to be saved via some other opt-in mechanism, but for now revert the change to reduce the fallout. This will have minimal impact upon use of MSA since the only supported CPU which includes it (the P5600) is 32-bit and therefore requires that the experimental CONFIG_MIPS_O32_FP64_SUPPORT Kconfig option be selected before the kernel will set FR=1 for a task, a requirement for MSA use. Thus the users of MSA are limited to known small groups of people & this patch won't be breaking any previously working MSA-using userland outside of experimental settings. [ralf@linux-mips.org: Fixed rejects.] Cc: stable@vger.kernel.org Reported-by: Joseph S. Myers <joseph@codesourcery.com> Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Cc: stable@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/7107/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent fb738f8 commit 16f77de

6 files changed

Lines changed: 16 additions & 363 deletions

File tree

‎arch/mips/include/asm/sigcontext.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ struct sigcontext32 {
3232
__u32 sc_lo2;
3333
__u32 sc_hi3;
3434
__u32 sc_lo3;
35-
__u64 sc_msaregs[32]; /* Most significant 64 bits */
36-
__u32 sc_msa_csr;
3735
};
3836
#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
3937
#endif /* _ASM_SIGCONTEXT_H */

‎arch/mips/include/uapi/asm/sigcontext.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
#include <linux/types.h>
1313
#include <asm/sgidefs.h>
1414

15-
/* Bits which may be set in sc_used_math */
16-
#define USEDMATH_FP (1 << 0)
17-
#define USEDMATH_MSA (1 << 1)
18-
1915
#if _MIPS_SIM == _MIPS_SIM_ABI32
2016

2117
/*
@@ -41,8 +37,6 @@ struct sigcontext {
4137
unsigned long sc_lo2;
4238
unsigned long sc_hi3;
4339
unsigned long sc_lo3;
44-
unsigned long long sc_msaregs[32]; /* Most significant 64 bits */
45-
unsigned long sc_msa_csr;
4640
};
4741

4842
#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
@@ -76,8 +70,6 @@ struct sigcontext {
7670
__u32 sc_used_math;
7771
__u32 sc_dsp;
7872
__u32 sc_reserved;
79-
__u64 sc_msaregs[32];
80-
__u32 sc_msa_csr;
8173
};
8274

8375

‎arch/mips/kernel/asm-offsets.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ void output_sc_defines(void)
293293
OFFSET(SC_LO2, sigcontext, sc_lo2);
294294
OFFSET(SC_HI3, sigcontext, sc_hi3);
295295
OFFSET(SC_LO3, sigcontext, sc_lo3);
296-
OFFSET(SC_MSAREGS, sigcontext, sc_msaregs);
297296
BLANK();
298297
}
299298
#endif
@@ -308,7 +307,6 @@ void output_sc_defines(void)
308307
OFFSET(SC_MDLO, sigcontext, sc_mdlo);
309308
OFFSET(SC_PC, sigcontext, sc_pc);
310309
OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr);
311-
OFFSET(SC_MSAREGS, sigcontext, sc_msaregs);
312310
BLANK();
313311
}
314312
#endif
@@ -320,7 +318,6 @@ void output_sc32_defines(void)
320318
OFFSET(SC32_FPREGS, sigcontext32, sc_fpregs);
321319
OFFSET(SC32_FPC_CSR, sigcontext32, sc_fpc_csr);
322320
OFFSET(SC32_FPC_EIR, sigcontext32, sc_fpc_eir);
323-
OFFSET(SC32_MSAREGS, sigcontext32, sc_msaregs);
324321
BLANK();
325322
}
326323
#endif

‎arch/mips/kernel/r4k_fpu.S‎

Lines changed: 0 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* Copyright (C) 1999, 2001 Silicon Graphics, Inc.
1414
*/
1515
#include <asm/asm.h>
16-
#include <asm/asmmacro.h>
1716
#include <asm/errno.h>
1817
#include <asm/fpregdef.h>
1918
#include <asm/mipsregs.h>
@@ -246,218 +245,6 @@ LEAF(_restore_fp_context32)
246245
END(_restore_fp_context32)
247246
#endif
248247

249-
#ifdef CONFIG_CPU_HAS_MSA
250-
251-
.macro save_sc_msareg wr, off, sc, tmp
252-
#ifdef CONFIG_64BIT
253-
copy_u_d \tmp, \wr, 1
254-
EX sd \tmp, (\off+(\wr*8))(\sc)
255-
#elif defined(CONFIG_CPU_LITTLE_ENDIAN)
256-
copy_u_w \tmp, \wr, 2
257-
EX sw \tmp, (\off+(\wr*8)+0)(\sc)
258-
copy_u_w \tmp, \wr, 3
259-
EX sw \tmp, (\off+(\wr*8)+4)(\sc)
260-
#else /* CONFIG_CPU_BIG_ENDIAN */
261-
copy_u_w \tmp, \wr, 2
262-
EX sw \tmp, (\off+(\wr*8)+4)(\sc)
263-
copy_u_w \tmp, \wr, 3
264-
EX sw \tmp, (\off+(\wr*8)+0)(\sc)
265-
#endif
266-
.endm
267-
268-
/*
269-
* int _save_msa_context(struct sigcontext *sc)
270-
*
271-
* Save the upper 64 bits of each vector register along with the MSA_CSR
272-
* register into sc. Returns zero on success, else non-zero.
273-
*/
274-
LEAF(_save_msa_context)
275-
save_sc_msareg 0, SC_MSAREGS, a0, t0
276-
save_sc_msareg 1, SC_MSAREGS, a0, t0
277-
save_sc_msareg 2, SC_MSAREGS, a0, t0
278-
save_sc_msareg 3, SC_MSAREGS, a0, t0
279-
save_sc_msareg 4, SC_MSAREGS, a0, t0
280-
save_sc_msareg 5, SC_MSAREGS, a0, t0
281-
save_sc_msareg 6, SC_MSAREGS, a0, t0
282-
save_sc_msareg 7, SC_MSAREGS, a0, t0
283-
save_sc_msareg 8, SC_MSAREGS, a0, t0
284-
save_sc_msareg 9, SC_MSAREGS, a0, t0
285-
save_sc_msareg 10, SC_MSAREGS, a0, t0
286-
save_sc_msareg 11, SC_MSAREGS, a0, t0
287-
save_sc_msareg 12, SC_MSAREGS, a0, t0
288-
save_sc_msareg 13, SC_MSAREGS, a0, t0
289-
save_sc_msareg 14, SC_MSAREGS, a0, t0
290-
save_sc_msareg 15, SC_MSAREGS, a0, t0
291-
save_sc_msareg 16, SC_MSAREGS, a0, t0
292-
save_sc_msareg 17, SC_MSAREGS, a0, t0
293-
save_sc_msareg 18, SC_MSAREGS, a0, t0
294-
save_sc_msareg 19, SC_MSAREGS, a0, t0
295-
save_sc_msareg 20, SC_MSAREGS, a0, t0
296-
save_sc_msareg 21, SC_MSAREGS, a0, t0
297-
save_sc_msareg 22, SC_MSAREGS, a0, t0
298-
save_sc_msareg 23, SC_MSAREGS, a0, t0
299-
save_sc_msareg 24, SC_MSAREGS, a0, t0
300-
save_sc_msareg 25, SC_MSAREGS, a0, t0
301-
save_sc_msareg 26, SC_MSAREGS, a0, t0
302-
save_sc_msareg 27, SC_MSAREGS, a0, t0
303-
save_sc_msareg 28, SC_MSAREGS, a0, t0
304-
save_sc_msareg 29, SC_MSAREGS, a0, t0
305-
save_sc_msareg 30, SC_MSAREGS, a0, t0
306-
save_sc_msareg 31, SC_MSAREGS, a0, t0
307-
jr ra
308-
li v0, 0
309-
END(_save_msa_context)
310-
311-
#ifdef CONFIG_MIPS32_COMPAT
312-
313-
/*
314-
* int _save_msa_context32(struct sigcontext32 *sc)
315-
*
316-
* Save the upper 64 bits of each vector register along with the MSA_CSR
317-
* register into sc. Returns zero on success, else non-zero.
318-
*/
319-
LEAF(_save_msa_context32)
320-
save_sc_msareg 0, SC32_MSAREGS, a0, t0
321-
save_sc_msareg 1, SC32_MSAREGS, a0, t0
322-
save_sc_msareg 2, SC32_MSAREGS, a0, t0
323-
save_sc_msareg 3, SC32_MSAREGS, a0, t0
324-
save_sc_msareg 4, SC32_MSAREGS, a0, t0
325-
save_sc_msareg 5, SC32_MSAREGS, a0, t0
326-
save_sc_msareg 6, SC32_MSAREGS, a0, t0
327-
save_sc_msareg 7, SC32_MSAREGS, a0, t0
328-
save_sc_msareg 8, SC32_MSAREGS, a0, t0
329-
save_sc_msareg 9, SC32_MSAREGS, a0, t0
330-
save_sc_msareg 10, SC32_MSAREGS, a0, t0
331-
save_sc_msareg 11, SC32_MSAREGS, a0, t0
332-
save_sc_msareg 12, SC32_MSAREGS, a0, t0
333-
save_sc_msareg 13, SC32_MSAREGS, a0, t0
334-
save_sc_msareg 14, SC32_MSAREGS, a0, t0
335-
save_sc_msareg 15, SC32_MSAREGS, a0, t0
336-
save_sc_msareg 16, SC32_MSAREGS, a0, t0
337-
save_sc_msareg 17, SC32_MSAREGS, a0, t0
338-
save_sc_msareg 18, SC32_MSAREGS, a0, t0
339-
save_sc_msareg 19, SC32_MSAREGS, a0, t0
340-
save_sc_msareg 20, SC32_MSAREGS, a0, t0
341-
save_sc_msareg 21, SC32_MSAREGS, a0, t0
342-
save_sc_msareg 22, SC32_MSAREGS, a0, t0
343-
save_sc_msareg 23, SC32_MSAREGS, a0, t0
344-
save_sc_msareg 24, SC32_MSAREGS, a0, t0
345-
save_sc_msareg 25, SC32_MSAREGS, a0, t0
346-
save_sc_msareg 26, SC32_MSAREGS, a0, t0
347-
save_sc_msareg 27, SC32_MSAREGS, a0, t0
348-
save_sc_msareg 28, SC32_MSAREGS, a0, t0
349-
save_sc_msareg 29, SC32_MSAREGS, a0, t0
350-
save_sc_msareg 30, SC32_MSAREGS, a0, t0
351-
save_sc_msareg 31, SC32_MSAREGS, a0, t0
352-
jr ra
353-
li v0, 0
354-
END(_save_msa_context32)
355-
356-
#endif /* CONFIG_MIPS32_COMPAT */
357-
358-
.macro restore_sc_msareg wr, off, sc, tmp
359-
#ifdef CONFIG_64BIT
360-
EX ld \tmp, (\off+(\wr*8))(\sc)
361-
insert_d \wr, 1, \tmp
362-
#elif defined(CONFIG_CPU_LITTLE_ENDIAN)
363-
EX lw \tmp, (\off+(\wr*8)+0)(\sc)
364-
insert_w \wr, 2, \tmp
365-
EX lw \tmp, (\off+(\wr*8)+4)(\sc)
366-
insert_w \wr, 3, \tmp
367-
#else /* CONFIG_CPU_BIG_ENDIAN */
368-
EX lw \tmp, (\off+(\wr*8)+4)(\sc)
369-
insert_w \wr, 2, \tmp
370-
EX lw \tmp, (\off+(\wr*8)+0)(\sc)
371-
insert_w \wr, 3, \tmp
372-
#endif
373-
.endm
374-
375-
/*
376-
* int _restore_msa_context(struct sigcontext *sc)
377-
*/
378-
LEAF(_restore_msa_context)
379-
restore_sc_msareg 0, SC_MSAREGS, a0, t0
380-
restore_sc_msareg 1, SC_MSAREGS, a0, t0
381-
restore_sc_msareg 2, SC_MSAREGS, a0, t0
382-
restore_sc_msareg 3, SC_MSAREGS, a0, t0
383-
restore_sc_msareg 4, SC_MSAREGS, a0, t0
384-
restore_sc_msareg 5, SC_MSAREGS, a0, t0
385-
restore_sc_msareg 6, SC_MSAREGS, a0, t0
386-
restore_sc_msareg 7, SC_MSAREGS, a0, t0
387-
restore_sc_msareg 8, SC_MSAREGS, a0, t0
388-
restore_sc_msareg 9, SC_MSAREGS, a0, t0
389-
restore_sc_msareg 10, SC_MSAREGS, a0, t0
390-
restore_sc_msareg 11, SC_MSAREGS, a0, t0
391-
restore_sc_msareg 12, SC_MSAREGS, a0, t0
392-
restore_sc_msareg 13, SC_MSAREGS, a0, t0
393-
restore_sc_msareg 14, SC_MSAREGS, a0, t0
394-
restore_sc_msareg 15, SC_MSAREGS, a0, t0
395-
restore_sc_msareg 16, SC_MSAREGS, a0, t0
396-
restore_sc_msareg 17, SC_MSAREGS, a0, t0
397-
restore_sc_msareg 18, SC_MSAREGS, a0, t0
398-
restore_sc_msareg 19, SC_MSAREGS, a0, t0
399-
restore_sc_msareg 20, SC_MSAREGS, a0, t0
400-
restore_sc_msareg 21, SC_MSAREGS, a0, t0
401-
restore_sc_msareg 22, SC_MSAREGS, a0, t0
402-
restore_sc_msareg 23, SC_MSAREGS, a0, t0
403-
restore_sc_msareg 24, SC_MSAREGS, a0, t0
404-
restore_sc_msareg 25, SC_MSAREGS, a0, t0
405-
restore_sc_msareg 26, SC_MSAREGS, a0, t0
406-
restore_sc_msareg 27, SC_MSAREGS, a0, t0
407-
restore_sc_msareg 28, SC_MSAREGS, a0, t0
408-
restore_sc_msareg 29, SC_MSAREGS, a0, t0
409-
restore_sc_msareg 30, SC_MSAREGS, a0, t0
410-
restore_sc_msareg 31, SC_MSAREGS, a0, t0
411-
jr ra
412-
li v0, 0
413-
END(_restore_msa_context)
414-
415-
#ifdef CONFIG_MIPS32_COMPAT
416-
417-
/*
418-
* int _restore_msa_context32(struct sigcontext32 *sc)
419-
*/
420-
LEAF(_restore_msa_context32)
421-
restore_sc_msareg 0, SC32_MSAREGS, a0, t0
422-
restore_sc_msareg 1, SC32_MSAREGS, a0, t0
423-
restore_sc_msareg 2, SC32_MSAREGS, a0, t0
424-
restore_sc_msareg 3, SC32_MSAREGS, a0, t0
425-
restore_sc_msareg 4, SC32_MSAREGS, a0, t0
426-
restore_sc_msareg 5, SC32_MSAREGS, a0, t0
427-
restore_sc_msareg 6, SC32_MSAREGS, a0, t0
428-
restore_sc_msareg 7, SC32_MSAREGS, a0, t0
429-
restore_sc_msareg 8, SC32_MSAREGS, a0, t0
430-
restore_sc_msareg 9, SC32_MSAREGS, a0, t0
431-
restore_sc_msareg 10, SC32_MSAREGS, a0, t0
432-
restore_sc_msareg 11, SC32_MSAREGS, a0, t0
433-
restore_sc_msareg 12, SC32_MSAREGS, a0, t0
434-
restore_sc_msareg 13, SC32_MSAREGS, a0, t0
435-
restore_sc_msareg 14, SC32_MSAREGS, a0, t0
436-
restore_sc_msareg 15, SC32_MSAREGS, a0, t0
437-
restore_sc_msareg 16, SC32_MSAREGS, a0, t0
438-
restore_sc_msareg 17, SC32_MSAREGS, a0, t0
439-
restore_sc_msareg 18, SC32_MSAREGS, a0, t0
440-
restore_sc_msareg 19, SC32_MSAREGS, a0, t0
441-
restore_sc_msareg 20, SC32_MSAREGS, a0, t0
442-
restore_sc_msareg 21, SC32_MSAREGS, a0, t0
443-
restore_sc_msareg 22, SC32_MSAREGS, a0, t0
444-
restore_sc_msareg 23, SC32_MSAREGS, a0, t0
445-
restore_sc_msareg 24, SC32_MSAREGS, a0, t0
446-
restore_sc_msareg 25, SC32_MSAREGS, a0, t0
447-
restore_sc_msareg 26, SC32_MSAREGS, a0, t0
448-
restore_sc_msareg 27, SC32_MSAREGS, a0, t0
449-
restore_sc_msareg 28, SC32_MSAREGS, a0, t0
450-
restore_sc_msareg 29, SC32_MSAREGS, a0, t0
451-
restore_sc_msareg 30, SC32_MSAREGS, a0, t0
452-
restore_sc_msareg 31, SC32_MSAREGS, a0, t0
453-
jr ra
454-
li v0, 0
455-
END(_restore_msa_context32)
456-
457-
#endif /* CONFIG_MIPS32_COMPAT */
458-
459-
#endif /* CONFIG_CPU_HAS_MSA */
460-
461248
.set reorder
462249

463250
.type fault@function

0 commit comments

Comments
 (0)