Skip to content

Commit 37cddff

Browse files
paulburtonralfbaechle
authored andcommitted
MIPS: 16 byte align MSA vector context
The MSA specification upon first read appears to suggest that it is safe to perform vector loads & stores with arbitrary alignment. However it leaves provision for "address-dependent exceptions"... Align the vector context to a 16 byte boundary to ensure that the kernel cannot cause any such exceptions. Note that the fpu field of struct thread_struct was already at a 16 byte boundary within the struct, the introduction of FPU_ALIGN simply makes the requirement explicit. The only part of this impacting the generated kernel binary is ARCH_MIN_TASKALIGN. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/7308/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 762a1f4 commit 37cddff

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,13 @@ typedef struct {
238238
unsigned long seg;
239239
} mm_segment_t;
240240

241-
#define ARCH_MIN_TASKALIGN 8
241+
#ifdef CONFIG_CPU_HAS_MSA
242+
# define ARCH_MIN_TASKALIGN 16
243+
# define FPU_ALIGN __aligned(16)
244+
#else
245+
# define ARCH_MIN_TASKALIGN 8
246+
# define FPU_ALIGN
247+
#endif
242248

243249
struct mips_abi;
244250

@@ -255,7 +261,7 @@ struct thread_struct {
255261
unsigned long cp0_status;
256262

257263
/* Saved fpu/fpu emulator stuff. */
258-
struct mips_fpu_struct fpu;
264+
struct mips_fpu_struct fpu FPU_ALIGN;
259265
#ifdef CONFIG_MIPS_MT_FPAFF
260266
/* Emulated instruction count */
261267
unsigned long emulated_fp;

0 commit comments

Comments
 (0)