Linux MSI network driver error
I am trying to create a network driver for a custom hardware. I am targeting a Xilinx Zync-7000 FPGA device.
My problem is the software's MSI interrupt handling on the CPU side. The problem is when an interrupt is triggered on a PCIe device, the driver code executes the interrupt handler once and returns, but then PCIe IO stops working and MSI is reset when I look lspci
. Any future interrupts are not caught by the kernel and PCIe-dev is pretty much dead. I checked the hardware and no drops are issued by the FPGA, so I think something is going on in the kernel.
Thanks in advance.
source to share
After posting this question, I discovered an issue that has been haunting me for days. What was happening is when I mapped my DMA buffer like this:
net_priv->rx_phy_addr = dma_map_single(&pdev->dev, net_priv->rx_virt_addr, dev->mtu, PCI_DMA_FROMDEVICE);
I disabled the same buffer again 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 it dev->mtu
was 1.5KB. It looks like when I cut off 1MB of space it started to untie other memory cards in addition to 1.5bkB. Once dma_unmap_single
completed the PCIe IO area was dead as well as the interrupt area. Hope my mistake can help someone else.
source to share