Browse Source

Fix the VFP handling on the Feroceon CPU

This CPU generates synchronous VFP exceptions in a non-standard way -
the FPEXC.EX bit set but without the FPSCR.IXE bit being set like in the
VFP subarchitecture 1 or just the FPEXC.DEX bit like in VFP
subarchitecture 2. The main problem is that the faulty instruction
(which needs to be emulated in software) will be restarted several times
(normally until a context switch disables the VFP). This patch ensures
that the VFP exception is treated as synchronous.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Nicolas Pitre <nico@cam.org>
Catalin Marinas 16 years ago
parent
commit
85d6943af5
2 changed files with 6 additions and 0 deletions
  1. 4 0
      arch/arm/vfp/vfphw.S
  2. 2 0
      arch/arm/vfp/vfpmodule.c

+ 4 - 0
arch/arm/vfp/vfphw.S

@@ -100,6 +100,7 @@ ENTRY(vfp_support_entry)
 	beq	no_old_VFP_process
 	beq	no_old_VFP_process
 	VFPFSTMIA r4, r5		@ save the working registers
 	VFPFSTMIA r4, r5		@ save the working registers
 	VFPFMRX	r5, FPSCR		@ current status
 	VFPFMRX	r5, FPSCR		@ current status
+#ifndef CONFIG_CPU_FEROCEON
 	tst	r1, #FPEXC_EX		@ is there additional state to save?
 	tst	r1, #FPEXC_EX		@ is there additional state to save?
 	beq	1f
 	beq	1f
 	VFPFMRX	r6, FPINST		@ FPINST (only if FPEXC.EX is set)
 	VFPFMRX	r6, FPINST		@ FPINST (only if FPEXC.EX is set)
@@ -107,6 +108,7 @@ ENTRY(vfp_support_entry)
 	beq	1f
 	beq	1f
 	VFPFMRX	r8, FPINST2		@ FPINST2 if needed (and present)
 	VFPFMRX	r8, FPINST2		@ FPINST2 if needed (and present)
 1:
 1:
+#endif
 	stmia	r4, {r1, r5, r6, r8}	@ save FPEXC, FPSCR, FPINST, FPINST2
 	stmia	r4, {r1, r5, r6, r8}	@ save FPEXC, FPSCR, FPINST, FPINST2
 					@ and point r4 at the word at the
 					@ and point r4 at the word at the
 					@ start of the register dump
 					@ start of the register dump
@@ -119,6 +121,7 @@ no_old_VFP_process:
 	VFPFLDMIA r10, r5		@ reload the working registers while
 	VFPFLDMIA r10, r5		@ reload the working registers while
 					@ FPEXC is in a safe state
 					@ FPEXC is in a safe state
 	ldmia	r10, {r1, r5, r6, r8}	@ load FPEXC, FPSCR, FPINST, FPINST2
 	ldmia	r10, {r1, r5, r6, r8}	@ load FPEXC, FPSCR, FPINST, FPINST2
+#ifndef CONFIG_CPU_FEROCEON
 	tst	r1, #FPEXC_EX		@ is there additional state to restore?
 	tst	r1, #FPEXC_EX		@ is there additional state to restore?
 	beq	1f
 	beq	1f
 	VFPFMXR	FPINST, r6		@ restore FPINST (only if FPEXC.EX is set)
 	VFPFMXR	FPINST, r6		@ restore FPINST (only if FPEXC.EX is set)
@@ -126,6 +129,7 @@ no_old_VFP_process:
 	beq	1f
 	beq	1f
 	VFPFMXR	FPINST2, r8		@ FPINST2 if needed (and present)
 	VFPFMXR	FPINST2, r8		@ FPINST2 if needed (and present)
 1:
 1:
+#endif
 	VFPFMXR	FPSCR, r5		@ restore status
 	VFPFMXR	FPSCR, r5		@ restore status
 
 
 check_for_exception:
 check_for_exception:

+ 2 - 0
arch/arm/vfp/vfpmodule.c

@@ -253,12 +253,14 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
 	}
 	}
 
 
 	if (fpexc & FPEXC_EX) {
 	if (fpexc & FPEXC_EX) {
+#ifndef CONFIG_CPU_FEROCEON
 		/*
 		/*
 		 * Asynchronous exception. The instruction is read from FPINST
 		 * Asynchronous exception. The instruction is read from FPINST
 		 * and the interrupted instruction has to be restarted.
 		 * and the interrupted instruction has to be restarted.
 		 */
 		 */
 		trigger = fmrx(FPINST);
 		trigger = fmrx(FPINST);
 		regs->ARM_pc -= 4;
 		regs->ARM_pc -= 4;
+#endif
 	} else if (!(fpexc & FPEXC_DEX)) {
 	} else if (!(fpexc & FPEXC_DEX)) {
 		/*
 		/*
 		 * Illegal combination of bits. It can be caused by an
 		 * Illegal combination of bits. It can be caused by an