Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm running Linux on ARM and accessing FPGA through PCIe. I can perform read/write to PCIe in driver code but not in ISR.

I'm modifying a linux PCIe driver to work with altera FPGA PCIe core. Inside my driver code, I'do pci_set_master(dev) to make the PCIe read write working.

I'm using altera SG-DMA to do PCIe transfer instead of using ARM DMA. I need to write enable bit to the FPGA DMA to initiate the transfer. It is working perfectly by doing pcie write(barx,offset,data) to the enable bit register.

The problem is, I need my system to initiate the PCIe FPGA DMA when an I/O interrupt happen, but when interrupt happen, inside the ISR i put the pcie write(barx,offset,data) and this cause the whole linux hang there.

Anyone have face this before? Please help me. Thanks in advance.
Posted
Updated 4-Jun-13 16:38pm
v2
Comments
Ron Beyer 4-Jun-13 22:31pm    
I guess it's a little unclear, are you running linux on a RISC (like x86 or x64) and interfacing to an FPGA via PCIe? Or are you running linux on an ARM and accessing the FPGA over PCIe?
shahrilhafiz 4-Jun-13 22:37pm    
Sorry for that, I'm running Linux on ARM and accessing FPGA through PCIe. I can perform read/write to PCIe in driver code but not in ISR.
Ron Beyer 4-Jun-13 22:56pm    
I looked through all my driver books and I can't find a reference to pcie write function (my books may be outdated). There are some rules though with drivers, are you exchanging data in user space? Does the pcie write function use a mutex? Most write() functions in the kernel are the prototype write(fd, buffer, length), are you sure you don't have the prototype wrong? Just rattling stuff off the top of my head...
shahrilhafiz 5-Jun-13 1:27am    
Thanks for your reply,

I'm not exchanging data in user space, all happen in driver space.
The PCIe write function doesn't use mutex. The PCIe write prototype:

void __write(u32* __iomem bar_base, u32 addr, u32 wdata)
{
bar_base[ addr / 4] = wdata;
wmb();
return;
}
Ahmad.Reza.S.I 6-Aug-14 3:28am    
hello m.r shahrilhafiz please help me
how can i read and write data by PC from ML507 trough the PCIe

1 solution

Hi,

Sorry guys, I found something I do wrong within my code. I accidentally unmap the bar0 address in driver space once it finish probing. Hence the the interrupt happened, it make write into bar0 failed. I solved this already.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900