summary refs log tree commit diff
path: root/arch/arc/include
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2020-01-17 15:04:03 -0800
committerVineet Gupta <vgupta@synopsys.com>2020-01-17 16:53:44 -0800
commitf45ba2bd6da0dc8000aa7ea7a3858fb51608f766 (patch)
tree3be8113cb45459531bc5ffee5bbbb1de38d5d234 /arch/arc/include
parentf05523aa7a1e63bfada5e222c0a57e02dbd4fcfa (diff)
downloadlinux-f45ba2bd6da0dc8000aa7ea7a3858fb51608f766.tar.gz
ARCv2: fpu: preserve userspace fpu state
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/include')
-rw-r--r--arch/arc/include/asm/arcregs.h2
-rw-r--r--arch/arc/include/asm/fpu.h28
2 files changed, 29 insertions, 1 deletions
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index 5134f0baf33c..f7e432448e4b 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -39,6 +39,8 @@
 #define ARC_REG_CLUSTER_BCR	0xcf
 #define ARC_REG_AUX_ICCM	0x208	/* ICCM Base Addr (ARCv2) */
 #define ARC_REG_LPB_CTRL	0x488	/* ARCv2 Loop Buffer control */
+#define ARC_REG_FPU_CTRL	0x300
+#define ARC_REG_FPU_STATUS	0x301
 
 /* Common for ARCompact and ARCv2 status register */
 #define ARC_REG_STATUS32	0x0A
diff --git a/arch/arc/include/asm/fpu.h b/arch/arc/include/asm/fpu.h
index de467423d99b..64347250fdf5 100644
--- a/arch/arc/include/asm/fpu.h
+++ b/arch/arc/include/asm/fpu.h
@@ -11,6 +11,8 @@
 
 #include <asm/ptrace.h>
 
+#ifdef CONFIG_ISA_ARCOMPACT
+
 /* These DPFP regs need to be saved/restored across ctx-sw */
 struct arc_fpu {
 	struct {
@@ -18,11 +20,35 @@ struct arc_fpu {
 	} aux_dpfp[2];
 };
 
-extern void fpu_save_restore(struct task_struct *p, struct task_struct *n);
+#define fpu_init_task(regs)
 
 #else
 
+/*
+ * ARCv2 FPU Control aux register
+ *   - bits to enable Traps on Exceptions
+ *   - Rounding mode
+ *
+ * ARCv2 FPU Status aux register
+ *   - FPU exceptions flags (Inv, Div-by-Zero, overflow, underflow, inexact)
+ *   - Flag Write Enable to clear flags explicitly (vs. by fpu instructions
+ *     only
+ */
+
+struct arc_fpu {
+	unsigned int ctrl, status;
+};
+
+extern void fpu_init_task(struct pt_regs *regs);
+
+#endif	/* !CONFIG_ISA_ARCOMPACT */
+
+extern void fpu_save_restore(struct task_struct *p, struct task_struct *n);
+
+#else	/* !CONFIG_ARC_FPU_SAVE_RESTORE */
+
 #define fpu_save_restore(p, n)
+#define fpu_init_task(regs)
 
 #endif	/* CONFIG_ARC_FPU_SAVE_RESTORE */