Shan FPU
From RCSWiki
This is an article talking about configuring Floating-Point Unit (FPU) under Linux on Spirit cluster. Before changing the Linux kernel, the hardware FPU should be built in the base system.
The Linux kernel are downloaded from Xilinx repository. While Xilinx is trying to migrate PPC tree to PowerPC tree, our current work is focusing on PPC tree.
Files need to be modified:
- /arch/ppc/Kconfig
- /arch/ppc/include/asm/reg.h -> /include/asm-powerpc/reg.h
- /arch/ppc/kernel/head_4xx.S
Detailed changes:
- /arch/ppc/Kconfig
- Search for "40x" in Kconfig file
- Add select PPC_FPU under config 40x
- This change would compile arch/powerpc/kernel/fpu.S into the kernel
- /arch/ppc/include/asm/reg.h
- Search for "MSR_USER32" and "MSR_USER" in reg.h
- Add 1<<19 | 1<<25 to MSR_USER and MSR_USER32 define
- This change sets FPU related bits in MSR after Linux boot up
- /arch/ppc/kernel/head_4xx.S
- Search for "_GLOBAL(giveup_fpu)" in head_4xx.S
- Comment this line and the following line "blr"
- During compilation, this may cause errors when we have FPU in
- Search for "0x0800" to find where the fp_unavailable exception should be
- Comment "EXCEPTION(0x0800, Trap_08, unknown_exception, EXC_XFER_EE)"
- Add the following code right above the commented line, the following code can also be copied from head_32.S in powerpc tree
- This change would enable Floating-Point Unit unavailable exception. Not sure this change is 100% correct
/* Floating-point unavailable */
. = 0x800
FPUnavailable:
BEGIN_FTR_SECTION
/*
* Certain Freescale cores don't have a FPU and treat fp instructions
* as a FP Unavailable exception. Redirect to illegal/emulation handling.
*/
b ProgramCheck
END_FTR_SECTION_IFSET(CPU_FTR_FPU_UNAVAILABLE)
NORMAL_EXCEPTION_PROLOG
bne load_up_fpu /* if from user, just load it up */
addi r3,r1,STACK_FRAME_OVERHEAD
EXC_XFER_EE_LITE(0x800, kernel_fp_unavailable_exception)
