cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
hamelinp
Visitor
Visitor
4,226 Views
Registered: ‎04-01-2010

Need help to enable Virtex-5 PPC440 FPU

Hello,

 

I'm having problems with the PPC440 FPU on the Virtex-5. I compiled my toolchain using crosstool-ng 1.10.0 with the flags: "--with-cpu=440fp --with-tune=440fp". I succesfuly compiled U-Boot and the Xilinx Linux Kernel (2.6.37) with that toolchain. I compiled the kernel with CONFIG_PPC_FPU=y and without CONFIG_MATH_EMULATION. I compiled a simple hello world init program and I'm having a kernel oops while executing that file. Here is the output:

 

 

[    9.795869] ------------[ cut here ]------------
[    9.799193] kernel BUG at arch/powerpc/kernel/traps.c:1001!
[    9.804724] Oops: Exception in kernel mode, sig: 5 [#1]
[    9.809897] PREEMPT Xilinx Virtex440
[    9.813441] last sysfs file: 
[    9.816379] Modules linked in:
[    9.819407] **bleep**: c000b344 LR: c000db58 CTR: 10008088
[    9.824335] REGS: c3827e70 TRAP: 0700   Not tainted  (2.6.37)
[    9.830030] MSR: 00029000 <EE,ME,CE>  CR: 40000004  XER: 20000005
[    9.836082] TASK = c3825900[1] 'init' THREAD: c3826000
[    9.841002] GPR00: 00000001 c3827f20 c3825900 c3827f50 08000000 00000000 10096cbc 1002d538 
[    9.849297] GPR08: 0002d000 c03c0000 08000000 c000b2b0 20000002 1009b69c 00000000 00000000 
[    9.857591] GPR16: 03fece10 00000000 00000000 03fe249c 03fe249c 03fe249c c0000020 00000000 
[    9.865885] GPR24: 00000000 03fc1698 00000e80 00800000 10090000 bfdc41ac 08000000 c3827f50 
[    9.874390] **bleep** [c000b344] program_check_exception+0x94/0x5bc
[    9.880069] LR [c000db58] ret_from_except_full+0x0/0x4c
[    9.885239] Call Trace:
[    9.887666] [c3827f20] [03fc1698] 0x3fc1698 (unreliable)
[    9.892937] [c3827f40] [c000db58] ret_from_except_full+0x0/0x4c
[    9.898810] --- Exception: 700 at 0x1000f3f8
[    9.898817]     LR = 0x1000ab3c
[    9.906148] Instruction dump:
[    9.909087] 80010024 81810014 83c10018 7c0803a6 83e1001c 38210020 7d808120 4bfff9ec 
[    9.916775] 3d20c03c 8809a060 2f800000 419e00c0 <0fe00000> 48000000 7c431378 4bffc419 
[    9.924646] ---[ end trace 84b1d9982878dfd6 ]---
[    9.931324] Kernel panic - not syncing: Attempted to kill init!
[    9.936257] Call Trace:
[    9.938440] [c3827c70] [c0006c7c] show_stack+0x70/0x1bc (unreliable)
[    9.944679] [c3827cb0] [c02d5418] panic+0xc0/0x1e8
[    9.949429] [c3827d00] [c0025eb0] do_exit+0x620/0x680
[    9.954435] [c3827d50] [c000aae0] die+0x100/0x1f8
[    9.959096] [c3827d70] [c000ade8] _exception+0xcc/0x148
[    9.964283] [c3827e60] [c000db58] ret_from_except_full+0x0/0x4c
[    9.970162] --- Exception: 700 at program_check_exception+0x94/0x5bc
[    9.970171]     LR = ret_from_except_full+0x0/0x4c
[    9.981226] [c3827f20] [03fc1698] 0x3fc1698 (unreliable)
[    9.986483] [c3827f40] [c000db58] ret_from_except_full+0x0/0x4c
[    9.992356] --- Exception: 700 at 0x1000f3f8
[    9.992363]     LR = 0x1000ab3c
[    9.999722] Rebooting in 180 seconds..

 

The first thing I can see is that the FP bit of the MSR register isn't enabled. Now, looking at that file (traps.c:1001) :

 

[...]


#ifdef CONFIG_MATH_EMULATION

 

        /* (reason & REASON_ILLEGAL) would be the obvious thing here,

         * but there seems to be a hardware bug on the 405GP (RevD)

         * that means ESR is sometimes set incorrectly - either to

         * ESR_DST (!?) or 0.  In the process of chasing this with the

         * hardware people - not sure if it can happen on any illegal

         * instruction or only on FP instructions, whether there is a

         * pattern to occurences etc. -dgibson 31/Mar/2003 */

        switch (do_mathemu(regs)) {

        case 0:

                emulate_single_step(regs);

                return;

        case 1: {

                        int code = 0;

                        code = __parse_fpscr(current->thread.fpscr.val);

                        _exception(SIGFPE, regs, code, regs->**bleep**);

                        return;

                }

        case -EFAULT:

                _exception(SIGSEGV, regs, SEGV_MAPERR, regs->**bleep**);

                return;

        }

        /* fall through on any other errors */

#endif /* CONFIG_MATH_EMULATION */


#if defined(CONFIG_XILINX_VIRTEX_5_FXT) && defined(CONFIG_PPC_FPU)

        if (reason & REASON_ILLEGAL) {

                if (excep_state < 1) {

                        excep_state++;

                        return;

                }

                /* should never get here */

                BUG();

        }

#endif


        /* Try to emulate it if we should. */

        if (reason & (REASON_ILLEGAL | REASON_PRIVILEGED)) {

                switch (emulate_instruction(regs)) {

                case 0:

                        regs->**bleep** += 4;

                        emulate_single_step(regs);

                        return;

                case -EFAULT:

[...]
The init program crash where the comment "/* should never get here */" is. I'm not very familiar with that code, but what I see is that the FPU isn't enabled while a FP instruction is executed. In fact, enabling CONFIG_MATH_EMULATION solves the problem. I think that it actually fails to execute the FP instruction, so it reverts to the math emulation just above. 
I joined the complete log file of the console session. 
Any help is very welcome. 
Thank you,
Philippe

 

0 Kudos
3 Replies
linnj
Xilinx Employee
Xilinx Employee
4,224 Views
Registered: ‎09-10-2008

I don't remember much and it's been a long time since we looked at FPU stuff.

 

Did you review the wiki page?

 

http://xilinx.wikidot.com/osl-fpu-440

 

Sorry.

 

0 Kudos
hamelinp
Visitor
Visitor
4,222 Views
Registered: ‎04-01-2010

John,

 

Yes I found this page but It didn't give me more information that I already had. Do you have any suggestion where I should look first?

 

Thank you,

 

Philippe

 

0 Kudos
hamelinp
Visitor
Visitor
4,220 Views
Registered: ‎04-01-2010

Hello,

 

I've gone a bit further in the problem. I compiled a basic root file system without FPU so now I can boot. Then, I compiled (statically) a simple program which do a FP multiplication with the ppc440-fpu toolchain. I get the same results (kernel oops). Where is the logic to enable or not the FPU?

 

Thank you,

 

Philippe

0 Kudos