Xilinx Home
Embedded Linux
Register  ·  Sign In  ·  Help
Jump to Page:   1 · 2  |  Next Page
  Reply   Reply  

Using FPU under Linux on ML507 fails
Options    Options  
andn
Visitor
Posts: 4
Registered: 04-02-2009


andn

Message 1 of 15

Viewed 2,535 times


Hi,

 

I have a ML507 board running a project with the FPU instantiated. Works fine for standalone floating point apps created via xps. However, any fp calculation will return 'Illegal Instruction' if run in a 2.6.28 linux kernel. I have tried the tricks mentioned in other posts, especially hopeful on changing MSR_USER to |=MSR_FP in reg.h, but that only caused the kernel to crash on bootup, because again, fp opcodes are not usable.

I now found out that if I load the kernel via xmd, the FPU does actually work, but have no clue why that is. Are there any registers that XMD changes for this to be possible? How can I control them (e.g. how can I find the APU control register to make sure bit31 is set)? Is there any tweaking of the first stage bootloader or u-boot necessary?

 

 

thanks a lot for any help!

 

regards, Andi

 

 

Kudos!
Solved!
Go to the Solution
Go to Solution
04-02-2009 01:42 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
linnj
Expert Contributor
Posts: 354
Registered: 09-10-2008


linnj

Message 2 of 15

Viewed 2,524 times


What tools are you using, are they FPU enabled tools?

 

In other words, the ELDK has 2 sets of tools for the 4xx processors, the FP enabled and the non-FP tools.

 

I have not done testing with the FP tools to take advantage of the FPU.

 

-- John


 

John Linn

Kudos!
04-02-2009 06:58 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
linnj
Expert Contributor
Posts: 354
Registered: 09-10-2008


linnj

Message 3 of 15

Viewed 2,523 times


A little more digging on the subject.....
 
We had code in to select the FPU but we ended up taking it out when the code went into the mainline.  It had code to select the FPU in the kernel configuration and some code for some strange exceptions which I think were on early Xilinx hardware.
 
To select the FPU in the kernel configuration, the arch/powerpc/platforms/44x/Kconfig would need to be altered to turn on the FPU for the Xilinx 440.
 
         select PPC_FPU
 
Since I don't have the 4XX FP tools setup I don't have a quick way to test this.
 
-- John
 

 

John Linn

Kudos!
04-02-2009 07:14 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
linnj
Expert Contributor
Posts: 354
Registered: 09-10-2008


linnj

Message 4 of 15

Viewed 2,522 times


git.xilinx.com Git - linux-2.6-xlnx.git/commit
Here's the commit in the git tree where Peter added the code.  When we went to mainline we ended up removing this.
 
 
author Peter Ryser (none)] <[ryserp@xsjryserp40>
  Mon, 21 Apr 2008 21:52:49 +0000 (15:52 -0600)
committer John Linn <john.linn@xilinx.com>
  Thu, 22 May 2008 20:54:06 +0000 (13:54 -0700)
commit 41ce854b8eb6d991038f5df12bf384f67cd4f99c
tree b9ecf24083215b1e7e1f00e4f75b511c1ccf1445
parent f203f01c35c6f31134747b132d5240fa5b08cb4c
Xilinx:FPU:Add/modify support for the PPC440 FPU

Added option in Kconfig to enable/disable the soft FPU for the PPC440.
Added code into fpu.S and traps.c to work around an errata in the APU.
Added code into virtex.c to disable the APU if math emulation is enabled.

Signed-off-by: peter.ryser@xilinx.com
Signed-off-by: John Linn <john.linn@xilinx.com>
arch/powerpc/kernel/fpu.S  
arch/powerpc/kernel/traps.c  
arch/powerpc/platforms/44x/Kconfig  

 

John Linn

Kudos!
04-02-2009 07:16 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
Xilinx Employee chaplin
Xilinx Employee
Posts: 77
Registered: 08-07-2007


chaplin

Message 5 of 15

Viewed 2,520 times


Hello,

 

I have had a go with the FPU recently, please see attached a Kconfig file that I modified (/arch/powerpc/platforms/44x/Kconfig).

 

Then in menuconfig, under platform support select Enable Xilinx Soft FPU.

 

I ran some tests using the ppc_4xxFP ELDK toolchain, and all seemed to go well for me.

 

Hope that helps

Kris

 


 

Kris Chaplin
Xilinx UK

 

Attachment Kconfig (7 kb)

1
Kudos!
Accepted Solution
Accepted Solution
04-02-2009 07:24 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
bones10
Visitor
Posts: 11
Registered: 10-28-2008


bones10

Message 6 of 15

Viewed 2,511 times


The Virtex5 floating point unit needs a few workarounds. It issues spurrious illegal instruction exceptions. The code that was removed handled these spurrious exceptions.

 

 

- John 

Kudos!
04-02-2009 08:00 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
linnj
Expert Contributor
Posts: 354
Registered: 09-10-2008


linnj

Message 7 of 15

Viewed 2,500 times


I am doing a quick test now, but I was able to grab that commit that we had in the tree previously and apply it to the top of tree using GIT.

 

>git cherry-pick 4ace854b8

 

The kernel builds and runs with the FPU enabled and the exceptions using the non-FPU GNU tools from ELDK.

 

I'm hearing from others in Xilinx other than John B the same thing, that the exceptions can still occur on production hardware and this commit was the code that handles those exceptions.

 

-- John


 

John Linn

Kudos!
04-02-2009 08:07 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
linnj
Expert Contributor
Posts: 354
Registered: 09-10-2008


linnj

Message 8 of 15

Viewed 2,492 times


I added a page to the wiki describing this process also.

 

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

 

-- John


 

John Linn

Kudos!
04-02-2009 08:38 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
andn
Visitor
Posts: 4
Registered: 04-02-2009


andn

Message 9 of 15

Viewed 2,485 times


Thank you very much for your input on that! I solved one problem today, that is the CCR0 register was set in the U-Boot start.S file for ppc4xx to some value which disables broadcast of Instructions to the APU (bit 11). Once I changed this my FPU does actually do something, but at the moment the calculations are wrong since I have not fully converted to ppc_4xxFP toolchain.

The problems you're already mentioning are my next step, to be followed up with in the next days. I'll keep you posted on this.

 

@Kris:

Does the 'Enable Xilinx Soft FPU' use only the floating point emulation? Actually I really need the processing power of the real FPU.

 

 

cheers, Andi

Kudos!
04-02-2009 08:51 AM
  Reply   Reply  

Re: Using FPU under Linux on ML507 fails
Options    Options  
linnj
Expert Contributor
Posts: 354
Registered: 09-10-2008


linnj

Message 10 of 15

Viewed 2,480 times


The soft FPU does FP operations in hardware, it's just named soft as the logic in the hardware is soft rather than hard.

 

 -- John


 

John Linn

Kudos!
04-02-2009 08:57 AM
Jump to Page:   1 · 2  |  Next Page