diff options
author | Michael Neuling <mikey@neuling.org> | 2008-06-25 00:07:18 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-30 21:28:50 -0400 |
commit | ce48b2100785e5ca629fb3aa8e3b50aca808f692 (patch) | |
tree | 63532ff7cc68b18ca4902bd10e03fcbaaf01cade /arch/powerpc/kernel/head_64.S | |
parent | 72ffff5b1792b0fa4d40a8e2f3276fff999820ec (diff) |
powerpc: Add VSX context save/restore, ptrace and signal support
This patch extends the floating point save and restore code to use the
VSX load/stores when VSX is available. This will make FP context
save/restore marginally slower on FP only code, when VSX is available,
as it has to load/store 128bits rather than just 64bits.
Mixing FP, VMX and VSX code will get constant architected state.
The signals interface is extended to enable access to VSR 0-31
doubleword 1 after discussions with tool chain maintainers. Backward
compatibility is maintained.
The ptrace interface is also extended to allow access to VSR 0-31 full
registers.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/head_64.S')
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 64433731d995..ecced1eb03ae 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -278,6 +278,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) | |||
278 | . = 0xf20 | 278 | . = 0xf20 |
279 | b altivec_unavailable_pSeries | 279 | b altivec_unavailable_pSeries |
280 | 280 | ||
281 | . = 0xf40 | ||
282 | b vsx_unavailable_pSeries | ||
283 | |||
281 | #ifdef CONFIG_CBE_RAS | 284 | #ifdef CONFIG_CBE_RAS |
282 | HSTD_EXCEPTION_PSERIES(0x1200, cbe_system_error) | 285 | HSTD_EXCEPTION_PSERIES(0x1200, cbe_system_error) |
283 | #endif /* CONFIG_CBE_RAS */ | 286 | #endif /* CONFIG_CBE_RAS */ |
@@ -297,6 +300,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) | |||
297 | /* moved from 0xf00 */ | 300 | /* moved from 0xf00 */ |
298 | STD_EXCEPTION_PSERIES(., performance_monitor) | 301 | STD_EXCEPTION_PSERIES(., performance_monitor) |
299 | STD_EXCEPTION_PSERIES(., altivec_unavailable) | 302 | STD_EXCEPTION_PSERIES(., altivec_unavailable) |
303 | STD_EXCEPTION_PSERIES(., vsx_unavailable) | ||
300 | 304 | ||
301 | /* | 305 | /* |
302 | * An interrupt came in while soft-disabled; clear EE in SRR1, | 306 | * An interrupt came in while soft-disabled; clear EE in SRR1, |
@@ -836,6 +840,67 @@ _STATIC(load_up_altivec) | |||
836 | blr | 840 | blr |
837 | #endif /* CONFIG_ALTIVEC */ | 841 | #endif /* CONFIG_ALTIVEC */ |
838 | 842 | ||
843 | .align 7 | ||
844 | .globl vsx_unavailable_common | ||
845 | vsx_unavailable_common: | ||
846 | EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN) | ||
847 | #ifdef CONFIG_VSX | ||
848 | BEGIN_FTR_SECTION | ||
849 | bne .load_up_vsx | ||
850 | 1: | ||
851 | END_FTR_SECTION_IFSET(CPU_FTR_VSX) | ||
852 | #endif | ||
853 | bl .save_nvgprs | ||
854 | addi r3,r1,STACK_FRAME_OVERHEAD | ||
855 | ENABLE_INTS | ||
856 | bl .vsx_unavailable_exception | ||
857 | b .ret_from_except | ||
858 | |||
859 | #ifdef CONFIG_VSX | ||
860 | /* | ||
861 | * load_up_vsx(unused, unused, tsk) | ||
862 | * Disable VSX for the task which had it previously, | ||
863 | * and save its vector registers in its thread_struct. | ||
864 | * Reuse the fp and vsx saves, but first check to see if they have | ||
865 | * been saved already. | ||
866 | * On entry: r13 == 'current' && last_task_used_vsx != 'current' | ||
867 | */ | ||
868 | _STATIC(load_up_vsx) | ||
869 | /* Load FP and VSX registers if they haven't been done yet */ | ||
870 | andi. r5,r12,MSR_FP | ||
871 | beql+ load_up_fpu /* skip if already loaded */ | ||
872 | andis. r5,r12,MSR_VEC@h | ||
873 | beql+ load_up_altivec /* skip if already loaded */ | ||
874 | |||
875 | #ifndef CONFIG_SMP | ||
876 | ld r3,last_task_used_vsx@got(r2) | ||
877 | ld r4,0(r3) | ||
878 | cmpdi 0,r4,0 | ||
879 | beq 1f | ||
880 | /* Disable VSX for last_task_used_vsx */ | ||
881 | addi r4,r4,THREAD | ||
882 | ld r5,PT_REGS(r4) | ||
883 | ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) | ||
884 | lis r6,MSR_VSX@h | ||
885 | andc r6,r4,r6 | ||
886 | std r6,_MSR-STACK_FRAME_OVERHEAD(r5) | ||
887 | 1: | ||
888 | #endif /* CONFIG_SMP */ | ||
889 | ld r4,PACACURRENT(r13) | ||
890 | addi r4,r4,THREAD /* Get THREAD */ | ||
891 | li r6,1 | ||
892 | stw r6,THREAD_USED_VSR(r4) /* ... also set thread used vsr */ | ||
893 | /* enable use of VSX after return */ | ||
894 | oris r12,r12,MSR_VSX@h | ||
895 | std r12,_MSR(r1) | ||
896 | #ifndef CONFIG_SMP | ||
897 | /* Update last_task_used_math to 'current' */ | ||
898 | ld r4,PACACURRENT(r13) | ||
899 | std r4,0(r3) | ||
900 | #endif /* CONFIG_SMP */ | ||
901 | b fast_exception_return | ||
902 | #endif /* CONFIG_VSX */ | ||
903 | |||
839 | /* | 904 | /* |
840 | * Hash table stuff | 905 | * Hash table stuff |
841 | */ | 906 | */ |