3
votes

I am attempting to create a network driver for custom hardware. I am targeting a Xilinx Zync-7000 FPGA device.

My issue is the software handling of the MSI interrupt on the CPU side. The problem I have is when the interrupt is fired on the PCIe device the driver code executes the interrupt handler one time and returns, but then the PCIe IO stops working and the MSI is reset when I look at lspci. Any future interrupts are not caught by the kernel and the PCIe dev is pretty much dead. I checked the hardware and no resets are issued to the FPGA so I am thinking that something is going on in the kernel.

Thank you in advance.

1
Thanks for providing the update. Please make the solution an answer to your question and accept it.wallyk

1 Answers

3
votes

After posting this question I discovered the problem which has been plaguing me for a little over a day now. What was happening is when I mapped my DMA buffer as follows:

net_priv->rx_phy_addr = dma_map_single(&pdev->dev, net_priv->rx_virt_addr,  
                                       dev->mtu, PCI_DMA_FROMDEVICE);

I unmapped the same buffer later with

dma_unmap_single(&pdev->dev, net_priv->rx_phy_addr, BUFFER_SIZE,  
                 PCI_DMA_FROMDEVICE);

My BUFFER_SIZE typo was 1MB in size and dev->mtu is 1.5kB. What seems to happen is that when I unmapped 1MB of space it started unmapping other memory maps in addition to the 1.5bkB. As soon as the dma_unmap_single completed the PCIe IO region was dead as well as the interrupt region. Hope my mistake can help someone else out.